From 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 08:04:56 +0000 Subject: merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3 ignore-dead-branch --- indra/newview/CMakeLists.txt | 194 +- indra/newview/app_settings/cmd_line.xml | 50 + indra/newview/app_settings/ignorable_dialogs.xml | 291 + indra/newview/app_settings/settings.xml | 8062 +++++++------------- indra/newview/app_settings/settings_files.xml | 61 +- indra/newview/app_settings/std_bump.ini | 30 +- indra/newview/character/avatar_lad.xml | 109 +- indra/newview/character/checkerboard.tga | Bin 0 -> 16428 bytes indra/newview/character/invisible_head.tga | Bin 0 -> 140793 bytes .../installers/windows/installer_template.nsi | 3 +- indra/newview/llagent.cpp | 1935 +---- indra/newview/llagent.h | 1668 ++-- indra/newview/llagentaccess.cpp | 52 +- indra/newview/llagentaccess.h | 32 +- indra/newview/llagentlanguage.h | 2 +- indra/newview/llagentpilot.cpp | 9 +- indra/newview/llagentpilot.h | 1 + indra/newview/llagentwearables.cpp | 1584 ++++ indra/newview/llagentwearables.h | 235 + indra/newview/llappviewer.cpp | 592 +- indra/newview/llappviewer.h | 23 +- indra/newview/llappviewermacosx.cpp | 49 +- indra/newview/llappviewerwin32.cpp | 63 +- indra/newview/llassetuploadresponders.cpp | 246 +- indra/newview/llavatariconctrl.cpp | 255 + indra/newview/llavatariconctrl.h | 89 + indra/newview/llavatarlist.cpp | 163 + indra/newview/llavatarlist.h | 63 + indra/newview/llavatarlistitem.cpp | 273 + indra/newview/llavatarlistitem.h | 102 + indra/newview/llavatarpropertiesprocessor.cpp | 441 ++ indra/newview/llavatarpropertiesprocessor.h | 206 + indra/newview/llbottomtray.cpp | 343 + indra/newview/llbottomtray.h | 91 + indra/newview/llcallingcard.cpp | 2 +- indra/newview/llchatbar.cpp | 147 +- indra/newview/llchatbar.h | 7 +- indra/newview/llchiclet.cpp | 725 ++ indra/newview/llchiclet.h | 286 + indra/newview/llcloud.h | 2 +- indra/newview/llcolorswatch.cpp | 154 +- indra/newview/llcolorswatch.h | 57 +- indra/newview/llcompilequeue.cpp | 255 +- indra/newview/llcompilequeue.h | 65 +- indra/newview/llcurrencyuimanager.cpp | 4 +- indra/newview/lldebugmessagebox.cpp | 131 +- indra/newview/lldebugmessagebox.h | 4 +- indra/newview/lldebugview.cpp | 63 +- indra/newview/lldebugview.h | 14 +- indra/newview/lldirpicker.cpp | 1 + indra/newview/lldrawable.h | 3 +- indra/newview/lldrawpoolavatar.cpp | 23 +- indra/newview/lldrawpoolbump.cpp | 8 +- indra/newview/lldrawpoolsky.cpp | 69 +- indra/newview/lldrawpooltree.cpp | 1 - indra/newview/lldrawpoolwater.cpp | 1 - indra/newview/lldynamictexture.cpp | 7 +- indra/newview/lleventnotifier.cpp | 5 +- indra/newview/llface.h | 1 - indra/newview/llfasttimerview.cpp | 1129 ++- indra/newview/llfasttimerview.h | 43 +- indra/newview/llfavoritesbar.cpp | 579 ++ indra/newview/llfavoritesbar.h | 89 + indra/newview/llfilepicker.cpp | 8 + indra/newview/llfirstuse.cpp | 66 +- indra/newview/llflexibleobject.h | 1 - indra/newview/llfloaterabout.cpp | 132 +- indra/newview/llfloaterabout.h | 14 +- indra/newview/llfloateranimpreview.cpp | 181 +- indra/newview/llfloateranimpreview.h | 8 +- indra/newview/llfloaterauction.cpp | 40 +- indra/newview/llfloaterauction.h | 14 +- indra/newview/llfloateravatarpicker.cpp | 78 +- indra/newview/llfloateravatarpicker.h | 5 +- indra/newview/llfloateravatartextures.cpp | 29 +- indra/newview/llfloateravatartextures.h | 1 + indra/newview/llfloaterbeacons.cpp | 8 +- indra/newview/llfloaterbeacons.h | 4 +- indra/newview/llfloaterbuildoptions.cpp | 48 +- indra/newview/llfloaterbuildoptions.h | 13 +- indra/newview/llfloaterbulkpermission.cpp | 19 +- indra/newview/llfloaterbulkpermission.h | 1 + indra/newview/llfloaterbump.cpp | 56 +- indra/newview/llfloaterbump.h | 17 +- indra/newview/llfloaterbuy.cpp | 23 +- indra/newview/llfloaterbuy.h | 2 +- indra/newview/llfloaterbuycontents.cpp | 15 +- indra/newview/llfloaterbuycontents.h | 2 +- indra/newview/llfloaterbuycurrency.cpp | 20 +- indra/newview/llfloaterbuyland.cpp | 41 +- indra/newview/llfloatercamera.cpp | 56 +- indra/newview/llfloatercamera.h | 2 +- indra/newview/llfloaterchat.cpp | 193 +- indra/newview/llfloaterchat.h | 24 +- indra/newview/llfloaterchatterbox.cpp | 92 +- indra/newview/llfloaterchatterbox.h | 101 +- indra/newview/llfloatercolorpicker.cpp | 254 +- indra/newview/llfloatercolorpicker.h | 10 +- indra/newview/llfloaterdaycycle.cpp | 14 +- indra/newview/llfloaterdaycycle.h | 2 +- indra/newview/llfloaterenvsettings.cpp | 72 +- indra/newview/llfloaterenvsettings.h | 4 +- indra/newview/llfloaterevent.cpp | 12 +- indra/newview/llfloaterevent.h | 2 +- indra/newview/llfloaterfonttest.cpp | 11 +- indra/newview/llfloaterfonttest.h | 7 +- indra/newview/llfloaterfriends.cpp | 241 +- indra/newview/llfloaterfriends.h | 16 +- indra/newview/llfloatergesture.cpp | 74 +- indra/newview/llfloatergesture.h | 2 +- indra/newview/llfloatergodtools.cpp | 194 +- indra/newview/llfloatergodtools.h | 25 +- indra/newview/llfloatergroupinvite.cpp | 41 +- indra/newview/llfloatergroupinvite.h | 5 +- indra/newview/llfloatergroups.cpp | 116 +- indra/newview/llfloatergroups.h | 11 +- indra/newview/llfloaterhandler.cpp | 2 +- indra/newview/llfloaterhardwaresettings.cpp | 23 +- indra/newview/llfloaterhardwaresettings.h | 10 +- indra/newview/llfloaterhud.cpp | 17 +- indra/newview/llfloaterimagepreview.cpp | 45 +- indra/newview/llfloaterinspect.cpp | 33 +- indra/newview/llfloaterjoystick.cpp | 60 +- indra/newview/llfloaterjoystick.h | 5 +- indra/newview/llfloaterlagmeter.cpp | 20 +- indra/newview/llfloaterlagmeter.h | 4 +- indra/newview/llfloaterland.cpp | 143 +- indra/newview/llfloaterland.h | 9 +- indra/newview/llfloaterlandholdings.cpp | 20 +- indra/newview/llfloatermap.cpp | 178 +- indra/newview/llfloatermap.h | 44 +- indra/newview/llfloatermemleak.cpp | 8 +- indra/newview/llfloaternamedesc.cpp | 8 +- indra/newview/llfloaternotificationsconsole.cpp | 28 +- indra/newview/llfloaternotificationsconsole.h | 1 + indra/newview/llfloateropenobject.cpp | 34 +- indra/newview/llfloateropenobject.h | 3 +- indra/newview/llfloaterparcel.cpp | 12 +- indra/newview/llfloaterparcel.h | 2 +- indra/newview/llfloaterperms.cpp | 7 +- indra/newview/llfloaterpostcard.cpp | 33 +- indra/newview/llfloaterpostcard.h | 6 +- indra/newview/llfloaterpostprocess.cpp | 33 +- indra/newview/llfloaterpostprocess.h | 4 +- indra/newview/llfloaterpreference.cpp | 1106 ++- indra/newview/llfloaterpreference.h | 127 +- indra/newview/llfloaterproperties.cpp | 94 +- indra/newview/llfloaterproperties.h | 12 +- indra/newview/llfloaterregioninfo.cpp | 105 +- indra/newview/llfloaterregioninfo.h | 14 +- indra/newview/llfloaterreporter.cpp | 254 +- indra/newview/llfloaterreporter.h | 8 +- indra/newview/llfloaterscriptdebug.cpp | 84 +- indra/newview/llfloaterscriptdebug.h | 10 +- indra/newview/llfloatersellland.cpp | 19 +- indra/newview/llfloatersellland.h | 3 +- indra/newview/llfloatersettingsdebug.cpp | 91 +- indra/newview/llfloatersettingsdebug.h | 10 +- indra/newview/llfloatersnapshot.cpp | 170 +- indra/newview/llfloatersnapshot.h | 27 +- indra/newview/llfloatertelehub.cpp | 10 +- indra/newview/llfloatertelehub.h | 2 +- indra/newview/llfloatertools.cpp | 528 +- indra/newview/llfloatertools.h | 50 +- indra/newview/llfloatertopobjects.cpp | 23 +- indra/newview/llfloatertos.cpp | 4 +- indra/newview/llfloateruipreview.cpp | 1550 ++++ indra/newview/llfloateruipreview.h | 216 + indra/newview/llfloaterurldisplay.cpp | 3 +- indra/newview/llfloaterurlentry.cpp | 34 +- indra/newview/llfloaterurlentry.h | 6 +- indra/newview/llfloatervoicedevicesettings.cpp | 27 +- indra/newview/llfloatervoicedevicesettings.h | 9 +- indra/newview/llfloaterwater.cpp | 61 +- indra/newview/llfloaterwater.h | 4 +- indra/newview/llfloaterwindlight.cpp | 66 +- indra/newview/llfloaterwindlight.h | 4 +- indra/newview/llfloaterworldmap.cpp | 226 +- indra/newview/llfloaterworldmap.h | 25 +- indra/newview/llfolderview.cpp | 501 +- indra/newview/llfolderview.h | 133 +- indra/newview/llgesturemgr.cpp | 7 +- indra/newview/llglsandbox.cpp | 124 +- indra/newview/llgroupactions.cpp | 141 + indra/newview/llgroupactions.h | 79 + indra/newview/llgrouplist.cpp | 70 + indra/newview/llgrouplist.h | 53 + indra/newview/llgroupmgr.cpp | 2 +- indra/newview/llhudeffect.h | 3 - indra/newview/llhudicon.h | 2 +- indra/newview/llhudmanager.cpp | 4 +- indra/newview/llhudmanager.h | 2 +- indra/newview/llhudobject.h | 2 +- indra/newview/llhudrender.cpp | 26 +- indra/newview/llhudrender.h | 2 + indra/newview/llhudtext.cpp | 52 +- indra/newview/llhudtext.h | 2 +- indra/newview/llhudview.cpp | 7 +- indra/newview/llimpanel.cpp | 165 +- indra/newview/llimpanel.h | 16 +- indra/newview/llimview.cpp | 378 +- indra/newview/llimview.h | 46 +- indra/newview/llinventorybridge.cpp | 1202 +-- indra/newview/llinventorybridge.h | 262 +- indra/newview/llinventorymodel.cpp | 105 +- indra/newview/llinventorymodel.h | 8 + indra/newview/lljoystickbutton.cpp | 187 +- indra/newview/lljoystickbutton.h | 74 +- indra/newview/lllandmarklist.cpp | 61 +- indra/newview/lllandmarklist.h | 13 +- indra/newview/lllocationhistory.cpp | 134 + indra/newview/lllocationhistory.h | 68 + indra/newview/lllocationinputctrl.cpp | 513 ++ indra/newview/lllocationinputctrl.h | 119 + indra/newview/lllogchat.cpp | 29 +- indra/newview/llloginhandler.cpp | 10 +- indra/newview/llmanip.cpp | 57 +- indra/newview/llmaniprotate.cpp | 38 +- indra/newview/llmanipscale.cpp | 6 +- indra/newview/llmaniptranslate.cpp | 8 +- indra/newview/llmemoryview.cpp | 204 +- indra/newview/llmemoryview.h | 22 +- indra/newview/llmenucommands.cpp | 47 +- indra/newview/llmenucommands.h | 6 - indra/newview/llmetricperformancetester.cpp | 258 + indra/newview/llmetricperformancetester.h | 159 + indra/newview/llmorphview.cpp | 14 +- indra/newview/llmorphview.h | 10 +- indra/newview/llmoveview.cpp | 43 +- indra/newview/llmoveview.h | 4 +- indra/newview/llmutelist.cpp | 33 +- indra/newview/llnamebox.cpp | 17 +- indra/newview/llnamebox.h | 17 +- indra/newview/llnameeditor.cpp | 62 +- indra/newview/llnameeditor.h | 26 +- indra/newview/llnamelistctrl.cpp | 328 +- indra/newview/llnamelistctrl.h | 76 +- indra/newview/llnavigationbar.cpp | 533 ++ indra/newview/llnavigationbar.h | 103 + indra/newview/llnetmap.cpp | 422 +- indra/newview/llnetmap.h | 106 +- indra/newview/lloutputmonitorctrl.cpp | 141 + indra/newview/lloutputmonitorctrl.h | 92 + indra/newview/lloverlaybar.cpp | 28 +- indra/newview/lloverlaybar.h | 1 - indra/newview/llpanelavatar.cpp | 2418 +----- indra/newview/llpanelavatar.h | 341 +- indra/newview/llpanelclassified.cpp | 74 +- indra/newview/llpanelcontents.cpp | 58 +- indra/newview/llpanelcontents.h | 2 +- indra/newview/llpanelface.cpp | 72 +- indra/newview/llpanelface.h | 23 +- indra/newview/llpanelgroup.cpp | 196 +- indra/newview/llpanelgroup.h | 15 +- indra/newview/llpanelgroupgeneral.cpp | 75 +- indra/newview/llpanelgroupgeneral.h | 2 +- indra/newview/llpanelgroupinvite.cpp | 33 +- indra/newview/llpanelgroupinvite.h | 2 +- indra/newview/llpanelgrouplandmoney.cpp | 87 +- indra/newview/llpanelgrouplandmoney.h | 2 +- indra/newview/llpanelgroupnotices.cpp | 93 +- indra/newview/llpanelgroupnotices.h | 4 +- indra/newview/llpanelgrouproles.cpp | 155 +- indra/newview/llpanelgrouproles.h | 24 +- indra/newview/llpanelland.cpp | 4 +- indra/newview/llpanelland.h | 2 +- indra/newview/llpanellandmarks.cpp | 252 + indra/newview/llpanellandmarks.h | 61 + indra/newview/llpanellandmedia.cpp | 6 +- indra/newview/llpanellogin.cpp | 98 +- indra/newview/llpanellogin.h | 6 +- indra/newview/llpanelobject.cpp | 79 +- indra/newview/llpanelobject.h | 14 +- indra/newview/llpanelpeople.cpp | 729 ++ indra/newview/llpanelpeople.h | 122 + indra/newview/llpanelpermissions.cpp | 77 +- indra/newview/llpanelpermissions.h | 14 +- indra/newview/llpanelpick.cpp | 597 +- indra/newview/llpanelpick.h | 106 +- indra/newview/llpanelpicks.cpp | 469 ++ indra/newview/llpanelpicks.h | 153 + indra/newview/llpanelplace.cpp | 280 +- indra/newview/llpanelplace.h | 13 +- indra/newview/llpanelplaceinfo.cpp | 382 + indra/newview/llpanelplaceinfo.h | 109 + indra/newview/llpanelplaces.cpp | 293 + indra/newview/llpanelplaces.h | 85 + indra/newview/llpanelplacestab.cpp | 98 + indra/newview/llpanelplacestab.h | 68 + indra/newview/llpanelprofileview.cpp | 112 + indra/newview/llpanelprofileview.h | 69 + indra/newview/llpanelteleporthistory.cpp | 218 + indra/newview/llpanelteleporthistory.h | 72 + indra/newview/llpanelvolume.cpp | 28 +- indra/newview/llpanelvolume.h | 10 +- indra/newview/llparcelselection.h | 3 +- indra/newview/llpreview.cpp | 304 +- indra/newview/llpreview.h | 58 +- indra/newview/llpreviewanim.cpp | 71 +- indra/newview/llpreviewanim.h | 11 +- indra/newview/llpreviewgesture.cpp | 241 +- indra/newview/llpreviewgesture.h | 31 +- indra/newview/llpreviewnotecard.cpp | 172 +- indra/newview/llpreviewnotecard.h | 21 +- indra/newview/llpreviewscript.cpp | 739 +- indra/newview/llpreviewscript.h | 96 +- indra/newview/llpreviewsound.cpp | 37 +- indra/newview/llpreviewsound.h | 7 +- indra/newview/llpreviewtexture.cpp | 182 +- indra/newview/llpreviewtexture.h | 25 +- indra/newview/llprogressview.cpp | 9 +- indra/newview/llprogressview.h | 2 +- indra/newview/llrecentpeople.cpp | 69 + indra/newview/llrecentpeople.h | 101 + indra/newview/llremoteparcelrequest.cpp | 118 +- indra/newview/llremoteparcelrequest.h | 64 +- indra/newview/llrootview.h | 55 + indra/newview/llsavedsettingsglue.cpp | 30 +- indra/newview/llsavedsettingsglue.h | 10 +- indra/newview/llselectmgr.cpp | 40 +- indra/newview/llselectmgr.h | 10 +- indra/newview/llsidetray.cpp | 746 ++ indra/newview/llsidetray.h | 240 + indra/newview/llslurl.cpp | 114 + indra/newview/llslurl.h | 85 + indra/newview/llspatialpartition.h | 5 +- indra/newview/llstartup.cpp | 327 +- indra/newview/llstartup.h | 4 + indra/newview/llstatusbar.cpp | 336 +- indra/newview/llstatusbar.h | 40 +- indra/newview/llstylemap.cpp | 6 +- indra/newview/llsurface.cpp | 2 +- indra/newview/llsurface.h | 1 - indra/newview/llsurfacepatch.h | 2 +- indra/newview/llteleporthistory.cpp | 198 + indra/newview/llteleporthistory.h | 225 + indra/newview/lltexglobalcolor.cpp | 150 + indra/newview/lltexglobalcolor.h | 86 + indra/newview/lltexlayer.cpp | 1505 ++-- indra/newview/lltexlayer.h | 576 +- indra/newview/lltexlayerparams.cpp | 541 ++ indra/newview/lltexlayerparams.h | 180 + indra/newview/lltexturecache.cpp | 2 +- indra/newview/lltexturectrl.cpp | 522 +- indra/newview/lltexturectrl.h | 72 +- indra/newview/lltexturefetch.cpp | 15 + indra/newview/lltexturefetch.h | 1 + indra/newview/lltextureview.cpp | 61 +- indra/newview/lltextureview.h | 4 +- indra/newview/lltool.cpp | 2 +- indra/newview/lltoolbar.cpp | 251 +- indra/newview/lltoolbar.h | 21 +- indra/newview/lltoolbrush.cpp | 2 +- indra/newview/lltoolcomp.cpp | 21 +- indra/newview/lltooldraganddrop.cpp | 41 +- indra/newview/lltoolface.cpp | 7 +- indra/newview/lltoolfocus.cpp | 2 +- indra/newview/lltoolgrab.cpp | 4 +- indra/newview/lltoolgrab.h | 2 +- indra/newview/lltoolgun.cpp | 5 +- indra/newview/lltoolindividual.cpp | 5 +- indra/newview/lltoolmgr.cpp | 94 +- indra/newview/lltoolmgr.h | 8 +- indra/newview/lltoolmorph.cpp | 7 +- indra/newview/lltoolobjpicker.cpp | 5 +- indra/newview/lltoolpie.cpp | 272 +- indra/newview/lltoolpie.h | 10 +- indra/newview/lltoolpipette.cpp | 24 +- indra/newview/lltoolpipette.h | 13 +- indra/newview/lltoolplacer.cpp | 100 +- indra/newview/lltoolplacer.h | 39 - indra/newview/lltoolselect.cpp | 8 +- indra/newview/lltoolselectland.cpp | 9 +- indra/newview/lltoolselectrect.cpp | 3 +- indra/newview/lltoolview.cpp | 4 +- indra/newview/lltracker.cpp | 23 +- indra/newview/lltracker.h | 2 +- indra/newview/lluploaddialog.cpp | 17 +- indra/newview/llurldispatcher.cpp | 109 +- indra/newview/llurldispatcher.h | 9 - indra/newview/llviewchildren.cpp | 8 +- indra/newview/llviewercamera.cpp | 122 +- indra/newview/llviewercamera.h | 1 + indra/newview/llviewercontrol.cpp | 387 +- indra/newview/llviewercontrol.h | 112 +- indra/newview/llviewerdisplay.cpp | 76 +- indra/newview/llviewerfloaterreg.cpp | 112 + indra/newview/llviewerfloaterreg.h | 43 + indra/newview/llviewergesture.cpp | 3 +- indra/newview/llviewerinventory.cpp | 199 +- indra/newview/llviewerinventory.h | 11 + indra/newview/llviewerjointattachment.h | 16 +- indra/newview/llviewerkeyboard.cpp | 29 +- indra/newview/llviewermedia.cpp | 2 +- indra/newview/llviewermenu.cpp | 5172 +++++++------ indra/newview/llviewermenu.h | 51 +- indra/newview/llviewermenufile.cpp | 106 +- indra/newview/llviewermessage.cpp | 262 +- indra/newview/llviewermessage.h | 3 +- indra/newview/llviewernetwork.cpp | 2 +- indra/newview/llviewerobject.cpp | 42 +- indra/newview/llviewerobject.h | 3 +- indra/newview/llviewerobjectlist.cpp | 26 +- indra/newview/llviewerobjectlist.h | 13 +- indra/newview/llviewerparcelmedia.cpp | 8 +- indra/newview/llviewerparcelmgr.cpp | 48 +- indra/newview/llviewerparcelmgr.h | 22 +- indra/newview/llviewerparceloverlay.cpp | 40 +- indra/newview/llviewerpartsim.h | 2 +- indra/newview/llviewerpartsource.h | 3 +- indra/newview/llviewerprecompiledheaders.h | 29 +- indra/newview/llviewerregion.cpp | 7 +- indra/newview/llviewerregion.h | 3 - indra/newview/llviewerstats.cpp | 114 +- indra/newview/llviewerstats.h | 23 +- indra/newview/llviewertexteditor.cpp | 187 +- indra/newview/llviewertexteditor.h | 28 +- indra/newview/llviewervisualparam.cpp | 14 +- indra/newview/llviewervisualparam.h | 2 +- indra/newview/llviewerwindow.cpp | 1377 ++-- indra/newview/llviewerwindow.h | 62 +- indra/newview/llvoavatar.cpp | 3389 +++----- indra/newview/llvoavatar.h | 1331 ++-- indra/newview/llvoavatardefines.cpp | 265 +- indra/newview/llvoavatardefines.h | 183 +- indra/newview/llvoavatarself.cpp | 2016 +++++ indra/newview/llvoavatarself.h | 321 + indra/newview/llvograss.cpp | 10 - indra/newview/llvoiceclient.cpp | 113 +- indra/newview/llvoiceclient.h | 4 +- indra/newview/llvoicevisualizer.cpp | 26 +- indra/newview/llvosky.cpp | 6 +- indra/newview/llvotree.cpp | 2 +- indra/newview/llvovolume.cpp | 76 +- indra/newview/llwearable.cpp | 248 +- indra/newview/llwearable.h | 96 +- indra/newview/llwearablelist.cpp | 107 +- indra/newview/llwearablelist.h | 30 +- indra/newview/llweb.cpp | 31 +- indra/newview/llweb.h | 7 - indra/newview/llwldaycycle.cpp | 3 +- indra/newview/llwldaycycle.h | 2 - indra/newview/llworld.cpp | 1 + indra/newview/llworld.h | 2 +- indra/newview/llworldmap.cpp | 20 +- indra/newview/llworldmap.h | 7 +- indra/newview/llworldmapview.cpp | 113 +- indra/newview/llworldmapview.h | 6 +- indra/newview/macview_Prefix.h | 2 - indra/newview/pipeline.cpp | 153 +- indra/newview/pipeline.h | 4 +- indra/newview/res/bitmap2.bmp | Bin 0 -> 25118 bytes indra/newview/res/install_icon.BMP | Bin 0 -> 262198 bytes indra/newview/res/loginbackground.bmp | Bin 0 -> 336054 bytes indra/newview/res/uninstall_icon.BMP | Bin 0 -> 262198 bytes indra/newview/skins/default/colors.xml | 3160 +++++++- .../skins/default/textures/jump_left_in.tga | Bin 0 -> 812 bytes .../skins/default/textures/jump_left_out.tga | Bin 0 -> 812 bytes .../skins/default/textures/jump_right_in.tga | Bin 0 -> 812 bytes .../skins/default/textures/jump_right_out.tga | Bin 0 -> 812 bytes .../skins/default/textures/menu_separator.png | Bin 0 -> 2831 bytes indra/newview/skins/default/textures/show_btn.tga | Bin 0 -> 3884 bytes .../skins/default/textures/show_btn_selected.tga | Bin 0 -> 3884 bytes indra/newview/skins/default/textures/textures.xml | 191 +- .../newview/skins/default/textures/transparent.j2c | Bin 0 -> 172 bytes .../skins/default/textures/voice_meter_dot.j2c | Bin 0 -> 499 bytes .../skins/default/textures/voice_meter_rings.j2c | Bin 0 -> 2518 bytes .../skins/default/xui/da/floater_about_land.xml | 438 +- .../default/xui/da/floater_animation_preview.xml | 161 +- .../skins/default/xui/da/floater_buy_land.xml | 72 +- .../skins/default/xui/da/floater_customize.xml | 512 +- .../default/xui/da/floater_hardware_settings.xml | 22 +- .../skins/default/xui/da/floater_image_preview.xml | 40 +- .../xui/da/floater_inventory_item_properties.xml | 8 +- .../default/xui/da/floater_preview_gesture.xml | 44 +- .../skins/default/xui/da/floater_report_abuse.xml | 191 +- .../skins/default/xui/da/floater_sell_land.xml | 20 +- .../default/xui/da/floater_settings_debug.xml | 8 +- .../skins/default/xui/da/floater_snapshot.xml | 154 +- .../newview/skins/default/xui/da/floater_tools.xml | 591 +- .../skins/default/xui/da/floater_world_map.xml | 88 +- indra/newview/skins/default/xui/da/panel_login.xml | 12 +- .../default/xui/da/panel_preferences_chat.xml | 12 +- .../default/xui/da/panel_preferences_general.xml | 147 +- .../default/xui/da/panel_preferences_graphics1.xml | 68 +- .../default/xui/de/floater_animation_preview.xml | 148 +- .../skins/default/xui/de/floater_buy_land.xml | 13 +- .../skins/default/xui/de/floater_god_tools.xml | 24 +- .../default/xui/de/floater_hardware_settings.xml | 20 +- .../skins/default/xui/de/floater_image_preview.xml | 40 +- .../xui/de/floater_inventory_item_properties.xml | 8 +- .../default/xui/de/floater_preview_gesture.xml | 8 +- .../skins/default/xui/de/floater_report_abuse.xml | 144 +- .../skins/default/xui/de/floater_sell_land.xml | 20 +- .../default/xui/de/floater_settings_debug.xml | 8 +- .../skins/default/xui/de/floater_sound_preview.xml | 16 +- indra/newview/skins/default/xui/de/floater_tos.xml | 8 +- .../skins/default/xui/de/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/de/panel_login.xml | 12 +- .../default/xui/de/panel_preferences_chat.xml | 12 +- .../default/xui/de/panel_preferences_graphics1.xml | 68 +- .../skins/default/xui/en/accordion_parent.xml | 7 + .../newview/skins/default/xui/en/floater_about.xml | 117 + .../skins/default/xui/en/floater_about_land.xml | 2139 ++++++ .../default/xui/en/floater_animation_preview.xml | 475 ++ .../skins/default/xui/en/floater_auction.xml | 61 + .../skins/default/xui/en/floater_avatar_picker.xml | 208 + .../default/xui/en/floater_avatar_textures.xml | 211 + .../skins/default/xui/en/floater_beacons.xml | 86 + .../skins/default/xui/en/floater_build_options.xml | 71 + .../skins/default/xui/en/floater_bulk_perms.xml | 337 + .../newview/skins/default/xui/en/floater_bumps.xml | 47 + .../skins/default/xui/en/floater_buy_contents.xml | 94 + .../skins/default/xui/en/floater_buy_currency.xml | 294 + .../skins/default/xui/en/floater_buy_land.xml | 696 ++ .../skins/default/xui/en/floater_buy_object.xml | 108 + .../skins/default/xui/en/floater_camera.xml | 69 + .../skins/default/xui/en/floater_choose_group.xml | 49 + .../skins/default/xui/en/floater_color_picker.xml | 228 + .../skins/default/xui/en/floater_critical.xml | 57 + .../skins/default/xui/en/floater_customize.xml | 3574 +++++++++ .../default/xui/en/floater_day_cycle_options.xml | 613 ++ .../default/xui/en/floater_device_settings.xml | 16 + .../skins/default/xui/en/floater_env_settings.xml | 174 + .../skins/default/xui/en/floater_font_test.xml | 336 + .../skins/default/xui/en/floater_gesture.xml | 91 + .../skins/default/xui/en/floater_god_tools.xml | 685 ++ .../default/xui/en/floater_hardware_settings.xml | 158 + indra/newview/skins/default/xui/en/floater_hud.xml | 20 + indra/newview/skins/default/xui/en/floater_im.xml | 78 + .../skins/default/xui/en/floater_image_preview.xml | 125 + .../skins/default/xui/en/floater_incoming_call.xml | 67 + .../skins/default/xui/en/floater_inspect.xml | 64 + .../skins/default/xui/en/floater_inventory.xml | 423 + .../xui/en/floater_inventory_item_properties.xml | 395 + .../xui/en/floater_inventory_view_finder.xml | 281 + .../skins/default/xui/en/floater_joystick.xml | 859 +++ .../skins/default/xui/en/floater_lagmeter.xml | 337 + .../skins/default/xui/en/floater_land_holdings.xml | 164 + .../default/xui/en/floater_live_lsleditor.xml | 71 + .../skins/default/xui/en/floater_lsl_guide.xml | 62 + indra/newview/skins/default/xui/en/floater_map.xml | 172 + .../skins/default/xui/en/floater_media_browser.xml | 144 + .../skins/default/xui/en/floater_mem_leaking.xml | 110 + .../skins/default/xui/en/floater_moveview.xml | 127 + .../skins/default/xui/en/floater_mute_object.xml | 55 + .../skins/default/xui/en/floater_my_friends.xml | 41 + .../skins/default/xui/en/floater_nearby_chat.xml | 32 + .../skins/default/xui/en/floater_notification.xml | 36 + .../xui/en/floater_notifications_console.xml | 36 + .../skins/default/xui/en/floater_openobject.xml | 57 + indra/newview/skins/default/xui/en/floater_pay.xml | 129 + .../skins/default/xui/en/floater_pay_object.xml | 174 + .../skins/default/xui/en/floater_perm_prefs.xml | 106 + .../skins/default/xui/en/floater_post_process.xml | 420 + .../skins/default/xui/en/floater_postcard.xml | 156 + .../skins/default/xui/en/floater_preferences.xml | 153 + .../default/xui/en/floater_preview_animation.xml | 57 + .../default/xui/en/floater_preview_classified.xml | 22 + .../skins/default/xui/en/floater_preview_event.xml | 22 + .../default/xui/en/floater_preview_gesture.xml | 351 + .../default/xui/en/floater_preview_notecard.xml | 105 + .../skins/default/xui/en/floater_preview_sound.xml | 61 + .../default/xui/en/floater_preview_texture.xml | 77 + .../skins/default/xui/en/floater_region_info.xml | 18 + .../skins/default/xui/en/floater_report_abuse.xml | 454 ++ .../skins/default/xui/en/floater_script_debug.xml | 19 + .../default/xui/en/floater_script_debug_panel.xml | 20 + .../default/xui/en/floater_script_preview.xml | 62 + .../skins/default/xui/en/floater_script_queue.xml | 49 + .../skins/default/xui/en/floater_script_search.xml | 90 + .../skins/default/xui/en/floater_select_key.xml | 32 + .../skins/default/xui/en/floater_sell_land.xml | 315 + .../default/xui/en/floater_settings_debug.xml | 108 + .../skins/default/xui/en/floater_snapshot.xml | 370 + .../skins/default/xui/en/floater_sound_preview.xml | 75 + .../skins/default/xui/en/floater_statistics.xml | 10 + .../newview/skins/default/xui/en/floater_stats.xml | 30 + .../skins/default/xui/en/floater_telehub.xml | 132 + .../skins/default/xui/en/floater_test_button.xml | 111 + .../skins/default/xui/en/floater_test_checkbox.xml | 83 + .../skins/default/xui/en/floater_test_combobox.xml | 143 + .../skins/default/xui/en/floater_test_layout.xml | 88 + .../default/xui/en/floater_test_radiogroup.xml | 81 + .../skins/default/xui/en/floater_test_slider.xml | 77 + .../skins/default/xui/en/floater_test_spinner.xml | 93 + .../skins/default/xui/en/floater_test_textbox.xml | 129 + .../skins/default/xui/en/floater_test_widgets.xml | 342 + .../skins/default/xui/en/floater_texture_ctrl.xml | 149 + .../newview/skins/default/xui/en/floater_tools.xml | 2866 +++++++ .../skins/default/xui/en/floater_top_objects.xml | 224 + indra/newview/skins/default/xui/en/floater_tos.xml | 79 + .../skins/default/xui/en/floater_ui_preview.xml | 381 + .../skins/default/xui/en/floater_url_entry.xml | 69 + .../newview/skins/default/xui/en/floater_water.xml | 656 ++ .../default/xui/en/floater_wearable_save_as.xml | 58 + .../default/xui/en/floater_windlight_options.xml | 1487 ++++ .../skins/default/xui/en/floater_world_map.xml | 540 ++ indra/newview/skins/default/xui/en/fonts.xml | 108 + .../skins/default/xui/en/menu_avatar_icon.xml | 43 + .../skins/default/xui/en/menu_favorites.xml | 39 + .../skins/default/xui/en/menu_group_plus.xml | 11 + .../skins/default/xui/en/menu_inventory.xml | 518 ++ indra/newview/skins/default/xui/en/menu_login.xml | 105 + .../newview/skins/default/xui/en/menu_mini_map.xml | 56 + indra/newview/skins/default/xui/en/menu_navbar.xml | 85 + .../skins/default/xui/en/menu_nearby_chat.xml | 43 + indra/newview/skins/default/xui/en/menu_slurl.xml | 37 + indra/newview/skins/default/xui/en/menu_viewer.xml | 3545 +++++++++ indra/newview/skins/default/xui/en/mime_types.xml | 456 ++ .../newview/skins/default/xui/en/notifications.xml | 6470 ++++++++++++++++ .../skins/default/xui/en/panel_audio_device.xml | 153 + .../default/xui/en/panel_avatar_list_item.xml | 65 + indra/newview/skins/default/xui/en/panel_bars.xml | 69 + .../skins/default/xui/en/panel_bottomtray.xml | 41 + .../skins/default/xui/en/panel_classified.xml | 135 + .../skins/default/xui/en/panel_edit_pick.xml | 147 + .../skins/default/xui/en/panel_edit_profile.xml | 243 + .../newview/skins/default/xui/en/panel_friends.xml | 124 + .../skins/default/xui/en/panel_group_general.xml | 316 + .../skins/default/xui/en/panel_group_invite.xml | 102 + .../default/xui/en/panel_group_land_money.xml | 373 + .../skins/default/xui/en/panel_group_notices.xml | 378 + .../skins/default/xui/en/panel_group_roles.xml | 743 ++ .../newview/skins/default/xui/en/panel_groups.xml | 111 + .../skins/default/xui/en/panel_landmark_info.xml | 258 + .../skins/default/xui/en/panel_landmarks.xml | 10 + indra/newview/skins/default/xui/en/panel_login.xml | 221 + .../skins/default/xui/en/panel_navigation_bar.xml | 142 + .../skins/default/xui/en/panel_nearby_chat.xml | 27 + indra/newview/skins/default/xui/en/panel_notes.xml | 202 + .../default/xui/en/panel_notifications_channel.xml | 77 + .../newview/skins/default/xui/en/panel_people.xml | 443 ++ .../skins/default/xui/en/panel_pick_info.xml | 184 + indra/newview/skins/default/xui/en/panel_picks.xml | 173 + .../newview/skins/default/xui/en/panel_places.xml | 86 + .../default/xui/en/panel_preferences_chat.xml | 370 + .../default/xui/en/panel_preferences_general.xml | 427 ++ .../default/xui/en/panel_preferences_graphics1.xml | 915 +++ .../newview/skins/default/xui/en/panel_profile.xml | 574 ++ .../skins/default/xui/en/panel_profile_view.xml | 64 + .../skins/default/xui/en/panel_progress.xml | 133 + .../skins/default/xui/en/panel_region_covenant.xml | 328 + .../skins/default/xui/en/panel_region_debug.xml | 272 + .../skins/default/xui/en/panel_region_estate.xml | 519 ++ .../skins/default/xui/en/panel_region_general.xml | 350 + .../skins/default/xui/en/panel_region_terrain.xml | 239 + .../skins/default/xui/en/panel_region_texture.xml | 340 + .../skins/default/xui/en/panel_script_ed.xml | 190 + .../skins/default/xui/en/panel_scrolling_param.xml | 92 + .../skins/default/xui/en/panel_side_tray.xml | 95 + .../default/xui/en/panel_side_tray_tab_caption.xml | 15 + .../skins/default/xui/en/panel_status_bar.xml | 252 + .../default/xui/en/panel_teleport_history.xml | 12 + .../skins/default/xui/en/panel_world_map.xml | 128 + .../newview/skins/default/xui/en/role_actions.xml | 187 + indra/newview/skins/default/xui/en/strings.xml | 788 ++ .../skins/default/xui/en/teleport_strings.xml | 90 + .../skins/default/xui/en/widgets/button.xml | 17 + .../skins/default/xui/en/widgets/check_box.xml | 18 + .../skins/default/xui/en/widgets/color_swatch.xml | 10 + .../skins/default/xui/en/widgets/combo_box.xml | 22 + .../skins/default/xui/en/widgets/drop_down.xml | 20 + .../skins/default/xui/en/widgets/flyout_button.xml | 13 + .../newview/skins/default/xui/en/widgets/icon.xml | 7 + .../skins/default/xui/en/widgets/line_editor.xml | 18 + .../default/xui/en/widgets/location_input.xml | 66 + .../newview/skins/default/xui/en/widgets/menu.xml | 6 + .../default/xui/en/widgets/menu_item_call.xml | 6 + .../default/xui/en/widgets/menu_item_check.xml | 6 + .../default/xui/en/widgets/menu_item_separator.xml | 6 + .../skins/default/xui/en/widgets/multi_slider.xml | 6 + .../default/xui/en/widgets/multi_slider_bar.xml | 10 + .../skins/default/xui/en/widgets/name_editor.xml | 2 + .../newview/skins/default/xui/en/widgets/panel.xml | 5 + .../skins/default/xui/en/widgets/progress_bar.xml | 21 + .../skins/default/xui/en/widgets/radio_group.xml | 6 + .../skins/default/xui/en/widgets/radio_item.xml | 9 + .../skins/default/xui/en/widgets/scroll_bar.xml | 19 + .../default/xui/en/widgets/scroll_container.xml | 3 + .../skins/default/xui/en/widgets/scroll_list.xml | 16 + .../skins/default/xui/en/widgets/search_editor.xml | 6 + .../skins/default/xui/en/widgets/side_tray.xml | 8 + .../default/xui/en/widgets/simple_text_editor.xml | 11 + .../skins/default/xui/en/widgets/slider.xml | 16 + .../skins/default/xui/en/widgets/slider_bar.xml | 7 + .../skins/default/xui/en/widgets/spinner.xml | 5 + .../skins/default/xui/en/widgets/tab_container.xml | 9 + .../newview/skins/default/xui/en/widgets/text.xml | 16 + .../skins/default/xui/en/widgets/text_editor.xml | 19 + .../default/xui/en/widgets/texture_picker.xml | 9 + .../skins/default/xui/en/widgets/view_border.xml | 8 + .../skins/default/xui/en/widgets/web_browser.xml | 2 + indra/newview/skins/default/xui/en/xui_version.xml | 4 + .../default/xui/es/floater_animation_preview.xml | 173 +- .../skins/default/xui/es/floater_buy_land.xml | 23 +- .../skins/default/xui/es/floater_customize.xml | 14 +- .../skins/default/xui/es/floater_god_tools.xml | 24 +- .../default/xui/es/floater_hardware_settings.xml | 24 +- .../skins/default/xui/es/floater_image_preview.xml | 50 +- .../xui/es/floater_inventory_item_properties.xml | 16 +- .../default/xui/es/floater_preview_gesture.xml | 24 +- .../skins/default/xui/es/floater_report_abuse.xml | 148 +- .../skins/default/xui/es/floater_sell_land.xml | 20 +- .../default/xui/es/floater_settings_debug.xml | 10 +- .../skins/default/xui/es/floater_snapshot.xml | 128 +- .../skins/default/xui/es/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/es/panel_login.xml | 12 +- .../default/xui/es/panel_preferences_chat.xml | 17 +- .../default/xui/es/panel_preferences_graphics1.xml | 112 +- .../default/xui/fr/floater_animation_preview.xml | 148 +- .../skins/default/xui/fr/floater_auction.xml | 8 +- .../skins/default/xui/fr/floater_buy_land.xml | 13 +- .../skins/default/xui/fr/floater_god_tools.xml | 24 +- .../default/xui/fr/floater_hardware_settings.xml | 20 +- .../skins/default/xui/fr/floater_image_preview.xml | 40 +- .../xui/fr/floater_inventory_item_properties.xml | 8 +- .../default/xui/fr/floater_preview_gesture.xml | 9 +- .../skins/default/xui/fr/floater_sell_land.xml | 20 +- .../default/xui/fr/floater_settings_debug.xml | 8 +- .../skins/default/xui/fr/floater_snapshot.xml | 120 +- .../skins/default/xui/fr/floater_sound_preview.xml | 16 +- .../newview/skins/default/xui/fr/floater_tools.xml | 246 +- indra/newview/skins/default/xui/fr/floater_tos.xml | 8 +- .../skins/default/xui/fr/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/fr/panel_login.xml | 16 +- .../default/xui/fr/panel_preferences_chat.xml | 12 +- .../default/xui/fr/panel_preferences_graphics1.xml | 68 +- .../default/xui/it/floater_animation_preview.xml | 167 +- .../skins/default/xui/it/floater_buy_land.xml | 23 +- .../skins/default/xui/it/floater_customize.xml | 8 +- .../default/xui/it/floater_hardware_settings.xml | 26 +- .../skins/default/xui/it/floater_image_preview.xml | 45 +- .../xui/it/floater_inventory_item_properties.xml | 16 +- .../default/xui/it/floater_preview_gesture.xml | 17 +- .../skins/default/xui/it/floater_report_abuse.xml | 149 +- .../skins/default/xui/it/floater_sell_land.xml | 20 +- .../default/xui/it/floater_settings_debug.xml | 10 +- .../skins/default/xui/it/floater_snapshot.xml | 138 +- .../skins/default/xui/it/floater_world_map.xml | 8 +- .../default/xui/it/panel_preferences_chat.xml | 14 +- .../default/xui/it/panel_preferences_graphics1.xml | 96 +- .../default/xui/ja/floater_animation_preview.xml | 148 +- .../skins/default/xui/ja/floater_buy_land.xml | 13 +- .../default/xui/ja/floater_hardware_settings.xml | 20 +- .../skins/default/xui/ja/floater_image_preview.xml | 40 +- .../xui/ja/floater_inventory_item_properties.xml | 8 +- .../default/xui/ja/floater_preview_gesture.xml | 8 +- .../skins/default/xui/ja/floater_sell_land.xml | 12 +- .../default/xui/ja/floater_settings_debug.xml | 8 +- .../skins/default/xui/ja/floater_snapshot.xml | 120 +- .../skins/default/xui/ja/floater_sound_preview.xml | 16 +- .../newview/skins/default/xui/ja/floater_tools.xml | 246 +- indra/newview/skins/default/xui/ja/floater_tos.xml | 8 +- .../skins/default/xui/ja/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/ja/panel_login.xml | 14 +- .../default/xui/ja/panel_preferences_chat.xml | 12 +- .../default/xui/ja/panel_preferences_graphics1.xml | 68 +- .../skins/default/xui/nl/floater_buy_land.xml | 15 +- .../skins/default/xui/nl/floater_customize.xml | 32 +- .../skins/default/xui/nl/floater_report_abuse.xml | 158 +- .../skins/default/xui/nl/floater_sell_land.xml | 20 +- .../skins/default/xui/nl/floater_snapshot.xml | 126 +- .../skins/default/xui/nl/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/nl/panel_login.xml | 14 +- .../skins/default/xui/pl/floater_buy_land.xml | 12 +- .../skins/default/xui/pl/floater_god_tools.xml | 24 +- .../default/xui/pl/floater_hardware_settings.xml | 20 +- .../skins/default/xui/pl/floater_image_preview.xml | 40 +- .../xui/pl/floater_inventory_item_properties.xml | 8 +- .../default/xui/pl/floater_preview_gesture.xml | 8 +- .../skins/default/xui/pl/floater_report_abuse.xml | 144 +- .../skins/default/xui/pl/floater_sell_land.xml | 20 +- .../default/xui/pl/floater_settings_debug.xml | 8 +- .../skins/default/xui/pl/floater_snapshot.xml | 120 +- .../skins/default/xui/pl/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/pl/panel_login.xml | 14 +- .../default/xui/pl/panel_preferences_chat.xml | 12 +- .../default/xui/pl/panel_preferences_graphics1.xml | 68 +- .../default/xui/pt/floater_animation_preview.xml | 173 +- .../skins/default/xui/pt/floater_buy_land.xml | 31 +- .../skins/default/xui/pt/floater_customize.xml | 8 +- .../skins/default/xui/pt/floater_god_tools.xml | 24 +- .../default/xui/pt/floater_hardware_settings.xml | 20 +- .../skins/default/xui/pt/floater_image_preview.xml | 45 +- .../xui/pt/floater_inventory_item_properties.xml | 10 +- .../default/xui/pt/floater_preview_gesture.xml | 32 +- .../skins/default/xui/pt/floater_report_abuse.xml | 148 +- .../skins/default/xui/pt/floater_sell_land.xml | 20 +- .../default/xui/pt/floater_settings_debug.xml | 8 +- .../skins/default/xui/pt/floater_snapshot.xml | 132 +- .../skins/default/xui/pt/floater_world_map.xml | 8 +- indra/newview/skins/default/xui/pt/panel_login.xml | 16 +- .../default/xui/pt/panel_preferences_chat.xml | 14 +- .../default/xui/pt/panel_preferences_graphics1.xml | 88 +- indra/newview/skins/paths.xml | 2 +- indra/newview/tests/llagentaccess_test.cpp | 137 +- indra/newview/viewer_manifest.py | 21 +- 798 files changed, 96335 insertions(+), 36412 deletions(-) create mode 100644 indra/newview/app_settings/ignorable_dialogs.xml create mode 100644 indra/newview/character/checkerboard.tga create mode 100755 indra/newview/character/invisible_head.tga create mode 100644 indra/newview/llagentwearables.cpp create mode 100644 indra/newview/llagentwearables.h create mode 100644 indra/newview/llavatariconctrl.cpp create mode 100644 indra/newview/llavatariconctrl.h create mode 100644 indra/newview/llavatarlist.cpp create mode 100644 indra/newview/llavatarlist.h create mode 100644 indra/newview/llavatarlistitem.cpp create mode 100644 indra/newview/llavatarlistitem.h create mode 100644 indra/newview/llavatarpropertiesprocessor.cpp create mode 100644 indra/newview/llavatarpropertiesprocessor.h create mode 100644 indra/newview/llbottomtray.cpp create mode 100644 indra/newview/llbottomtray.h create mode 100644 indra/newview/llchiclet.cpp create mode 100644 indra/newview/llchiclet.h create mode 100644 indra/newview/llfavoritesbar.cpp create mode 100644 indra/newview/llfavoritesbar.h create mode 100644 indra/newview/llfloateruipreview.cpp create mode 100644 indra/newview/llfloateruipreview.h create mode 100644 indra/newview/llgroupactions.cpp create mode 100644 indra/newview/llgroupactions.h create mode 100644 indra/newview/llgrouplist.cpp create mode 100644 indra/newview/llgrouplist.h create mode 100644 indra/newview/lllocationhistory.cpp create mode 100644 indra/newview/lllocationhistory.h create mode 100644 indra/newview/lllocationinputctrl.cpp create mode 100644 indra/newview/lllocationinputctrl.h create mode 100644 indra/newview/llmetricperformancetester.cpp create mode 100644 indra/newview/llmetricperformancetester.h create mode 100644 indra/newview/llnavigationbar.cpp create mode 100644 indra/newview/llnavigationbar.h create mode 100644 indra/newview/lloutputmonitorctrl.cpp create mode 100644 indra/newview/lloutputmonitorctrl.h create mode 100644 indra/newview/llpanellandmarks.cpp create mode 100644 indra/newview/llpanellandmarks.h create mode 100644 indra/newview/llpanelpeople.cpp create mode 100644 indra/newview/llpanelpeople.h create mode 100644 indra/newview/llpanelpicks.cpp create mode 100644 indra/newview/llpanelpicks.h create mode 100644 indra/newview/llpanelplaceinfo.cpp create mode 100644 indra/newview/llpanelplaceinfo.h create mode 100644 indra/newview/llpanelplaces.cpp create mode 100644 indra/newview/llpanelplaces.h create mode 100644 indra/newview/llpanelplacestab.cpp create mode 100644 indra/newview/llpanelplacestab.h create mode 100644 indra/newview/llpanelprofileview.cpp create mode 100644 indra/newview/llpanelprofileview.h create mode 100644 indra/newview/llpanelteleporthistory.cpp create mode 100644 indra/newview/llpanelteleporthistory.h create mode 100644 indra/newview/llrecentpeople.cpp create mode 100644 indra/newview/llrecentpeople.h create mode 100644 indra/newview/llrootview.h create mode 100644 indra/newview/llsidetray.cpp create mode 100644 indra/newview/llsidetray.h create mode 100644 indra/newview/llslurl.cpp create mode 100644 indra/newview/llslurl.h create mode 100644 indra/newview/llteleporthistory.cpp create mode 100644 indra/newview/llteleporthistory.h create mode 100644 indra/newview/lltexglobalcolor.cpp create mode 100644 indra/newview/lltexglobalcolor.h create mode 100644 indra/newview/lltexlayerparams.cpp create mode 100644 indra/newview/lltexlayerparams.h create mode 100644 indra/newview/llviewerfloaterreg.cpp create mode 100644 indra/newview/llviewerfloaterreg.h create mode 100644 indra/newview/llvoavatarself.cpp create mode 100644 indra/newview/llvoavatarself.h create mode 100644 indra/newview/res/bitmap2.bmp create mode 100644 indra/newview/res/install_icon.BMP create mode 100644 indra/newview/res/loginbackground.bmp create mode 100644 indra/newview/res/uninstall_icon.BMP create mode 100644 indra/newview/skins/default/textures/jump_left_in.tga create mode 100644 indra/newview/skins/default/textures/jump_left_out.tga create mode 100644 indra/newview/skins/default/textures/jump_right_in.tga create mode 100644 indra/newview/skins/default/textures/jump_right_out.tga create mode 100644 indra/newview/skins/default/textures/menu_separator.png create mode 100644 indra/newview/skins/default/textures/show_btn.tga create mode 100644 indra/newview/skins/default/textures/show_btn_selected.tga create mode 100644 indra/newview/skins/default/textures/transparent.j2c create mode 100644 indra/newview/skins/default/textures/voice_meter_dot.j2c create mode 100644 indra/newview/skins/default/textures/voice_meter_rings.j2c create mode 100644 indra/newview/skins/default/xui/en/accordion_parent.xml create mode 100644 indra/newview/skins/default/xui/en/floater_about.xml create mode 100644 indra/newview/skins/default/xui/en/floater_about_land.xml create mode 100644 indra/newview/skins/default/xui/en/floater_animation_preview.xml create mode 100644 indra/newview/skins/default/xui/en/floater_auction.xml create mode 100644 indra/newview/skins/default/xui/en/floater_avatar_picker.xml create mode 100644 indra/newview/skins/default/xui/en/floater_avatar_textures.xml create mode 100644 indra/newview/skins/default/xui/en/floater_beacons.xml create mode 100644 indra/newview/skins/default/xui/en/floater_build_options.xml create mode 100644 indra/newview/skins/default/xui/en/floater_bulk_perms.xml create mode 100644 indra/newview/skins/default/xui/en/floater_bumps.xml create mode 100644 indra/newview/skins/default/xui/en/floater_buy_contents.xml create mode 100644 indra/newview/skins/default/xui/en/floater_buy_currency.xml create mode 100644 indra/newview/skins/default/xui/en/floater_buy_land.xml create mode 100644 indra/newview/skins/default/xui/en/floater_buy_object.xml create mode 100644 indra/newview/skins/default/xui/en/floater_camera.xml create mode 100644 indra/newview/skins/default/xui/en/floater_choose_group.xml create mode 100644 indra/newview/skins/default/xui/en/floater_color_picker.xml create mode 100644 indra/newview/skins/default/xui/en/floater_critical.xml create mode 100644 indra/newview/skins/default/xui/en/floater_customize.xml create mode 100644 indra/newview/skins/default/xui/en/floater_day_cycle_options.xml create mode 100644 indra/newview/skins/default/xui/en/floater_device_settings.xml create mode 100644 indra/newview/skins/default/xui/en/floater_env_settings.xml create mode 100644 indra/newview/skins/default/xui/en/floater_font_test.xml create mode 100644 indra/newview/skins/default/xui/en/floater_gesture.xml create mode 100644 indra/newview/skins/default/xui/en/floater_god_tools.xml create mode 100644 indra/newview/skins/default/xui/en/floater_hardware_settings.xml create mode 100644 indra/newview/skins/default/xui/en/floater_hud.xml create mode 100644 indra/newview/skins/default/xui/en/floater_im.xml create mode 100644 indra/newview/skins/default/xui/en/floater_image_preview.xml create mode 100644 indra/newview/skins/default/xui/en/floater_incoming_call.xml create mode 100644 indra/newview/skins/default/xui/en/floater_inspect.xml create mode 100644 indra/newview/skins/default/xui/en/floater_inventory.xml create mode 100644 indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml create mode 100644 indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml create mode 100644 indra/newview/skins/default/xui/en/floater_joystick.xml create mode 100644 indra/newview/skins/default/xui/en/floater_lagmeter.xml create mode 100644 indra/newview/skins/default/xui/en/floater_land_holdings.xml create mode 100644 indra/newview/skins/default/xui/en/floater_live_lsleditor.xml create mode 100644 indra/newview/skins/default/xui/en/floater_lsl_guide.xml create mode 100644 indra/newview/skins/default/xui/en/floater_map.xml create mode 100644 indra/newview/skins/default/xui/en/floater_media_browser.xml create mode 100644 indra/newview/skins/default/xui/en/floater_mem_leaking.xml create mode 100644 indra/newview/skins/default/xui/en/floater_moveview.xml create mode 100644 indra/newview/skins/default/xui/en/floater_mute_object.xml create mode 100644 indra/newview/skins/default/xui/en/floater_my_friends.xml create mode 100644 indra/newview/skins/default/xui/en/floater_nearby_chat.xml create mode 100644 indra/newview/skins/default/xui/en/floater_notification.xml create mode 100644 indra/newview/skins/default/xui/en/floater_notifications_console.xml create mode 100644 indra/newview/skins/default/xui/en/floater_openobject.xml create mode 100644 indra/newview/skins/default/xui/en/floater_pay.xml create mode 100644 indra/newview/skins/default/xui/en/floater_pay_object.xml create mode 100644 indra/newview/skins/default/xui/en/floater_perm_prefs.xml create mode 100644 indra/newview/skins/default/xui/en/floater_post_process.xml create mode 100644 indra/newview/skins/default/xui/en/floater_postcard.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preferences.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_animation.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_classified.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_event.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_gesture.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_notecard.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_sound.xml create mode 100644 indra/newview/skins/default/xui/en/floater_preview_texture.xml create mode 100644 indra/newview/skins/default/xui/en/floater_region_info.xml create mode 100644 indra/newview/skins/default/xui/en/floater_report_abuse.xml create mode 100644 indra/newview/skins/default/xui/en/floater_script_debug.xml create mode 100644 indra/newview/skins/default/xui/en/floater_script_debug_panel.xml create mode 100644 indra/newview/skins/default/xui/en/floater_script_preview.xml create mode 100644 indra/newview/skins/default/xui/en/floater_script_queue.xml create mode 100644 indra/newview/skins/default/xui/en/floater_script_search.xml create mode 100644 indra/newview/skins/default/xui/en/floater_select_key.xml create mode 100644 indra/newview/skins/default/xui/en/floater_sell_land.xml create mode 100644 indra/newview/skins/default/xui/en/floater_settings_debug.xml create mode 100644 indra/newview/skins/default/xui/en/floater_snapshot.xml create mode 100644 indra/newview/skins/default/xui/en/floater_sound_preview.xml create mode 100644 indra/newview/skins/default/xui/en/floater_statistics.xml create mode 100644 indra/newview/skins/default/xui/en/floater_stats.xml create mode 100644 indra/newview/skins/default/xui/en/floater_telehub.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_button.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_checkbox.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_combobox.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_layout.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_radiogroup.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_slider.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_spinner.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_textbox.xml create mode 100644 indra/newview/skins/default/xui/en/floater_test_widgets.xml create mode 100644 indra/newview/skins/default/xui/en/floater_texture_ctrl.xml create mode 100644 indra/newview/skins/default/xui/en/floater_tools.xml create mode 100644 indra/newview/skins/default/xui/en/floater_top_objects.xml create mode 100644 indra/newview/skins/default/xui/en/floater_tos.xml create mode 100644 indra/newview/skins/default/xui/en/floater_ui_preview.xml create mode 100644 indra/newview/skins/default/xui/en/floater_url_entry.xml create mode 100644 indra/newview/skins/default/xui/en/floater_water.xml create mode 100644 indra/newview/skins/default/xui/en/floater_wearable_save_as.xml create mode 100644 indra/newview/skins/default/xui/en/floater_windlight_options.xml create mode 100644 indra/newview/skins/default/xui/en/floater_world_map.xml create mode 100644 indra/newview/skins/default/xui/en/fonts.xml create mode 100644 indra/newview/skins/default/xui/en/menu_avatar_icon.xml create mode 100644 indra/newview/skins/default/xui/en/menu_favorites.xml create mode 100644 indra/newview/skins/default/xui/en/menu_group_plus.xml create mode 100644 indra/newview/skins/default/xui/en/menu_inventory.xml create mode 100644 indra/newview/skins/default/xui/en/menu_login.xml create mode 100644 indra/newview/skins/default/xui/en/menu_mini_map.xml create mode 100644 indra/newview/skins/default/xui/en/menu_navbar.xml create mode 100644 indra/newview/skins/default/xui/en/menu_nearby_chat.xml create mode 100644 indra/newview/skins/default/xui/en/menu_slurl.xml create mode 100644 indra/newview/skins/default/xui/en/menu_viewer.xml create mode 100644 indra/newview/skins/default/xui/en/mime_types.xml create mode 100644 indra/newview/skins/default/xui/en/notifications.xml create mode 100644 indra/newview/skins/default/xui/en/panel_audio_device.xml create mode 100644 indra/newview/skins/default/xui/en/panel_avatar_list_item.xml create mode 100644 indra/newview/skins/default/xui/en/panel_bars.xml create mode 100644 indra/newview/skins/default/xui/en/panel_bottomtray.xml create mode 100644 indra/newview/skins/default/xui/en/panel_classified.xml create mode 100644 indra/newview/skins/default/xui/en/panel_edit_pick.xml create mode 100644 indra/newview/skins/default/xui/en/panel_edit_profile.xml create mode 100644 indra/newview/skins/default/xui/en/panel_friends.xml create mode 100644 indra/newview/skins/default/xui/en/panel_group_general.xml create mode 100644 indra/newview/skins/default/xui/en/panel_group_invite.xml create mode 100644 indra/newview/skins/default/xui/en/panel_group_land_money.xml create mode 100644 indra/newview/skins/default/xui/en/panel_group_notices.xml create mode 100644 indra/newview/skins/default/xui/en/panel_group_roles.xml create mode 100644 indra/newview/skins/default/xui/en/panel_groups.xml create mode 100644 indra/newview/skins/default/xui/en/panel_landmark_info.xml create mode 100644 indra/newview/skins/default/xui/en/panel_landmarks.xml create mode 100644 indra/newview/skins/default/xui/en/panel_login.xml create mode 100644 indra/newview/skins/default/xui/en/panel_navigation_bar.xml create mode 100644 indra/newview/skins/default/xui/en/panel_nearby_chat.xml create mode 100644 indra/newview/skins/default/xui/en/panel_notes.xml create mode 100644 indra/newview/skins/default/xui/en/panel_notifications_channel.xml create mode 100644 indra/newview/skins/default/xui/en/panel_people.xml create mode 100644 indra/newview/skins/default/xui/en/panel_pick_info.xml create mode 100644 indra/newview/skins/default/xui/en/panel_picks.xml create mode 100644 indra/newview/skins/default/xui/en/panel_places.xml create mode 100644 indra/newview/skins/default/xui/en/panel_preferences_chat.xml create mode 100644 indra/newview/skins/default/xui/en/panel_preferences_general.xml create mode 100644 indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml create mode 100644 indra/newview/skins/default/xui/en/panel_profile.xml create mode 100644 indra/newview/skins/default/xui/en/panel_profile_view.xml create mode 100644 indra/newview/skins/default/xui/en/panel_progress.xml create mode 100644 indra/newview/skins/default/xui/en/panel_region_covenant.xml create mode 100644 indra/newview/skins/default/xui/en/panel_region_debug.xml create mode 100644 indra/newview/skins/default/xui/en/panel_region_estate.xml create mode 100644 indra/newview/skins/default/xui/en/panel_region_general.xml create mode 100644 indra/newview/skins/default/xui/en/panel_region_terrain.xml create mode 100644 indra/newview/skins/default/xui/en/panel_region_texture.xml create mode 100644 indra/newview/skins/default/xui/en/panel_script_ed.xml create mode 100644 indra/newview/skins/default/xui/en/panel_scrolling_param.xml create mode 100644 indra/newview/skins/default/xui/en/panel_side_tray.xml create mode 100644 indra/newview/skins/default/xui/en/panel_side_tray_tab_caption.xml create mode 100644 indra/newview/skins/default/xui/en/panel_status_bar.xml create mode 100644 indra/newview/skins/default/xui/en/panel_teleport_history.xml create mode 100644 indra/newview/skins/default/xui/en/panel_world_map.xml create mode 100644 indra/newview/skins/default/xui/en/role_actions.xml create mode 100644 indra/newview/skins/default/xui/en/strings.xml create mode 100644 indra/newview/skins/default/xui/en/teleport_strings.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/button.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/check_box.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/color_swatch.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/combo_box.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/drop_down.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/flyout_button.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/icon.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/line_editor.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/location_input.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/menu.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/menu_item_call.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/menu_item_check.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/menu_item_separator.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/multi_slider.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/multi_slider_bar.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/name_editor.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/panel.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/progress_bar.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/radio_group.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/radio_item.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/scroll_bar.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/scroll_container.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/scroll_list.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/search_editor.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/side_tray.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/slider.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/slider_bar.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/spinner.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/tab_container.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/text.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/text_editor.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/texture_picker.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/view_border.xml create mode 100644 indra/newview/skins/default/xui/en/widgets/web_browser.xml create mode 100644 indra/newview/skins/default/xui/en/xui_version.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 0c8486bd4f..0cbacd5b2e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -63,41 +63,48 @@ include_directories( ) set(viewer_SOURCE_FILES + llaccordionpanel.cpp llagent.cpp llagentaccess.cpp llagentdata.cpp llagentlanguage.cpp llagentpilot.cpp + llagentwearables.cpp llanimstatelabels.cpp llappviewer.cpp llassetuploadresponders.cpp llassetuploadqueue.cpp llaudiosourcevo.cpp + llavatariconctrl.cpp + llavatarlist.cpp + llavatarlistitem.cpp + llavatarpropertiesprocessor.cpp llbbox.cpp + llbottomtray.cpp llbox.cpp llcallbacklist.cpp llcallingcard.cpp llcapabilitylistener.cpp llcaphttpsender.cpp llchatbar.cpp + llchathistoryscroll.cpp + llchiclet.cpp llclassifiedinfo.cpp llclassifiedstatsresponder.cpp llcloud.cpp - llcolorscheme.cpp + llcollapsiblectrl.cpp llcolorswatch.cpp llcommandhandler.cpp llcommandlineparser.cpp - llcompass.cpp llcompilequeue.cpp llconfirmationmanager.cpp - llconsole.cpp - llcontainerview.cpp llcurrencyuimanager.cpp llcylinder.cpp lldebugmessagebox.cpp lldebugview.cpp lldelayedgestureerror.cpp lldirpicker.cpp + lldraggerbar.cpp lldrawable.cpp lldrawpoolalpha.cpp lldrawpoolavatar.cpp @@ -118,12 +125,14 @@ set(viewer_SOURCE_FILES lleventpoll.cpp llface.cpp llfasttimerview.cpp + llfavoritesbar.cpp llfeaturemanager.cpp llfilepicker.cpp llfirstuse.cpp llflexibleobject.cpp llfloaterabout.cpp llfloateractivespeakers.cpp + llfloateraddlandmark.cpp llfloateranimpreview.cpp llfloaterauction.cpp llfloateravatarinfo.cpp @@ -137,6 +146,7 @@ set(viewer_SOURCE_FILES llfloaterbuy.cpp llfloaterbuycurrency.cpp llfloaterbuyland.cpp + llfloatercall.cpp llfloatercamera.cpp llfloaterchat.cpp llfloaterchatterbox.cpp @@ -145,7 +155,6 @@ set(viewer_SOURCE_FILES llfloatercustomize.cpp llfloaterdaycycle.cpp llfloaterdirectory.cpp - llfloatereditui.cpp llfloaterenvsettings.cpp llfloaterevent.cpp llfloaterfriends.cpp @@ -168,17 +177,15 @@ set(viewer_SOURCE_FILES llfloaterlagmeter.cpp llfloaterland.cpp llfloaterlandholdings.cpp - llfloaterlandmark.cpp llfloatermap.cpp llfloatermemleak.cpp + llfloaterminiinspector.cpp llfloatermute.cpp llfloaternamedesc.cpp - llfloaternewim.cpp llfloaternotificationsconsole.cpp llfloaterobjectiminfo.cpp llfloateropenobject.cpp llfloaterparcel.cpp - llfloaterpermissionsmgr.cpp llfloaterperms.cpp llfloaterpostcard.cpp llfloaterpostprocess.cpp @@ -190,12 +197,11 @@ set(viewer_SOURCE_FILES llfloatersellland.cpp llfloatersettingsdebug.cpp llfloatersnapshot.cpp - llfloaterstats.cpp llfloatertelehub.cpp - llfloatertest.cpp llfloatertools.cpp llfloatertopobjects.cpp llfloatertos.cpp + llfloateruipreview.cpp llfloaterurldisplay.cpp llfloaterurlentry.cpp llfloatervoicedevicesettings.cpp @@ -204,11 +210,12 @@ set(viewer_SOURCE_FILES llfloaterworldmap.cpp llfolderview.cpp llfollowcam.cpp - llframestats.cpp - llframestatview.cpp + llfriendactions.cpp llgesturemgr.cpp llgivemoney.cpp llglsandbox.cpp + llgroupactions.cpp + llgrouplist.cpp llgroupmgr.cpp llgroupnotify.cpp llhomelocationresponder.cpp @@ -226,13 +233,15 @@ set(viewer_SOURCE_FILES llhudview.cpp llimpanel.cpp llimview.cpp - llinventoryactions.cpp + llimcontrolpanel.cpp llinventorybridge.cpp llinventoryclipboard.cpp llinventorymodel.cpp llinventoryview.cpp lljoystickbutton.cpp lllandmarklist.cpp + lllocationhistory.cpp + lllocationinputctrl.cpp lllogchat.cpp llloginhandler.cpp llmanip.cpp @@ -243,6 +252,7 @@ set(viewer_SOURCE_FILES llmediaremotectrl.cpp llmemoryview.cpp llmenucommands.cpp + llmetricperformancetester.cpp llmimetypes.cpp llmorphview.cpp llmoveview.cpp @@ -250,15 +260,16 @@ set(viewer_SOURCE_FILES llnamebox.cpp llnameeditor.cpp llnamelistctrl.cpp + llnavigationbar.cpp + llnearbychathistory.cpp llnetmap.cpp llnotify.cpp + lloutputmonitorctrl.cpp lloverlaybar.cpp - llpanelaudioprefs.cpp - llpanelaudiovolume.cpp llpanelavatar.cpp + llpanelavatarrow.cpp llpanelclassified.cpp llpanelcontents.cpp - llpaneldebug.cpp llpaneldirbrowser.cpp llpaneldirclassified.cpp llpaneldirevents.cpp @@ -267,41 +278,37 @@ set(viewer_SOURCE_FILES llpaneldirland.cpp llpaneldirpeople.cpp llpaneldirplaces.cpp - llpaneldirpopular.cpp llpaneldisplay.cpp llpanelevent.cpp llpanelface.cpp - llpanelgeneral.cpp llpanelgroup.cpp llpanelgroupgeneral.cpp llpanelgroupinvite.cpp llpanelgrouplandmoney.cpp llpanelgroupnotices.cpp llpanelgrouproles.cpp - llpanelinput.cpp llpanelinventory.cpp llpanelland.cpp + llpanellandmarks.cpp llpanellandmedia.cpp - llpanellandobjects.cpp - llpanellandoptions.cpp llpanellogin.cpp - llpanelmorph.cpp - llpanelmsgs.cpp - llpanelnetwork.cpp + llpanelmeprofile.cpp llpanelobject.cpp + llpanelpeople.cpp llpanelpermissions.cpp llpanelpick.cpp + llpanelpicks.cpp llpanelplace.cpp - llpanelskins.cpp + llpanelplaceinfo.cpp + llpanelplaces.cpp + llpanelplacestab.cpp + llpanelprofileview.cpp + llpanelteleporthistory.cpp llpanelvolume.cpp - llpanelweb.cpp llparcelselection.cpp llpatchvertexarray.cpp llpolymesh.cpp llpolymorph.cpp - llprefschat.cpp - llprefsim.cpp - llprefsvoice.cpp llpreviewanim.cpp llpreview.cpp llpreviewgesture.cpp @@ -312,23 +319,26 @@ set(viewer_SOURCE_FILES llpreviewtexture.cpp llproductinforequest.cpp llprogressview.cpp + llrecentpeople.cpp llregionposition.cpp llremoteparcelrequest.cpp llsavedsettingsglue.cpp llselectmgr.cpp + llsidetray.cpp llsky.cpp + llslurl.cpp llspatialpartition.cpp llsprite.cpp llsrv.cpp llstartup.cpp - llstatbar.cpp - llstatgraph.cpp llstatusbar.cpp - llstatview.cpp llstylemap.cpp llsurface.cpp llsurfacepatch.cpp + llteleporthistory.cpp + lltexglobalcolor.cpp lltexlayer.cpp + lltexlayerparams.cpp lltexturecache.cpp lltexturectrl.cpp lltexturefetch.cpp @@ -352,9 +362,7 @@ set(viewer_SOURCE_FILES lltoolselect.cpp lltoolselectland.cpp lltoolselectrect.cpp - lltoolview.cpp lltracker.cpp - lltrans.cpp lluploaddialog.cpp llurl.cpp llurldispatcher.cpp @@ -363,13 +371,13 @@ set(viewer_SOURCE_FILES llurlwhitelist.cpp lluserauth.cpp llvectorperfoptions.cpp - llvelocitybar.cpp llviewchildren.cpp llviewerassetstorage.cpp llvieweraudio.cpp llviewercamera.cpp llviewercontrol.cpp llviewerdisplay.cpp + llviewerfloaterreg.cpp llviewergenericmessage.cpp llviewergesture.cpp llviewerimage.cpp @@ -409,6 +417,7 @@ set(viewer_SOURCE_FILES llvlmanager.cpp llvoavatar.cpp llvoavatardefines.cpp + llvoavatarself.cpp llvocache.cpp llvoclouds.cpp llvograss.cpp @@ -416,6 +425,7 @@ set(viewer_SOURCE_FILES llvoiceclient.cpp llvoiceremotectrl.cpp llvoicevisualizer.cpp + llvoicecontrolpanel.cpp llvoinventorylistener.cpp llvopartgroup.cpp llvosky.cpp @@ -429,6 +439,7 @@ set(viewer_SOURCE_FILES llwaterparammanager.cpp llwaterparamset.cpp llwearable.cpp + llwearabledictionary.cpp llwearablelist.cpp llweb.cpp llwebbrowserctrl.cpp @@ -465,19 +476,25 @@ endif (LINUX) set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake - + llaccordionpanel.h llagent.h llagentaccess.h llagentdata.h llagentlanguage.h llagentpilot.h + llagentwearables.h llanimstatelabels.h llappearance.h llappviewer.h llassetuploadresponders.h llassetuploadqueue.h llaudiosourcevo.h + llavatariconctrl.h + llavatarlist.h + llavatarlistitem.h + llavatarpropertiesprocessor.h llbbox.h + llbottomtray.h llbox.h llcallbacklist.h llcallingcard.h @@ -485,24 +502,24 @@ set(viewer_HEADER_FILES llcapabilityprovider.h llcaphttpsender.h llchatbar.h + llchathistoryscroll.h + llchiclet.h llclassifiedinfo.h llclassifiedstatsresponder.h llcloud.h - llcolorscheme.h + llcollapsiblectrl.h llcolorswatch.h llcommandhandler.h llcommandlineparser.h - llcompass.h llcompilequeue.h llconfirmationmanager.h - llconsole.h - llcontainerview.h llcurrencyuimanager.h llcylinder.h lldebugmessagebox.h lldebugview.h lldelayedgestureerror.h lldirpicker.h + lldraggerbar.h lldrawable.h lldrawpool.h lldrawpoolalpha.h @@ -524,12 +541,14 @@ set(viewer_HEADER_FILES lleventpoll.h llface.h llfasttimerview.h + llfavoritesbar.h llfeaturemanager.h llfilepicker.h llfirstuse.h llflexibleobject.h llfloaterabout.h llfloateractivespeakers.h + llfloateraddlandmark.h llfloateranimpreview.h llfloaterauction.h llfloateravatarinfo.h @@ -543,6 +562,7 @@ set(viewer_HEADER_FILES llfloaterbuycontents.h llfloaterbuycurrency.h llfloaterbuyland.h + llfloatercall.h llfloatercamera.h llfloaterchat.h llfloaterchatterbox.h @@ -551,7 +571,6 @@ set(viewer_HEADER_FILES llfloatercustomize.h llfloaterdaycycle.h llfloaterdirectory.h - llfloatereditui.h llfloaterenvsettings.h llfloaterevent.h llfloaterfonttest.h @@ -574,17 +593,15 @@ set(viewer_HEADER_FILES llfloaterlagmeter.h llfloaterland.h llfloaterlandholdings.h - llfloaterlandmark.h llfloatermap.h llfloatermemleak.h + llfloaterminiinspector.h llfloatermute.h llfloaternamedesc.h - llfloaternewim.h llfloaternotificationsconsole.h llfloaterobjectiminfo.h llfloateropenobject.h llfloaterparcel.h - llfloaterpermissionsmgr.h llfloaterpostcard.h llfloaterpostprocess.h llfloaterpreference.h @@ -596,12 +613,11 @@ set(viewer_HEADER_FILES llfloatersellland.h llfloatersettingsdebug.h llfloatersnapshot.h - llfloaterstats.h llfloatertelehub.h - llfloatertest.h llfloatertools.h llfloatertopobjects.h llfloatertos.h + llfloateruipreview.h llfloaterurldisplay.h llfloaterurlentry.h llfloatervoicedevicesettings.h @@ -610,10 +626,11 @@ set(viewer_HEADER_FILES llfloaterworldmap.h llfolderview.h llfollowcam.h - llframestats.h - llframestatview.h + llfriendactions.h llgesturemgr.h llgivemoney.h + llgroupactions.h + llgrouplist.h llgroupmgr.h llgroupnotify.h llhomelocationresponder.h @@ -631,6 +648,7 @@ set(viewer_HEADER_FILES llhudview.h llimpanel.h llimview.h + llimcontrolpanel.h llinventorybridge.h llinventoryclipboard.h llinventorymodel.h @@ -638,6 +656,8 @@ set(viewer_HEADER_FILES lljoystickbutton.h lllandmarklist.h lllightconstants.h + lllocationhistory.h + lllocationinputctrl.h lllogchat.h llloginhandler.h llmanip.h @@ -648,6 +668,7 @@ set(viewer_HEADER_FILES llmediaremotectrl.h llmemoryview.h llmenucommands.h + llmetricperformancetester.h llmimetypes.h llmorphview.h llmoveview.h @@ -655,15 +676,16 @@ set(viewer_HEADER_FILES llnamebox.h llnameeditor.h llnamelistctrl.h + llnavigationbar.h + llnearbychathistory.h llnetmap.h llnotify.h + lloutputmonitorctrl.h lloverlaybar.h - llpanelaudioprefs.h - llpanelaudiovolume.h llpanelavatar.h + llpanelavatarrow.h llpanelclassified.h llpanelcontents.h - llpaneldebug.h llpaneldirbrowser.h llpaneldirclassified.h llpaneldirevents.h @@ -672,42 +694,37 @@ set(viewer_HEADER_FILES llpaneldirland.h llpaneldirpeople.h llpaneldirplaces.h - llpaneldirpopular.h llpaneldisplay.h llpanelevent.h llpanelface.h - llpanelgeneral.h llpanelgroup.h llpanelgroupgeneral.h llpanelgroupinvite.h llpanelgrouplandmoney.h llpanelgroupnotices.h llpanelgrouproles.h - llpanelinput.h llpanelinventory.h llpanelland.h + llpanellandmarks.h llpanellandmedia.h - llpanellandobjects.h - llpanellandoptions.h - llpanelLCD.h llpanellogin.h - llpanelmorph.h - llpanelmsgs.h - llpanelnetwork.h + llpanelmeprofile.h llpanelobject.h + llpanelpeople.h llpanelpermissions.h llpanelpick.h + llpanelpicks.h llpanelplace.h - llpanelskins.h + llpanelplaceinfo.h + llpanelplaces.h + llpanelplacestab.h + llpanelprofileview.h + llpanelteleporthistory.h llpanelvolume.h - llpanelweb.h llparcelselection.h llpatchvertexarray.h llpolymesh.h llpolymorph.h - llprefschat.h - llprefsim.h - llprefsvoice.h llpreview.h llpreviewanim.h llpreviewgesture.h @@ -718,25 +735,29 @@ set(viewer_HEADER_FILES llpreviewtexture.h llproductinforequest.h llprogressview.h + llrecentpeople.h llregionposition.h llremoteparcelrequest.h llresourcedata.h + llrootview.h llsavedsettingsglue.h llselectmgr.h + llsidetray.h llsky.h + llslurl.h llspatialpartition.h llsprite.h llsrv.h llstartup.h - llstatbar.h - llstatgraph.h llstatusbar.h - llstatview.h llstylemap.h llsurface.h llsurfacepatch.h lltable.h + llteleporthistory.h + lltexglobalcolor.h lltexlayer.h + lltexlayerparams.h lltexturecache.h lltexturectrl.h lltexturefetch.h @@ -760,9 +781,7 @@ set(viewer_HEADER_FILES lltoolselect.h lltoolselectland.h lltoolselectrect.h - lltoolview.h lltracker.h - lltrans.h lluiconstants.h lluploaddialog.h llurl.h @@ -772,7 +791,6 @@ set(viewer_HEADER_FILES llurlwhitelist.h lluserauth.h llvectorperfoptions.h - llvelocitybar.h llviewchildren.h llviewerassetstorage.h llvieweraudio.h @@ -780,6 +798,7 @@ set(viewer_HEADER_FILES llviewercamera.h llviewercontrol.h llviewerdisplay.h + llviewerfloaterreg.h llviewergenericmessage.h llviewergesture.h llviewerimage.h @@ -817,6 +836,7 @@ set(viewer_HEADER_FILES llvlmanager.h llvoavatar.h llvoavatardefines.h + llvoavatarself.h llvocache.h llvoclouds.h llvograss.h @@ -824,6 +844,7 @@ set(viewer_HEADER_FILES llvoiceclient.h llvoiceremotectrl.h llvoicevisualizer.h + llvoicecontrolpanel.h llvoinventorylistener.h llvopartgroup.h llvosky.h @@ -838,6 +859,7 @@ set(viewer_HEADER_FILES llwaterparammanager.h llwaterparamset.h llwearable.h + llwearabledictionary.h llwearablelist.h llweb.h llwebbrowserctrl.h @@ -937,6 +959,10 @@ if (WINDOWS) ) endforeach( src_file ${viewer_SOURCE_FILES} ) list(APPEND viewer_SOURCE_FILES llviewerprecompiledheaders.cpp) + # llstartup.cpp needs special symbols for audio libraries, so it resets + # COMPILE_FLAGS below. Make sure it maintains precompiled header settings. + set(LLSTARTUP_COMPILE_FLAGS + "${LLSTARTUP_COMPILE_FLAGS} /Yullviewerprecompiledheaders.h") # Add resource files to the project. # viewerRes.rc is the only buildable file, but @@ -1000,12 +1026,11 @@ if (WINDOWS) ) set(viewer_LIBRARIES - advapi32 + ${WINDOWS_LIBRARIES} comdlg32 ${DINPUT_LIBRARY} ${DXGUID_LIBRARY} fmodvc - gdi32 kernel32 odbc32 odbccp32 @@ -1013,7 +1038,6 @@ if (WINDOWS) oleaut32 opengl32 shell32 - user32 Vfw32 winspool ) @@ -1035,16 +1059,18 @@ endif (WINDOWS) # Add the xui files. This is handy for searching for xui elements # from within the IDE. - -file(GLOB viewer_XUI_FILE_GLOB_LIST - ${CMAKE_CURRENT_SOURCE_DIR}/skins/default/xui/en-us/*.xml) - set(viewer_XUI_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/skins/default/colors.xml - ${CMAKE_CURRENT_SOURCE_DIR}/skins/default/colors_base.xml + skins/default/colors.xml + skins/default/textures/textures.xml ) +file(GLOB DEFAULT_XUI_FILE_GLOB_LIST + ${CMAKE_CURRENT_SOURCE_DIR}/skins/default/xui/en/*.xml) +list(APPEND viewer_XUI_FILES ${DEFAULT_XUI_FILE_GLOB_LIST}) + +file(GLOB DEFAULT_WIDGET_FILE_GLOB_LIST + ${CMAKE_CURRENT_SOURCE_DIR}/skins/default/xui/en/widgets/*.xml) +list(APPEND viewer_XUI_FILES ${DEFAULT_WIDGET_FILE_GLOB_LIST}) -list(APPEND viewer_XUI_FILES ${viewer_XUI_FILE_GLOB_LIST}) list(SORT viewer_XUI_FILES) source_group("XUI Files" FILES ${viewer_XUI_FILES}) @@ -1167,8 +1193,10 @@ if (WINDOWS) set_target_properties(${VIEWER_BINARY_NAME} PROPERTIES + # *TODO -reenable this once we get server usage sorted out + #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\"" LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\"" + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" LINK_FLAGS_RELEASE ${release_flags} ) @@ -1271,6 +1299,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${WINDOWS_LIBRARIES} ${XMLRPCEPI_LIBRARIES} ${ELFIO_LIBRARIES} + ${GOOGLE_PERFTOOLS_LIBRARIES} ) build_version(viewer) @@ -1408,3 +1437,4 @@ set_source_files_properties( ) LL_ADD_PROJECT_UNIT_TESTS(${VIEWER_BINARY_NAME} "${viewer_TEST_SOURCE_FILES}") +#ADD_VIEWER_BUILD_TEST(llmemoryview viewer) diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 5f11ed8e22..783a886fdd 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -106,6 +106,46 @@ QuitAfterSeconds + logperformance + + desc + Log performance metrics for benchmarking + map-to + LogPerformance + + + logmetrics + + desc + Log metrics for benchmarking + map-to + LogMetrics + + + analyzeperformance + + desc + When used in conjunction with logperformance, analyzes result of log against baseline. + map-to + AnalyzePerformance + + + debugsession + + desc + Run as if RenderDebugGL is TRUE, but log errors until end of session. + map-to + DebugSession + + + replaysession + + desc + After login, replay last recorded session and quit. + map-to + ReplaySession + + rotate map-to @@ -166,6 +206,16 @@ UserLogFile + graphicslevel + + desc + Set the detail level. + 0 - low, 1 - medium, 2 - high, 3 - ultra + + count + 1 + + setdefault desc diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml new file mode 100644 index 0000000000..669235af1b --- /dev/null +++ b/indra/newview/app_settings/ignorable_dialogs.xml @@ -0,0 +1,291 @@ + + + + FirstAppearance + + Comment + Enables FirstAppearance warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstAttach + + Comment + Enables FirstAttach warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstBalanceDecrease + + Comment + Enables FirstBalanceDecrease warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstBalanceIncrease + + Comment + Enables FirstBalanceIncrease warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstBuild + + Comment + Enables FirstBuild warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstDebugMenus + + Comment + Enables FirstDebugMenus warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstFlexible + + Comment + Enables FirstFlexible warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstGoTo + + Comment + Enables FirstGoTo warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstInventory + + Comment + Enables FirstInventory warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstLeftClickNoHit + + Comment + Enables FirstLeftClickNoHit warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstMap + + Comment + Enables FirstMap warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstMedia + + Comment + Enables FirstMedia warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstOverrideKeys + + Comment + Enables FirstOverrideKeys warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstSandbox + + Comment + Enables FirstSandbox warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstSculptedPrim + + Comment + Enables FirstSculptedPrim warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstSit + + Comment + Enables FirstSit warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstStreamingMusic + + Comment + Enables FirstStreamingMusic warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstStreamingVideo + + Comment + Enables FirstStreamingVideo warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstTeleport + + Comment + Enables FirstTeleport warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + FirstVoice + + Comment + Enables FirstVoice warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + AboutDirectX9 + + Comment + Enables AboutDirectX9 warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + BrowserLaunch + + Comment + Enables BrowserLaunch warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + DeedObject + + Comment + Enables DeedObject warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + NewClassified + + Comment + Enables NewClassified warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + QuickTimeInstalled + + Comment + Enables QuickTimeInstalled warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + ReturnToOwner + + Comment + Enables ReturnToOwner warning dialog + Persist + 1 + Type + Boolean + Value + 1 + + + diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7ae92129dc..5ad49774a9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -23,38 +23,6 @@ Value 0 - UserChatColor - - Comment - Color of your chat messages - Persist - 1 - Type - Color4 - Value - - 1.0 - 1.0 - 1.0 - 1.0 - - - AgentChatColor - - Comment - Color of chat messages from other residents - Persist - 1 - Type - Color4 - Value - - 1.0 - 1.0 - 1.0 - 1.0 - - AlertedUnsupportedHardware Comment @@ -594,22 +562,6 @@ Value 0 - BackgroundChatColor - - Comment - Color of chat bubble background - Persist - 1 - Type - Color4 - Value - - 0.0 - 0.0 - 0.0 - 1.0 - - BackgroundYieldTime Comment @@ -621,42 +573,21 @@ Value 40 - BackwardBtnRect - - Comment - - Persist - 0 - Type - Rect - Value - - 45 - 29 - 66 - 4 - - - BasicHelpRect + BeaconAlwaysOn Comment - Rectangle for help window + Beacons / highlighting always on Persist 1 Type - Rect + Boolean Value - - 0 - 404 - 467 - 0 - + 0 - BeaconAlwaysOn + BottomPanelNew Comment - Beacons / highlighting always on + Enable the new bottom panel Persist 1 Type @@ -884,6 +815,17 @@ Value 0 + BuildBtnEnabled + + Comment + + Persist + 0 + Type + Boolean + Value + 0 + BuildFeathering Comment @@ -1391,22 +1333,6 @@ Value 1 - ChatterboxRect - - Comment - Rectangle for chatterbox window - Persist - 1 - Type - Rect - Value - - 0 - 400 - 350 - 0 - - CheesyBeacon Comment @@ -1421,7 +1347,7 @@ ClientSettingsFile Comment - Persisted client settings file name (per install). + Client settings file name (per install). Persist 0 Type @@ -1497,777 +1423,612 @@ - ColorPaletteEntry01 + CompressSnapshotsToDisk Comment - Color picker palette entry + Compress snapshots saved to disk (Using JPEG 2000) Persist 1 Type - Color4 + Boolean Value - - 0.0 - 0.0 - 0.0 - 1.0 - - - ColorPaletteEntry02 + 0 + + ConnectAsGod Comment - Color picker palette entry + Log in a god if you have god access. Persist 1 Type - Color4 + Boolean Value - - 0.5 - 0.5 - 0.5 - 1.0 - + 0 - ColorPaletteEntry03 + ConnectionPort Comment - Color picker palette entry + Custom connection port number Persist 1 Type - Color4 + U32 Value - - 0.5 - 0.0 - 0.0 - 1.0 - + 13000 - ColorPaletteEntry04 + ConnectionPortEnabled Comment - Color picker palette entry + Use the custom connection port? Persist 1 Type - Color4 + Boolean Value - - 0.5 - 0.5 - 0.0 - 1.0 - + 0 - ColorPaletteEntry05 + ConsoleBackgroundOpacity Comment - Color picker palette entry + Opacity of chat console (0.0 = completely transparent, 1.0 = completely opaque) Persist 1 Type - Color4 + F32 Value - - 0.0 - 0.5 - 0.0 - 1.0 - + 0.700 - ColorPaletteEntry06 + ConsoleBufferSize Comment - Color picker palette entry + Size of chat console history (lines of chat) Persist 1 Type - Color4 + S32 Value - - 0.0 - 0.5 - 0.5 - 1.0 - + 40 - ColorPaletteEntry07 + ConsoleMaxLines Comment - Color picker palette entry + Max number of lines of chat text visible in console. Persist 1 Type - Color4 + S32 Value - - 0.0 - 0.0 - 0.5 - 1.0 - + 40 - ColorPaletteEntry08 + ContactsTornOff Comment - Color picker palette entry + Show contacts window separately from Communicate window. Persist 1 Type - Color4 + Boolean Value - - 0.5 - 0.0 - 0.5 - 1.0 - + 0 - ColorPaletteEntry09 + CookiesEnabled Comment - Color picker palette entry + Accept cookies from Web sites? Persist 1 Type - Color4 + Boolean Value - - 0.5 - 0.5 - 0.0 - 1.0 - + 1 - ColorPaletteEntry10 + CreateToolCopyCenters Comment - Color picker palette entry + Persist - 1 + 0 Type - Color4 + Boolean Value - - 0.0 - 0.25 - 0.25 - 1.0 - + 1 - ColorPaletteEntry11 + CreateToolCopyRotates Comment - Color picker palette entry + Persist - 1 + 0 Type - Color4 + Boolean Value - - 0.0 - 0.5 - 1.0 - 1.0 - + 0 - ColorPaletteEntry12 + CreateToolCopySelection Comment - Color picker palette entry + Persist - 1 + 0 Type - Color4 + Boolean Value - - 0.0 - 0.25 - 0.5 - 1.0 - + 0 - ColorPaletteEntry13 + CreateToolKeepSelected Comment - Color picker palette entry + After using create tool, keep the create tool active Persist 1 Type - Color4 + Boolean Value - - 0.5 - 0.0 - 1.0 - 1.0 - + 0 - ColorPaletteEntry14 + Cursor3D Comment - Color picker palette entry + Tread Joystick values as absolute positions (not deltas). Persist 1 Type - Color4 + Boolean Value - - 0.5 - 0.25 - 0.0 - 1.0 - + 1 - ColorPaletteEntry15 + CustomServer Comment - Color picker palette entry + Specifies IP address or hostname of grid to which you connect Persist 1 Type - Color4 + String Value - - 1.0 - 1.0 - 1.0 - 1.0 - + - ColorPaletteEntry16 + DebugBeaconLineWidth Comment - Color picker palette entry + Size of lines for Debug Beacons Persist 1 Type - Color4 + S32 Value - - 1.0 - 1.0 - 1.0 - 1.0 - + 1 - ColorPaletteEntry17 + DebugInventoryFilters Comment - Color picker palette entry + Turn on debugging display for inventory filtering Persist 1 Type - Color4 + Boolean Value - - 1.0 - 1.0 - 1.0 - 1.0 - + 0 - ColorPaletteEntry18 + DebugPermissions Comment - Color picker palette entry + Log permissions for selected inventory items Persist 1 Type - Color4 + Boolean Value - - 0.75 - 0.75 - 0.75 - 1.0 - + 0 - ColorPaletteEntry19 + DebugShowColor Comment - Color picker palette entry + Show color under cursor Persist 1 Type - Color4 + Boolean Value - - 1.0 - 0.0 - 0.0 - 1.0 - + 0 - ColorPaletteEntry20 + DebugShowRenderInfo Comment - Color picker palette entry + Show depth buffer contents Persist 1 Type - Color4 + Boolean Value - - 1.0 - 1.0 - 0.0 - 1.0 - + 0 - ColorPaletteEntry21 + DebugShowRenderMatrices + + Comment + Display values of current view and projection matrices. + Persist + 1 + Type + Boolean + Value + 0 + + DebugShowTime Comment - Color picker palette entry + Show depth buffer contents Persist 1 Type - Color4 + Boolean Value - - 0.0 - 1.0 - 0.0 - 1.0 - + 0 - ColorPaletteEntry22 + DebugStatModeFPS Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 0.0 - 1.0 - 1.0 - 1.0 - + -1 - ColorPaletteEntry23 + DebugStatModeBandwidth Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 0.0 - 0.0 - 1.0 - 1.0 - + -1 - ColorPaletteEntry24 + DebugStatModePacketLoss Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 1.0 - 0.0 - 1.0 - 1.0 - + -1 - ColorPaletteEntry25 + DebugStatMode Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 1.0 - 1.0 - 0.5 - 1.0 - + -1 - ColorPaletteEntry26 + DebugStatModeKTrisDrawnFr Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 0.0 - 1.0 - 0.5 - 1.0 - + -1 - ColorPaletteEntry27 + DebugStatModeKTrisDrawnSec Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 0.5 - 1.0 - 1.0 - 1.0 - + -1 - ColorPaletteEntry28 + DebugStatModeTotalObjs Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 0.5 - 0.5 - 1.0 - 1.0 - + -1 - ColorPaletteEntry29 + DebugStatModeNewObjs Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 1.0 - 0.0 - 0.5 - 1.0 - + -1 - ColorPaletteEntry30 + DebugStatModeTextureCount Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 1.0 - 0.5 - 0.0 - 1.0 - + -1 - ColorPaletteEntry31 + DebugStatModeRawCount Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 1.0 - 1.0 - 1.0 - 1.0 - + -1 - ColorPaletteEntry32 + DebugStatModeGLMem Comment - Color picker palette entry + Mode of stat in Statistics floater Persist 1 Type - Color4 + S32 Value - - 1.0 - 1.0 - 1.0 - 1.0 - + -1 - ColumnHeaderDropDownDelay + DebugStatModeFormattedMem Comment - Time in seconds of mouse click before column header shows sort options list + Mode of stat in Statistics floater Persist 1 Type - F32 + S32 Value - 0.300000011921 + -1 - CompileOutputRect + DebugStatModeRawMem Comment - Rectangle for script Recompile Everything output window + Mode of stat in Statistics floater Persist 1 Type - Rect + S32 Value - - 0 - 400 - 300 - 0 - + -1 - ConnectAsGod + DebugStatModeBoundMem Comment - Log in a god if you have god access. + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - ConnectionPort + DebugStatModePacketsIn Comment - Custom connection port number + Mode of stat in Statistics floater Persist 1 Type - U32 + S32 Value - 13000 + -1 - ConnectionPortEnabled + DebugStatModePacketsOut Comment - Use the custom connection port? + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - ConsoleBackgroundOpacity + DebugStatModeObjects Comment - Opacity of chat console (0.0 = completely transparent, 1.0 = completely opaque) + Mode of stat in Statistics floater Persist 1 Type - F32 + S32 Value - 0.700 + -1 - ConsoleBufferSize + DebugStatModeTexture Comment - Size of chat console history (lines of chat) + Mode of stat in Statistics floater Persist 1 Type S32 Value - 40 + -1 - ConsoleMaxLines + DebugStatModeAsset Comment - Max number of lines of chat text visible in console. + Mode of stat in Statistics floater Persist 1 Type S32 Value - 40 + -1 - ContactsTornOff + DebugStatModeLayers Comment - Show contacts window separately from Communicate window. + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - CookiesEnabled + DebugStatModeActualIn Comment - Accept cookies from Web sites? + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 1 + -1 - CreateToolCopyCenters + DebugStatModeActualOut Comment - + Mode of stat in Statistics floater Persist - 0 + 1 Type - Boolean + S32 Value - 1 + -1 - CreateToolCopyRotates + DebugStatModeVFSPendingOps Comment - + Mode of stat in Statistics floater Persist - 0 + 1 Type - Boolean + S32 Value - 0 + -1 - CreateToolCopySelection + DebugStatModeTimeDialation Comment - + Mode of stat in Statistics floater Persist - 0 + 1 Type - Boolean + S32 Value - 0 + -1 - CreateToolKeepSelected + DebugStatModeSimFPS Comment - After using create tool, keep the create tool active + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - Cursor3D + DebugStatModePhysicsFPS Comment - Tread Joystick values as absolute positions (not deltas). + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 1 + -1 - CustomServer + DebugStatModePinnedObjects Comment - Specifies IP address or hostname of grid to which you connect + Mode of stat in Statistics floater Persist 1 Type - String + S32 Value - + -1 - DebugBeaconLineWidth + DebugStatModeLowLODObjects Comment - Size of lines for Debug Beacons + Mode of stat in Statistics floater Persist 1 Type S32 Value - 1 + -1 - DebugInventoryFilters + DebugStatModeMemoryAllocated Comment - Turn on debugging display for inventory filtering + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - DebugPermissions + DebugStatModeAgentUpdatesSec Comment - Log permissions for selected inventory items + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - DebugShowColor + DebugStatModeMainAgents Comment - Show color under cursor + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - DebugShowRenderInfo + DebugStatModeChildAgents Comment - Show depth buffer contents + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - DebugShowRenderMatrices - - Comment - Display values of current view and projection matrices. - Persist - 1 - Type - Boolean - Value - 0 - - DebugShowTime + DebugStatModeSimObjects Comment - Show depth buffer contents + Mode of stat in Statistics floater Persist 1 Type - Boolean + S32 Value - 0 + -1 - DebugStatModeFPS + DebugStatModeSimActiveObjects Comment Mode of stat in Statistics floater @@ -2278,7 +2039,7 @@ Value -1 - DebugStatModeBandwidth + DebugStatModeSimActiveScripts Comment Mode of stat in Statistics floater @@ -2289,7 +2050,7 @@ Value -1 - DebugStatModePacketLoss + DebugStatModeSimScriptEvents Comment Mode of stat in Statistics floater @@ -2300,7 +2061,7 @@ Value -1 - DebugStatMode + DebugStatModeSimInPPS Comment Mode of stat in Statistics floater @@ -2311,7 +2072,7 @@ Value -1 - DebugStatModeKTrisDrawnFr + DebugStatModeSimOutPPS Comment Mode of stat in Statistics floater @@ -2322,7 +2083,7 @@ Value -1 - DebugStatModeKTrisDrawnSec + DebugStatModeSimPendingDownloads Comment Mode of stat in Statistics floater @@ -2333,7 +2094,7 @@ Value -1 - DebugStatModeTotalObjs + SimPendingUploads Comment Mode of stat in Statistics floater @@ -2344,7 +2105,7 @@ Value -1 - DebugStatModeNewObjs + DebugStatModeSimTotalUnackedBytes Comment Mode of stat in Statistics floater @@ -2355,7 +2116,7 @@ Value -1 - DebugStatModeTextureCount + DebugStatModeSimFrameMsec Comment Mode of stat in Statistics floater @@ -2366,7 +2127,7 @@ Value -1 - DebugStatModeRawCount + DebugStatModeSimNetMsec Comment Mode of stat in Statistics floater @@ -2377,7 +2138,7 @@ Value -1 - DebugStatModeGLMem + DebugStatModeSimSimPhysicsMsec Comment Mode of stat in Statistics floater @@ -2388,7 +2149,7 @@ Value -1 - DebugStatModeFormattedMem + DebugStatModeSimSimOtherMsec Comment Mode of stat in Statistics floater @@ -2399,7 +2160,7 @@ Value -1 - DebugStatModeRawMem + DebugStatModeSimAgentMsec Comment Mode of stat in Statistics floater @@ -2410,7 +2171,7 @@ Value -1 - DebugStatModeBoundMem + DebugStatModeSimImagesMsec Comment Mode of stat in Statistics floater @@ -2421,7 +2182,7 @@ Value -1 - DebugStatModePacketsIn + DebugStatModeSimScriptMsec Comment Mode of stat in Statistics floater @@ -2432,7 +2193,7 @@ Value -1 - DebugStatModePacketsOut + DebugStatModeSimSpareMsec Comment Mode of stat in Statistics floater @@ -2443,7 +2204,7 @@ Value -1 - DebugStatModeObjects + DebugStatModeSimSimPhysicsStepMsec Comment Mode of stat in Statistics floater @@ -2454,7 +2215,7 @@ Value -1 - DebugStatModeTexture + DebugStatModeSimSimPhysicsShapeUpdateMsec Comment Mode of stat in Statistics floater @@ -2465,7 +2226,7 @@ Value -1 - DebugStatModeAsset + DebugStatModeSimSimPhysicsOtherMsec Comment Mode of stat in Statistics floater @@ -2476,7 +2237,7 @@ Value -1 - DebugStatModeLayers + DebugStatModeSimSleepMsec Comment Mode of stat in Statistics floater @@ -2487,7 +2248,7 @@ Value -1 - DebugStatModeActualIn + DebugStatModeSimPumpIOMsec Comment Mode of stat in Statistics floater @@ -2498,373 +2259,384 @@ Value -1 - DebugStatModeActualOut + DebugViews Comment - Mode of stat in Statistics floater + Display debugging info for views. Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeVFSPendingOps + DebugWindowProc Comment - Mode of stat in Statistics floater + Log windows messages Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeTimeDialation + DefaultObjectTexture Comment - Mode of stat in Statistics floater + Texture used as 'Default' in texture picker. (UUID texture reference) Persist 1 Type - S32 + String Value - -1 + 89556747-24cb-43ed-920b-47caed15465f - DebugStatModeSimFPS + DisableCameraConstraints Comment - Mode of stat in Statistics floater + Disable the normal bounds put on the camera by avatar position Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModePhysicsFPS + DisableRendering Comment - Mode of stat in Statistics floater + Disable GL rendering and GUI (load testing) Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModePinnedObjects + DisableVerticalSync Comment - Mode of stat in Statistics floater + Update frames as fast as possible (FALSE = update frames between display scans) Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeLowLODObjects + DisplayAvatarAgentTarget Comment - Mode of stat in Statistics floater + Show avatar positioning locators (animation debug) Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeMemoryAllocated + DisplayChat Comment - Mode of stat in Statistics floater + Display Latest Chat message on LCD Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeAgentUpdatesSec + DisplayDebug Comment - Mode of stat in Statistics floater + Display Network Information on LCD Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeMainAgents + DisplayDebugConsole Comment - Mode of stat in Statistics floater + Display Console Debug Information on LCD Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeChildAgents + DisplayIM Comment - Mode of stat in Statistics floater + Display Latest IM message on LCD Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeSimObjects + DisplayLinden Comment - Mode of stat in Statistics floater + Display Account Information on LCD Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeSimActiveObjects + DisplayRegion Comment - Mode of stat in Statistics floater + Display Location information on LCD Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeSimActiveScripts + DisplayTimecode Comment - Mode of stat in Statistics floater + Display timecode on screen Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeSimScriptEvents + Disregard128DefaultDrawDistance Comment - Mode of stat in Statistics floater + Whether to use the auto default to 128 draw distance Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeSimInPPS + Disregard96DefaultDrawDistance Comment - Mode of stat in Statistics floater + Whether to use the auto default to 96 draw distance Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeSimOutPPS + DoubleClickAutoPilot Comment - Mode of stat in Statistics floater + Enable double-click auto pilot Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeSimPendingDownloads + DragAndDropToolTipDelay Comment - Mode of stat in Statistics floater + Seconds before displaying tooltip when performing drag and drop operation Persist 1 Type - S32 + F32 Value - -1 + 0.10000000149 - SimPendingUploads + DropShadowButton Comment - Mode of stat in Statistics floater + Drop shadow width for buttons (pixels) Persist 1 Type S32 Value - -1 + 2 - DebugStatModeSimTotalUnackedBytes + DropShadowFloater Comment - Mode of stat in Statistics floater + Drop shadow width for floaters (pixels) Persist 1 Type S32 Value - -1 + 5 - DebugStatModeSimFrameMsec + DropShadowSlider Comment - Mode of stat in Statistics floater + Drop shadow width for sliders (pixels) Persist 1 Type S32 Value - -1 + 3 - DebugStatModeSimNetMsec + DropShadowTooltip Comment - Mode of stat in Statistics floater + Drop shadow width for tooltips (pixels) Persist 1 Type S32 Value - -1 + 4 - DebugStatModeSimSimPhysicsMsec + DynamicCameraStrength Comment - Mode of stat in Statistics floater + Amount camera lags behind avatar motion (0 = none, 30 = avatar velocity) Persist 1 Type - S32 + F32 Value - -1 + 2.0 - DebugStatModeSimSimOtherMsec + EditCameraMovement Comment - Mode of stat in Statistics floater + When entering build mode, camera moves up above avatar Persist 1 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeSimAgentMsec + EditLinkedParts Comment - Mode of stat in Statistics floater + Select individual parts of linked objects Persist - 1 + 0 Type - S32 + Boolean Value - -1 + 0 - DebugStatModeSimImagesMsec + EnableRippleWater Comment - Mode of stat in Statistics floater + Whether to use ripple water shader or not Persist 1 Type - S32 + Boolean Value - -1 - - DebugStatModeSimScriptMsec - - Comment - Mode of stat in Statistics floater - Persist 1 - Type - S32 - Value - -1 - DebugStatModeSimSpareMsec + EnableVoiceChat Comment - Mode of stat in Statistics floater + Enable talking to other residents with a microphone Persist 1 Type - S32 + Boolean Value - -1 + 1 - DebugStatModeSimSimPhysicsStepMsec + EnergyFromTop Comment - Mode of stat in Statistics floater + Persist - 1 + 0 Type S32 Value - -1 + 20 - DebugStatModeSimSimPhysicsShapeUpdateMsec + EnergyHeight Comment - Mode of stat in Statistics floater + Persist - 1 + 0 Type S32 Value - -1 + 40 - DebugStatModeSimSimPhysicsOtherMsec + EnergyWidth Comment - Mode of stat in Statistics floater + Persist - 1 + 0 Type S32 Value - -1 + 175 - DebugStatModeSimSleepMsec + EveryoneCopy + + Comment + Everyone can copy the newly created objects + Persist + 1 + Type + Boolean + Value + 0 + + FPSLogFrequency Comment - Mode of stat in Statistics floater + Seconds between display of FPS in log (0 for never) Persist 1 Type - S32 + F32 Value - -1 + 60.0 - DebugStatModeSimPumpIOMsec + FPSLogFrequency + + Comment + Seconds between display of FPS in log (0 for never) + Persist + 1 + Type + F32 + Value + 10.0 + + FilterItemsPerFrame Comment - Mode of stat in Statistics floater + Maximum number of inventory items to match against search filter every frame (lower to increase framerate while searching, higher to improve search speed) Persist 1 Type S32 Value - -1 + 500 - DebugViews + FindLandArea Comment - Display debugging info for views. + Enables filtering of land search results by area Persist 1 Type @@ -2872,54 +2644,54 @@ Value 0 - DebugWindowProc + FindLandPrice Comment - Log windows messages + Enables filtering of land search results by price Persist 1 Type Boolean Value - 0 + 1 - DefaultObjectTexture + FindLandType Comment - Texture used as 'Default' in texture picker. (UUID texture reference) + Controls which type of land you are searching for in Find Land interface ("All", "Auction", "For Sale") Persist 1 Type String Value - 89556747-24cb-43ed-920b-47caed15465f + All - DisableCameraConstraints + FindPeopleOnline Comment - Disable the normal bounds put on the camera by avatar position + Limits people search to only users who are logged on Persist 1 Type Boolean Value - 0 + 1 - DisableRendering + FindPlacesPictures Comment - Disable GL rendering and GUI (load testing) + Display only results of find places that have pictures Persist 1 Type Boolean Value - 0 + 1 - DisableVerticalSync + FirstLoginThisInstall Comment - Update frames as fast as possible (FALSE = update frames between display scans) + Specifies that you have not successfully logged in since you installed the latest update Persist 1 Type @@ -2927,43 +2699,43 @@ Value 1 - DisplayAvatarAgentTarget + FirstName Comment - Show avatar positioning locators (animation debug) + Login first name Persist 1 Type - Boolean + String Value - 0 + - DisplayChat + FirstPersonAvatarVisible Comment - Display Latest Chat message on LCD + Display avatar and attachments below neck while in mouselook Persist 1 Type Boolean Value - 1 + 0 - DisplayDebug + FirstPersonBtnState Comment - Display Network Information on LCD + Persist - 1 + 0 Type Boolean Value - 1 + 0 - DisplayDebugConsole + FirstRunThisInstall Comment - Display Console Debug Information on LCD + Specifies that you have not run the viewer since you installed the latest update Persist 1 Type @@ -2971,32 +2743,32 @@ Value 1 - DisplayIM + FirstSelectedDisabledPopups Comment - Display Latest IM message on LCD + Return false if there is not disabled popup selected in the list of floater preferences popups Persist - 1 + 0 Type Boolean Value - 1 - - DisplayLinden + 0 + + FixedWeather Comment - Display Account Information on LCD + Weather effects do not change over time Persist 1 Type Boolean Value - 1 + 0 - DisplayRegion + FloaterActiveSpeakersSortAscending Comment - Display Location information on LCD + Whether to sort up or down Persist 1 Type @@ -3004,131 +2776,137 @@ Value 1 - DisplayTimecode + FloaterActiveSpeakersSortColumn Comment - Display timecode on screen + Column name to sort on Persist 1 Type - Boolean + String Value - 0 + speaking_status - Disregard128DefaultDrawDistance + FloaterMapNorth Comment - Whether to use the auto default to 128 draw distance + Floater Map North Label Persist 1 Type - Boolean + String Value - 1 + N - Disregard96DefaultDrawDistance + FloaterMapNorthEast Comment - Whether to use the auto default to 96 draw distance + Floater Map North-East Label Persist 1 Type - Boolean + String Value - 1 + NE - DoubleClickAutoPilot + FloaterMapNorthWest Comment - Enable double-click auto pilot + Floater Map North-West Label Persist 1 Type - Boolean + String Value - 0 + NW - DragAndDropToolTipDelay + FloaterMapEast Comment - Seconds before displaying tooltip when performing drag and drop operation + Floater Map East Label Persist 1 Type - F32 + String Value - 0.10000000149 + E - DropShadowButton + FloaterMapWest Comment - Drop shadow width for buttons (pixels) + Floater Map West Label Persist 1 Type - S32 + String Value - 2 + W - DropShadowFloater + FloaterMapSouth Comment - Drop shadow width for floaters (pixels) + Floater Map South Label Persist 1 Type - S32 + String Value - 5 + S - DropShadowSlider + FloaterMapSouthEast Comment - Drop shadow width for sliders (pixels) + Floater Map South-East Label Persist 1 Type - S32 + String Value - 3 + SE - DropShadowTooltip + FloaterMapSouthWest Comment - Drop shadow width for tooltips (pixels) + Floater Map South-West Label Persist 1 Type - S32 + String Value - 4 + SW - DynamicCameraStrength + + FloaterStatisticsRect Comment - Amount camera lags behind avatar motion (0 = none, 30 = avatar velocity) + Rectangle for chat history Persist 1 Type - F32 + Rect Value - 2.0 + + 0 + 400 + 250 + 0 + - EditCameraMovement + FlyBtnEnabled Comment - When entering build mode, camera moves up above avatar + Persist - 1 + 0 Type Boolean Value - 0 + 1 - EditLinkedParts + FlyBtnState Comment - Select individual parts of linked objects + Persist 0 Type @@ -3136,1397 +2914,1152 @@ Value 0 - EffectColor + FlycamAbsolute Comment - Particle effects color + Treat Flycam values as absolute positions (not deltas). Persist 1 Type - Color4 + Boolean Value - - 1.0 - 1.0 - 1.0 - 1.0 - + 0 - EnableRippleWater + FlycamAxisDeadZone0 Comment - Whether to use ripple water shader or not + Flycam axis 0 dead zone. Persist 1 Type - Boolean + F32 Value - 1 + 0.1 - EnableVoiceChat + FlycamAxisDeadZone1 Comment - Enable talking to other residents with a microphone + Flycam axis 1 dead zone. Persist 1 Type - Boolean + F32 Value - 1 + 0.1 - EnergyFromTop + FlycamAxisDeadZone2 Comment - + Flycam axis 2 dead zone. Persist - 0 + 1 Type - S32 + F32 Value - 20 + 0.1 - EnergyHeight + FlycamAxisDeadZone3 Comment - + Flycam axis 3 dead zone. Persist - 0 + 1 Type - S32 + F32 Value - 40 + 0.1 - EnergyWidth + FlycamAxisDeadZone4 Comment - + Flycam axis 4 dead zone. Persist - 0 + 1 Type - S32 + F32 Value - 175 - - EveryoneCopy - - Comment - Everyone can copy the newly created objects - Persist - 1 - Type - Boolean - Value - 0 + 0.1 - FPSLogFrequency + FlycamAxisDeadZone5 Comment - Seconds between display of FPS in log (0 for never) + Flycam axis 5 dead zone. Persist 1 Type F32 Value - 60.0 + 0.1 - FPSLogFrequency - - Comment - Seconds between display of FPS in log (0 for never) - Persist - 1 - Type - F32 - Value - 10.0 - - FilterItemsPerFrame + FlycamAxisDeadZone6 Comment - Maximum number of inventory items to match against search filter every frame (lower to increase framerate while searching, higher to improve search speed) + Flycam axis 6 dead zone. Persist 1 Type - S32 + F32 Value - 500 + 0.1 - FindLandArea + FlycamAxisScale0 Comment - Enables filtering of land search results by area + Flycam axis 0 scaler. Persist 1 Type - Boolean + F32 Value - 0 + 1.0 - FindLandPrice + FlycamAxisScale1 Comment - Enables filtering of land search results by price + Flycam axis 1 scaler. Persist 1 Type - Boolean + F32 Value - 1 + 1.0 - FindLandType + FlycamAxisScale2 Comment - Controls which type of land you are searching for in Find Land interface ("All", "Auction", "For Sale") + Flycam axis 2 scaler. Persist 1 Type - String + F32 Value - All + 1.0 - FindPeopleOnline + FlycamAxisScale3 Comment - Limits people search to only users who are logged on + Flycam axis 3 scaler. Persist 1 Type - Boolean + F32 Value - 1 + 1.0 - FindPlacesPictures + FlycamAxisScale4 Comment - Display only results of find places that have pictures + Flycam axis 4 scaler. Persist 1 Type - Boolean + F32 Value - 1 + 1.0 - FirstLoginThisInstall + FlycamAxisScale5 Comment - Specifies that you have not successfully logged in since you installed the latest update + Flycam axis 5 scaler. Persist 1 Type - Boolean + F32 Value - 1 + 1.0 - FirstName + FlycamAxisScale6 Comment - Login first name + Flycam axis 6 scaler. Persist 1 Type - String + F32 Value - + 1.0 - FirstPersonAvatarVisible + FlycamFeathering Comment - Display avatar and attachments below neck while in mouselook + Flycam feathering (less is softer) Persist 1 Type - Boolean + F32 Value - 0 + 16.0 - FirstPersonBtnState + FlycamZoomDirect Comment - + Map flycam zoom axis directly to camera zoom. Persist - 0 + 1 Type Boolean Value 0 - FirstRunThisInstall + FlyingAtExit Comment - Specifies that you have not run the viewer since you installed the latest update + Was flying when last logged out, so fly when logging in Persist 1 Type Boolean Value - 1 + 0 - FixedWeather + FocusOffsetDefault Comment - Weather effects do not change over time + Default focus point offset relative to avatar (x-axis is forward) Persist 1 Type - Boolean + Vector3 Value - 0 + + 1.0 + 0.0 + 1.0 + - FloaterAboutRect + FocusPosOnLogout Comment - Rectangle for About window + Camera focus point when last logged out (global coordinates) Persist 1 Type - Rect + Vector3D Value - 0 - 440 - 470 - 0 + 0.0 + 0.0 + 0.0 - FloaterActiveSpeakersRect + FolderAutoOpenDelay Comment - Rectangle for active speakers window + Seconds before automatically expanding the folder under the mouse when performing inventory drag and drop Persist 1 Type - Rect + F32 Value - - 0 - 300 - 250 - 0 - + 0.75 - FloaterActiveSpeakersSortAscending + FolderLoadingMessageWaitTime Comment - Whether to sort up or down + Seconds to wait before showing the LOADING... text in folder views Persist 1 Type - Boolean + F32 Value - 1 + 0.5 - FloaterActiveSpeakersSortColumn + FontMonospace Comment - Column name to sort on + Name of monospace font that definitely exists (Truetype file name) Persist - 1 + 0 Type String Value - speaking_status + DejaVuSansMono.ttf - FloaterAdvancedSkyRect + FontSansSerif Comment - Rectangle for Advanced Sky Editor + Name of primary sans-serif font that definitely exists (Truetype file name) Persist - 1 + 0 Type - Rect + String Value - - 0 - 220 - 700 - 0 - + MtBkLfRg.ttf - FloaterAdvancedWaterRect + FontSansSerifBundledFallback Comment - Rectangle for Advanced Water Editor + Name of secondary sans-serif font that definitely exists (Truetype file name) Persist - 1 + 0 Type - Rect + String Value - - 0 - 240 - 700 - 0 - + DejaVuSansCondensed.ttf - FloaterAudioVolumeRect + FontSansSerifBold Comment - Rectangle for Audio Volume window + Name of bold font (Truetype file name) Persist - 1 + 0 Type - Rect + String Value - - 0 - 440 - 470 - 0 - + MtBdLfRg.ttf - FloaterBeaconsRect - - Comment - Rectangle for beacon and highlight controls - Persist - 1 - Type - Rect - Value - - 200 - 250 - 250 - 200 - - - FloaterBuildOptionsRect + FontSansSerifFallback Comment - Rectangle for build options window. + Name of sans-serif font (Truetype file name) Persist - 1 + 0 Type - Rect + String Value - - 0 - 0 - 0 - 0 - + - FloaterBumpRect + FontSansSerifFallbackScale Comment - Rectangle for Bumps/Hits window + Scale of fallback font relative to huge font (fraction of huge font size) Persist 1 Type - Rect + F32 Value - - 0 - 180 - 400 - 0 - + 1.0 - FloaterBuyContentsRect + FontScreenDPI Comment - Rectangle for Buy Contents window + Font resolution, higher is bigger (pixels per inch) Persist 1 Type - Rect + F32 Value - - 0 - 250 - 300 - 0 - + 96.0 - FloaterBuyRect + FontSizeHuge Comment - Rectangle for buy window + Size of huge font (points, or 1/72 of an inch) Persist 1 Type - Rect + F32 Value - - 0 - 250 - 300 - 0 - + 16.0 - FloaterCameraRect3 + FontSizeLarge Comment - Rectangle for camera control window + Size of large font (points, or 1/72 of an inch) Persist 1 Type - Rect + F32 Value - - 0 - 64 - 176 - 0 - + 12.0 - FloaterChatRect + FontSizeMedium Comment - Rectangle for chat history + Size of medium font (points, or 1/72 of an inch) Persist 1 Type - Rect + F32 Value - - 0 - 172 - 500 - 0 - + 10.0 - FloaterClothingRect + FontSizeMonospace Comment - Rectangle for clothing window + Size of monospaced font (points, or 1/72 of an inch) Persist 1 Type - Rect + F32 Value - - 0 - 480 - 320 - 0 - + 8.1 - FloaterContactsRect + FontSizeSmall Comment - Rectangle for chat history + Size of small font (points, or 1/72 of an inch) Persist 1 Type - Rect + F32 Value - - 0 - 390 - 395 - 0 - + 9.0 - FloaterCustomizeAppearanceRect + ForceShowGrid Comment - Rectangle for avatar customization window + Always show grid dropdown on login screen Persist 1 Type - Rect + Boolean Value - - 0 - 540 - 494 - 0 - + 0 - FloaterDayCycleRect + ForceMandatoryUpdate Comment - Rectangle for Day Cycle Editor + For QA: On next startup, forces the auto-updater to run Persist 1 Type - Rect + Boolean Value - - 0 - 646 - 275 - 0 - + 0 - FloaterEnvRect + FreezeTime Comment - Rectangle for Environment Editor + Persist - 1 + 0 Type - Rect + Boolean Value - - 0 - 150 - 600 - 0 - + 0 - FloaterFindRect2 + NotFullScreen Comment - Rectangle for Find window + Run SL in non fullscreen mode Persist 1 Type - Rect + Boolean Value - - 0 - 570 - 780 - 0 - + 1 - FloaterFriendsRect + FullScreenAspectRatio Comment - Rectangle for friends window + Aspect ratio of fullscreen display (width / height) Persist 1 Type - Rect + F32 Value - - 0 - 400 - 250 - 0 - + 1.33329999447 - FloaterGestureRect2 + FullScreenAutoDetectAspectRatio Comment - Rectangle for gestures window + Automatically detect proper aspect ratio for fullscreen display Persist 1 Type - Rect + Boolean Value - - 0 - 465 - 350 - 0 - + 1 - FloaterHUDRect2 + FullScreenHeight Comment - Rectangle for HUD Floater window + Fullscreen resolution in height Persist 1 Type - Rect + S32 Value - - - 0 - 292 - 362 - 0 - + 768 - FloaterHtmlRect + FullScreenWidth Comment - Rectangle for HTML window + Fullscreen resolution in width Persist 1 Type - Rect + S32 Value - - 100 - 460 - 370 - 100 - + 1024 - FloaterIMRect + GridCrossSections Comment - Rectangle for IM window + Highlight cross sections of prims with grid manipulation plane. Persist 1 Type - Rect + Boolean Value - - 0 - 160 - 500 - 0 - + 0 - FloaterInspectRect + GridDrawSize Comment - Rectangle for Object Inspect window + Visible extent of 2D snap grid (meters) Persist 1 Type - Rect + F32 Value - - 0 - 400 - 400 - 0 - + 12.0 - FloaterInventoryRect + GridMode Comment - Rectangle for inventory window + Snap grid reference frame (0 = world, 1 = local, 2 = reference object) Persist 1 Type - Rect + S32 Value - - 0 - 400 - 300 - 0 - + 0 - FloaterJoystickRect + GridOpacity Comment - Rectangle for joystick controls window. + Grid line opacity (0.0 = completely transparent, 1.0 = completely opaque) Persist 1 Type - Rect + F32 Value - - 0 - 0 - 0 - 0 - + 0.699999988079 - FloaterLagMeter + GridResolution Comment - Rectangle for lag meter + Size of single grid step (meters) Persist 1 Type - Rect + F32 Value - - 0 - 142 - 350 - 0 - + 0.5 - FloaterLandRect5 + GridSubUnit Comment - Rectangle for About Land window + Display fractional grid steps, relative to grid size Persist 1 Type - Rect + Boolean Value - - 0 - 370 - 460 - 0 - + 0 - FloaterLandmarkRect + GridSubdivision Comment - Rectangle for landmark picker + Maximum number of times to divide single snap grid unit when GridSubUnit is true Persist 1 Type - Rect + S32 Value - - 0 - 290 - 310 - 0 - + 32 - FloaterMediaRect + GroupNotifyBoxHeight Comment - Rectangle for media browser window + Height of group notice messages Persist 1 Type - Rect + S32 Value - - 16 - 650 - 600 - 128 - + 260 - FloaterMiniMapRect + GroupNotifyBoxWidth Comment - Rectangle for world map + Width of group notice messages Persist 1 Type - Rect + S32 Value - - 0 - 225 - 200 - 0 - - - FloaterMoveRect2 + 400 + + HelpHomeURL Comment - Rectangle for avatar control window + URL of initial help page Persist 1 Type - Rect + String Value - - 0 - 58 - 135 - 0 - + help/index.html - FloaterMuteRect3 + HelpLastVisitedURL Comment - Rectangle for mute window + URL of last help page, will be shown next time help is accessed Persist 1 Type - Rect + String Value - - 0 - 300 - 300 - 0 - + help/index.html - - FloaterObjectIMInfo - - Comment - Rectangle for floater object im info windows - Persist - 1 - Type - Rect - Value - - 0 - 300 - 300 - 0 - - - FloaterOpenObjectRect + HighResSnapshot Comment - Rectangle for Open Object window + Double resolution of snapshot from current window resolution Persist 1 Type - Rect + Boolean Value - - 0 - 350 - 300 - 0 - + 0 - FloaterPayRectB + HtmlHelpLastPage Comment - Rectangle for pay window + Last URL visited via help system Persist 1 Type - Rect + String Value - - 0 - 150 - 400 - 0 - + - FloaterPermPrefsRect + IMInChatConsole Comment - Rectangle for initial permissions preferences + Copy IM into chat console Persist 1 Type - Rect + Boolean Value - - 200 - 250 - 250 - 200 - + 1 - FloaterRegionInfo + IMInChatHistory Comment - Rectangle for region info window + Copy IM into chat history Persist 1 Type - Rect + Boolean Value - - 0 - 512 - 480 - 0 - + 0 - FloaterScriptDebugRect + IMShowTimestamps Comment - Rectangle for Script Error/Debug window + Show timestamps in IM Persist 1 Type - Rect + Boolean Value - - 0 - 130 - 450 - 0 - + 1 - FloaterSnapshotRect + IgnorePixelDepth Comment - Rectangle for snapshot window + Ignore pixel depth settings. Persist 1 Type - Rect + Boolean Value - - 0 - 200 - 200 - 400 - + 0 - FloaterStatisticsRect + ImagePipelineUseHTTP Comment - Rectangle for chat history + If TRUE use HTTP GET to fetch textures from the server Persist 1 Type - Rect + Boolean Value - - 0 - 400 - 250 - 0 - + 0 - FloaterViewBottom + InBandwidth Comment - [DO NOT MODIFY] Controls layout of floating windows within SL window + Incoming bandwidth throttle (bps) Persist 1 Type - S32 + F32 Value - -1 + 0.0 - FloaterWorldMapRect2 + InstallLanguage Comment - Rectangle for world map window + Language passed from installer (for UI) Persist 1 Type - Rect + String Value - - 0 - 0 - 0 - 0 - + default - FlyBtnState + InventoryAutoOpenDelay Comment - + Seconds before automatically opening inventory when mouse is over inventory button when performing inventory drag and drop Persist - 0 + 1 Type - Boolean + F32 Value - 0 + 1.0 - FlycamAbsolute + InventorySortOrder Comment - Treat Flycam values as absolute positions (not deltas). + Specifies sort key for inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) Persist 1 Type - Boolean + U32 Value - 0 + 7 - FlycamAxisDeadZone0 + InvertMouse Comment - Flycam axis 0 dead zone. + When in mouselook, moving mouse up looks down and vice verse (FALSE = moving up looks up) Persist 1 Type - F32 + Boolean Value - 0.1 + 0 - FlycamAxisDeadZone1 + JoystickAvatarEnabled Comment - Flycam axis 1 dead zone. + Enables the Joystick to control Avatar movement. Persist 1 Type - F32 + Boolean Value - 0.1 + 1 - FlycamAxisDeadZone2 + JoystickAxis0 Comment - Flycam axis 2 dead zone. + Flycam hardware axis mapping for internal axis 0 ([0, 5]). Persist 1 Type - F32 + S32 Value - 0.1 + 1 - FlycamAxisDeadZone3 + JoystickAxis1 Comment - Flycam axis 3 dead zone. + Flycam hardware axis mapping for internal axis 1 ([0, 5]). Persist 1 Type - F32 + S32 Value - 0.1 + 0 - FlycamAxisDeadZone4 + JoystickAxis2 Comment - Flycam axis 4 dead zone. + Flycam hardware axis mapping for internal axis 2 ([0, 5]). Persist 1 Type - F32 + S32 Value - 0.1 + 2 - FlycamAxisDeadZone5 + JoystickAxis3 Comment - Flycam axis 5 dead zone. + Flycam hardware axis mapping for internal axis 3 ([0, 5]). Persist 1 Type - F32 + S32 Value - 0.1 + 4 - FlycamAxisDeadZone6 + JoystickAxis4 Comment - Flycam axis 6 dead zone. + Flycam hardware axis mapping for internal axis 4 ([0, 5]). Persist 1 Type - F32 + S32 Value - 0.1 + 3 - FlycamAxisScale0 + JoystickAxis5 Comment - Flycam axis 0 scaler. + Flycam hardware axis mapping for internal axis 5 ([0, 5]). Persist 1 Type - F32 + S32 Value - 1.0 + 5 - FlycamAxisScale1 + JoystickAxis6 Comment - Flycam axis 1 scaler. + Flycam hardware axis mapping for internal axis 6 ([0, 5]). Persist 1 Type - F32 + S32 Value - 1.0 + -1 - FlycamAxisScale2 + JoystickBuildEnabled Comment - Flycam axis 2 scaler. + Enables the Joystick to move edited objects. Persist 1 Type - F32 + Boolean Value - 1.0 + 0 - FlycamAxisScale3 + JoystickEnabled Comment - Flycam axis 3 scaler. + Enables Joystick Input. Persist 1 Type - F32 + Boolean Value - 1.0 + 0 - FlycamAxisScale4 + JoystickFlycamEnabled Comment - Flycam axis 4 scaler. + Enables the Joystick to control the flycam. Persist - 1 + 0 Type - F32 + Boolean Value - 1.0 + 1 - FlycamAxisScale5 + JoystickInitialized Comment - Flycam axis 5 scaler. + Whether or not a joystick has been detected and initiailized. Persist 1 Type - F32 + String Value - 1.0 + - FlycamAxisScale6 + JoystickRunThreshold Comment - Flycam axis 6 scaler. + Input threshold to initiate running Persist - 1 + 1 Type - F32 + F32 Value - 1.0 - - FlycamFeathering + 0.25 + + KeepAspectForSnapshot Comment - Flycam feathering (less is softer) + Use full window when taking snapshot, regardless of requested image size Persist 1 Type - F32 + Boolean Value - 16.0 + 1 - FlycamZoomDirect + LandBrushSize Comment - Map flycam zoom axis directly to camera zoom. + Size of affected region when using teraform tool Persist - 1 + 1 Type - Boolean + F32 Value - 0 + 2.0 - FlyingAtExit + LCDDestination Comment - Was flying when last logged out, so fly when logging in + Which LCD to use Persist 1 Type - Boolean + S32 Value 0 - FocusOffsetDefault + LSLFindCaseInsensitivity + + Comment + Use case insensitivity when searching in LSL editor + Persist + 1 + Type + Boolean + Value + 0 + + LSLHelpURL Comment - Default focus point offset relative to avatar (x-axis is forward) + URL that points to LSL help files, with [LSL_STRING] corresponding to the referenced LSL function or keyword Persist 1 Type - Vector3 + String Value - - 1.0 - 0.0 - 1.0 - + http://wiki.secondlife.com/wiki/[LSL_STRING] - FocusPosOnLogout + LagMeterShrunk Comment - Camera focus point when last logged out (global coordinates) + Last large/small state for lag meter Persist 1 Type - Vector3D + Boolean Value - - 0.0 - 0.0 - 0.0 - + 0 - FolderAutoOpenDelay + Language Comment - Seconds before automatically expanding the folder under the mouse when performing inventory drag and drop + Language specifier (for UI) Persist 1 Type - F32 + String Value - 0.75 + default - FolderLoadingMessageWaitTime + LanguageIsPublic + + Comment + Let other residents see our language information + Persist + 1 + Type + Boolean + Value + 1 + + LastFeatureVersion Comment - Seconds to wait before showing the LOADING... text in folder views + [DO NOT MODIFY] Version number for tracking hardware changes Persist 1 Type - F32 + S32 Value - 0.5 + 0 - FontMonospace + LastFindPanel Comment - Name of monospace font that definitely exists (Truetype file name) + Controls which find operation appears by default when clicking "Find" button Persist - 0 + 1 Type String Value - DejaVuSansMono.ttf + find_all_panel - FontSansSerif + LastName Comment - Name of primary sans-serif font that definitely exists (Truetype file name) + Login last name Persist - 0 + 1 Type String Value - MtBkLfRg.ttf + - FontSansSerifBundledFallback + LastPrefTab Comment - Name of secondary sans-serif font that definitely exists (Truetype file name) + Last selected tab in preferences window Persist - 0 + 1 Type - String + S32 Value - DejaVuSansCondensed.ttf + 0 - FontSansSerifBold + LastRunVersion Comment - Name of bold font (Truetype file name) + Version number of last instance of the viewer that you ran Persist - 0 + 1 Type String Value - MtBdLfRg.ttf + 0.0.0 - FontSansSerifFallback + + LastSnapshotToEmailHeight Comment - Name of sans-serif font (Truetype file name) + The height of the last email snapshot, in px Persist - 0 + 1 Type - String + S32 Value - + 768 - FontSansSerifFallbackScale + LastSnapshotToEmailWidth Comment - Scale of fallback font relative to huge font (fraction of huge font size) + The width of the last email snapshot, in px Persist 1 Type - F32 + S32 Value - 1.0 + 1024 - FontScreenDPI + LastSnapshotToDiskHeight Comment - Font resolution, higher is bigger (pixels per inch) + The height of the last disk snapshot, in px Persist 1 Type - F32 + S32 Value - 96.0 + 768 - FontSizeHuge + LastSnapshotToDiskWidth Comment - Size of huge font (points, or 1/72 of an inch) + The width of the last disk snapshot, in px Persist 1 Type - F32 + S32 Value - 16.0 + 1024 - FontSizeLarge + LastSnapshotToInventoryHeight Comment - Size of large font (points, or 1/72 of an inch) + The height of the last texture snapshot, in px Persist 1 Type - F32 + S32 Value - 12.0 + 512 - FontSizeMedium + LastSnapshotToInventoryWidth Comment - Size of medium font (points, or 1/72 of an inch) + The width of the last texture snapshot, in px Persist 1 Type - F32 + S32 Value - 10.0 + 512 - FontSizeMonospace + LastSnapshotType Comment - Size of monospaced font (points, or 1/72 of an inch) + Select this as next type of snapshot to take (0 = postcard, 1 = texture, 2 = local image) Persist 1 Type - F32 + S32 Value - 8.1 + 0 - FontSizeSmall + LeftClickShowMenu Comment - Size of small font (points, or 1/72 of an inch) + Left click opens pie menu (FALSE = left click touches or grabs object) Persist 1 Type - F32 + Boolean Value - 9.0 + 0 - ForceShowGrid + LimitDragDistance Comment - Always show grid dropdown on login screen + Limit translation of object via translate tool Persist 1 Type Boolean Value - 0 + 1 - ForceMandatoryUpdate + LimitSelectDistance Comment - For QA: On next startup, forces the auto-updater to run + Disallow selection of objects beyond max select distance Persist 1 Type Boolean Value - 0 + 1 - ForwardBtnRect + LipSyncAah Comment - + Aah (jaw opening) babble loop Persist - 0 + 1 Type - Rect + String Value - - 45 - 54 - 66 - 29 - + 257998776531013446642343 - FreezeTime + LipSyncAahPowerTransfer Comment - + Transfer curve for Voice Interface power to aah lip sync amplitude Persist - 0 + 1 Type - Boolean + String Value - 0 + 0000123456789 - FullScreen + LipSyncEnabled Comment - Run SL in fullscreen mode + 0 disable lip-sync, 1 enable babble loop Persist 1 Type @@ -4534,54 +4067,54 @@ Value 0 - FullScreenAspectRatio + LipSyncOoh Comment - Aspect ratio of fullscreen display (width / height) + Ooh (mouth width) babble loop Persist 1 Type - F32 + String Value - 1.33329999447 + 1247898743223344444443200000 - FullScreenAutoDetectAspectRatio + LipSyncOohAahRate Comment - Automatically detect proper aspect ratio for fullscreen display + Rate to babble Ooh and Aah (/sec) Persist 1 Type - Boolean + F32 Value - 1 + 24.0 - FullScreenHeight + LipSyncOohPowerTransfer Comment - Fullscreen resolution in height + Transfer curve for Voice Interface power to ooh lip sync amplitude Persist 1 Type - S32 + String Value - 768 + 0012345566778899 - FullScreenWidth + LocalCacheVersion Comment - Fullscreen resolution in width + Version number of cache Persist 1 Type S32 Value - 1024 + 0 - GridCrossSections + LogMessages Comment - Highlight cross sections of prims with grid manipulation plane. + Log network traffic Persist 1 Type @@ -4589,54 +4122,43 @@ Value 0 - GridDrawSize + LoginAsGod Comment - Visible extent of 2D snap grid (meters) + Attempt to login with god powers (Linden accounts only) Persist 1 Type - F32 - Value - 12.0 - - GridMode - - Comment - Snap grid reference frame (0 = world, 1 = local, 2 = reference object) - Persist - 1 - Type - S32 + Boolean Value 0 - GridOpacity + LoginLocation Comment - Grid line opacity (0.0 = completely transparent, 1.0 = completely opaque) + Login at same location you last logged out Persist 1 Type - F32 + String Value - 0.699999988079 + last - GridResolution + LoginPage Comment - Size of single grid step (meters) + Login authentication page. Persist 1 Type - F32 + String Value - 0.5 + - GridSubUnit + LosslessJ2CUpload Comment - Display fractional grid steps, relative to grid size + Use lossless compression for small image uploads Persist 1 Type @@ -4644,108 +4166,98 @@ Value 0 - GridSubdivision + MainloopTimeoutDefault Comment - Maximum number of times to divide single snap grid unit when GridSubUnit is true + Timeout duration for mainloop lock detection, in seconds. Persist 1 Type - S32 + F32 Value - 32 + 20.0 - GroupNotifyBoxHeight + MapOverlayIndex Comment - Height of group notice messages + Currently selected world map type Persist 1 Type S32 Value - 260 + 0 - GroupNotifyBoxWidth + MapScale Comment - Width of group notice messages + World map zoom level (pixels per region) Persist 1 Type - S32 + F32 Value - 400 + 128.0 - HTMLLinkColor + MapShowEvents Comment - Color of hyperlinks + Show events on world map Persist 1 Type - Color4 + Boolean Value - - 0.600000023842 - 0.600000023842 - 1.0 - 1.0 - + 1 - HelpHomeURL + MapShowInfohubs Comment - URL of initial help page + Show infohubs on the world map Persist 1 Type - String + Boolean Value - help/index.html + 1 - HelpLastVisitedURL + MapShowLandForSale Comment - URL of last help page, will be shown next time help is accessed + Show land for sale on world map Persist 1 Type - String + Boolean Value - help/index.html + 0 - HighResSnapshot + MapShowPeople Comment - Double resolution of snapshot from current window resolution + Show other users on world map Persist 1 Type Boolean Value - 0 + 1 - HtmlFindRect + MapShowTelehubs Comment - Rectangle for HTML find window + Show telehubs on world map Persist 1 Type - Rect + Boolean Value - - 16 - 650 - 600 - 128 - + 1 - HtmlHelpLastPage + Marker Comment - Last URL visited via help system + [NOT USED] Persist 1 Type @@ -4753,80 +4265,65 @@ Value - HtmlHelpRect + MaxDragDistance Comment - Rectangle for HTML help window + Maximum allowed translation distance in a single operation of translate tool (meters from start point) Persist 1 Type - Rect + F32 Value - - 16 - 650 - 600 - 128 - + 48.0 - HtmlReleaseMessage + MaxSelectDistance Comment - Rectangle for HTML Release Message Floater window + Maximum allowed selection distance (meters from avatar) Persist 1 Type - Rect + F32 Value - - 46 - 520 - 400 - 128 - + 64.0 - IMChatColor + MeanCollisionBump Comment - Color of instant messages from other residents + You have experienced an abuse of being bumped by an object or avatar Persist 1 Type - Color4 + Boolean Value - - 1.0 - 1.0 - 1.0 - 1.0 - + 0 - IMInChatConsole + MeanCollisionPhysical Comment - Copy IM into background chat console + You have experienced an abuse from a physical object Persist 1 Type Boolean Value - 1 + 0 - IMShowTimestamps + MeanCollisionPushObject Comment - Show timestamps in IM + You have experienced an abuse of being pushed by a scripted object Persist 1 Type Boolean Value - 1 + 0 - IgnorePixelDepth + MeanCollisionScripted Comment - Ignore pixel depth settings. + You have experienced an abuse from a scripted object Persist 1 Type @@ -4834,10 +4331,10 @@ Value 0 - ImagePipelineUseHTTP + MeanCollisionSelected Comment - If TRUE use HTTP GET to fetch textures from the server + You have experienced an abuse of being pushed via a selected object Persist 1 Type @@ -4845,65 +4342,76 @@ Value 0 - InBandwidth + MemoryLogFrequency + + Comment + Seconds between display of Memory in log (0 for never) + Persist + 1 + Type + F32 + Value + 600.0 + + MemProfiling Comment - Incoming bandwidth throttle (bps) + You want to use tcmalloc's memory profiling options. Persist 1 Type - F32 + Boolean Value - 0.0 - - InstallLanguage + 0 + + MenuAccessKeyTime Comment - Language passed from installer (for UI) + Time (seconds) in which the menu key must be tapped to move focus to the menu bar Persist 1 Type - String + F32 Value - default + 0.25 - InventoryAutoOpenDelay + MenuBarHeight Comment - Seconds before automatically opening inventory when mouse is over inventory button when performing inventory drag and drop + Persist - 1 + 0 Type - F32 + S32 Value - 1.0 + 18 - InventorySortOrder + MenuBarWidth Comment - Specifies sort key for inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) + Persist - 1 + 0 Type - U32 + S32 Value - 7 + 410 - InvertMouse + MigrateCacheDirectory Comment - When in mouselook, moving mouse up looks down and vice verse (FALSE = moving up looks up) + Check for old version of disk cache to migrate to current location Persist 1 Type Boolean Value - 0 + 1 - JoystickAvatarEnabled + MiniMapRotate Comment - Enables the Joystick to control Avatar movement. + Rotate miniature world map to avatar direction Persist 1 Type @@ -4911,87 +4419,87 @@ Value 1 - JoystickAxis0 + MiniMapScale Comment - Flycam hardware axis mapping for internal axis 0 ([0, 5]). + Miniature world map zoom levle (pixels per region) Persist 1 Type - S32 + F32 Value - 1 + 128.0 - JoystickAxis1 + MouseSensitivity Comment - Flycam hardware axis mapping for internal axis 1 ([0, 5]). + Controls responsiveness of mouse when in mouselook mode (fraction or multiple of default mouse sensitivity) Persist 1 Type - S32 + F32 Value - 0 + 3.0 - JoystickAxis2 + MouseSmooth Comment - Flycam hardware axis mapping for internal axis 2 ([0, 5]). + Smooths out motion of mouse when in mouselook mode. Persist 1 Type - S32 + Boolean Value - 2 + 0 - JoystickAxis3 + MouseSun Comment - Flycam hardware axis mapping for internal axis 3 ([0, 5]). + Persist - 1 + 0 Type - S32 + Boolean Value - 4 + 0 - JoystickAxis4 + MouselookBtnState Comment - Flycam hardware axis mapping for internal axis 4 ([0, 5]). + Persist - 1 + 0 Type - S32 + Boolean Value - 3 + 0 - JoystickAxis5 + MuteAmbient Comment - Flycam hardware axis mapping for internal axis 5 ([0, 5]). + Ambient sound effects, such as wind noise, play at 0 volume Persist 1 Type - S32 + Boolean Value - 5 + 0 - JoystickAxis6 + MuteAudio Comment - Flycam hardware axis mapping for internal axis 6 ([0, 5]). + All audio plays at 0 volume (streaming audio still takes up bandwidth, for example) Persist 1 Type - S32 + Boolean Value - -1 + 0 - JoystickBuildEnabled + MuteMedia Comment - Enables the Joystick to move edited objects. + Media plays at 0 volume (streaming audio still takes up bandwidth) Persist 1 Type @@ -4999,10 +4507,10 @@ Value 0 - JoystickEnabled + MuteMusic Comment - Enables Joystick Input. + Music plays at 0 volume (streaming audio still takes up bandwidth) Persist 1 Type @@ -5010,43 +4518,43 @@ Value 0 - JoystickFlycamEnabled + MuteSounds Comment - Enables the Joystick to control the flycam. + Sound effects play at 0 volume Persist - 0 + 1 Type Boolean Value - 1 + 0 - JoystickInitialized + MuteUI Comment - Whether or not a joystick has been detected and initiailized. + UI sound effects play at 0 volume Persist 1 Type - String + Boolean Value - + 0 - JoystickRunThreshold + MuteVoice Comment - Input threshold to initiate running + Voice plays at 0 volume (streaming audio still takes up bandwidth) Persist - 1 + 1 Type - F32 + Boolean Value - 0.25 - - KeepAspectForSnapshot + 0 + + MuteWhenMinimized Comment - Use full window when taking snapshot, regardless of requested image size + Mute audio when SL window is minimized Persist 1 Type @@ -5054,247 +4562,219 @@ Value 1 - LandBrushSize + NearMeRange Comment - Size of affected region when using teraform tool + Search radius for nearby avatars Persist - 1 + 1 Type - F32 + F32 Value - 2.0 + 20 - LCDDestination + NextOwnerCopy Comment - Which LCD to use + Newly created objects can be copied by next owner Persist 1 Type - S32 + Boolean Value 0 - LSLFindCaseInsensitivity - - Comment - Use case insensitivity when searching in LSL editor - Persist - 1 - Type - Boolean - Value - 0 - - LSLHelpRect + NextOwnerModify Comment - Rectangle for LSL help window + Newly created objects can be modified by next owner Persist 1 Type - Rect + Boolean Value - - 0 - 400 - 400 - 0 - + 0 - LSLHelpURL + NextOwnerTransfer Comment - URL that points to LSL help files, with [LSL_STRING] corresponding to the referenced LSL function or keyword + Newly created objects can be resold or given away by next owner Persist 1 Type - String + Boolean Value - http://wiki.secondlife.com/wiki/[LSL_STRING] + 1 - LagMeterShrunk + NewCacheLocation Comment - Last large/small state for lag meter + Change the location of the local disk cache to this Persist 1 Type - Boolean + String Value - 0 + - Language + NextLoginLocation Comment - Language specifier (for UI) + Location to log into by default. Persist 1 Type String Value - default + - LanguageIsPublic - - Comment - Let other residents see our language information - Persist - 1 - Type - Boolean - Value - 1 - - LastFeatureVersion + NoAudio Comment - [DO NOT MODIFY] Version number for tracking hardware changes + Disable audio playback. Persist 1 Type - S32 + Boolean Value 0 - LastFindPanel + NoHardwareProbe Comment - Controls which find operation appears by default when clicking "Find" button + Disable hardware probe. Persist 1 Type - String + Boolean Value - find_all_panel + 0 - LastName + NoInventoryLibrary Comment - Login last name + Do not request inventory library. Persist 1 Type - String + Boolean Value - + 0 - LastPrefTab + NoPreload Comment - Last selected tab in preferences window + Disable sound and image preload. Persist 1 Type - S32 + Boolean Value 0 - LastRunVersion + NoVerifySSLCert Comment - Version number of last instance of the viewer that you ran + Do not verify SSL peers. Persist 1 Type - String + Boolean Value - 0.0.0 + 0 - - LastSnapshotToEmailHeight + NotifyBoxHeight Comment - The height of the last email snapshot, in px + Height of notification messages Persist 1 Type S32 Value - 768 + 200 - LastSnapshotToEmailWidth + NotifyBoxWidth Comment - The width of the last email snapshot, in px + Width of notification messages Persist 1 Type S32 Value - 1024 + 350 - LastSnapshotToDiskHeight + NotifyMoneyChange Comment - The height of the last disk snapshot, in px + Pop up notifications for all L$ transactions Persist 1 Type - S32 + Boolean Value - 768 + 1 - LastSnapshotToDiskWidth + NotifyTipDuration Comment - The width of the last disk snapshot, in px + Length of time that notification tips stay on screen (seconds) Persist 1 Type - S32 + F32 Value - 1024 + 4.0 - LastSnapshotToInventoryHeight + NumSessions Comment - The height of the last texture snapshot, in px + Number of successful logins to Second Life Persist 1 Type S32 Value - 512 + 0 - LastSnapshotToInventoryWidth + NumpadControl Comment - The width of the last texture snapshot, in px + How numpad keys control your avatar. 0 = Like the normal arrow keys, 1 = Numpad moves avatar when numlock is off, 2 = Numpad moves avatar regardless of numlock (use this if you have no numlock) Persist 1 Type S32 Value - 512 + 0 - LastSnapshotType + OpenDebugStatAdvanced Comment - Select this as next type of snapshot to take (0 = postcard, 1 = texture, 2 = local image) + Expand advanced performance stats display Persist 1 Type - S32 + Boolean Value 0 - LeftClickShowMenu + OpenDebugStatBasic Comment - Left click opens pie menu (FALSE = left click touches or grabs object) + Expand basic performance stats display Persist 1 Type Boolean Value - 0 + 1 - LimitDragDistance + OpenDebugStatNet Comment - Limit translation of object via translate tool + Expand network stats display Persist 1 Type @@ -5302,10 +4782,10 @@ Value 1 - LimitSelectDistance + OpenDebugStatRender Comment - Disallow selection of objects beyond max select distance + Expand render stats display Persist 1 Type @@ -5313,32 +4793,32 @@ Value 1 - LipSyncAah + OpenDebugStatSim Comment - Aah (jaw opening) babble loop + Expand simulator performance stats display Persist 1 Type - String + Boolean Value - 257998776531013446642343 + 1 - LipSyncAahPowerTransfer + OpenDebugStatTexture Comment - Transfer curve for Voice Interface power to aah lip sync amplitude + Expand Texture performance stats display Persist 1 Type - String + Boolean Value - 0000123456789 + 0 - LipSyncEnabled + OpenDebugStatPhysicsDetails Comment - 0 disable lip-sync, 1 enable babble loop + Expand Physics Details performance stats display Persist 1 Type @@ -5346,164 +4826,175 @@ Value 0 - LipSyncOoh + OpenDebugStatSimTime Comment - Ooh (mouth width) babble loop + Expand Simulator Time performance stats display Persist 1 Type - String + Boolean Value - 1247898743223344444443200000 + 0 - LipSyncOohAahRate + OpenDebugStatSimTimeDetails Comment - Rate to babble Ooh and Aah (/sec) + Expand Simulator Time Details performance stats display Persist 1 Type - F32 + Boolean Value - 24.0 + 0 - LipSyncOohPowerTransfer + OutBandwidth Comment - Transfer curve for Voice Interface power to ooh lip sync amplitude + Expand render stats display Persist 1 Type - String + Boolean Value - 0012345566778899 + 1 - LocalCacheVersion + OutBandwidth Comment - Version number of cache + Outgoing bandwidth throttle (bps) Persist 1 Type - S32 + F32 Value - 0 + 0.0 - LogMessages + OverlayTitle Comment - Log network traffic + Controls watermark text message displayed on screen when "ShowOverlayTitle" is enabled (one word, underscores become spaces) Persist 1 Type - Boolean + String Value + Set_via_OverlayTitle_in_settings.xml + + PTTCurrentlyEnabled + + Comment + Use Push to Talk mode + Persist 0 + Type + Boolean + Value + 1 - LoginAsGod + PacketDropPercentage Comment - Attempt to login with god powers (Linden accounts only) + Percentage of packets dropped by the client. Persist 1 Type - Boolean + F32 Value - 0 + 0.0 - LoginLastLocation + ParcelMediaAutoPlayEnable Comment - Login at same location you last logged out + Auto play parcel media when available Persist 1 Type Boolean Value - 1 + 0 - LoginPage + PerAccountSettingsFile Comment - Login authentication page. + Persisted client settings file name (per user). Persist - 1 + 0 Type String Value - LosslessJ2CUpload + PermissionsCautionEnabled Comment - Use lossless compression for small image uploads + When enabled, changes the handling of script permission requests to help avoid accidental granting of certain permissions, such as the debit permission Persist - 1 + 0 Type Boolean Value - 0 + 1 - MainloopTimeoutDefault + PermissionsCautionNotifyBoxHeight Comment - Timeout duration for mainloop lock detection, in seconds. + Height of caution-style notification messages Persist - 1 + 0 Type - F32 + S32 Value - 20.0 + 344 - MapOverlayIndex + PickerContextOpacity Comment - Currently selected world map type + Controls overall opacity of context frustrum connecting color and texture pickers with their swatches Persist 1 Type - S32 + F32 Value - 0 + 0.34999999404 - MapScale + PicksPerSecondMouseMoving Comment - World map zoom level (pixels per region) + How often to perform hover picks while the mouse is moving (picks per second) Persist 1 Type F32 Value - 128.0 + 5.0 - MapShowEvents + PicksPerSecondMouseStationary Comment - Show events on world map + How often to perform hover picks while the mouse is stationary (picks per second) Persist 1 Type - Boolean + F32 Value - 1 + 0.0 - MapShowInfohubs + PieMenuLineWidth Comment - Show infohubs on the world map + Width of lines in pie menu display (pixels) Persist 1 Type - Boolean + F32 Value - 1 + 2.5 - MapShowLandForSale + PingInterpolate Comment - Show land for sale on world map + Extrapolate object position along velocity vector based on ping delay Persist 1 Type @@ -5511,21 +5002,21 @@ Value 0 - MapShowPeople + PitchFromMousePosition Comment - Show other users on world map + Vertical range over which avatar head tracks mouse position (degrees of head rotation from top of window to bottom) Persist 1 Type - Boolean + F32 Value - 1 + 90.0 - MapShowTelehubs + PlayTypingAnim Comment - Show telehubs on world map + Your avatar plays the typing animation whenever you type in the chat bar Persist 1 Type @@ -5533,43 +5024,43 @@ Value 1 - Marker + PrecachingDelay Comment - [NOT USED] + Delay when logging in to load world before showing it (seconds) Persist 1 Type - String + F32 Value - + 6.0 - MaxDragDistance + PreferredMaturity Comment - Maximum allowed translation distance in a single operation of translate tool (meters from start point) + Setting for the user's preferred maturity level. Persist 1 Type - F32 + U32 Value - 48.0 + 13 - MaxSelectDistance + ProbeHardwareOnStartup Comment - Maximum allowed selection distance (meters from avatar) + Query current hardware configuration on application startup Persist 1 Type - F32 + Boolean Value - 64.0 + 1 - MeanCollisionBump + PurgeCacheOnNextStartup Comment - You have experienced an abuse of being bumped by an object or avatar + Clear local file cache next time viewer is run Persist 1 Type @@ -5577,10 +5068,10 @@ Value 0 - MeanCollisionPhysical + PurgeCacheOnStartup Comment - You have experienced an abuse from a physical object + Clear local file cache every time viewer is run Persist 1 Type @@ -5588,21 +5079,21 @@ Value 0 - MeanCollisionPushObject + PushToTalkButton Comment - You have experienced an abuse of being pushed by a scripted object + Which button or keyboard key is used for push-to-talk Persist 1 Type - Boolean + String Value - 0 + MiddleMouse - MeanCollisionScripted + PushToTalkToggle Comment - You have experienced an abuse from a scripted object + Should the push-to-talk button behave as a toggle Persist 1 Type @@ -5610,10 +5101,10 @@ Value 0 - MeanCollisionSelected + QAMode Comment - You have experienced an abuse of being pushed via a selected object + Enable Testing Features. Persist 1 Type @@ -5621,240 +5112,208 @@ Value 0 - MemoryLogFrequency - - Comment - Seconds between display of Memory in log (0 for never) - Persist - 1 - Type - F32 - Value - 600.0 - - MenuAccessKeyTime + QuietSnapshotsToDisk Comment - Time (seconds) in which the menu key must be tapped to move focus to the menu bar + Take snapshots to disk without playing animation or sound Persist 1 Type - F32 + Boolean Value - 0.25 + 0 - MenuBarHeight + QuitAfterSeconds Comment - + The duration allowed before quitting. Persist - 0 + 1 Type - S32 + F32 Value - 18 + 0.0 - MenuBarWidth + RadioLandBrushAction Comment - + Last selected land modification operation (0 = flatten, 1 = raise, 2 = lower, 3 = smooth, 4 = roughen, 5 = revert) Persist - 0 + 1 Type S32 Value - 410 + 0 - MigrateCacheDirectory + RadioLandBrushSize Comment - Check for old version of disk cache to migrate to current location + Size of land modification brush (0 = small, 1 = medium, 2 = large) Persist 1 Type - Boolean + S32 Value - 1 + 0 - MiniMapRotate + LandBrushForce + + Comment + Multiplier for land modification brush force. + Persist + 1 + Type + F32 + Value + 1.0 + + RecentItemsSortOrder Comment - Rotate miniature world map to avatar direction + Specifies sort key for recent inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) Persist 1 Type - Boolean + U32 Value 1 - MiniMapScale + RectangleSelectInclusive Comment - Miniature world map zoom levle (pixels per region) + Select objects that have at least one vertex inside selection rectangle Persist 1 Type - F32 + Boolean Value - 128.0 + 1 - MouseSensitivity + RegionTextureSize Comment - Controls responsiveness of mouse when in mouselook mode (fraction or multiple of default mouse sensitivity) + Terrain texture dimensions (power of 2) Persist 1 Type - F32 + U32 Value - 3.0 + 256 - MouseSmooth + RememberPassword Comment - Smooths out motion of mouse when in mouselook mode. + Keep password (in encrypted form) for next login Persist 1 Type Boolean Value - 0 + 1 - MouseSun + RenderAnisotropic Comment - + Render textures using anisotropic filtering Persist - 0 + 1 Type Boolean Value 0 - MouselookBtnState + RenderAppleUseMultGL Comment - + Whether we want to use multi-threaded OpenGL on Apple hardware (requires restart of SL). Persist - 0 + 1 Type Boolean Value 0 - MoveDownBtnRect - - Comment - - Persist - 0 - Type - Rect - Value - - 91 - 29 - 116 - 4 - - - MoveUpBtnRect + RenderAttachedLights + + Comment + Render lighted prims that are attached to avatars + Persist + 1 + Type + Boolean + Value + 1 + + RenderAttachedParticles + + Comment + Render particle systems that are attached to avatars + Persist + 1 + Type + Boolean + Value + 1 + + RenderAvatar Comment - + Render Avatars Persist 0 Type - Rect - Value - - 91 - 54 - 116 - 29 - - - MuteAmbient - - Comment - Ambient sound effects, such as wind noise, play at 0 volume - Persist - 1 - Type Boolean Value - 0 - - MuteAudio - - Comment - All audio plays at 0 volume (streaming audio still takes up bandwidth, for example) - Persist 1 - Type - Boolean - Value - 0 - MuteMedia + RenderAvatarCloth Comment - Media plays at 0 volume (streaming audio still takes up bandwidth) + Controls if avatars use wavy cloth Persist 1 Type Boolean Value - 0 - - MuteMusic - - Comment - Music plays at 0 volume (streaming audio still takes up bandwidth) - Persist 1 - Type - Boolean - Value - 0 - MuteSounds + RenderAvatarLODFactor Comment - Sound effects play at 0 volume + Controls level of detail of avatars (multiplier for current screen area when calculated level of detail) Persist 1 Type - Boolean + F32 Value - 0 + 0.5 - MuteUI + RenderAvatarMaxVisible Comment - UI sound effects play at 0 volume + Maximum number of avatars to display at any one time Persist 1 Type - Boolean + S32 Value - 0 + 35 - MuteVoice + RenderAvatarInvisible Comment - Voice plays at 0 volume (streaming audio still takes up bandwidth) + Set your avatar as Invisible Persist - 1 + 0 Type Boolean Value 0 - MuteWhenMinimized + RenderAvatarVP Comment - Mute audio when SL window is minimized + Use vertex programs to perform hardware skinning of avatar Persist 1 Type @@ -5862,76 +5321,160 @@ Value 1 - NearMeRange + + RenderShadowGaussian + + Comment + Gaussian coefficients for the two shadow/SSAO blurring passes (z component unused). + Persist + 1 + Type + Vector3 + Value + + 2.0 + 2.0 + 0.0 + + + + RenderShadowNearDist + + Comment + Near clip plane of shadow camera (affects precision of depth shadows). + Persist + 1 + Type + Vector3 + Value + + 256 + 256 + 256 + + + RenderShadowClipPlanes + + Comment + Near clip plane split distances for shadow map frusta. + Persist + 1 + Type + Vector3 + Value + + 4.0 + 8.0 + 24.0 + + + RenderSSAOScale + + Comment + Scaling factor for the area to sample for occluders (pixels at 1 meter away, inversely varying with distance) + Persist + 1 + Type + F32 + Value + 500.0 + + RenderSSAOMaxScale + + Comment + Maximum screen radius for sampling (pixels) + Persist + 1 + Type + U32 + Value + 60 + + RenderSSAOFactor + + Comment + Occlusion sensitivity factor for ambient occlusion (larger is more) + Persist + 1 + Type + F32 + Value + 0.30 + + RenderSSAOEffect + + Comment + Multiplier for (1) value and (2) saturation (HSV definition), for areas which are totally occluded. Blends with original color for partly-occluded areas. (Third component is unused.) + Persist + 1 + Type + Vector3 + Value + + 0.40 + 1.00 + 0.00 + + + RenderBumpmapMinDistanceSquared Comment - Search radius for nearby avatars + Maximum distance at which to render bumpmapped primitives (distance in meters, squared) Persist 1 Type F32 Value - 20 + 100.0 - NextOwnerCopy + RenderNormalMapScale + + Comment + Scaler applied to height map when generating normal maps + Persist + 1 + Type + F32 + Value + 128 + + RenderCubeMap Comment - Newly created objects can be copied by next owner + Whether we can render the cube map or not Persist 1 Type Boolean Value - 0 - - NextOwnerModify - - Comment - Newly created objects can be modified by next owner - Persist 1 - Type - Boolean - Value - 0 - NextOwnerTransfer + RenderCustomSettings Comment - Newly created objects can be resold or given away by next owner + Do you want to set the graphics settings yourself Persist 1 Type Boolean Value - 1 - - NewCacheLocation - - Comment - Change the location of the local disk cache to this - Persist - 1 - Type - String - Value - + 0 - NextLoginLocation + RenderDebugAlphaMask Comment - Location to log into by default. + Test Alpha Masking Cutoffs. Persist 1 Type - String + F32 Value - + 0.5 - NoAudio + RenderDebugGL Comment - Disable audio playback. + Enable strict GL debugging. Persist 1 Type @@ -5939,21 +5482,21 @@ Value 0 - NoHardwareProbe + RenderDebugPipeline Comment - Disable hardware probe. + Enable strict pipeline debugging. Persist 1 Type - Boolean + Boolean Value 0 - NoInventoryLibrary + RenderDebugTextureBind Comment - Do not request inventory library. + Enable texture bind performance test. Persist 1 Type @@ -5961,1960 +5504,132 @@ Value 0 - NoPreload - - Comment - Disable sound and image preload. - Persist - 1 - Type - Boolean - Value - 0 - - NoVerifySSLCert - - Comment - Do not verify SSL peers. - Persist - 1 - Type - Boolean - Value - 0 - - NotecardEditorRect - - Comment - Rectangle for notecard editor - Persist - 1 - Type - Rect - Value - - 0 - 400 - 400 - 0 - - - NotifyBoxHeight - - Comment - Height of notification messages - Persist - 1 - Type - S32 - Value - 200 - - NotifyBoxWidth - - Comment - Width of notification messages - Persist - 1 - Type - S32 - Value - 350 - - NotifyMoneyChange - - Comment - Pop up notifications for all L$ transactions - Persist - 1 - Type - Boolean - Value - 1 - - NotifyTipDuration - - Comment - Length of time that notification tips stay on screen (seconds) - Persist - 1 - Type - F32 - Value - 4.0 - - NumSessions - - Comment - Number of successful logins to Second Life - Persist - 1 - Type - S32 - Value - 0 - - NumpadControl - - Comment - How numpad keys control your avatar. 0 = Like the normal arrow keys, 1 = Numpad moves avatar when numlock is off, 2 = Numpad moves avatar regardless of numlock (use this if you have no numlock) - Persist - 1 - Type - S32 - Value - 0 - - ObjectChatColor - - Comment - Color of chat messages from objects - Persist - 1 - Type - Color4 - Value - - 0.699999988079 - 0.899999976158 - 0.699999988079 - 1 - - - OpenDebugStatAdvanced - - Comment - Expand advanced performance stats display - Persist - 1 - Type - Boolean - Value - 0 - - OpenDebugStatBasic - - Comment - Expand basic performance stats display - Persist - 1 - Type - Boolean - Value - 1 - - OpenDebugStatNet - - Comment - Expand network stats display - Persist - 1 - Type - Boolean - Value - 1 - - OpenDebugStatRender - - Comment - Expand render stats display - Persist - 1 - Type - Boolean - Value - 1 - - OpenDebugStatSim - - Comment - Expand simulator performance stats display - Persist - 1 - Type - Boolean - Value - 1 - - OpenDebugStatTexture - - Comment - Expand Texture performance stats display - Persist - 1 - Type - Boolean - Value - 0 - - OpenDebugStatPhysicsDetails - - Comment - Expand Physics Details performance stats display - Persist - 1 - Type - Boolean - Value - 0 - - OpenDebugStatSimTime - - Comment - Expand Simulator Time performance stats display - Persist - 1 - Type - Boolean - Value - 0 - - OpenDebugStatSimTimeDetails - - Comment - Expand Simulator Time Details performance stats display - Persist - 1 - Type - Boolean - Value - 0 - - OutBandwidth - - Comment - Outgoing bandwidth throttle (bps) - Persist - 1 - Type - F32 - Value - 0.0 - - OverdrivenColor - - Comment - Color of various indicators when resident is speaking too loud. - Persist - 1 - Type - Color4 - Value - - 1.0 - 0.0 - 0.0 - 1.0 - - - OverlayTitle - - Comment - Controls watermark text message displayed on screen when "ShowOverlayTitle" is enabled (one word, underscores become spaces) - Persist - 1 - Type - String - Value - Set_via_OverlayTitle_in_settings.xml - - PTTCurrentlyEnabled - - Comment - Use Push to Talk mode - Persist - 0 - Type - Boolean - Value - 1 - - PacketDropPercentage - - Comment - Percentage of packets dropped by the client. - Persist - 1 - Type - F32 - Value - 0.0 - - ParcelMediaAutoPlayEnable - - Comment - Auto play parcel media when available - Persist - 1 - Type - Boolean - Value - 0 - - PerAccountSettingsFile - - Comment - Persisted client settings file name (per user). - Persist - 0 - Type - String - Value - - - PermissionsCautionEnabled - - Comment - When enabled, changes the handling of script permission requests to help avoid accidental granting of certain permissions, such as the debit permission - Persist - 0 - Type - Boolean - Value - 1 - - PermissionsCautionNotifyBoxHeight - - Comment - Height of caution-style notification messages - Persist - 0 - Type - S32 - Value - 344 - - PermissionsManagerRect - - Comment - Rectangle for permissions manager window - Persist - 1 - Type - Rect - Value - - 0 - 85 - 300 - 0 - - - PickerContextOpacity - - Comment - Controls overall opacity of context frustrum connecting color and texture pickers with their swatches - Persist - 1 - Type - F32 - Value - 0.34999999404 - - PicksPerSecondMouseMoving - - Comment - How often to perform hover picks while the mouse is moving (picks per second) - Persist - 1 - Type - F32 - Value - 5.0 - - PicksPerSecondMouseStationary - - Comment - How often to perform hover picks while the mouse is stationary (picks per second) - Persist - 1 - Type - F32 - Value - 0.0 - - PieMenuLineWidth - - Comment - Width of lines in pie menu display (pixels) - Persist - 1 - Type - F32 - Value - 2.5 - - PinTalkViewOpen - - Comment - Stay in IM after hitting return - Persist - 1 - Type - Boolean - Value - 1 - - PingInterpolate - - Comment - Extrapolate object position along velocity vector based on ping delay - Persist - 1 - Type - Boolean - Value - 0 - - PitchFromMousePosition - - Comment - Vertical range over which avatar head tracks mouse position (degrees of head rotation from top of window to bottom) - Persist - 1 - Type - F32 - Value - 90.0 - - PlayTypingAnim - - Comment - Your avatar plays the typing animation whenever you type in the chat bar - Persist - 1 - Type - Boolean - Value - 1 - - PrecachingDelay - - Comment - Delay when logging in to load world before showing it (seconds) - Persist - 1 - Type - F32 - Value - 6.0 - - PreferredMaturity - - Comment - Setting for the user's preferred maturity level. - Persist - 1 - Type - U32 - Value - 13 - - PreviewAnimRect - - Comment - Rectangle for animation preview window - Persist - 1 - Type - Rect - Value - - 0 - 85 - 300 - 0 - - - PreviewClassifiedRect - - Comment - Rectangle for URL preview window - Persist - 1 - Type - Rect - Value - - 0 - 530 - 420 - 0 - - - PreviewEventRect - - Comment - Rectangle for Event preview window - Persist - 1 - Type - Rect - Value - - 0 - 530 - 420 - 0 - - - PreviewLandmarkRect - - Comment - Rectangle for landmark preview window - Persist - 1 - Type - Rect - Value - - 0 - 90 - 300 - 0 - - - PreviewObjectRect - - Comment - Rectangle for object preview window - Persist - 1 - Type - Rect - Value - - 0 - 85 - 300 - 0 - - - PreviewScriptRect - - Comment - Rectangle for script preview window - Persist - 1 - Type - Rect - Value - - 0 - 586 - 576 - 0 - - - PreviewSoundRect - - Comment - Rectangle for sound preview window - Persist - 1 - Type - Rect - Value - - 0 - 85 - 300 - 0 - - - PreviewTextureRect - - Comment - Rectangle for texture preview window - Persist - 1 - Type - Rect - Value - - 0 - 400 - 400 - 0 - - - PreviewURLRect - - Comment - Rectangle for URL preview window - Persist - 1 - Type - Rect - Value - - 0 - 90 - 300 - 0 - - - PreviewWearableRect - - Comment - Rectangle for wearable preview window - Persist - 1 - Type - Rect - Value - - 0 - 85 - 300 - 0 - - - ProbeHardwareOnStartup - - Comment - Query current hardware configuration on application startup - Persist - 1 - Type - Boolean - Value - 1 - - PropertiesRect - - Comment - Rectangle for inventory item properties window - Persist - 1 - Type - Rect - Value - - 0 - 320 - 350 - 0 - - - PurgeCacheOnNextStartup - - Comment - Clear local file cache next time viewer is run - Persist - 1 - Type - Boolean - Value - 0 - - PurgeCacheOnStartup - - Comment - Clear local file cache every time viewer is run - Persist - 1 - Type - Boolean - Value - 0 - - PushToTalkButton - - Comment - Which button or keyboard key is used for push-to-talk - Persist - 1 - Type - String - Value - MiddleMouse - - PushToTalkToggle - - Comment - Should the push-to-talk button behave as a toggle - Persist - 1 - Type - Boolean - Value - 0 - - QAMode - - Comment - Enable Testing Features. - Persist - 1 - Type - Boolean - Value - 0 - - QuietSnapshotsToDisk - - Comment - Take snapshots to disk without playing animation or sound - Persist - 1 - Type - Boolean - Value - 0 - - QuitAfterSeconds - - Comment - The duration allowed before quitting. - Persist - 1 - Type - F32 - Value - 0.0 - - RadioLandBrushAction - - Comment - Last selected land modification operation (0 = flatten, 1 = raise, 2 = lower, 3 = smooth, 4 = roughen, 5 = revert) - Persist - 1 - Type - S32 - Value - 0 - - RadioLandBrushSize - - Comment - Size of land modification brush (0 = small, 1 = medium, 2 = large) - Persist - 1 - Type - S32 - Value - 0 - - LandBrushForce - - Comment - Multiplier for land modification brush force. - Persist - 1 - Type - F32 - Value - 1.0 - - RecentItemsSortOrder - - Comment - Specifies sort key for recent inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) - Persist - 1 - Type - U32 - Value - 1 - - RectangleSelectInclusive - - Comment - Select objects that have at least one vertex inside selection rectangle - Persist - 1 - Type - Boolean - Value - 1 - - RegionTextureSize - - Comment - Terrain texture dimensions (power of 2) - Persist - 1 - Type - U32 - Value - 256 - - RememberPassword - - Comment - Keep password (in encrypted form) for next login - Persist - 1 - Type - Boolean - Value - 1 - - RenderAnisotropic - - Comment - Render textures using anisotropic filtering - Persist - 1 - Type - Boolean - Value - 0 - - RenderAppleUseMultGL - - Comment - Whether we want to use multi-threaded OpenGL on Apple hardware (requires restart of SL). - Persist - 1 - Type - Boolean - Value - 0 - - RenderAttachedLights - - Comment - Render lighted prims that are attached to avatars - Persist - 1 - Type - Boolean - Value - 1 - - RenderAttachedParticles - - Comment - Render particle systems that are attached to avatars - Persist - 1 - Type - Boolean - Value - 1 - - RenderAvatarCloth - - Comment - Controls if avatars use wavy cloth - Persist - 1 - Type - Boolean - Value - 1 - - RenderAvatarLODFactor - - Comment - Controls level of detail of avatars (multiplier for current screen area when calculated level of detail) - Persist - 1 - Type - F32 - Value - 0.5 - - RenderAvatarMaxVisible - - Comment - Maximum number of avatars to display at any one time - Persist - 1 - Type - S32 - Value - 35 - - RenderAvatarInvisible - - Comment - Set your avatar as Invisible - Persist - 0 - Type - Boolean - Value - 0 - - RenderAvatarVP - - Comment - Use vertex programs to perform hardware skinning of avatar - Persist - 1 - Type - Boolean - Value - 1 - - - RenderShadowGaussian - - Comment - Gaussian coefficients for the two shadow/SSAO blurring passes (z component unused). - Persist - 1 - Type - Vector3 - Value - - 2.0 - 2.0 - 0.0 - - - - RenderShadowNearDist - - Comment - Near clip plane of shadow camera (affects precision of depth shadows). - Persist - 1 - Type - Vector3 - Value - - 256 - 256 - 256 - - - RenderShadowClipPlanes - - Comment - Near clip plane split distances for shadow map frusta. - Persist - 1 - Type - Vector3 - Value - - 4.0 - 8.0 - 24.0 - - - RenderSSAOScale - - Comment - Scaling factor for the area to sample for occluders (pixels at 1 meter away, inversely varying with distance) - Persist - 1 - Type - F32 - Value - 500.0 - - RenderSSAOMaxScale - - Comment - Maximum screen radius for sampling (pixels) - Persist - 1 - Type - U32 - Value - 60 - - RenderSSAOFactor - - Comment - Occlusion sensitivity factor for ambient occlusion (larger is more) - Persist - 1 - Type - F32 - Value - 0.30 - - RenderSSAOEffect - - Comment - Multiplier for (1) value and (2) saturation (HSV definition), for areas which are totally occluded. Blends with original color for partly-occluded areas. (Third component is unused.) - Persist - 1 - Type - Vector3 - Value - - 0.40 - 1.00 - 0.00 - - - RenderBumpmapMinDistanceSquared - - Comment - Maximum distance at which to render bumpmapped primitives (distance in meters, squared) - Persist - 1 - Type - F32 - Value - 100.0 - - RenderNormalMapScale - - Comment - Scaler applied to height map when generating normal maps - Persist - 1 - Type - F32 - Value - 128 - - RenderCubeMap - - Comment - Whether we can render the cube map or not - Persist - 1 - Type - Boolean - Value - 1 - - RenderCustomSettings - - Comment - Do you want to set the graphics settings yourself - Persist - 1 - Type - Boolean - Value - 0 - - RenderDebugGL - - Comment - Enable strict GL debugging. - Persist - 1 - Type - Boolean - Value - 0 - - RenderDebugPipeline - - Comment - Enable strict pipeline debugging. - Persist - 1 - Type - Boolean - Value - 0 - - RenderDebugTextureBind - - Comment - Enable texture bind performance test. - Persist - 1 - Type - Boolean - Value - 0 - - RenderDelayCreation - - Comment - Throttle creation of drawables. - Persist - 1 - Type - Boolean - Value - 0 - - RenderAnimateRes - - Comment - Animate rezing prims. - Persist - 1 - Type - Boolean - Value - 0 - - - RenderAnimateTrees - - Comment - Use GL matrix ops to animate tree branches. - Persist - 1 - Type - Boolean - Value - 0 - - RenderDeferredAlphaSoften - - Comment - Scalar for softening alpha surfaces (for soft particles). - Persist - 1 - Type - F32 - Value - 0.75 - - RenderDeferredNoise - - Comment - Noise scalar to hide banding in deferred render. - Persist - 1 - Type - F32 - Value - 4 - - RenderDeferred - - Comment - Use deferred rendering pipeline. - Persist - 1 - Type - Boolean - Value - 0 - - RenderDeferredSunShadow - - Comment - Generate shadows from the sun. - Persist - 1 - Type - Boolean - Value - 1 - - RenderDeferredSunWash - - Comment - Amount local lights are washed out by sun. - Persist - 1 - Type - F32 - Value - 0.5 - - RenderShadowNoise - - Comment - Magnitude of noise on shadow samples. - Persist - 1 - Type - F32 - Value - -0.0001 - - RenderShadowBlurSize - - Comment - Scale of shadow softening kernel. - Persist - 1 - Type - F32 - Value - 0.7 - - RenderShadowBlurSamples - - Comment - Number of samples to take for each pass of shadow blur (value range 1-16). Actual number of samples is value * 2 - 1. - Persist - 1 - Type - U32 - Value - 5 - - RenderDynamicLOD - - Comment - Dynamically adjust level of detail. - Persist - 1 - Type - Boolean - Value - 1 - - RenderFSAASamples - - Comment - Number of samples to use for FSAA (0 = no AA). - Persist - 1 - Type - U32 - Value - 0 - - RenderFarClip - - Comment - Distance of far clip plane from camera (meters) - Persist - 1 - Type - F32 - Value - 256.0 - - RenderFastAlpha - - Comment - Use lossy alpha rendering optimization (opaque/nonexistent small alpha faces). - Persist - 1 - Type - Boolean - Value - 0 - - RenderFastUI - - Comment - [NOT USED] - Persist - 1 - Type - Boolean - Value - 0 - - RenderFlexTimeFactor - - Comment - Controls level of detail of flexible objects (multiplier for amount of time spent processing flex objects) - Persist - 1 - Type - F32 - Value - 1.0 - - RenderFogRatio - - Comment - Distance from camera where fog reaches maximum density (fraction or multiple of far clip distance) - Persist - 1 - Type - F32 - Value - 4.0 - - RenderGamma - - Comment - Sets gamma exponent for renderer - Persist - 1 - Type - F32 - Value - 0.0 - - RenderGammaFull - - Comment - Use fully controllable gamma correction, instead of faster, hard-coded gamma correction of 2. - Persist - 1 - Type - Boolean - Value - 1.0 - - RenderGlow - - Comment - Render bloom post effect. - Persist - 1 - Type - Boolean - Value - 1 - - RenderGlowIterations - - Comment - Number of times to iterate the glow (higher = wider and smoother but slower) - Persist - 1 - Type - S32 - Value - 2 - - RenderGlowLumWeights - - Comment - Weights for each color channel to be used in calculating luminance (should add up to 1.0) - Persist - 1 - Type - Vector3 - Value - - 0.299 - 0.587 - 0.114 - - - RenderGlowMaxExtractAlpha - - Comment - Max glow alpha value for brightness extraction to auto-glow. - Persist - 1 - Type - F32 - Value - 0.065 - - RenderGlowMinLuminance - - Comment - Min luminance intensity necessary to consider an object bright enough to automatically glow. - Persist - 1 - Type - F32 - Value - 2.5 - - RenderGlowResolutionPow - - Comment - Glow map resolution power of two. - Persist - 1 - Type - S32 - Value - 9 - - RenderGlowStrength - - Comment - Additive strength of glow. - Persist - 1 - Type - F32 - Value - 0.35 - - RenderGlowWarmthAmount - - Comment - Amount of warmth extraction to use (versus luminance extraction). 0 = lum, 1.0 = warmth - Persist - 1 - Type - F32 - Value - 0.0 - - RenderGlowWarmthWeights - - Comment - Weight of each color channel used before finding the max warmth - Persist - 1 - Type - Vector3 - Value - - 1.0 - 0.5 - 0.7 - - - RenderGlowWidth - - Comment - Glow sample size (higher = wider and softer but eventually more pixelated) - Persist - 1 - Type - F32 - Value - 1.3 - - RenderGround - - Comment - Determines whether we can render the ground pool or not - Persist - 1 - Type - Boolean - Value - 1 - - RenderHUDInSnapshot - - Comment - Display HUD attachments in snapshot - Persist - 1 - Type - Boolean - Value - 0 - - RenderHUDParticles - - Comment - Display particle systems in HUD attachments (experimental) - Persist - 1 - Type - Boolean - Value - 0 - - RenderHiddenSelections - - Comment - Show selection lines on objects that are behind other objects - Persist - 1 - Type - Boolean - Value - 1 - - RenderHideGroupTitle - - Comment - Don't show my group title in my name label - Persist - 1 - Type - Boolean - Value - 0 - - RenderHideGroupTitleAll - - Comment - Show group titles in name labels - Persist - 1 - Type - Boolean - Value - 0 - - RenderInitError - - Comment - Error occured while initializing GL - Persist - 1 - Type - Boolean - Value - 0 - - RenderLightRadius - - Comment - Render the radius of selected lights - Persist - 1 - Type - Boolean - Value - 0 - - RenderLightingDetail - - Comment - Amount of detail for lighting objects/avatars/terrain (0=sun/moon only, 1=enable local lights) - Persist - 1 - Type - S32 - Value - 1 - - RenderMaxPartCount - - Comment - Maximum number of particles to display on screen - Persist - 1 - Type - S32 - Value - 4096 - - RenderMaxNodeSize - - Comment - Maximum size of a single node's vertex data (in KB). - Persist - 1 - Type - S32 - Value - 4096 - - RenderMaxVBOSize - - Comment - Maximum size of a vertex buffer (in KB). - Persist - 1 - Type - S32 - Value - 512 - - RenderName - - Comment - Controls display of names above avatars (0 = never, 1 = fade, 2 = always) - Persist - 1 - Type - S32 - Value - 2 - - RenderNameFadeDuration - - Comment - Time interval over which to fade avatar names (seconds) - Persist - 1 - Type - F32 - Value - 1.0 - - RenderNameHideSelf - - Comment - Don't display own name above avatar - Persist - 1 - Type - Boolean - Value - 0 - - RenderNameShowTime - - Comment - Fade avatar names after specified time (seconds) - Persist - 1 - Type - F32 - Value - 10.0 - - RenderObjectBump - - Comment - Show bumpmapping on primitives - Persist - 1 - Type - Boolean - Value - 1 - - RenderQualityPerformance - - Comment - Which graphics settings you've chosen - Persist - 1 - Type - U32 - Value - 1 - - RenderReflectionDetail - - Comment - Detail of reflection render pass. - Persist - 1 - Type - S32 - Value - 2 - - RenderReflectionRes - - Comment - Reflection map resolution. - Persist - 1 - Type - S32 - Value - 64 - - RenderResolutionDivisor - - Comment - Divisor for rendering 3D scene at reduced resolution. - Persist - 1 - Type - U32 - Value - 1 - - RenderShaderLightingMaxLevel - - Comment - Max lighting level to use in the shader (class 3 is default, 2 is less lights, 1 is sun/moon only. Works around shader compiler bugs on certain platforms.) - Persist - 1 - Type - S32 - Value - 3 - - RenderShaderLODThreshold - - Comment - Fraction of draw distance defining the switch to a different shader LOD - Persist - 1 - Type - F32 - Value - 1.0 - - RenderShaderParticleThreshold - - Comment - Fraction of draw distance to not use shader on particles - Persist - 1 - Type - F32 - Value - 0.25 - - RenderSunDynamicRange - - Comment - Defines what percent brighter the sun is than local point lights (1.0 = 100% brighter. Value should not be less than 0. ). - Persist - 1 - Type - F32 - Value - 1.0 - - RenderTerrainDetail - - Comment - Detail applied to terrain texturing (0 = none, 1 or 2 = full) - Persist - 1 - Type - S32 - Value - 2 - - RenderTerrainLODFactor - - Comment - Controls level of detail of terrain (multiplier for current screen area when calculated level of detail) - Persist - 1 - Type - F32 - Value - 1.0 - - RenderTerrainScale - - Comment - Terrain detail texture scale - Persist - 1 - Type - F32 - Value - 12.0 - - RenderTextureMemoryMultiple - - Comment - Multiple of texture memory value to use (should fit: 0 < value <= 1.0) - Persist - 1 - Type - F32 - Value - 1.0 - - RenderTreeLODFactor - - Comment - Controls level of detail of vegetation (multiplier for current screen area when calculated level of detail) - Persist - 1 - Type - F32 - Value - 0.5 - - RenderUIInSnapshot - - Comment - Display user interface in snapshot - Persist - 1 - Type - Boolean - Value - 0 - - RenderUnloadedAvatar - - Comment - Show avatars which haven't finished loading - Persist - 1 - Type - Boolean - Value - 0 - - RenderUseFBO - - Comment - Whether we want to use GL_EXT_framebuffer_objects. - Persist - 1 - Type - Boolean - Value - 0 - - RenderUseFarClip - - Comment - If false, frustum culling will ignore far clip plane. - Persist - 1 - Type - Boolean - Value - 1 - - RenderUseImpostors - - Comment - Whether we want to use impostors for far away avatars. - Persist - 1 - Type - Boolean - Value - 1 - - RenderUseShaderLOD - - Comment - Whether we want to have different shaders for LOD - Persist - 1 - Type - Boolean - Value - 1 - - RenderUseShaderNearParticles - - Comment - Whether we want to use shaders on near particles - Persist - 1 - Type - Boolean - Value - 0 - - RenderVBOEnable - - Comment - Use GL Vertex Buffer Objects - Persist - 1 - Type - Boolean - Value - 1 - - RenderVolumeLODFactor - - Comment - Controls level of detail of primitives (multiplier for current screen area when calculated level of detail) - Persist - 1 - Type - F32 - Value - 1.0 - - RenderWater - - Comment - Display water - Persist - 1 - Type - Boolean - Value - 1 - - RenderWaterMipNormal - - Comment - Use mip maps for water normal map. - Persist - 1 - Type - Boolean - Value - 1 - - RenderWaterRefResolution - - Comment - Water planar reflection resolution. - Persist - 1 - Type - S32 - Value - 512 - - RenderWaterReflections - - Comment - Reflect the environment in the water. - Persist - 1 - Type - Boolean - Value - 0 - - RotateRight - - Comment - Make the agent rotate to its right. - Persist - 1 - Type - Boolean - Value - 0 - - RotationStep - - Comment - All rotations via rotation tool are constrained to multiples of this unit (degrees) - Persist - 1 - Type - F32 - Value - 1.0 - - RunBtnState - - Comment - - Persist - 0 - Type - Boolean - Value - 0 - - RunMultipleThreads - - Comment - If TRUE keep background threads active during render - Persist - 1 - Type - Boolean - Value - 0 - - SafeMode - - Comment - Reset preferences, run in safe mode. - Persist - 1 - Type - Boolean - Value - 0 - - SaveMinidump - - Comment - Save minidump for developer debugging on crash - Persist - 1 - Type - Boolean - Value - 1 - - ScaleShowAxes - - Comment - Show indicator of selected scale axis when scaling - Persist - 1 - Type - Boolean - Value - 0 - - ScaleStretchTextures + RenderDelayCreation + + Comment + Throttle creation of drawables. + Persist + 1 + Type + Boolean + Value + 0 + + RenderAnimateRes + + Comment + Animate rezing prims. + Persist + 1 + Type + Boolean + Value + 0 + + + RenderAnimateTrees + + Comment + Use GL matrix ops to animate tree branches. + Persist + 1 + Type + Boolean + Value + 0 + + RenderDeferredAlphaSoften + + Comment + Scalar for softening alpha surfaces (for soft particles). + Persist + 1 + Type + F32 + Value + 0.75 + + RenderDeferredNoise + + Comment + Noise scalar to hide banding in deferred render. + Persist + 1 + Type + F32 + Value + 4 + + RenderDeferred + + Comment + Use deferred rendering pipeline. + Persist + 1 + Type + Boolean + Value + 0 + + RenderDeferredSunShadow + + Comment + Generate shadows from the sun. + Persist + 1 + Type + Boolean + Value + 1 + + RenderDeferredSunWash + + Comment + Amount local lights are washed out by sun. + Persist + 1 + Type + F32 + Value + 0.5 + + RenderShadowNoise + + Comment + Magnitude of noise on shadow samples. + Persist + 1 + Type + F32 + Value + -0.0001 + + RenderShadowBlurSize + + Comment + Scale of shadow softening kernel. + Persist + 1 + Type + F32 + Value + 0.7 + + RenderShadowBlurSamples + + Comment + Number of samples to take for each pass of shadow blur (value range 1-16). Actual number of samples is value * 2 - 1. + Persist + 1 + Type + U32 + Value + 5 + + RenderDynamicLOD Comment - Stretch textures along with object when scaling + Dynamically adjust level of detail. Persist 1 Type @@ -7922,37 +5637,32 @@ Value 1 - ScaleUniform + RenderFSAASamples Comment - Scale selected objects evenly about center of selection + Number of samples to use for FSAA (0 = no AA). Persist 1 Type - Boolean + U32 Value 0 - ScriptErrorColor + RenderFarClip Comment - Color of script error messages + Distance of far clip plane from camera (meters) Persist 1 Type - Color4 + F32 Value - - 0.8235294117 - 0.2745098039 - 0.2745098039 - 1.0 - + 256.0 - ScriptErrorsAsChat + RenderFastAlpha Comment - Display script errors and warning in chat history + Use lossy alpha rendering optimization (opaque/nonexistent small alpha faces). Persist 1 Type @@ -7960,10 +5670,10 @@ Value 0 - ScriptHelpFollowsCursor + RenderFastUI Comment - Scripting help window updates contents based on script editor contents under text cursor + [NOT USED] Persist 1 Type @@ -7971,159 +5681,153 @@ Value 0 - SearchURLDefault + RenderFlexTimeFactor Comment - URL to load for empty searches + Controls level of detail of flexible objects (multiplier for amount of time spent processing flex objects) Persist 1 - HideFromEditor - 1 Type - String + F32 Value - http://search.secondlife.com/client_search.php? + 1.0 - SearchURLQuery + RenderFogRatio Comment - URL to use for searches + Distance from camera where fog reaches maximum density (fraction or multiple of far clip distance) Persist 1 - HideFromEditor - 1 Type - String + F32 Value - http://search.secondlife.com/client_search.php?q=[QUERY]&s=[COLLECTION]& + 4.0 - SearchURLSuffix2 + RenderGamma Comment - Parameters added to end of search queries + Sets gamma exponent for renderer Persist 1 - HideFromEditor - 1 Type - String + F32 Value - lang=[LANG]&mat=[MATURITY]&t=[TEEN]&region=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION] + 0.0 - SelectMovableOnly + RenderGammaFull Comment - Select only objects you can move + Use fully controllable gamma correction, instead of faster, hard-coded gamma correction of 2. Persist 1 Type Boolean Value - 0 + 1.0 - SelectOwnedOnly + RenderGlow Comment - Select only objects you own + Render bloom post effect. Persist 1 Type Boolean Value - 0 + 1 - SelectionHighlightAlpha + RenderGlowIterations Comment - Opacity of selection highlight (0.0 = completely transparent, 1.0 = completely opaque) + Number of times to iterate the glow (higher = wider and smoother but slower) Persist 1 Type - F32 + S32 Value - 0.40000000596 + 2 - SelectionHighlightAlphaTest + RenderGlowMaxExtractAlpha Comment - Alpha value below which pixels are displayed on selection highlight line (0.0 = show all pixels, 1.0 = show now pixels) + Max glow alpha value for brightness extraction to auto-glow. Persist 1 Type F32 Value - 0.1 + 0.065 - SelectionHighlightThickness + RenderGlowMinLuminance Comment - Thickness of selection highlight line (fraction of view distance) + Min luminance intensity necessary to consider an object bright enough to automatically glow. Persist 1 Type F32 Value - 0.00999999977648 + 2.5 - SelectionHighlightUAnim + RenderGlowResolutionPow Comment - Rate at which texture animates along U direction in selection highlight line (fraction of texture per second) + Glow map resolution power of two. Persist 1 Type - F32 + S32 Value - 0.0 + 9 - SelectionHighlightUScale + RenderGlowStrength Comment - Scale of texture display on selection highlight line (fraction of texture size) + Additive strength of glow. Persist 1 Type F32 Value - 0.1 + 0.35 - SelectionHighlightVAnim + RenderGlowWarmthAmount Comment - Rate at which texture animates along V direction in selection highlight line (fraction of texture per second) + Amount of warmth extraction to use (versus luminance extraction). 0 = lum, 1.0 = warmth Persist 1 Type F32 Value - 0.5 + 0.0 - SelectionHighlightVScale + RenderGlowWidth Comment - Scale of texture display on selection highlight line (fraction of texture size) + Glow sample size (higher = wider and softer but eventually more pixelated) Persist 1 Type F32 Value - 1.0 + 1.3 - ServerChoice + RenderGround Comment - [DO NOT MODIFY] Controls which grid you connect to + Determines whether we can render the ground pool or not Persist 1 Type - S32 + Boolean Value - 0 + 1 - ShareWithGroup + RenderHUDInSnapshot Comment - Newly created objects are shared with the currently active group + Display HUD attachments in snapshot Persist 1 Type @@ -8131,10 +5835,10 @@ Value 0 - ShowActiveSpeakers + RenderHUDParticles Comment - Display active speakers list on login + Display particle systems in HUD attachments (experimental) Persist 1 Type @@ -8142,21 +5846,21 @@ Value 0 - ShowAllObjectHoverTip + RenderHiddenSelections Comment - Show descriptive tooltip when mouse hovers over non-interactive and interactive objects. + Show selection lines on objects that are behind other objects Persist 1 Type Boolean Value - 0 + 1 - ShowAxes + RenderHideGroupTitle Comment - Render coordinate frame at your position + Don't show my group title in my name label Persist 1 Type @@ -8164,76 +5868,109 @@ Value 0 - ShowBanLines + RenderHideGroupTitleAll Comment - Show in-world ban/access borders + Show group titles in name labels Persist 1 Type Boolean Value - 1 + 0 - ShowCameraControls + RenderInitError Comment - Display camera controls on login + Error occured while initializing GL Persist 1 Type Boolean Value - 1 + 0 - ShowChatHistory + RenderLightRadius Comment - + Render the radius of selected lights Persist - 0 + 1 Type Boolean Value 0 - ShowCommunicate + RenderLightingDetail Comment - + Amount of detail for lighting objects/avatars/terrain (0=sun/moon only, 1=enable local lights) Persist - 0 + 1 Type - Boolean + S32 Value - 0 + 1 - ShowConsoleWindow + RenderMaxPartCount Comment - Show log in separate OS window + Maximum number of particles to display on screen Persist 1 Type - Boolean + S32 Value - 0 + 4096 - ShowCrosshairs + RenderMaxNodeSize + + Comment + Maximum size of a single node's vertex data (in KB). + Persist + 1 + Type + S32 + Value + 4096 + + RenderMaxVBOSize Comment - Display crosshairs when in mouselook mode + Maximum size of a vertex buffer (in KB). Persist 1 Type - Boolean + S32 + Value + 512 + + RenderName + + Comment + Controls display of names above avatars (0 = never, 1 = fade, 2 = always) + Persist + 1 + Type + S32 Value + 2 + + RenderNameFadeDuration + + Comment + Time interval over which to fade avatar names (seconds) + Persist 1 + Type + F32 + Value + 1.0 - ShowDebugConsole + RenderNameHideSelf Comment - Show log in SL window + Don't display own name above avatar Persist 1 Type @@ -8241,376 +5978,340 @@ Value 0 - ShowDebugStats + RenderNameShowTime Comment - Show performance stats display + Fade avatar names after specified time (seconds) Persist 1 Type - Boolean + F32 Value - 0 + 10.0 - ShowDirectory + RenderObjectBump Comment - + Show bumpmapping on primitives Persist - 0 + 1 Type Boolean Value - 0 + 1 - ShowEmptyFoldersWhenSearching + RenderQualityPerformance Comment - Shows folders that do not have any visible contents when applying a filter to inventory + Which graphics settings you've chosen Persist 1 Type - Boolean + U32 Value - 0 + 1 - ShowHoverTips + RenderReflectionDetail Comment - Show descriptive tooltip when mouse hovers over items in world + Detail of reflection render pass. Persist 1 Type - Boolean + S32 Value + 2 + + RenderReflectionRes + + Comment + Reflection map resolution. + Persist 1 + Type + S32 + Value + 64 - ShowInventory + RenderResolutionDivisor Comment - Open inventory window on login + Divisor for rendering 3D scene at reduced resolution. Persist 1 Type - Boolean + U32 Value - 0 + 1 - ShowLandHoverTip + RenderShaderLightingMaxLevel Comment - Show descriptive tooltip when mouse hovers over land + Max lighting level to use in the shader (class 3 is default, 2 is less lights, 1 is sun/moon only. Works around shader compiler bugs on certain platforms.) Persist 1 Type - Boolean + S32 Value - 0 + 3 - ShowLeaders + RenderShaderLODThreshold Comment - + Fraction of draw distance defining the switch to a different shader LOD Persist - 0 + 1 Type - Boolean + F32 Value - 0 + 1.0 - ShowPGSearchAll + RenderShaderParticleThreshold Comment - Display results of search All that are flagged as PG + Fraction of draw distance to not use shader on particles Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 1 + 0.25 - ShowMatureSearchAll + RenderSunDynamicRange Comment - Display results of search All that are flagged as mature + Defines what percent brighter the sun is than local point lights (1.0 = 100% brighter. Value should not be less than 0. ). Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 0 + 1.0 - ShowAdultSearchAll + RenderTerrainDetail Comment - Display results of search All that are flagged as adult + Detail applied to terrain texturing (0 = none, 1 or 2 = full) Persist 1 - HideFromEditor - 1 Type - Boolean + S32 Value - 0 + 2 - ShowPGGroups + RenderTerrainLODFactor Comment - Display results of find groups that are flagged as PG + Controls level of detail of terrain (multiplier for current screen area when calculated level of detail) Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 1 + 1.0 - ShowMatureGroups + RenderTerrainScale Comment - Display results of find groups that are flagged as mature + Terrain detail texture scale Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 0 + 12.0 - ShowAdultGroups + RenderTextureMemoryMultiple Comment - Display results of find groups that are flagged as adult + Multiple of texture memory value to use (should fit: 0 < value <= 1.0) Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 0 + 1.0 - ShowPGClassifieds + RenderTreeLODFactor Comment - Display results of find classifieds that are flagged as PG + Controls level of detail of vegetation (multiplier for current screen area when calculated level of detail) Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 1 + 0.5 - ShowMatureClassifieds + RenderUIInSnapshot Comment - Display results of find classifieds that are flagged as mature + Display user interface in snapshot Persist 1 - HideFromEditor - 1 Type Boolean Value 0 - ShowAdultClassifieds + RenderUnloadedAvatar Comment - Display results of find classifieds that are flagged as adult + Show avatars which haven't finished loading Persist 1 - HideFromEditor - 1 Type Boolean Value 0 - ShowPGEvents + RenderUseFBO Comment - Display results of find events that are flagged as PG + Whether we want to use GL_EXT_framebuffer_objects. Persist 1 - HideFromEditor - 1 Type Boolean Value - 1 + 0 - ShowMatureEvents + RenderUseFarClip Comment - Display results of find events that are flagged as mature + If false, frustum culling will ignore far clip plane. Persist 1 - HideFromEditor - 1 Type Boolean Value - 0 + 1 - ShowAdultEvents + RenderUseImpostors Comment - Display results of find events that are flagged as adult + Whether we want to use impostors for far away avatars. Persist 1 - HideFromEditor - 1 Type Boolean Value - 0 + 1 - ShowPGLand + RenderUseShaderLOD Comment - Display results of find land sales that are flagged as PG + Whether we want to have different shaders for LOD Persist 1 - HideFromEditor - 1 Type Boolean Value 1 - ShowMatureLand + RenderUseShaderNearParticles Comment - Display results of find land sales that are flagged as mature + Whether we want to use shaders on near particles Persist 1 - HideFromEditor - 1 Type Boolean Value 0 - ShowAdultLand + RenderVBOEnable Comment - Display results of find land sales that are flagged as adult + Use GL Vertex Buffer Objects Persist 1 - HideFromEditor - 1 Type Boolean Value - 0 + 1 - ShowPGSims + RenderVolumeLODFactor Comment - Display results of find places or find popular that are in PG sims + Controls level of detail of primitives (multiplier for current screen area when calculated level of detail) Persist 1 - HideFromEditor - 1 Type - Boolean + F32 Value - 1 + 1.0 - ShowMatureSims + RenderWater Comment - Display results of find places or find popular that are in mature sims + Display water Persist 1 - HideFromEditor - 1 Type Boolean Value - 0 + 1 - ShowAdultSims + RenderWaterMipNormal Comment - Display results of find places or find popular that are in adult sims + Use mip maps for water normal map. Persist 1 - HideFromEditor - 1 Type Boolean Value - 0 + 1 - ShowMiniMap + RenderWaterRefResolution Comment - Display mini map on login + Water planar reflection resolution. Persist 1 Type - Boolean + S32 Value - 0 + 512 - ShowMovementControls + RenderWaterReflections Comment - Display movement controls on login + Reflect the environment in the water. Persist 1 Type Boolean Value - 1 + 0 - ShowNearClip + RotateRight Comment - + Make the agent rotate to its right. Persist - 0 + 1 Type Boolean Value 0 - ShowNewInventory + RotationStep Comment - Automatically views new notecards/textures/landmarks + All rotations via rotation tool are constrained to multiples of this unit (degrees) Persist 1 Type - Boolean + F32 Value - 1 + 1.0 - ShowInInventory - - Comment - Automatically opens inventory to show accepted objects - Persist - 1 - Type - Boolean - Value - 1 - - ShowObjectUpdates + RunBtnState Comment - Show when update messages are received for individual objects + Persist 0 Type @@ -8618,10 +6319,10 @@ Value 0 - ShowOverlayTitle + RunMultipleThreads Comment - Prints watermark text message on screen + If TRUE keep background threads active during render Persist 1 Type @@ -8629,32 +6330,32 @@ Value 0 - ShowParcelOwners + SafeMode Comment - + Reset preferences, run in safe mode. Persist - 0 + 1 Type Boolean Value 0 - ShowPermissions + SaveMinidump Comment - + Save minidump for developer debugging on crash Persist - 0 + 1 Type Boolean Value - 0 + 1 - ShowPropertyLines + ScaleShowAxes Comment - Show line overlay demarking property boundaries + Show indicator of selected scale axis when scaling Persist 1 Type @@ -8662,10 +6363,10 @@ Value 0 - ShowSearchBar + ScaleStretchTextures Comment - Show the Search Bar in the Status Overlay + Stretch textures along with object when scaling Persist 1 Type @@ -8673,21 +6374,21 @@ Value 1 - ShowSelectionBeam + ScaleUniform Comment - Show selection particle beam when selecting or interacting with objects. + Scale selected objects evenly about center of selection Persist 1 Type Boolean Value - 1 + 0 - ShowStartLocation + ScriptErrorsAsChat Comment - Display starting location menu on login screen + Display script errors and warning in chat history Persist 1 Type @@ -8695,10 +6396,10 @@ Value 0 - ShowTangentBasis + ScriptHelpFollowsCursor Comment - Render normal and binormal (debugging bump mapping) + Scripting help window updates contents based on script editor contents under text cursor Persist 1 Type @@ -8706,54 +6407,49 @@ Value 0 - ShowToolBar + SearchURLDefault Comment - Show toolbar at bottom of screen + URL to load for empty searches Persist 1 + HideFromEditor + 1 Type - Boolean + String Value - 1 + http://search.secondlife.com/client_search.php? - ShowTools + SearchURLQuery Comment - + URL to use for searches Persist - 0 + 1 + HideFromEditor + 1 Type - Boolean + String Value - 0 + http://search.secondlife.com/client_search.php?q=[QUERY]&s=[COLLECTION]& - ShowTutorial - - Comment - Show tutorial window on login - Persist - 1 - Type - Boolean - Value - 0 - - ShowVoiceChannelPopup + SearchURLSuffix2 Comment - Controls visibility of the current voice channel popup above the voice tab + Parameters added to end of search queries Persist 1 + HideFromEditor + 1 Type - Boolean + String Value - 0 + lang=[LANG]&mat=[MATURITY]&t=[TEEN]&region=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION] - ShowVolumeSettingsPopup + SelectMovableOnly Comment - Show individual volume slider for voice, sound effects, etc + Select only objects you can move Persist 1 Type @@ -8761,10 +6457,10 @@ Value 0 - ShowWorldMap + SelectOwnedOnly Comment - Display world map on login + Select only objects you own Persist 1 Type @@ -8772,160 +6468,142 @@ Value 0 - ShowXUINames + SelectionHighlightAlpha Comment - Display XUI Names as Tooltips + Opacity of selection highlight (0.0 = completely transparent, 1.0 = completely opaque) Persist 1 Type - Boolean + F32 Value - 0 + 0.40000000596 - SitBtnState + SelectionHighlightAlphaTest Comment - + Alpha value below which pixels are displayed on selection highlight line (0.0 = show all pixels, 1.0 = show now pixels) Persist - 0 + 1 Type - Boolean + F32 Value - 0 + 0.1 - SkinCurrent + SelectionHighlightThickness Comment - The currently selected skin. + Thickness of selection highlight line (fraction of view distance) Persist 1 Type - String + F32 Value - default + 0.00999999977648 - SkyAmbientScale + SelectionHighlightUAnim Comment - Controls strength of ambient, or non-directional light from the sun and moon (fraction or multiple of default ambient level) + Rate at which texture animates along U direction in selection highlight line (fraction of texture per second) Persist 1 Type F32 Value - 0.300000011921 + 0.0 - SkyEditPresets + SelectionHighlightUScale Comment - Whether to be able to edit the sky defaults or not + Scale of texture display on selection highlight line (fraction of texture size) Persist 1 Type - Boolean + F32 Value - 0 + 0.1 - SkyNightColorShift + SelectionHighlightVAnim Comment - Controls moonlight color (base color applied to moon as light source) + Rate at which texture animates along V direction in selection highlight line (fraction of texture per second) Persist 1 Type - Color3 + F32 Value - - 0.699999988079 - 0.699999988079 - 1.0 - + 0.5 - SkyOverrideSimSunPosition + SelectionHighlightVScale Comment - + Scale of texture display on selection highlight line (fraction of texture size) Persist - 0 + 1 Type - Boolean + F32 Value - 0 + 1.0 - SkySunDefaultPosition + ServerChoice Comment - Default position of sun in sky (direction in world coordinates) + [DO NOT MODIFY] Controls which grid you connect to Persist 1 Type - Vector3 + S32 Value - - 1.0 - 0.0 - 0.1 - + 0 - SkyUseClassicClouds + ShareWithGroup Comment - Whether to use the old Second Life particle clouds or not + Newly created objects are shared with the currently active group Persist 1 Type Boolean Value - 1 + 0 - SlideLeftBtnRect + ShowActiveSpeakers Comment - + Display active speakers list on login Persist - 0 + 1 Type - Rect + Boolean Value - - 20 - 54 - 45 - 29 - + 0 - SlideRightBtnRect + ShowAllObjectHoverTip Comment - + Show descriptive tooltip when mouse hovers over non-interactive and interactive objects. Persist - 0 + 1 Type - Rect + Boolean Value - - 66 - 54 - 91 - 29 - + 0 - SmallAvatarNames + ShowAxes Comment - Display avatar name text in smaller font + Render coordinate frame at your position Persist 1 Type Boolean Value - 1 + 0 - SnapEnabled + ShowBanLines Comment - Enable snapping to grid + Show in-world ban/access borders Persist 1 Type @@ -8933,21 +6611,21 @@ Value 1 - SnapMargin + ShowCameraControls Comment - Controls maximum distance between windows before they auto-snap together (pixels) + Display camera controls on login Persist 1 Type - S32 + Boolean Value - 10 + 1 - SnapToMouseCursor + ShowConsoleWindow Comment - When snapping to grid, center object on nearest grid point to mouse cursor + Show log in separate OS window Persist 1 Type @@ -8955,81 +6633,65 @@ Value 0 - SnapshotFormat + ShowCrosshairs Comment - Save snapshots in this format (0 = PNG, 1 = JPEG, 2 = BMP) + Display crosshairs when in mouselook mode Persist 1 Type - S32 + Boolean Value - 0 - - SnapshotLocalLastResolution - - Comment - Take next local snapshot at this resolution - Persist 1 - Type - S32 - Value - 0 - SnapshotPostcardLastResolution + ShowDebugConsole Comment - Take next postcard snapshot at this resolution + Show log in SL window Persist 1 Type - S32 + Boolean Value 0 - SnapshotQuality + ShowDirectory Comment - Quality setting of postcard JPEGs (0 = worst, 100 = best) + Persist - 1 + 0 Type - S32 + Boolean Value - 75 + 0 - SnapshotTextureLastResolution + ShowEmptyFoldersWhenSearching Comment - Take next texture snapshot at this resolution + Shows folders that do not have any visible contents when applying a filter to inventory Persist 1 Type - S32 + Boolean Value 0 - SpeakingColor + ShowHoverTips Comment - Color of various indicators when resident is speaking on a voice channel. + Show descriptive tooltip when mouse hovers over items in world Persist 1 Type - Color4 + Boolean Value - - 0.0 - 1.0 - 0.0 - 1.0 - + 1 - SpeedTest + ShowLandHoverTip Comment - Performance testing mode, no network + Show descriptive tooltip when mouse hovers over land Persist 1 Type @@ -9037,359 +6699,376 @@ Value 0 - StatsAutoRun + ShowLeaders Comment - Play back autopilot + Persist - 1 + 0 Type Boolean Value 0 - StatsFile + ShowPGSearchAll Comment - Filename for stats logging output + Display results of search All that are flagged as PG Persist 1 + HideFromEditor + 1 Type - String + Boolean Value - fs.txt + 1 - StatsNumRuns + ShowMatureSearchAll Comment - Loop autopilot playback this number of times + Display results of search All that are flagged as mature Persist 1 + HideFromEditor + 1 Type - S32 + Boolean Value - -1 + 0 - StatsPilotFile + ShowAdultSearchAll Comment - Filename for stats logging autopilot path + Display results of search All that are flagged as adult Persist 1 + HideFromEditor + 1 Type - String + Boolean Value - pilot.txt + 0 - StatsQuitAfterRuns + ShowPGGroups Comment - Quit application after this number of autopilot playback runs + Display results of find groups that are flagged as PG Persist 1 + HideFromEditor + 1 Type Boolean Value - 0 + 1 - StatsSessionTrackFrameStats + ShowMatureGroups Comment - Track rendering and network statistics + Display results of find groups that are flagged as mature Persist 1 + HideFromEditor + 1 Type Boolean Value 0 - StatsSummaryFile + ShowAdultGroups Comment - Filename for stats logging summary + Display results of find groups that are flagged as adult Persist 1 + HideFromEditor + 1 Type - String + Boolean Value - fss.txt + 0 - StatusBarHeight + ShowPGClassifieds Comment - Height of menu/status bar at top of screen (pixels) + Display results of find classifieds that are flagged as PG Persist 1 + HideFromEditor + 1 Type - S32 + Boolean Value - 26 + 1 - StatusBarPad + ShowMatureClassifieds Comment - Spacing between popup buttons at bottom of screen (Stand up, Release Controls) + Display results of find classifieds that are flagged as mature Persist 1 + HideFromEditor + 1 Type - S32 + Boolean Value - 10 + 0 - SystemChatColor + ShowAdultClassifieds Comment - Color of chat messages from SL System + Display results of find classifieds that are flagged as adult Persist 1 + HideFromEditor + 1 Type - Color4 + Boolean Value - - 0.800000011921 - 1.0 - 1.0 - 1.0 - + 0 - SystemLanguage + ShowPGEvents Comment - Language indicated by system settings (for UI) + Display results of find events that are flagged as PG Persist 1 + HideFromEditor + 1 Type - String + Boolean Value - en-us + 1 - TabToTextFieldsOnly + ShowMatureEvents Comment - TAB key takes you to next text entry field, instead of next widget + Display results of find events that are flagged as mature Persist 1 + HideFromEditor + 1 Type Boolean Value 0 - TerrainColorHeightRange + ShowAdultEvents Comment - Altitude range over which a given terrain texture has effect (meters) + Display results of find events that are flagged as adult Persist 1 + HideFromEditor + 1 Type - F32 + Boolean Value - 60.0 + 0 - TerrainColorStartHeight + ShowPGLand Comment - Starting altitude for terrain texturing (meters) + Display results of find land sales that are flagged as PG Persist 1 + HideFromEditor + 1 Type - F32 + Boolean Value - 20.0 + 1 - TextureMemory + ShowMatureLand Comment - Amount of memory to use for textures in MB (0 = autodetect) + Display results of find land sales that are flagged as mature Persist 1 + HideFromEditor + 1 Type - S32 + Boolean Value 0 - TexturePickerRect + ShowAdultLand Comment - Rectangle for texture picker + Display results of find land sales that are flagged as adult Persist 1 + HideFromEditor + 1 Type - Rect + Boolean Value - - 0 - 290 - 350 - 0 - + 0 - TexturePickerShowFolders + ShowPGSims Comment - Show folders with no texures in texture picker + Display results of find places or find popular that are in PG sims Persist 1 + HideFromEditor + 1 Type Boolean Value 1 - TexturePickerSortOrder + ShowMatureSims Comment - Specifies sort key for textures in texture picker (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) + Display results of find places or find popular that are in mature sims Persist 1 + HideFromEditor + 1 Type - U32 + Boolean Value - 2 + 0 - ThirdPersonBtnState + ShowAdultSims Comment - + Display results of find places or find popular that are in adult sims Persist - 0 + 1 + HideFromEditor + 1 Type Boolean Value - 1 + 0 - ThrottleBandwidthKBPS + ShowMovementControls Comment - Maximum allowable downstream bandwidth (kilo bits per second) + Display movement controls on login Persist 1 Type - F32 + Boolean Value - 500.0 + 1 - ToolHelpRect + ShowNearClip Comment Persist 0 Type - Rect + Boolean Value - - 8 - 178 - 75 - 162 - + 0 - ToolTipDelay + ShowNewInventory Comment - Seconds before displaying tooltip when mouse stops over UI element + Automatically views new notecards/textures/landmarks Persist 1 Type - F32 + Boolean Value - 0.699999988079 + 1 - ToolboxAutoMove + ShowInInventory + + Comment + Automatically opens inventory to show accepted objects + Persist + 1 + Type + Boolean + Value + 1 + + ShowObjectUpdates Comment - [NOT USED] + Show when update messages are received for individual objects Persist - 1 + 0 Type Boolean Value 0 - ToolboxRect + ShowOverlayTitle Comment - Rectangle for tools window + Prints watermark text message on screen Persist 1 Type - Rect + Boolean Value - - 0 - 100 - 100 - 100 - + 0 - TrackFocusObject + ShowParcelOwners Comment - Camera tracks last object zoomed on + Persist - 1 + 0 Type Boolean Value - 1 + 0 - TurnLeftBtnRect + ShowPermissions Comment Persist 0 Type - Rect + Boolean Value - - 20 - 29 - 45 - 4 - + 0 - TurnRightBtnRect + ShowPropertyLines Comment - + Show line overlay demarking property boundaries Persist - 0 + 1 Type - Rect + Boolean Value - - 66 - 29 - 91 - 4 - + 0 - TutorialURL + ShowSearchBar Comment - URL for tutorial menu item, set automatically during login + Show the Search Bar in the Status Overlay Persist - 0 + 1 Type - String + Boolean Value - + 0 - TypeAheadTimeout + ShowNetStats Comment - Time delay before clearing type-ahead buffer in lists (seconds) + Show the Search Bar in the Status Overlay Persist 1 Type - F32 + Boolean Value - 1.5 + 0 - UIAutoScale + ShowSelectionBeam Comment - Keep UI scale consistent across different resolutions + Show selection particle beam when selecting or interacting with objects. Persist 1 Type @@ -9397,10 +7076,10 @@ Value 1 - UIFloaterTestBool + ShowStartLocation Comment - Example saved setting for the test floater + Display starting location menu on login screen Persist 1 Type @@ -9408,720 +7087,724 @@ Value 0 - UIImgBtnCloseActiveUUID + ShowTangentBasis Comment - + Render normal and binormal (debugging bump mapping) Persist - 0 + 1 Type - String + Boolean Value - 47a8c844-cd2a-4b1a-be01-df8b1612fe5d - - UIImgBtnCloseInactiveUUID - - Comment - - Persist 0 - Type - String - Value - 779e4fa3-9b13-f74a-fba9-3886fe9c86ba - UIImgBtnClosePressedUUID + ShowToolBar Comment - + Show toolbar at bottom of screen Persist - 0 + 1 Type - String + Boolean Value - e5821134-23c0-4bd0-af06-7fa95b9fb01a + 1 - UIImgBtnForwardInUUID + ShowTools Comment Persist 0 Type - String + Boolean Value - 54197a61-f5d1-4c29-95d2-c071d08849cb + 0 - UIImgBtnForwardOutUUID + ShowTutorial + + Comment + Show tutorial window on login + Persist + 1 + Type + Boolean + Value + 0 + + ShowVoiceChannelPopup Comment - + Controls visibility of the current voice channel popup above the voice tab Persist - 0 + 1 Type - String + Boolean Value - a0eb4021-1b20-4a53-892d-8faa9265a6f5 + 0 - UIImgBtnJumpLeftInUUID + ShowVolumeSettingsPopup Comment - + Show individual volume slider for voice, sound effects, etc Persist - 0 + 1 Type - String + Boolean Value - 9cad3e6d-2d6d-107d-f8ab-5ba272b5bfe1 + 0 - UIImgBtnJumpLeftOutUUID + ShowXUINames Comment - + Display XUI Names as Tooltips Persist 0 Type - String + Boolean Value - 3c18c87e-5f50-14e2-e744-f44734aa365f + 0 - UIImgBtnJumpRightInUUID + SitBtnState Comment Persist 0 Type - String + Boolean Value - 7dabc040-ec13-2309-ddf7-4f161f6de2f4 + 0 - UIImgBtnJumpRightOutUUID + SkinCurrent Comment - + The currently selected skin. Persist - 0 + 1 Type String Value - ff9a71eb-7414-4cf8-866e-a701deb7c3cf + default - UIImgBtnLeftInUUID + SkinningSettingsFile Comment - + Client skin color setting file name (per install). Persist 0 Type String Value - 95463c78-aaa6-464d-892d-3a805b6bb7bf + - UIImgBtnLeftOutUUID + SkyAmbientScale Comment - + Controls strength of ambient, or non-directional light from the sun and moon (fraction or multiple of default ambient level) Persist - 0 + 1 Type - String + F32 Value - 13a93910-6b44-45eb-ad3a-4d1324c59bac + 0.300000011921 - UIImgBtnMinimizeActiveUUID + SkyEditPresets Comment - + Whether to be able to edit the sky defaults or not Persist - 0 + 1 Type - String + Boolean Value - 34c9398d-bb78-4643-9633-46a2fa3e9637 + 0 - UIImgBtnMinimizeInactiveUUID + SkyOverrideSimSunPosition Comment Persist 0 Type - String + Boolean Value - 6e72abba-1378-437f-bf7a-f0c15f3e99a3 + 0 - UIImgBtnMinimizePressedUUID + SkySunDefaultPosition Comment - + Default position of sun in sky (direction in world coordinates) Persist - 0 + 1 Type - String + Vector3 Value - 39801651-26cb-4926-af57-7af9352c273c + + 1.0 + 0.0 + 0.1 + - UIImgBtnMoveDownInUUID + SkyUseClassicClouds Comment - + Whether to use the old Second Life particle clouds or not Persist - 0 + 1 Type - String + Boolean Value - b92a70b9-c841-4c94-b4b3-cee9eb460d48 + 1 - UIImgBtnMoveDownOutUUID + SmallAvatarNames Comment - + Display avatar name text in smaller font Persist - 0 + 1 Type - String + Boolean Value - b5abc9fa-9e62-4e03-bc33-82c4c1b6b689 + 1 - UIImgBtnMoveUpInUUID + SnapEnabled Comment - + Enable snapping to grid Persist - 0 + 1 Type - String + Boolean Value - 49b4b357-e430-4b56-b9e0-05b8759c3c82 + 1 - UIImgBtnMoveUpOutUUID + SnapMargin Comment - + Controls maximum distance between windows before they auto-snap together (pixels) Persist - 0 + 1 Type - String + S32 Value - f887146d-829f-4e39-9211-cf872b78f97c + 10 - UIImgBtnPanDownInUUID + SnapToMouseCursor Comment - + When snapping to grid, center object on nearest grid point to mouse cursor Persist - 0 + 1 Type - String + Boolean Value - e5821134-23c0-4bd0-af06-7fa95b9fb01a + 0 - UIImgBtnPanDownOutUUID + SnapshotFormat Comment - + Save snapshots in this format (0 = PNG, 1 = JPEG, 2 = BMP) Persist - 0 + 1 Type - String + S32 Value - 47a8c844-cd2a-4b1a-be01-df8b1612fe5d - - UIImgBtnPanLeftInUUID + 0 + + SnapshotLocalLastResolution Comment - + Take next local snapshot at this resolution Persist - 0 + 1 Type - String + S32 Value - e5821134-23c0-4bd0-af06-7fa95b9fb01a + 0 - UIImgBtnPanLeftOutUUID + SnapshotPostcardLastResolution Comment - + Take next postcard snapshot at this resolution Persist - 0 + 1 Type - String + S32 Value - 47a8c844-cd2a-4b1a-be01-df8b1612fe5d + 0 - UIImgBtnPanRightInUUID + SnapshotQuality Comment - + Quality setting of postcard JPEGs (0 = worst, 100 = best) Persist - 0 + 1 Type - String + S32 Value - e5821134-23c0-4bd0-af06-7fa95b9fb01a + 75 - UIImgBtnPanRightOutUUID + SnapshotTextureLastResolution Comment - + Take next texture snapshot at this resolution Persist - 0 + 1 Type - String + S32 Value - 47a8c844-cd2a-4b1a-be01-df8b1612fe5d + 0 - UIImgBtnPanUpInUUID + SpeedTest Comment - + Performance testing mode, no network Persist - 0 + 1 Type - String + Boolean Value - e5821134-23c0-4bd0-af06-7fa95b9fb01a + 0 - UIImgBtnPanUpOutUUID + StatsAutoRun Comment - + Play back autopilot Persist - 0 + 1 Type - String + Boolean Value - 47a8c844-cd2a-4b1a-be01-df8b1612fe5d + 0 - UIImgBtnRestoreActiveUUID + StatsFile Comment - + Filename for stats logging output Persist - 0 + 1 Type String Value - 111b39de-8928-4690-b7b2-e17d5c960277 + fs.txt - UIImgBtnRestoreInactiveUUID + StatsNumRuns Comment - + Loop autopilot playback this number of times Persist - 0 + 1 Type - String + S32 Value - 0eafa471-70af-4882-b8c1-40a310929744 + -1 - UIImgBtnRestorePressedUUID + StatsPilotFile Comment - + Filename for stats logging autopilot path Persist - 0 + 1 Type String Value - 90a0ed5c-2e7b-4845-9958-a64a1b30f312 + pilot.txt - UIImgBtnRightInUUID + StatsQuitAfterRuns Comment - + Quit application after this number of autopilot playback runs Persist - 0 + 1 Type - String + Boolean Value - 5e616d0d-4335-476f-9977-560bccd009da + 0 - UIImgBtnRightOutUUID + StatsSessionTrackFrameStats Comment - + Track rendering and network statistics Persist - 0 + 1 Type - String + Boolean Value - 5a44fd04-f52b-4c30-8b00-4a31e27614bd + 0 - UIImgBtnScrollDownInUUID + StatsSummaryFile Comment - + Filename for stats logging summary Persist - 0 + 1 Type String Value - d2421bab-2eaf-4863-b8f6-5e4c52519247 + fss.txt - UIImgBtnScrollDownOutUUID + SystemLanguage Comment - + Language indicated by system settings (for UI) Persist - 0 + 1 Type String Value - b4ecdecf-5c8d-44e7-b882-17a77e88ed55 + en - UIImgBtnScrollLeftInUUID + TabToTextFieldsOnly Comment - + TAB key takes you to next text entry field, instead of next widget Persist - 0 + 1 Type - String + Boolean Value - ea137a32-6718-4d05-9c22-7d570d27b2cd + 0 - UIImgBtnScrollLeftOutUUID + TerrainColorHeightRange Comment - + Altitude range over which a given terrain texture has effect (meters) Persist - 0 + 1 Type - String + F32 Value - 43773e8d-49aa-48e0-80f3-a04715f4677a + 60.0 - UIImgBtnScrollRightInUUID + TerrainColorStartHeight Comment - + Starting altitude for terrain texturing (meters) Persist - 0 + 1 Type - String + F32 Value - b749de64-e903-4c3c-ac0b-25fb6fa39cb5 + 20.0 - UIImgBtnScrollRightOutUUID + TextureMemory Comment - + Amount of memory to use for textures in MB (0 = autodetect) Persist - 0 + 1 Type - String + S32 Value - 3d700d19-e708-465d-87f2-46c8c0ee7938 + 0 - UIImgBtnScrollUpInUUID + TexturePickerShowFolders Comment - + Show folders with no texures in texture picker Persist - 0 + 1 Type - String + Boolean Value - a93abdf3-27b5-4e22-a8fa-c48216cd2e3a + 1 - UIImgBtnScrollUpOutUUID + TexturePickerSortOrder Comment - + Specifies sort key for textures in texture picker (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) Persist - 0 + 1 Type - String + U32 Value - dad084d7-9a46-452a-b0ff-4b9f1cefdde9 + 2 - UIImgBtnSlideLeftInUUID + ThirdPersonBtnState Comment Persist 0 Type - String + Boolean Value - 724996f5-b956-46f6-9844-4fcfce1d5e83 + 1 - UIImgBtnSlideLeftOutUUID + ThrottleBandwidthKBPS Comment - + Maximum allowable downstream bandwidth (kilo bits per second) Persist - 0 + 1 Type - String + F32 Value - 82476321-0374-4c26-9567-521535ab4cd7 + 500.0 - UIImgBtnSlideRightInUUID + ToolTipDelay Comment - + Seconds before displaying tooltip when mouse stops over UI element Persist - 0 + 1 Type - String + F32 Value - 7eeb57d2-3f37-454d-a729-8b217b8be443 + 0.699999988079 - UIImgBtnSlideRightOutUUID + ToolboxAutoMove Comment - + [NOT USED] Persist - 0 + 1 Type - String + Boolean Value - 1fbe4e60-0607-44d1-a50a-032eff56ae75 + 0 - UIImgBtnSpinDownInUUID + TrackFocusObject Comment - + Camera tracks last object zoomed on Persist - 0 + 1 Type - String + Boolean Value - a985ac71-052f-48e6-9c33-d931c813ac92 + 1 - UIImgBtnSpinDownOutUUID + TutorialURL Comment - + URL for tutorial menu item, set automatically during login Persist 0 Type String Value - b6d240dd-5602-426f-b606-bbb49a30726d + - UIImgBtnSpinUpInUUID + TypeAheadTimeout Comment - + Time delay before clearing type-ahead buffer in lists (seconds) Persist - 0 + 1 Type - String + F32 Value - c8450082-96a0-4319-8090-d3ff900b4954 + 1.5 - UIImgBtnSpinUpOutUUID + UIAutoScale Comment - + Keep UI scale consistent across different resolutions Persist - 0 + 1 Type - String + Boolean Value - 56576e6e-6710-4e66-89f9-471b59122794 + 1 - UIImgBtnTabBottomInUUID + UIAvatariconctrlSymbolHPad Comment - + UI Avatar Icon Control Symbol Horizontal Pad Persist - 0 + 1 Type - String + S32 Value - c001d8fd-a869-4b6f-86a1-fdcb106df9c7 - - UIImgBtnTabBottomOutUUID + 2 + + UIAvatariconctrlSymbolVPad Comment - + UI Avatar Icon Control Symbol Vertical Pad Persist - 0 + 1 Type - String + S32 Value - bf0a8779-689b-48c3-bb9a-6af546366ef4 - - UIImgBtnTabBottomPartialInUUID + 2 + + UIAvatariconctrlSymbolSize Comment - + UI Avatar Icon Control Symbol Size Persist - 0 + 1 Type - String + S32 Value - eb0b0904-8c91-4f24-b500-1180b91140de - - UIImgBtnTabBottomPartialOutUUID + 5 + + UIAvatariconctrlSymbolPosition Comment - + UI Avatar Icon Control Symbol Position (TopLeft|TopRight|BottomLeft|BottomRight) Persist - 0 + 1 Type String Value - 8dca716c-b29c-403a-9886-91c028357d6e + BottomRight - UIImgBtnTabTopInUUID + UIButtonOrigHPad Comment - + UI Button Original Horizontal Pad Persist - 0 + 1 Type - String + S32 Value - 16d032e8-817b-4368-8a4e-b7b947ae3889 + 6 - UIImgBtnTabTopOutUUID + UICheckboxctrlBtnSize Comment - + UI Checkbox Control Button Size Persist - 0 + 1 Type - String + S32 Value - 1ed83f57-41cf-4052-a3b4-2e8bb78d8191 + 13 - UIImgBtnTabTopPartialInUUID + UICheckboxctrlHeight Comment - + UI Checkbox Control Height Persist - 0 + 1 Type - String + S32 Value - 7c6c6c26-0e25-4438-89bd-30d8b8e9d704 + 16 - UIImgBtnTabTopPartialOutUUID + UICheckboxctrlHPad Comment - + UI Checkbox Control Horizontal Pad Persist - 0 + 1 Type - String + S32 Value - 932ad585-0e45-4a57-aa23-4cf81beeb7b0 + 2 - UIImgBtnTearOffActiveUUID + UICheckboxctrlSpacing Comment - + UI Checkbox Control Spacing Persist - 0 + 1 Type - String + S32 Value - 74e1a96f-4833-a24d-a1bb-1bce1468b0e7 + 5 - UIImgBtnTearOffInactiveUUID + UICheckboxctrlVPad Comment - + UI Checkbox Control Vertical Pad Persist - 0 + 1 Type - String + S32 Value - 74e1a96f-4833-a24d-a1bb-1bce1468b0e7 + 2 - UIImgBtnTearOffPressedUUID + UICloseBoxFromTop Comment - + Size of UI floater close box from top Persist - 0 + 1 Type - String + S32 Value - d2524c13-4ba6-af7c-e305-8ac6cc18d86a + 1 - UIImgCheckboxActiveSelectedUUID + UIExtraTriangleHeight Comment - + UI extra triangle height Persist - 0 + 1 Type - String + S32 Value - cf4a2ed7-1533-4686-9dde-df9a37ddca55 + -2 - UIImgCheckboxActiveUUID + UIExtraTriangleWidth Comment - + UI extra triangle width Persist - 0 + 1 Type - String + S32 Value - 05bb64ee-96fd-4243-b74e-f40a41bc53ba + 2 - UIImgCheckboxInactiveSelectedUUID + UIFloaterCloseBoxSize Comment - + Size of UI floater close box size Persist - 0 + 1 Type - String + S32 Value - c817c642-9abd-4236-9287-ae0513fe7d2b + 16 - UIImgCheckboxInactiveUUID + UIFloaterHeaderSize Comment - + Size of UI floater header size Persist - 0 + 1 Type - String + S32 Value - 7d94cb59-32a2-49bf-a516-9e5a2045f9d9 + 18 - UIImgCreateSelectedUUID + UIFloaterHPad Comment - + Size of UI floater horizontal pad Persist - 0 + 1 Type - String + S32 Value - 0098b015-3daf-4cfe-a72f-915369ea97c2 + 6 - UIImgCreateUUID + UIFloaterTestBool Comment - + Example saved setting for the test floater Persist - 0 + 1 Type - String + Boolean Value - 7a0b1bdb-b5d9-4df5-bac2-ba230da93b5b + 0 - UIImgCrosshairsUUID + UIFloaterVPad Comment - Image to use for crosshair display (UUID texture reference) + Size of UI floater vertical pad Persist 1 Type - String + S32 Value - 6e1a3980-bf2d-4274-8970-91e60d85fb52 + 6 UIImgDefaultEyesUUID @@ -10222,7 +7905,7 @@ Value 5748decc-f629-461c-9a36-a35a221fe21f - UIImgDefaultUnderwearUUID + UIImgDefaultAlphaUUID Comment @@ -10233,7 +7916,7 @@ Value 5748decc-f629-461c-9a36-a35a221fe21f - UIImgDirectionArrowUUID + UIImgDefaultTattooUUID Comment @@ -10242,9 +7925,9 @@ Type String Value - 586383e8-4d9b-4fba-9196-2b5938e79c2c + 5748decc-f629-461c-9a36-a35a221fe21f - UIImgFaceSelectedUUID + UIImgDefaultUnderwearUUID Comment @@ -10253,9 +7936,9 @@ Type String Value - b4870163-6208-42a9-9801-93133bf9a6cd + 5748decc-f629-461c-9a36-a35a221fe21f - UIImgFaceUUID + UIImgWhiteUUID Comment @@ -10264,194 +7947,238 @@ Type String Value - ce15fd63-b0b6-463c-a37d-ea6393208b3e + 5748decc-f629-461c-9a36-a35a221fe21f - UIImgFocusSelectedUUID + UILineEditorCursorThickness Comment - + UI Line Editor Cursor Thickness Persist - 0 + 1 Type - String + S32 Value - ab6a730e-ddfd-4982-9a32-c6de3de6d31d + 2 - UIImgFocusUUID + UILineEditorHPad Comment - + UI Line Editor Horizontal Pad Persist - 0 + 1 Type - String + S32 Value - 57bc39d1-288c-4519-aea6-6d1786a5c274 + 2 - UIImgGrabSelectedUUID + UILineEditorVPad Comment - + UI Line Editor Vertical Pad Persist - 0 + 1 Type - String + S32 Value - c1e21504-f136-451d-b8e9-929037812f1d + 1 - UIImgGrabUUID + UIMaxComboWidth Comment - + Maximum width of combo box Persist - 0 + 1 Type - String + S32 Value - c63f124c-6340-4fbf-b59e-0869a44adb64 + 500 - UIImgMoveSelectedUUID + UIMinimizedWidth Comment - + Size of UI floater minimized width Persist - 0 + 1 Type - String + S32 Value - 46f17c7b-8381-48c3-b628-6a406e060dd6 + 160 - UIImgMoveUUID + UIMultiSliderctrlSpacing Comment - + UI multi slider ctrl spacing Persist - 0 + 1 Type - String + S32 Value - 2fa5dc06-bcdd-4e09-a426-f9f262d4fa65 + 4 - UIImgRadioActiveSelectedUUID + UIMultiTrackHeight Comment - + UI multi track height Persist - 0 + 1 Type - String + S32 Value - 52f09e07-5816-4052-953c-94c6c10479b7 + 6 - UIImgRadioActiveUUID + UIPreeditMarkerBrightness Comment - + UI Preedit Marker Brightness Persist - 0 + 1 Type - String + F32 Value - 7a1ba9b8-1047-4d1e-9cfc-bc478c80b63f + 0.4 - UIImgRadioInactiveSelectedUUID + UIPreeditMarkerGap Comment - + UI Preedit Marker Gap Persist - 0 + 1 Type - String + S32 Value - 1975db39-aa29-4251-aea0-409ac09d414d + 1 - UIImgRadioInactiveUUID + UIPreeditMarkerPosition Comment - + UI Preedit Marker Position Persist - 0 + 1 Type - String + S32 Value - 90688481-67ff-4af0-be69-4aa084bcad1e + 1 - UIImgResizeBottomRightUUID + UIPreeditMarkerThickness Comment - + UI Preedit Marker Thickness Persist - 0 + 1 Type - String + S32 Value - e3690e25-9690-4f6c-a745-e7dcd885285a + 1 - UIImgRotateSelectedUUID + UIPreeditStandoutBrightness Comment - + UI Preedit Standout Brightness Persist - 0 + 1 Type - String + F32 Value - cdfb7fde-0d13-418a-9d89-2bd91019fc95 + 0.6 - UIImgRotateUUID + UIPreeditStandoutGap Comment - + UI Preedit Standout Gap Persist - 0 + 1 Type - String + S32 + Value + 1 + + UIPreeditStandoutPosition + + Comment + UI Preedit Standout Position + Persist + 1 + Type + S32 + Value + 2 + + UIPreeditStandoutThickness + + Comment + UI Preedit Standout Thickness + Persist + 1 + Type + S32 + Value + 2 + + UIResizeBarHeight + + Comment + Size of UI resize bar height + Persist + 1 + Type + S32 + Value + 3 + + UIResizeBarOverlap + + Comment + Size of UI resize bar overlap + Persist + 1 + Type + S32 Value - c34b1eaa-aae3-4351-b082-e26c0b636779 + 1 - UIImgScaleSelectedUUID + UIScaleFactor Comment - + Size of UI relative to default layout on 1024x768 screen Persist - 0 + 1 Type - String + F32 Value - 55aa57ef-508a-47f7-8867-85d21c5a810d + 1.0 - UIImgScaleUUID + UIScrollbarSize Comment - + UI scrollbar size Persist - 0 + 1 Type - String + S32 Value - 88a90fef-b448-4883-9344-ecf378a60433 + 16 - UIImgWhiteUUID + UISliderctrlHeight Comment - + UI slider ctrl height Persist - 0 + 1 Type - String + S32 Value - 5748decc-f629-461c-9a36-a35a221fe21f + 16 - UIScaleFactor + UISliderctrlSpacing Comment - Size of UI relative to default layout on 1024x768 screen + UI slider ctrl spacing Persist 1 Type - F32 + S32 Value - 1.0 + 4 UISndAlert @@ -10816,286 +8543,197 @@ Value c80260ba-41fd-8a46-768a-6bf236360e3a - UploadBakedTexOld - - Comment - Forces the baked texture pipeline to upload using the old method. - Persist - 1 - Type - Boolean - Value - 0 - - UseAltKeyForMenus - - Comment - Access menus via keyboard by tapping Alt - Persist - 1 - Type - Boolean - Value - 0 - - UseChatBubbles - - Comment - Show chat above avatars head in chat bubbles - Persist - 1 - Type - Boolean - Value - 0 - - UseDebugLogin - - Comment - Provides extra control over which grid to connect to - Persist - 1 - Type - Boolean - Value - 0 - - UseDebugMenus - - Comment - Turns on "Debug" menu - Persist - 1 - Type - Boolean - Value - 0 - - UseDefaultColorPicker + UISpinctrlBtnHeight Comment - Use color picker supplied by operating system + UI spin control button height Persist 1 Type - Boolean - Value - 0 - - UseEnergy - - Comment - - Persist - 0 - Type - Boolean + S32 Value - 1 + 8 - UseExternalBrowser + UISpinctrlBtnWidth Comment - Use default browser when opening web pages instead of in-world browser. + UI spin control button width Persist 1 Type - Boolean + S32 Value - 0 + 16 - UseFreezeFrame + UISpinctrlDefaultLabelWidth Comment - Freeze time when taking snapshots. + UI spin control default label width Persist 1 Type - Boolean + S32 Value - 0 + 10 - UseOcclusion + UISpinctrlSpacing Comment - Enable object culling based on occlusion (coverage) by other objects + UI spin control spacing Persist 1 Type - Boolean + S32 Value - 1 + 2 - RenderDelayVBUpdate + UITabCntrArrowBtnSize Comment - Delay vertex buffer updates until just before rendering + UI Tab Container Arrow Button Size Persist 1 Type - Boolean + S32 Value - 1 + 16 - UseStartScreen + UITabCntrvArrowBtnSize Comment - Whether to load a start screen image or not. + UI Tab Container V Arrow Button Size Persist 1 Type - Boolean + S32 Value - 1 + 16 - UseWebPagesOnPrims + UITabCntrvPad Comment - [NOT USED] + UI Tab Container V Pad Persist 1 Type - Boolean + S32 Value 0 - UserConnectionPort + UITabCntrButtonPanelOverlap Comment - Port that this client transmits on. + UI Tab Container Button Panel Overlap Persist 1 Type - U32 + S32 Value - 0 - - UserLogFile - - Comment - User specified log file name. - Persist 1 - Type - String - Value - - UserLoginInfo + UITabCntrCloseBtnSize Comment - Users loging data. + UI Tab Container Close Button Size Persist 1 Type - LLSD + S32 Value - - + 16 - VFSOldSize + UITabCntrTabHeight Comment - [DO NOT MODIFY] Controls resizing of local file cache + UI Tab Container Tab Height Persist 1 Type - U32 + S32 Value - 0 + 16 - VFSSalt + UITabCntrTabHPad Comment - [DO NOT MODIFY] Controls local file caching behavior + UI Tab Container Tab Horizontal Pad Persist 1 Type - U32 + S32 Value - 1 + 4 - VectorizeEnable + UITabCntrTabPartialWidth Comment - Enable general vector operations and data alignment. + UI Tab Container Tab Partial Width Persist 1 Type - Boolean + S32 Value - 0 + 12 - VectorizePerfTest + UITabCntrVertTabMinWidth Comment - Test SSE/vectorization performance and choose fastest version. + UI Tab Container Vertical Tab Minimum Width Persist 1 Type - Boolean - Value - 1 - - VectorizeProcessor - - Comment - 0=Compiler Default, 1=SSE, 2=SSE2, autodetected - Persist - 0 - Type - U32 + S32 Value - 0 + 100 - VectorizeSkin + UITabPadding Comment - Enable vector operations for avatar skinning. + UI Tab Padding Persist 1 Type - Boolean + S32 Value - 1 + 15 - VelocityInterpolate + UITextEditorBorder Comment - Extrapolate object motion from last packet based on received velocity + UI Text Editor Border Persist 1 Type - Boolean + S32 Value 1 - VerboseLogs + UITextEditorHPad Comment - Display source file and line number for each log item for debugging purposes + UI Text Horizontal Pad Persist 1 Type - Boolean + S32 Value - 0 + 4 - VersionChannelName + UITextEditorVPadTop Comment - Versioning Channel Name. + UI Text Vertical Pad Top Persist 1 Type - String + S32 Value - Second Life Release + 4 - VertexShaderEnable + UploadBakedTexOld Comment - Enable/disable all GLSL shaders (debug) + Forces the baked texture pipeline to upload using the old method. Persist 1 Type @@ -11103,10 +8741,10 @@ Value 0 - VivoxAutoPostCrashDumps + UseAltKeyForMenus Comment - If true, SLVoice will automatically send crash dumps directly to Vivox. + Access menus via keyboard by tapping Alt Persist 1 Type @@ -11114,43 +8752,10 @@ Value 0 - VivoxDebugLevel - - Comment - Logging level to use when launching the vivox daemon - Persist - 1 - Type - String - Value - -1 - - VivoxDebugSIPURIHostName - - Comment - Hostname portion of vivox SIP URIs (empty string for the default). - Persist - 1 - Type - String - Value - - - VivoxDebugVoiceAccountServerURI - - Comment - URI to the vivox account management server (empty string for the default). - Persist - 1 - Type - String - Value - - - VoiceCallsFriendsOnly + UseChatBubbles Comment - Only accept voice calls from residents on your friends list + Show chat above avatars head in chat bubbles Persist 1 Type @@ -11158,186 +8763,187 @@ Value 0 - AutoDisengageMic + UseDebugLogin Comment - Automatically turn off the microphone when ending IM calls. + Provides extra control over which grid to connect to Persist 1 Type Boolean Value - 1 + 0 - VoiceEarLocation + UseDebugMenus Comment - Location of the virtual ear for voice + Turns on "Debug" menu Persist 1 Type - S32 + Boolean Value 0 - VoiceHost + UseDefaultColorPicker Comment - Client SLVoice host to connect to + Use color picker supplied by operating system Persist 1 Type - String + Boolean Value - 127.0.0.1 + 0 - VoiceImageLevel0 + UseEnergy Comment - Texture UUID for voice image level 0 + Persist - 1 + 0 Type - String + Boolean Value - 041ee5a0-cb6a-9ac5-6e49-41e9320507d5 + 1 - VoiceImageLevel1 + UseExternalBrowser Comment - Texture UUID for voice image level 1 + Use default browser when opening web pages instead of in-world browser. Persist 1 Type - String + Boolean Value - 29de489d-0491-fb00-7dab-f9e686d31e83 + 0 - VoiceImageLevel2 + UseFreezeFrame Comment - Texture UUID for voice image level 2 + Freeze time when taking snapshots. Persist 1 Type - String + Boolean Value - 29de489d-0491-fb00-7dab-f9e686d31e83 + 0 - VoiceImageLevel3 + UseOcclusion Comment - Texture UUID for voice image level 3 + Enable object culling based on occlusion (coverage) by other objects Persist 1 Type - String + Boolean Value - 29de489d-0491-fb00-7dab-f9e686d31e83 + 1 - VoiceImageLevel4 + RenderDelayVBUpdate Comment - Texture UUID for voice image level 4 + Delay vertex buffer updates until just before rendering Persist 1 Type - String + Boolean Value - 29de489d-0491-fb00-7dab-f9e686d31e83 + 1 - VoiceImageLevel5 + UseStartScreen Comment - Texture UUID for voice image level 5 + Whether to load a start screen image or not. Persist 1 Type - String + Boolean Value - 29de489d-0491-fb00-7dab-f9e686d31e83 + 1 - VoiceImageLevel6 + UseWebPagesOnPrims Comment - Texture UUID for voice image level 6 + [NOT USED] Persist 1 Type - String + Boolean Value - 29de489d-0491-fb00-7dab-f9e686d31e83 + 0 - VoiceInputAudioDevice + UserConnectionPort Comment - Audio input device to use for voice + Port that this client transmits on. Persist 1 Type - String + U32 Value - Default + 0 - VoiceOutputAudioDevice + UserLogFile Comment - Audio output device to use for voice + User specified log file name. Persist 1 Type String Value - Default + - VoicePort + UserLoginInfo Comment - Client SLVoice port to connect to + Users loging data. Persist 1 Type - U32 + LLSD Value - 44125 + + - WLSkyDetail + VFSOldSize Comment - Controls vertex detail on the WindLight sky. Lower numbers will give better performance and uglier skies. + [DO NOT MODIFY] Controls resizing of local file cache Persist 1 Type U32 Value - 64 + 0 - WarnAboutBadPCI + VFSSalt Comment - Enables AboutBadPCI warning dialog + [DO NOT MODIFY] Controls local file caching behavior Persist 1 Type - Boolean + U32 Value 1 - WarnAboutDirectX9 + VectorizeEnable Comment - Enables AboutDirectX9 warning dialog + Enable general vector operations and data alignment. Persist 1 Type Boolean Value - 1 + 0 - WarnAboutOldGraphicsDriver + VectorizePerfTest Comment - Enables AboutOldGraphicsDriver warning dialog + Test SSE/vectorization performance and choose fastest version. Persist 1 Type @@ -11345,21 +8951,21 @@ Value 1 - WarnAboutPCIGraphics + VectorizeProcessor Comment - Enables AboutPCIGraphics warning dialog + 0=Compiler Default, 1=SSE, 2=SSE2, autodetected Persist - 1 + 0 Type - Boolean + U32 Value - 1 + 0 - WarnBrowserLaunch + VectorizeSkin Comment - Enables BrowserLaunch warning dialog + Enable vector operations for avatar skinning. Persist 1 Type @@ -11367,10 +8973,10 @@ Value 1 - WarnDeedObject + VelocityInterpolate Comment - Enables DeedObject warning dialog + Extrapolate object motion from last packet based on received velocity Persist 1 Type @@ -11378,98 +8984,98 @@ Value 1 - WarnFirstAppearance + VerboseLogs Comment - Enables FirstAppearance warning dialog + Display source file and line number for each log item for debugging purposes Persist 1 Type Boolean Value - 1 + 0 - WarnFirstAttach + VersionChannelName Comment - Enables FirstAttach warning dialog + Versioning Channel Name. Persist 1 Type - Boolean + String Value - 1 + Second Life Release - WarnFirstBalanceDecrease + VertexShaderEnable Comment - Enables FirstBalanceDecrease warning dialog + Enable/disable all GLSL shaders (debug) Persist 1 Type Boolean Value - 1 + 0 - WarnFirstBalanceIncrease + VivoxAutoPostCrashDumps Comment - Enables FirstBalanceIncrease warning dialog + If true, SLVoice will automatically send crash dumps directly to Vivox. Persist 1 Type Boolean Value - 1 + 0 - WarnFirstBuild + VivoxDebugLevel Comment - Enables FirstBuild warning dialog + Logging level to use when launching the vivox daemon Persist 1 Type - Boolean + String Value - 1 + -1 - WarnFirstDebugMenus + VivoxDebugSIPURIHostName Comment - Enables FirstDebugMenus warning dialog + Hostname portion of vivox SIP URIs (empty string for the default). Persist 1 Type - Boolean + String Value - 1 + - WarnFirstFlexible + VivoxDebugVoiceAccountServerURI Comment - Enables FirstFlexible warning dialog + URI to the vivox account management server (empty string for the default). Persist 1 Type - Boolean + String Value - 1 + - WarnFirstGoTo + VoiceCallsFriendsOnly Comment - Enables FirstGoTo warning dialog + Only accept voice calls from residents on your friends list Persist 1 Type Boolean Value - 1 + 0 - WarnFirstInventory + AutoDisengageMic Comment - Enables FirstInventory warning dialog + Automatically turn off the microphone when ending IM calls. Persist 1 Type @@ -11477,159 +9083,159 @@ Value 1 - WarnFirstLeftClickNoHit + VoiceEarLocation Comment - Enables FirstLeftClickNoHit warning dialog + Location of the virtual ear for voice Persist 1 Type - Boolean + S32 Value - 1 + 0 - WarnFirstMap + VoiceHost Comment - Enables FirstMap warning dialog + Client SLVoice host to connect to Persist 1 Type - Boolean + String Value - 1 + 127.0.0.1 - WarnFirstMedia + VoiceImageLevel0 Comment - Enables FirstMedia warning dialog + Texture UUID for voice image level 0 Persist 1 Type - Boolean + String Value - 1 + 041ee5a0-cb6a-9ac5-6e49-41e9320507d5 - WarnFirstOverrideKeys + VoiceImageLevel1 Comment - Enables FirstOverrideKeys warning dialog + Texture UUID for voice image level 1 Persist 1 Type - Boolean + String Value - 1 + 29de489d-0491-fb00-7dab-f9e686d31e83 - WarnFirstSandbox + VoiceImageLevel2 Comment - Enables FirstSandbox warning dialog + Texture UUID for voice image level 2 Persist 1 Type - Boolean + String Value - 1 + 29de489d-0491-fb00-7dab-f9e686d31e83 - WarnFirstSculptedPrim + VoiceImageLevel3 Comment - Enables FirstSculptedPrim warning dialog + Texture UUID for voice image level 3 Persist 1 Type - Boolean + String Value - 1 + 29de489d-0491-fb00-7dab-f9e686d31e83 - WarnFirstSit + VoiceImageLevel4 Comment - Enables FirstSit warning dialog + Texture UUID for voice image level 4 Persist 1 Type - Boolean + String Value - 1 + 29de489d-0491-fb00-7dab-f9e686d31e83 - WarnFirstStreamingMusic + VoiceImageLevel5 Comment - Enables FirstStreamingMusic warning dialog + Texture UUID for voice image level 5 Persist 1 Type - Boolean + String Value - 1 + 29de489d-0491-fb00-7dab-f9e686d31e83 - WarnFirstStreamingVideo + VoiceImageLevel6 Comment - Enables FirstStreamingVideo warning dialog + Texture UUID for voice image level 6 Persist 1 Type - Boolean + String Value - 1 + 29de489d-0491-fb00-7dab-f9e686d31e83 - WarnFirstTeleport + VoiceInputAudioDevice Comment - Enables FirstTeleport warning dialog + Audio input device to use for voice Persist 1 Type - Boolean + String Value - 1 + Default - WarnFirstVoice + VoiceOutputAudioDevice Comment - Enables FirstVoice warning dialog + Audio output device to use for voice Persist 1 Type - Boolean + String Value - 1 + Default - WarnNewClassified + VoicePort Comment - Enables NewClassified warning dialog + Client SLVoice port to connect to Persist 1 Type - Boolean + U32 Value - 1 + 44125 - WarnQuickTimeInstalled + WarningsAsChat Comment - Enables QuickTimeInstalled warning dialog + Display warning messages in chat history Persist 1 Type Boolean Value - 1 + 0 - WarnReturnToOwner + WLSkyDetail Comment - Enables ReturnToOwner warning dialog + Controls vertex detail on the WindLight sky. Lower numbers will give better performance and uglier skies. Persist 1 Type - Boolean + U32 Value - 1 + 64 WatchdogEnabled @@ -11807,22 +9413,6 @@ Value 0.40000000596 - llOwnerSayChatColor - - Comment - Color of chat messages from objects only visible to the owner - Persist - 1 - Type - Color4 - Value - - 0.990000009537 - 0.990000009537 - 0.689999997616 - 1.0 - - particlesbeacon Comment diff --git a/indra/newview/app_settings/settings_files.xml b/indra/newview/app_settings/settings_files.xml index ec55745358..aa5b301959 100644 --- a/indra/newview/app_settings/settings_files.xml +++ b/indra/newview/app_settings/settings_files.xml @@ -4,10 +4,10 @@ @@ -6451,8 +6459,6 @@ - + + + + + + + @@ -6659,6 +6677,13 @@ + + + + + - - - - + + + + + @@ -7843,6 +7870,12 @@ + + + + - - - - - - - - + + + + + @@ -8619,6 +8648,14 @@ + + + + + @@ -8798,6 +8835,7 @@ domain="0" /> + @@ -11258,5 +11296,36 @@ + + + + + + + + + + diff --git a/indra/newview/character/checkerboard.tga b/indra/newview/character/checkerboard.tga new file mode 100644 index 0000000000..1950d7403d Binary files /dev/null and b/indra/newview/character/checkerboard.tga differ diff --git a/indra/newview/character/invisible_head.tga b/indra/newview/character/invisible_head.tga new file mode 100755 index 0000000000..2673a237d5 Binary files /dev/null and b/indra/newview/character/invisible_head.tga differ diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 87218008bd..73a548cdc6 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -498,7 +498,8 @@ RMDir "$INSTDIR" IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER FOLDERFOUND: - MessageBox MB_YESNO $(DeleteProgramFilesMB) IDNO NOFOLDER + ; Silent uninstall always removes all files (/SD IDYES) + MessageBox MB_YESNO $(DeleteProgramFilesMB) /SD IDYES IDNO NOFOLDER RMDir /r "$INSTDIR" NOFOLDER: diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 07503404dc..a70d31431f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -32,115 +32,82 @@ #include "llviewerprecompiledheaders.h" -#include "stdtypes.h" -#include "stdenums.h" - #include "llagent.h" +#include "llagentwearables.h" -#include "llcamera.h" -#include "llcoordframe.h" -#include "indra_constants.h" -#include "llmath.h" -#include "llcriticaldamp.h" -#include "llfocusmgr.h" -#include "llglheaders.h" -#include "llparcel.h" -#include "llpermissions.h" -#include "llregionhandle.h" -#include "m3math.h" -#include "m4math.h" -#include "message.h" -#include "llquaternion.h" -#include "v3math.h" -#include "v4math.h" -#include "llsmoothstep.h" -#include "llsdutil.h" -//#include "vmath.h" - -#include "imageids.h" -#include "llbox.h" -#include "llbutton.h" +#include "llanimationstates.h" #include "llcallingcard.h" #include "llchatbar.h" #include "llconsole.h" #include "lldrawable.h" -#include "llface.h" #include "llfirstuse.h" -#include "llfloater.h" +#include "llfloaterreg.h" #include "llfloateractivespeakers.h" #include "llfloateravatarinfo.h" -#include "llfloaterbuildoptions.h" #include "llfloatercamera.h" -#include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloaterdirectory.h" #include "llfloatergroupinfo.h" -#include "llfloatergroups.h" #include "llfloaterland.h" -#include "llfloatermap.h" #include "llfloatermute.h" #include "llfloatersnapshot.h" #include "llfloatertools.h" #include "llfloaterworldmap.h" + +#include "llfocusmgr.h" #include "llgroupmgr.h" #include "llhomelocationresponder.h" -#include "llhudeffectlookat.h" +#include "llimview.h" #include "llhudmanager.h" -#include "llinventorymodel.h" -#include "llinventoryview.h" #include "lljoystickbutton.h" #include "llmenugl.h" #include "llmorphview.h" #include "llmoveview.h" -#include "llnotify.h" -#include "llquantize.h" +#include "llparcel.h" #include "llsdutil.h" #include "llselectmgr.h" #include "llsky.h" -#include "llrendersphere.h" +#include "llslurl.h" +#include "llsmoothstep.h" +#include "llsidetray.h" #include "llstatusbar.h" -#include "llstartup.h" -#include "llimview.h" +#include "llteleporthistory.h" #include "lltool.h" #include "lltoolcomp.h" -#include "lltoolfocus.h" -#include "lltoolgrab.h" #include "lltoolmgr.h" -#include "lltoolpie.h" -#include "lltoolview.h" -#include "llui.h" // for make_ui_sound +#include "lluictrlfactory.h" #include "llurldispatcher.h" + #include "llviewercamera.h" -#include "llviewerinventory.h" -#include "llviewermenu.h" -#include "llviewernetwork.h" +#include "llviewerdisplay.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" -#include "llviewerparceloverlay.h" -#include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerwindow.h" -#include "llviewerdisplay.h" -#include "llvoavatar.h" -#include "llvoground.h" -#include "llvosky.h" -#include "llwearable.h" -#include "llwearablelist.h" +#include "llviewercontrol.h" +#include "llviewerjoystick.h" + +#include "llvoavatarself.h" +#include "llwindow.h" #include "llworld.h" #include "llworldmap.h" + #include "pipeline.h" -#include "roles_constants.h" -#include "llviewercontrol.h" -#include "llappviewer.h" -#include "llviewerjoystick.h" -#include "llfollowcam.h" +#include "lltrans.h" +#include "llbottomtray.h" #include "stringize.h" #include "llcapabilitylistener.h" +#include "llnavigationbar.h" //to show/hide navigation bar when changing mouse look state + using namespace LLVOAvatarDefines; extern LLMenuBarGL* gMenuBarView; +const BOOL ANIMATE = TRUE; +const U8 AGENT_STATE_TYPING = 0x04; +const U8 AGENT_STATE_EDITING = 0x10; + //drone wandering constants const F32 MAX_WANDER_TIME = 20.f; // seconds const F32 MAX_HEADING_HALF_ERROR = 0.2f; // radians @@ -216,7 +183,7 @@ const F64 CHAT_AGE_FAST_RATE = 3.0; // The agent instance. LLAgent gAgent; -// +//-------------------------------------------------------------------- // Statics // @@ -242,6 +209,19 @@ void LLAgentFriendObserver::changed(U32 mask) } } +bool handleSlowMotionAnimation(const LLSD& newvalue) +{ + if (newvalue.asBoolean()) + { + gAgent.getAvatarObject()->setAnimTimeFactor(0.2f); + } + else + { + gAgent.getAvatarObject()->setAnimTimeFactor(1.0f); + } + return true; +} + // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that // locally believes the end user has godlike powers. @@ -264,19 +244,12 @@ LLAgent::LLAgent() : mHideGroupTitle(FALSE), mGroupID(), - mMapOriginX(0.F), - mMapOriginY(0.F), - mMapWidth(0), - mMapHeight(0), - mLookAt(NULL), mPointAt(NULL), mHUDTargetZoom(1.f), mHUDCurZoom(1.f), mInitialized(FALSE), - mNumPendingQueries(0), - mActiveCacheQueries(NULL), mForceMouselook(FALSE), mDoubleTapRunTimer(), @@ -395,24 +368,14 @@ LLAgent::LLAgent() : mFirstLogin(FALSE), mGenderChosen(FALSE), - mAgentWearablesUpdateSerialNum(0), - mWearablesLoaded(FALSE), - mTextureCacheQueryID(0), mAppearanceSerialNum(0) { - U32 i; - for (i = 0; i < TOTAL_CONTROLS; i++) + for (U32 i = 0; i < TOTAL_CONTROLS; i++) { mControlsTakenCount[i] = 0; mControlsTakenPassedOnCount[i] = 0; } - mActiveCacheQueries = new S32[BAKED_NUM_INDICES]; - for (i = 0; i < (U32)BAKED_NUM_INDICES; i++) - { - mActiveCacheQueries[i] = 0; - } - mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); } @@ -422,6 +385,9 @@ LLAgent::LLAgent() : //----------------------------------------------------------------------------- void LLAgent::init() { + gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", FALSE); + gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2)); + mDrawDistance = gSavedSettings.getF32("RenderFarClip"); // *Note: this is where LLViewerCamera::getInstance() used to be constructed. @@ -430,7 +396,7 @@ void LLAgent::init() // Leave at 0.1 meters until we have real near clip management LLViewerCamera::getInstance()->setNear(0.1f); LLViewerCamera::getInstance()->setFar(mDrawDistance); // if you want to change camera settings, do so in camera.h - LLViewerCamera::getInstance()->setAspect( gViewerWindow->getDisplayAspectRatio() ); // default, overridden in LLViewerWindow::reshape + LLViewerCamera::getInstance()->setAspect( gViewerWindow->getWorldViewAspectRatio() ); // default, overridden in LLViewerWindow::reshape LLViewerCamera::getInstance()->setViewHeightInPixels(768); // default, overridden in LLViewerWindow::reshape setFlying( gSavedSettings.getBOOL("FlyingAtExit") ); @@ -443,9 +409,10 @@ void LLAgent::init() mCameraZoomFraction = 1.f; mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject"); -// LLDebugVarMessageBox::show("Camera Lag", &CAMERA_FOCUS_HALF_LIFE, 0.5f, 0.01f); + mEffectColor = gSavedSkinSettings.getColor4("EffectColor"); - mEffectColor = gSavedSettings.getColor4("EffectColor"); + gSavedSettings.getControl("PreferredMaturity")->getValidateSignal()->connect(boost::bind(&LLAgent::validateMaturity, this, _2)); + gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLAgent::handleMaturity, this, _2)); mInitialized = TRUE; } @@ -456,7 +423,9 @@ void LLAgent::init() void LLAgent::cleanup() { setSitCamera(LLUUID::null); + mAvatarObject = NULL; + if(mLookAt) { mLookAt->markDead() ; @@ -478,9 +447,6 @@ LLAgent::~LLAgent() { cleanup(); - delete [] mActiveCacheQueries; - mActiveCacheQueries = NULL; - // *Note: this is where LLViewerCamera::getInstance() used to be deleted. } @@ -529,7 +495,7 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) LLViewerJoystick::getInstance()->moveAvatar(true); } - gFloaterTools->close(); + LLFloaterReg::hideInstance("build"); gViewerWindow->showCursor(); @@ -822,12 +788,24 @@ void LLAgent::setFlying(BOOL fly) //----------------------------------------------------------------------------- // toggleFlying() //----------------------------------------------------------------------------- +// static void LLAgent::toggleFlying() { - BOOL fly = !(mControlFlags & AGENT_CONTROL_FLY); + BOOL fly = !(gAgent.mControlFlags & AGENT_CONTROL_FLY); - setFlying( fly ); - resetView(); + gAgent.setFlying( fly ); + gAgent.resetView(); +} + +// static +bool LLAgent::enableFlying() +{ + BOOL sitting = FALSE; + if (gAgent.getAvatarObject()) + { + sitting = gAgent.getAvatarObject()->mIsSitting; + } + return !sitting; } @@ -942,7 +920,7 @@ std::string LLAgent::getSLURL() const S32 x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) ); S32 y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) ); S32 z = llround( (F32)agentPos.mdV[VZ] ); - slurl = LLURLDispatcher::buildSLURL(regionp->getName(), x, y, z); + slurl = LLSLURL::buildSLURL(regionp->getName(), x, y, z); } return slurl; } @@ -1319,14 +1297,19 @@ LLQuaternion LLAgent::getQuat() const //----------------------------------------------------------------------------- LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y) { - // calculate offset based on view direction - BOOL is_avatar = object->isAvatar(); - // since the animation system allows the avatars facing and position to deviate from its nominal LLViewerObject/LLDrawable transform - // calculate the focus-specific orientation for avatars based off the pelvis joint - // NOTE: pelvis no longer good candidate, removed. DEV-30589 LLMatrix4 obj_matrix = object->getRenderMatrix(); LLQuaternion obj_rot = object->getRenderRotation(); LLVector3 obj_pos = object->getRenderPosition(); + + BOOL is_avatar = object->isAvatar(); + // if is avatar - don't do any funk heuristics to position the focal point + // see DEV-30589 + if (is_avatar) + { + return original_focus_point - obj_pos; + } + + LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation LLVector3 object_extents = object->getScale(); // make sure they object extents are non-zero @@ -2119,8 +2102,7 @@ void LLAgent::setAFK() gAwayTimer.start(); if (gAFKMenu) { - //*TODO:Translate - gAFKMenu->setLabel(std::string("Set Not Away")); + gAFKMenu->setLabel(LLTrans::getString("AvatarSetNotAway")); } } } @@ -2143,8 +2125,7 @@ void LLAgent::clearAFK() clearControlFlags(AGENT_CONTROL_AWAY); if (gAFKMenu) { - //*TODO:Translate - gAFKMenu->setLabel(std::string("Set Away")); + gAFKMenu->setLabel(LLTrans::getString("AvatarSetAway")); } } } @@ -2166,10 +2147,9 @@ void LLAgent::setBusy() mIsBusy = TRUE; if (gBusyMenu) { - //*TODO:Translate - gBusyMenu->setLabel(std::string("Set Not Busy")); + gBusyMenu->setLabel(LLTrans::getString("AvatarSetNotBusy")); } - LLFloaterMute::getInstance()->updateButtons(); + LLFloaterReg::getTypedInstance("mute")->updateButtons(); } //----------------------------------------------------------------------------- @@ -2181,10 +2161,9 @@ void LLAgent::clearBusy() sendAnimationRequest(ANIM_AGENT_BUSY, ANIM_REQUEST_STOP); if (gBusyMenu) { - //*TODO:Translate - gBusyMenu->setLabel(std::string("Set Busy")); + gBusyMenu->setLabel(LLTrans::getString("AvatarSetBusy")); } - LLFloaterMute::getInstance()->updateButtons(); + LLFloaterReg::getTypedInstance("mute")->updateButtons(); } //----------------------------------------------------------------------------- @@ -2664,7 +2643,7 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) //----------------------------------------------------------------------------- // setAvatarObject() //----------------------------------------------------------------------------- -void LLAgent::setAvatarObject(LLVOAvatar *avatar) +void LLAgent::setAvatarObject(LLVOAvatarSelf *avatar) { mAvatarObject = avatar; @@ -2691,8 +2670,6 @@ void LLAgent::setAvatarObject(LLVOAvatar *avatar) { mPointAt->setSourceObject(avatar); } - - sendAgentWearablesRequest(); } // TRUE if your own avatar needs to be rendered. Usually only @@ -2743,7 +2720,7 @@ void LLAgent::startTyping() { sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START); } - gChatBar->sendChatFromViewer("", CHAT_TYPE_START, FALSE); + LLBottomTray::getInstance()->sendChatFromViewer("", CHAT_TYPE_START, FALSE); } //----------------------------------------------------------------------------- @@ -2755,7 +2732,7 @@ void LLAgent::stopTyping() { clearRenderState(AGENT_STATE_TYPING); sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP); - gChatBar->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); + LLBottomTray::getInstance()->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); } } @@ -2809,13 +2786,6 @@ U8 LLAgent::getRenderState() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static const LLFloaterView::skip_list_t& get_skip_list() -{ - static LLFloaterView::skip_list_t skip_list; - skip_list.insert(LLFloaterMap::getInstance()); - return skip_list; -} - //----------------------------------------------------------------------------- // endAnimationUpdateUI() //----------------------------------------------------------------------------- @@ -2834,17 +2804,29 @@ void LLAgent::endAnimationUpdateUI() gViewerWindow->showCursor(); // show menus gMenuBarView->setVisible(TRUE); + LLNavigationBar::getInstance()->setVisible(TRUE); gStatusBar->setVisibleForMouselook(true); + LLBottomTray::getInstance()->setVisible(TRUE); + + LLSideTray::getInstance()->setVisible(TRUE); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); // Only pop if we have pushed... if (TRUE == mViewsPushed) { +#if 0 // Use this once all floaters are registered + LLFloaterReg::restoreVisibleInstances(); +#else // Use this for now + LLFloaterView::skip_list_t skip_list; + skip_list.insert(LLFloaterReg::findInstance("mini_map")); + gFloaterView->popVisibleAll(skip_list); +#endif mViewsPushed = FALSE; - gFloaterView->popVisibleAll(get_skip_list()); } + gAgent.setLookAt(LOOKAT_TARGET_CLEAR); if( gMorphView ) { @@ -2886,13 +2868,6 @@ void LLAgent::endAnimationUpdateUI() LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - // HACK: If we're quitting, and we were in customize avatar, don't - // let the mini-map go visible again. JC - if (!LLAppViewer::instance()->quitRequested()) - { - LLFloaterMap::getInstance()->popVisible(); - } - if( gMorphView ) { gMorphView->setVisible( FALSE ); @@ -2919,8 +2894,13 @@ void LLAgent::endAnimationUpdateUI() { // hide menus gMenuBarView->setVisible(FALSE); + LLNavigationBar::getInstance()->setVisible(FALSE); gStatusBar->setVisibleForMouselook(false); + LLBottomTray::getInstance()->setVisible(FALSE); + + LLSideTray::getInstance()->setVisible(FALSE); + // clear out camera lag effect mCameraLag.clearVec(); @@ -2931,14 +2911,23 @@ void LLAgent::endAnimationUpdateUI() mViewsPushed = TRUE; - gFloaterView->pushVisibleAll(FALSE, get_skip_list()); + // hide all floaters except the mini map + +#if 0 // Use this once all floaters are registered + std::set exceptions; + exceptions.insert("mini_map"); + LLFloaterReg::hideVisibleInstances(exceptions); +#else // Use this for now + LLFloaterView::skip_list_t skip_list; + skip_list.insert(LLFloaterReg::findInstance("mini_map")); + gFloaterView->pushVisibleAll(FALSE, skip_list); +#endif if( gMorphView ) { gMorphView->setVisible(FALSE); } - gIMMgr->setFloaterOpen( FALSE ); gConsole->setVisible( TRUE ); if (mAvatarObject.notNull()) @@ -2987,15 +2976,6 @@ void LLAgent::endAnimationUpdateUI() { LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); - LLFloaterMap::getInstance()->pushVisible(FALSE); - /* - LLView *view; - for (view = gFloaterView->getFirstChild(); view; view = gFloaterView->getNextChild()) - { - view->pushVisible(FALSE); - } - */ - if( gMorphView ) { gMorphView->setVisible( TRUE ); @@ -4250,7 +4230,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani gFocusMgr.setKeyboardFocus( NULL ); gFocusMgr.setMouseCapture( NULL ); - LLVOAvatar::onCustomizeStart(); + LLVOAvatarSelf::onCustomizeStart(); } if (mAvatarObject.notNull()) @@ -4935,6 +4915,9 @@ int LLAgent::convertTextToMaturity(char text) bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity) { + if (!getRegion()) + return false; + // Update agent access preference on the server std::string url = getRegion()->getCapability("UpdateAgentInformation"); if (!url.empty()) @@ -4994,6 +4977,17 @@ const LLAgentAccess& LLAgent::getAgentAccess() return mAgentAccess; } +bool LLAgent::validateMaturity(const LLSD& newvalue) +{ + return mAgentAccess.canSetMaturity(newvalue.asInteger()); +} + +void LLAgent::handleMaturity(const LLSD& newvalue) +{ + sendMaturityPreferenceToServer(newvalue.asInteger()); +} + +//---------------------------------------------------------------------------- void LLAgent::buildFullname(std::string& name) const { @@ -5157,8 +5151,14 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO } // utility to build a location string -void LLAgent::buildLocationString(std::string& str) +BOOL LLAgent::buildLocationString(std::string& str, ELocationFormat fmt) { + LLViewerRegion* region = getRegion(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + + if (!region || !parcel) + return FALSE; + const LLVector3& agent_pos_region = getPositionAgent(); S32 pos_x = S32(agent_pos_region.mV[VX]); S32 pos_y = S32(agent_pos_region.mV[VY]); @@ -5185,23 +5185,53 @@ void LLAgent::buildLocationString(std::string& str) } // create a defult name and description for the landmark + std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName(); + std::string region_name = region->getName(); std::string buffer; if( LLViewerParcelMgr::getInstance()->getAgentParcelName().empty() ) { // the parcel doesn't have a name - buffer = llformat("%.32s (%d, %d, %d)", - getRegion()->getName().c_str(), + switch (fmt) + { + case LOCATION_FORMAT_LANDMARK: + buffer = llformat("%.100s", region_name.c_str()); + break; + case LOCATION_FORMAT_NORMAL: + buffer = llformat("%s", region_name.c_str()); + break; + case LOCATION_FORMAT_FULL: + buffer = llformat("%s (%d, %d, %d)", + region_name.c_str(), pos_x, pos_y, pos_z); + break; + } } else { // the parcel has a name, so include it in the landmark name - buffer = llformat("%.32s, %.32s (%d, %d, %d)", - LLViewerParcelMgr::getInstance()->getAgentParcelName().c_str(), - getRegion()->getName().c_str(), - pos_x, pos_y, pos_z); + switch (fmt) + { + case LOCATION_FORMAT_LANDMARK: + buffer = llformat("%.100s", parcel_name.c_str()); + break; + case LOCATION_FORMAT_NORMAL: + buffer = llformat("%s, %s", + region_name.c_str(), + parcel_name.c_str()); + break; + case LOCATION_FORMAT_FULL: + std::string sim_access_string = region->getSimAccessString(); + buffer = llformat("%s, %s (%d, %d, %d)%s%s", + region_name.c_str(), + parcel_name.c_str(), + pos_x, pos_y, pos_z, + sim_access_string.empty() ? "" : " - ", + sim_access_string.c_str()); + break; + } } str = buffer; + return TRUE; } LLQuaternion LLAgent::getHeadRotation() @@ -5366,7 +5396,7 @@ BOOL LLAgent::allowOperation(PermissionBit op, } -void LLAgent::getName(std::string& name) +void LLAgent::getName(std::string& name) const { name.clear(); @@ -5404,16 +5434,51 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global) mAgentOriginGlobal = origin_global; } +BOOL LLAgent::leftButtonGrabbed() const +{ + return (!cameraMouselook() && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) + || (cameraMouselook() && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) + || (!cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) + || (cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0); +} + +BOOL LLAgent::rotateGrabbed() const +{ + return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0) + || (mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0); +} + +BOOL LLAgent::forwardGrabbed() const +{ + return (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0); +} + +BOOL LLAgent::backwardGrabbed() const +{ + return (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0); +} + +BOOL LLAgent::upGrabbed() const +{ + return (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0); +} + +BOOL LLAgent::downGrabbed() const +{ + return (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0); +} + void update_group_floaters(const LLUUID& group_id) { LLFloaterGroupInfo::refreshGroup(group_id); + //*TODO Implement group update for Profile View // update avatar info - LLFloaterAvatarInfo* fa = LLFloaterAvatarInfo::getInstance(gAgent.getID()); - if(fa) - { - fa->resetGroupList(); - } +// LLFloaterAvatarInfo* fa = LLFloaterReg::findTypedInstance("preview_avatar", LLSD(gAgent.getID())); +// if(fa) +// { +// fa->resetGroupList(); +// } if (gIMMgr) { @@ -5849,9 +5914,9 @@ void LLAgent::processControlRelease(LLMessageSystem *msg, void **) //static void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data) { - gAgent.mNumPendingQueries--; + gAgentQueryManager.mNumPendingQueries--; - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); if (!avatarp || avatarp->isDead()) { llwarns << "No avatar for user in cached texture update!" << llendl; @@ -5881,12 +5946,12 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * if (texture_id.notNull() && (S32)texture_index < BAKED_NUM_INDICES - && gAgent.mActiveCacheQueries[ texture_index ] == query_id) + && gAgentQueryManager.mActiveCacheQueries[texture_index] == query_id) { //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl; - avatarp->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id); + avatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id); //avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id ); - gAgent.mActiveCacheQueries[ texture_index ] = 0; + gAgentQueryManager.mActiveCacheQueries[texture_index] = 0; num_results++; } } @@ -5895,7 +5960,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * avatarp->updateMeshTextures(); - if (gAgent.mNumPendingQueries == 0) + if (gAgentQueryManager.mNumPendingQueries == 0) { // RN: not sure why composites are disabled at this point avatarp->setCompositeUpdatesEnabled(TRUE); @@ -5905,8 +5970,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * BOOL LLAgent::anyControlGrabbed() const { - U32 i; - for (i = 0; i < TOTAL_CONTROLS; i++) + for (U32 i = 0; i < TOTAL_CONTROLS; i++) { if (gAgent.mControlsTakenCount[i] > 0) return TRUE; @@ -5998,12 +6062,12 @@ bool LLAgent::teleportCore(bool is_local) // process_teleport_location_reply // close the map and find panels so we can see our destination - LLFloaterWorldMap::hide(NULL); - LLFloaterDirectory::hide(NULL); + LLFloaterReg::hideInstance("world_map"); + LLFloaterReg::hideInstance("search"); // hide land floater too - it'll be out of date LLFloaterLand::hideInstance(); - + LLViewerParcelMgr::getInstance()->deselectLand(); // Close all pie menus, deselect land, etc. @@ -6164,13 +6228,18 @@ void LLAgent::setTeleportState(ETeleportState state) mTeleportState = state; if (mTeleportState > TELEPORT_NONE && gSavedSettings.getBOOL("FreezeTime")) { - LLFloaterSnapshot::hide(0); + LLFloaterReg::hideInstance("snapshot"); } if (mTeleportState == TELEPORT_MOVING) { // We're outa here. Save "back" slurl. mTeleportSourceSLURL = getSLURL(); } + else if(mTeleportState == TELEPORT_ARRIVING) + { + // Let the interested parties know we've teleported. + LLViewerParcelMgr::getInstance()->onTeleportFinished(); + } } void LLAgent::stopCurrentAnimations() @@ -6298,974 +6367,103 @@ void LLAgent::requestLeaveGodMode() sendReliableMessage(); } -// wearables -LLAgent::createStandardWearablesAllDoneCallback::~createStandardWearablesAllDoneCallback() -{ - gAgent.createStandardWearablesAllDone(); -} - -LLAgent::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCallback() -{ - gAgent.sendAgentWearablesUpdate(); -} - -LLAgent::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback( - LLPointer cb, S32 index, LLWearable* wearable, U32 todo) : - mIndex(index), - mWearable(wearable), - mTodo(todo), - mCB(cb) -{ -} - -void LLAgent::addWearableToAgentInventoryCallback::fire(const LLUUID& inv_item) +//----------------------------------------------------------------------------- +// sendAgentSetAppearance() +//----------------------------------------------------------------------------- +void LLAgent::sendAgentSetAppearance() { - if (inv_item.isNull()) - return; - - gAgent.addWearabletoAgentInventoryDone(mIndex, inv_item, mWearable); + if (mAvatarObject.isNull()) return; - if (mTodo & CALL_UPDATE) - { - gAgent.sendAgentWearablesUpdate(); - } - if (mTodo & CALL_RECOVERDONE) - { - gAgent.recoverMissingWearableDone(); - } - /* - * Do this for every one in the loop - */ - if (mTodo & CALL_CREATESTANDARDDONE) - { - gAgent.createStandardWearablesDone(mIndex); - } - if (mTodo & CALL_MAKENEWOUTFITDONE) + if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgent.cameraCustomizeAvatar()) { - gAgent.makeNewOutfitDone(mIndex); + return; } -} -void LLAgent::addWearabletoAgentInventoryDone( - S32 index, - const LLUUID& item_id, - LLWearable* wearable) -{ - if (item_id.isNull()) - return; - LLUUID old_item_id = mWearableEntry[index].mItemID; - mWearableEntry[index].mItemID = item_id; - mWearableEntry[index].mWearable = wearable; - if (old_item_id.notNull()) - gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id); - gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); - LLViewerInventoryItem* item = gInventory.getItem(item_id); - if(item && wearable) - { - // We're changing the asset id, so we both need to set it - // locally via setAssetUUID() and via setTransactionID() which - // will be decoded on the server. JC - item->setAssetUUID(wearable->getID()); - item->setTransactionID(wearable->getTransactionID()); - gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); - item->updateServer(FALSE); - } - gInventory.notifyObservers(); -} + llinfos << "TAT: Sent AgentSetAppearance: " << mAvatarObject->getBakedStatusForPrintout() << llendl; + //dumpAvatarTEs( "sendAgentSetAppearance()" ); -void LLAgent::sendAgentWearablesUpdate() -{ - // First make sure that we have inventory items for each wearable - S32 i; - for(i=0; i < WT_COUNT; ++i) - { - LLWearable* wearable = mWearableEntry[ i ].mWearable; - if (wearable) - { - if( mWearableEntry[ i ].mItemID.isNull() ) - { - LLPointer cb = - new addWearableToAgentInventoryCallback( - LLPointer(NULL), - i, - wearable, - addWearableToAgentInventoryCallback::CALL_NONE); - addWearableToAgentInventory(cb, wearable); - } - else - { - gInventory.addChangedMask( LLInventoryObserver::LABEL, - mWearableEntry[i].mItemID ); - } - } - } + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_AgentSetAppearance); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, getID()); + msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - // Then make sure the inventory is in sync with the avatar. - gInventory.notifyObservers(); + // correct for the collision tolerance (to make it look like the + // agent is actually walking on the ground/object) + // NOTE -- when we start correcting all of the other Havok geometry + // to compensate for the COLLISION_TOLERANCE ugliness we will have + // to tweak this number again + const LLVector3 body_size = mAvatarObject->mBodySize; + msg->addVector3Fast(_PREHASH_Size, body_size); - // Send the AgentIsNowWearing - gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing); + // To guard against out of order packets + // Note: always start by sending 1. This resets the server's count. 0 on the server means "uninitialized" + mAppearanceSerialNum++; + msg->addU32Fast(_PREHASH_SerialNum, mAppearanceSerialNum ); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID()); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID()); + // is texture data current relative to wearables? + // KLW - TAT this will probably need to check the local queue. + BOOL textures_current = mAvatarObject->areTexturesCurrent(); - lldebugs << "sendAgentWearablesUpdate()" << llendl; - for(i=0; i < WT_COUNT; ++i) + for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) { - gMessageSystem->nextBlockFast(_PREHASH_WearableData); - - U8 type_u8 = (U8)i; - gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8 ); + const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); - LLWearable* wearable = mWearableEntry[ i ].mWearable; - if( wearable ) + // if we're not wearing a skirt, we don't need the texture to be baked + if (texture_index == TEX_SKIRT_BAKED && !mAvatarObject->isWearingWearableType(WT_SKIRT)) { - //llinfos << "Sending wearable " << wearable->getName() << llendl; - gMessageSystem->addUUIDFast(_PREHASH_ItemID, mWearableEntry[ i ].mItemID ); + continue; } - else + + // IMG_DEFAULT_AVATAR means not baked + if (!mAvatarObject->isTextureDefined(texture_index)) { - //llinfos << "Not wearing wearable type " << LLWearable::typeToTypeName((EWearableType)i) << llendl; - gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null ); + textures_current = FALSE; + break; } - - lldebugs << " " << LLWearable::typeToTypeLabel((EWearableType)i) << ": " << (wearable ? wearable->getID() : LLUUID::null) << llendl; } - gAgent.sendReliableMessage(); -} -void LLAgent::saveWearable( EWearableType type, BOOL send_update ) -{ - LLWearable* old_wearable = mWearableEntry[(S32)type].mWearable; - if( old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()) ) + // only update cache entries if we have all our baked textures + if (textures_current) { - LLWearable* new_wearable = gWearableList.createCopyFromAvatar( old_wearable ); - mWearableEntry[(S32)type].mWearable = new_wearable; - - LLInventoryItem* item = gInventory.getItem(mWearableEntry[(S32)type].mItemID); - if( item ) - { - // Update existing inventory item - LLPointer template_item = - new LLViewerInventoryItem(item->getUUID(), - item->getParentUUID(), - item->getPermissions(), - new_wearable->getID(), - new_wearable->getAssetType(), - item->getInventoryType(), - item->getName(), - item->getDescription(), - item->getSaleInfo(), - item->getFlags(), - item->getCreationDate()); - template_item->setTransactionID(new_wearable->getTransactionID()); - template_item->updateServer(FALSE); - gInventory.updateItem(template_item); - } - else + llinfos << "TAT: Sending cached texture data" << llendl; + for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - // Add a new inventory item (shouldn't ever happen here) - U32 todo = addWearableToAgentInventoryCallback::CALL_NONE; - if (send_update) + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + LLUUID hash; + for (U8 i=0; i < baked_dict->mWearables.size(); i++) { - todo |= addWearableToAgentInventoryCallback::CALL_UPDATE; + // EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num]; + const EWearableType wearable_type = baked_dict->mWearables[i]; + // MULTI-WEARABLE: fixed to 0th - extend to everything once messaging works. + const LLWearable* wearable = gAgentWearables.getWearable(wearable_type,0); + if (wearable) + { + hash ^= wearable->getID(); + } + } + if (hash.notNull()) + { + hash ^= baked_dict->mWearablesHashID; } - LLPointer cb = - new addWearableToAgentInventoryCallback( - LLPointer(NULL), - (S32)type, - new_wearable, - todo); - addWearableToAgentInventory(cb, new_wearable); - return; - } - - getAvatarObject()->wearableUpdated( type ); - if( send_update ) - { - sendAgentWearablesUpdate(); - } - } -} + const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); -void LLAgent::saveWearableAs( - EWearableType type, - const std::string& new_name, - BOOL save_in_lost_and_found) -{ - if(!isWearableCopyable(type)) - { - llwarns << "LLAgent::saveWearableAs() not copyable." << llendl; - return; - } - LLWearable* old_wearable = getWearable(type); - if(!old_wearable) - { - llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl; - return; - } - LLInventoryItem* item = gInventory.getItem(mWearableEntry[type].mItemID); - if(!item) - { - llwarns << "LLAgent::saveWearableAs() no inventory item." << llendl; - return; - } - std::string trunc_name(new_name); - LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN); - LLWearable* new_wearable = gWearableList.createCopyFromAvatar( - old_wearable, - trunc_name); - LLPointer cb = - new addWearableToAgentInventoryCallback( - LLPointer(NULL), - type, - new_wearable, - addWearableToAgentInventoryCallback::CALL_UPDATE); - LLUUID category_id; - if (save_in_lost_and_found) - { - category_id = gInventory.findCategoryUUIDForType( - LLAssetType::AT_LOST_AND_FOUND); + msg->nextBlockFast(_PREHASH_WearableData); + msg->addUUIDFast(_PREHASH_CacheID, hash); + msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index); + } + msg->nextBlockFast(_PREHASH_ObjectData); + mAvatarObject->packTEMessage( gMessageSystem ); } else { - // put in same folder as original - category_id = item->getParentUUID(); - } - - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - category_id, - new_name, - cb); - -/* - LLWearable* old_wearable = getWearable( type ); - if( old_wearable ) - { - std::string old_name = old_wearable->getName(); - old_wearable->setName( new_name ); - LLWearable* new_wearable = gWearableList.createCopyFromAvatar( old_wearable ); - old_wearable->setName( old_name ); - - LLUUID category_id; - LLInventoryItem* item = gInventory.getItem( mWearableEntry[ type ].mItemID ); - if( item ) - { - new_wearable->setPermissions(item->getPermissions()); - if (save_in_lost_and_found) - { - category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); - } - else - { - // put in same folder as original - category_id = item->getParentUUID(); - } - LLInventoryView* view = LLInventoryView::getActiveInventory(); - if(view) - { - view->getPanel()->setSelection(item->getUUID(), TAKE_FOCUS_NO); - } - } - - mWearableEntry[ type ].mWearable = new_wearable; - LLPointer cb = - new addWearableToAgentInventoryCallback( - LLPointer(NULL), - type, - addWearableToAgentInventoryCallback::CALL_UPDATE); - addWearableToAgentInventory(cb, new_wearable, category_id); - } -*/ -} - -void LLAgent::revertWearable( EWearableType type ) -{ - LLWearable* wearable = mWearableEntry[(S32)type].mWearable; - if( wearable ) - { - wearable->writeToAvatar( TRUE ); - } - sendAgentSetAppearance(); -} - -void LLAgent::revertAllWearables() -{ - for( S32 i=0; i < WT_COUNT; i++ ) - { - revertWearable( (EWearableType)i ); - } -} - -void LLAgent::saveAllWearables() -{ - //if(!gInventory.isLoaded()) - //{ - // return; - //} - - for( S32 i=0; i < WT_COUNT; i++ ) - { - saveWearable( (EWearableType)i, FALSE ); - } - sendAgentWearablesUpdate(); -} - -// Called when the user changes the name of a wearable inventory item that is currenlty being worn. -void LLAgent::setWearableName( const LLUUID& item_id, const std::string& new_name ) -{ - for( S32 i=0; i < WT_COUNT; i++ ) - { - if( mWearableEntry[i].mItemID == item_id ) - { - LLWearable* old_wearable = mWearableEntry[i].mWearable; - llassert( old_wearable ); - - std::string old_name = old_wearable->getName(); - old_wearable->setName( new_name ); - LLWearable* new_wearable = gWearableList.createCopy( old_wearable ); - LLInventoryItem* item = gInventory.getItem(item_id); - if(item) - { - new_wearable->setPermissions(item->getPermissions()); - } - old_wearable->setName( old_name ); - - mWearableEntry[i].mWearable = new_wearable; - sendAgentWearablesUpdate(); - break; - } - } -} - - -BOOL LLAgent::isWearableModifiable(EWearableType type) -{ - LLUUID item_id = getWearableItem(type); - if(!item_id.isNull()) - { - LLInventoryItem* item = gInventory.getItem(item_id); - if(item && item->getPermissions().allowModifyBy(gAgent.getID(), - gAgent.getGroupID())) - { - return TRUE; - } - } - return FALSE; -} - -BOOL LLAgent::isWearableCopyable(EWearableType type) -{ - LLUUID item_id = getWearableItem(type); - if(!item_id.isNull()) - { - LLInventoryItem* item = gInventory.getItem(item_id); - if(item && item->getPermissions().allowCopyBy(gAgent.getID(), - gAgent.getGroupID())) - { - return TRUE; - } - } - return FALSE; -} - -U32 LLAgent::getWearablePermMask(EWearableType type) -{ - LLUUID item_id = getWearableItem(type); - if(!item_id.isNull()) - { - LLInventoryItem* item = gInventory.getItem(item_id); - if(item) - { - return item->getPermissions().getMaskOwner(); - } - } - return PERM_NONE; -} - -LLInventoryItem* LLAgent::getWearableInventoryItem(EWearableType type) -{ - LLUUID item_id = getWearableItem(type); - LLInventoryItem* item = NULL; - if(item_id.notNull()) - { - item = gInventory.getItem(item_id); - } - return item; -} - -LLWearable* LLAgent::getWearableFromWearableItem( const LLUUID& item_id ) -{ - for( S32 i=0; i < WT_COUNT; i++ ) - { - if( mWearableEntry[i].mItemID == item_id ) - { - return mWearableEntry[i].mWearable; - } - } - return NULL; -} - - -void LLAgent::sendAgentWearablesRequest() -{ - gMessageSystem->newMessageFast(_PREHASH_AgentWearablesRequest); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - sendReliableMessage(); -} - -// Used to enable/disable menu items. -// static -BOOL LLAgent::selfHasWearable( void* userdata ) -{ - EWearableType type = (EWearableType)(intptr_t)userdata; - return gAgent.getWearable( type ) != NULL; -} - -BOOL LLAgent::isWearingItem( const LLUUID& item_id ) -{ - return (getWearableFromWearableItem( item_id ) != NULL); -} - -// static -void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void** user_data ) -{ - // We should only receive this message a single time. Ignore subsequent AgentWearablesUpdates - // that may result from AgentWearablesRequest having been sent more than once. - static bool first = true; - if (!first) return; - first = false; - - LLUUID agent_id; - gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( avatar && (agent_id == avatar->getID()) ) - { - gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgent.mAgentWearablesUpdateSerialNum ); - - S32 num_wearables = gMessageSystem->getNumberOfBlocksFast(_PREHASH_WearableData); - if( num_wearables < 4 ) - { - // Transitional state. Avatars should always have at least their body parts (hair, eyes, shape and skin). - // The fact that they don't have any here (only a dummy is sent) implies that this account existed - // before we had wearables, or that the database has gotten messed up. - return; - } - - //lldebugs << "processAgentInitialWearablesUpdate()" << llendl; - // Add wearables - LLUUID asset_id_array[ WT_COUNT ]; - S32 i; - for( i=0; i < num_wearables; i++ ) - { - U8 type_u8 = 0; - gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i ); - if( type_u8 >= WT_COUNT ) - { - continue; - } - EWearableType type = (EWearableType) type_u8; - - LLUUID item_id; - gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i ); - - LLUUID asset_id; - gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i ); - if( asset_id.isNull() ) - { - LLWearable::removeFromAvatar( type, FALSE ); - } - else - { - LLAssetType::EType asset_type = LLWearable::typeToAssetType( type ); - if( asset_type == LLAssetType::AT_NONE ) - { - continue; - } - - gAgent.mWearableEntry[type].mItemID = item_id; - asset_id_array[type] = asset_id; - } - - lldebugs << " " << LLWearable::typeToTypeLabel(type) << llendl; - } - - // now that we have the asset ids...request the wearable assets - for( i = 0; i < WT_COUNT; i++ ) - { - if( !gAgent.mWearableEntry[i].mItemID.isNull() ) - { - gWearableList.getAsset( - asset_id_array[i], - LLStringUtil::null, - LLWearable::typeToAssetType( (EWearableType) i ), - LLAgent::onInitialWearableAssetArrived, (void*)(intptr_t)i ); - } - } - } -} - -// A single wearable that the avatar was wearing on start-up has arrived from the database. -// static -void LLAgent::onInitialWearableAssetArrived( LLWearable* wearable, void* userdata ) -{ - EWearableType type = (EWearableType)(intptr_t)userdata; - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( !avatar ) - { - return; - } - - if( wearable ) - { - llassert( type == wearable->getType() ); - gAgent.mWearableEntry[ type ].mWearable = wearable; - - // disable composites if initial textures are baked - avatar->setupComposites(); - gAgent.queryWearableCache(); - - wearable->writeToAvatar( FALSE ); - avatar->setCompositeUpdatesEnabled(TRUE); - gInventory.addChangedMask( LLInventoryObserver::LABEL, gAgent.mWearableEntry[type].mItemID ); - } - else - { - // Somehow the asset doesn't exist in the database. - gAgent.recoverMissingWearable( type ); - } - - gInventory.notifyObservers(); - - // Have all the wearables that the avatar was wearing at log-in arrived? - if( !gAgent.mWearablesLoaded ) - { - gAgent.mWearablesLoaded = TRUE; - for( S32 i = 0; i < WT_COUNT; i++ ) - { - if( !gAgent.mWearableEntry[i].mItemID.isNull() && !gAgent.mWearableEntry[i].mWearable ) - { - gAgent.mWearablesLoaded = FALSE; - break; - } - } - } - - if( gAgent.mWearablesLoaded ) - { - // Make sure that the server's idea of the avatar's wearables actually match the wearables. - gAgent.sendAgentSetAppearance(); - - // Check to see if there are any baked textures that we hadn't uploaded before we logged off last time. - // If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive. - if( !gAgent.cameraCustomizeAvatar() ) - { - avatar->requestLayerSetUploads(); - } - } -} - -// Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the -// database. If for some reason, we can't load one of those assets, we can try to reconstruct it so that -// the user isn't left without a shape, for example. (We can do that only after the inventory has loaded.) -void LLAgent::recoverMissingWearable( EWearableType type ) -{ - // Try to recover by replacing missing wearable with a new one. - LLNotifications::instance().add("ReplacedMissingWearable"); - lldebugs << "Wearable " << LLWearable::typeToTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; - LLWearable* new_wearable = gWearableList.createNewWearable(type); - - S32 type_s32 = (S32) type; - mWearableEntry[type_s32].mWearable = new_wearable; - new_wearable->writeToAvatar( TRUE ); - - // Add a new one in the lost and found folder. - // (We used to overwrite the "not found" one, but that could potentially - // destory content.) JC - LLUUID lost_and_found_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); - LLPointer cb = - new addWearableToAgentInventoryCallback( - LLPointer(NULL), - type_s32, - new_wearable, - addWearableToAgentInventoryCallback::CALL_RECOVERDONE); - addWearableToAgentInventory( cb, new_wearable, lost_and_found_id, TRUE); -} - -void LLAgent::recoverMissingWearableDone() -{ - // Have all the wearables that the avatar was wearing at log-in arrived or been fabricated? - mWearablesLoaded = TRUE; - for( S32 i = 0; i < WT_COUNT; i++ ) - { - if( !mWearableEntry[i].mItemID.isNull() && !mWearableEntry[i].mWearable ) - { - mWearablesLoaded = FALSE; - break; - } - } - - if( mWearablesLoaded ) - { - // Make sure that the server's idea of the avatar's wearables actually match the wearables. - sendAgentSetAppearance(); - } - else - { - gInventory.addChangedMask( LLInventoryObserver::LABEL, LLUUID::null ); - gInventory.notifyObservers(); - } -} - -void LLAgent::createStandardWearables(BOOL female) -{ - llwarns << "Creating Standard " << (female ? "female" : "male" ) - << " Wearables" << llendl; - - if (mAvatarObject.isNull()) - { - return; - } - - if(female) mAvatarObject->setSex(SEX_FEMALE); - else mAvatarObject->setSex(SEX_MALE); - - BOOL create[WT_COUNT] = - { - TRUE, //WT_SHAPE - TRUE, //WT_SKIN - TRUE, //WT_HAIR - TRUE, //WT_EYES - TRUE, //WT_SHIRT - TRUE, //WT_PANTS - TRUE, //WT_SHOES - TRUE, //WT_SOCKS - FALSE, //WT_JACKET - FALSE, //WT_GLOVES - TRUE, //WT_UNDERSHIRT - TRUE, //WT_UNDERPANTS - FALSE //WT_SKIRT - }; - - for( S32 i=0; i < WT_COUNT; i++ ) - { - bool once = false; - LLPointer donecb = NULL; - if( create[i] ) - { - if (!once) - { - once = true; - donecb = new createStandardWearablesAllDoneCallback; - } - llassert( mWearableEntry[i].mWearable == NULL ); - LLWearable* wearable = gWearableList.createNewWearable((EWearableType)i); - mWearableEntry[i].mWearable = wearable; - // no need to update here... - LLPointer cb = - new addWearableToAgentInventoryCallback( - donecb, - i, - wearable, - addWearableToAgentInventoryCallback::CALL_CREATESTANDARDDONE); - addWearableToAgentInventory(cb, wearable, LLUUID::null, FALSE); - } - } -} -void LLAgent::createStandardWearablesDone(S32 index) -{ - LLWearable* wearable = mWearableEntry[index].mWearable; - - if (wearable) - { - wearable->writeToAvatar(TRUE); - } -} - -void LLAgent::createStandardWearablesAllDone() -{ - // ... because sendAgentWearablesUpdate will notify inventory - // observers. - mWearablesLoaded = TRUE; - sendAgentWearablesUpdate(); - sendAgentSetAppearance(); - - // Treat this as the first texture entry message, if none received yet - mAvatarObject->onFirstTEMessageReceived(); -} - -void LLAgent::makeNewOutfit( - const std::string& new_folder_name, - const LLDynamicArray& wearables_to_include, - const LLDynamicArray& attachments_to_include, - BOOL rename_clothing) -{ - if (mAvatarObject.isNull()) - { - return; - } - - // First, make a folder in the Clothes directory. - LLUUID folder_id = gInventory.createNewCategory( - gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING), - LLAssetType::AT_NONE, - new_folder_name); - - bool found_first_item = false; - - /////////////////// - // Wearables - - if( wearables_to_include.count() ) - { - // Then, iterate though each of the wearables and save copies of them in the folder. - S32 i; - S32 count = wearables_to_include.count(); - LLDynamicArray delete_items; - LLPointer cbdone = NULL; - for( i = 0; i < count; ++i ) - { - S32 index = wearables_to_include[i]; - LLWearable* old_wearable = mWearableEntry[ index ].mWearable; - if( old_wearable ) - { - std::string new_name; - LLWearable* new_wearable; - new_wearable = gWearableList.createCopy(old_wearable); - if (rename_clothing) - { - new_name = new_folder_name; - new_name.append(" "); - new_name.append(old_wearable->getTypeLabel()); - LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); - new_wearable->setName(new_name); - } - - LLViewerInventoryItem* item = gInventory.getItem(mWearableEntry[index].mItemID); - S32 todo = addWearableToAgentInventoryCallback::CALL_NONE; - if (!found_first_item) - { - found_first_item = true; - /* set the focus to the first item */ - todo |= addWearableToAgentInventoryCallback::CALL_MAKENEWOUTFITDONE; - /* send the agent wearables update when done */ - cbdone = new sendAgentWearablesUpdateCallback; - } - LLPointer cb = - new addWearableToAgentInventoryCallback( - cbdone, - index, - new_wearable, - todo); - if (isWearableCopyable((EWearableType)index)) - { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - folder_id, - new_name, - cb); - } - else - { - move_inventory_item( - gAgent.getID(), - gAgent.getSessionID(), - item->getUUID(), - folder_id, - new_name, - cb); - } - } - } - gInventory.notifyObservers(); - } - - - /////////////////// - // Attachments - - if( attachments_to_include.count() ) - { - BOOL msg_started = FALSE; - LLMessageSystem* msg = gMessageSystem; - for( S32 i = 0; i < attachments_to_include.count(); i++ ) - { - S32 attachment_pt = attachments_to_include[i]; - LLViewerJointAttachment* attachment = get_if_there(mAvatarObject->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL ); - if(!attachment) continue; - LLViewerObject* attached_object = attachment->getObject(); - if(!attached_object) continue; - const LLUUID& item_id = attachment->getItemID(); - if(item_id.isNull()) continue; - LLInventoryItem* item = gInventory.getItem(item_id); - if(!item) continue; - if(!msg_started) - { - msg_started = TRUE; - msg->newMessage("CreateNewOutfitAttachments"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", getID()); - msg->addUUID("SessionID", getSessionID()); - msg->nextBlock("HeaderData"); - msg->addUUID("NewFolderID", folder_id); - } - msg->nextBlock("ObjectData"); - msg->addUUID("OldItemID", item_id); - msg->addUUID("OldFolderID", item->getParentUUID()); - } - - if( msg_started ) - { - sendReliableMessage(); - } - - } -} - -void LLAgent::makeNewOutfitDone(S32 index) -{ - LLUUID first_item_id = mWearableEntry[index].mItemID; - // Open the inventory and select the first item we added. - if( first_item_id.notNull() ) - { - LLInventoryView* view = LLInventoryView::getActiveInventory(); - if(view) - { - view->getPanel()->setSelection(first_item_id, TAKE_FOCUS_NO); - } - } -} - - -void LLAgent::addWearableToAgentInventory( - LLPointer cb, - LLWearable* wearable, - const LLUUID& category_id, - BOOL notify) -{ - create_inventory_item( - gAgent.getID(), - gAgent.getSessionID(), - category_id, - wearable->getTransactionID(), - wearable->getName(), - wearable->getDescription(), - wearable->getAssetType(), - LLInventoryType::IT_WEARABLE, - wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), - cb); -} - -//----------------------------------------------------------------------------- -// sendAgentSetAppearance() -//----------------------------------------------------------------------------- -void LLAgent::sendAgentSetAppearance() -{ - if (mAvatarObject.isNull()) return; - - if (mNumPendingQueries > 0 && !gAgent.cameraCustomizeAvatar()) - { - return; - } - - - llinfos << "TAT: Sent AgentSetAppearance: " << mAvatarObject->getBakedStatusForPrintout() << llendl; - //dumpAvatarTEs( "sendAgentSetAppearance()" ); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_AgentSetAppearance); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, getID()); - msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - - // correct for the collision tolerance (to make it look like the - // agent is actually walking on the ground/object) - // NOTE -- when we start correcting all of the other Havok geometry - // to compensate for the COLLISION_TOLERANCE ugliness we will have - // to tweak this number again - const LLVector3 body_size = mAvatarObject->mBodySize; - msg->addVector3Fast(_PREHASH_Size, body_size); - - // To guard against out of order packets - // Note: always start by sending 1. This resets the server's count. 0 on the server means "uninitialized" - mAppearanceSerialNum++; - msg->addU32Fast(_PREHASH_SerialNum, mAppearanceSerialNum ); - - // is texture data current relative to wearables? - // KLW - TAT this will probably need to check the local queue. - BOOL textures_current = !mAvatarObject->hasPendingBakedUploads() && mWearablesLoaded; - - for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) - { - const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)baked_index); - - // if we're not wearing a skirt, we don't need the texture to be baked - if (texture_index == TEX_SKIRT_BAKED && !mAvatarObject->isWearingWearableType(WT_SKIRT)) - { - continue; - } - - // IMG_DEFAULT_AVATAR means not baked - if (!mAvatarObject->isTextureDefined(texture_index)) - { - textures_current = FALSE; - break; - } - } - - // only update cache entries if we have all our baked textures - if (textures_current) - { - llinfos << "TAT: Sending cached texture data" << llendl; - for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) - { - const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = LLVOAvatarDictionary::getInstance()->getWearable((EBakedTextureIndex)baked_index); - LLUUID hash; - for (U8 i=0; i < wearable_dict->mWearablesVec.size(); i++) - { - // EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num]; - const EWearableType wearable_type = wearable_dict->mWearablesVec[i]; - const LLWearable* wearable = getWearable(wearable_type); - if (wearable) - { - hash ^= wearable->getID(); - } - } - if (hash.notNull()) - { - hash ^= wearable_dict->mHashID; - } - - const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)baked_index); - - msg->nextBlockFast(_PREHASH_WearableData); - msg->addUUIDFast(_PREHASH_CacheID, hash); - msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index); - } - msg->nextBlockFast(_PREHASH_ObjectData); - mAvatarObject->packTEMessage( gMessageSystem ); - } - else - { - // If the textures aren't baked, send NULL for texture IDs - // This means the baked texture IDs on the server will be untouched. - // Once all textures are baked, another AvatarAppearance message will be sent to update the TEs - msg->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addBinaryDataFast(_PREHASH_TextureEntry, NULL, 0); + // If the textures aren't baked, send NULL for texture IDs + // This means the baked texture IDs on the server will be untouched. + // Once all textures are baked, another AvatarAppearance message will be sent to update the TEs + msg->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addBinaryDataFast(_PREHASH_TextureEntry, NULL, 0); } @@ -7294,456 +6492,20 @@ void LLAgent::sendAgentDataUpdateRequest() { gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest); gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); sendReliableMessage(); } -void LLAgent::removeWearable( EWearableType type ) -{ - LLWearable* old_wearable = mWearableEntry[ type ].mWearable; - - if ( (gAgent.isTeen()) - && (type == WT_UNDERSHIRT || type == WT_UNDERPANTS)) - { - // Can't take off underclothing in simple UI mode or on PG accounts - return; - } - - if( old_wearable ) - { - if( old_wearable->isDirty() ) - { - LLSD payload; - payload["wearable_type"] = (S32)type; - // Bring up view-modal dialog: Save changes? Yes, No, Cancel - LLNotifications::instance().add("WearableSave", LLSD(), payload, &LLAgent::onRemoveWearableDialog); - return; - } - else - { - removeWearableFinal( type ); - } - } -} - -// static -bool LLAgent::onRemoveWearableDialog(const LLSD& notification, const LLSD& response ) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger(); - switch( option ) - { - case 0: // "Save" - gAgent.saveWearable( type ); - gAgent.removeWearableFinal( type ); - break; - - case 1: // "Don't Save" - gAgent.removeWearableFinal( type ); - break; - - case 2: // "Cancel" - break; - - default: - llassert(0); - break; - } - return false; -} - -// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal. -void LLAgent::removeWearableFinal( EWearableType type ) -{ - LLWearable* old_wearable = mWearableEntry[ type ].mWearable; - - gInventory.addChangedMask( LLInventoryObserver::LABEL, mWearableEntry[type].mItemID ); - - mWearableEntry[ type ].mWearable = NULL; - mWearableEntry[ type ].mItemID.setNull(); - - queryWearableCache(); - - if( old_wearable ) - { - old_wearable->removeFromAvatar( TRUE ); - } - - // Update the server - sendAgentWearablesUpdate(); - sendAgentSetAppearance(); - gInventory.notifyObservers(); -} - -void LLAgent::copyWearableToInventory( EWearableType type ) -{ - LLWearable* wearable = mWearableEntry[ type ].mWearable; - if( wearable ) - { - // Save the old wearable if it has changed. - if( wearable->isDirty() ) - { - wearable = gWearableList.createCopyFromAvatar( wearable ); - mWearableEntry[ type ].mWearable = wearable; - } - - // Make a new entry in the inventory. (Put it in the same folder as the original item if possible.) - LLUUID category_id; - LLInventoryItem* item = gInventory.getItem( mWearableEntry[ type ].mItemID ); - if( item ) - { - category_id = item->getParentUUID(); - wearable->setPermissions(item->getPermissions()); - } - LLPointer cb = - new addWearableToAgentInventoryCallback( - LLPointer(NULL), - type, - wearable); - addWearableToAgentInventory(cb, wearable, category_id); - } -} - - -// A little struct to let setWearable() communicate more than one value with onSetWearableDialog(). -struct LLSetWearableData -{ - LLSetWearableData( const LLUUID& new_item_id, LLWearable* new_wearable ) : - mNewItemID( new_item_id ), mNewWearable( new_wearable ) {} - LLUUID mNewItemID; - LLWearable* mNewWearable; -}; - -BOOL LLAgent::needsReplacement(EWearableType wearableType, S32 remove) -{ - return TRUE; - /*if (remove) return TRUE; - - return getWearable(wearableType) ? TRUE : FALSE;*/ -} - -// Assumes existing wearables are not dirty. -void LLAgent::setWearableOutfit( - const LLInventoryItem::item_array_t& items, - const LLDynamicArray< LLWearable* >& wearables, - BOOL remove ) -{ - lldebugs << "setWearableOutfit() start" << llendl; - - BOOL wearables_to_remove[WT_COUNT]; - wearables_to_remove[WT_SHAPE] = FALSE; - wearables_to_remove[WT_SKIN] = FALSE; - wearables_to_remove[WT_HAIR] = FALSE; - wearables_to_remove[WT_EYES] = FALSE; - wearables_to_remove[WT_SHIRT] = remove; - wearables_to_remove[WT_PANTS] = remove; - wearables_to_remove[WT_SHOES] = remove; - wearables_to_remove[WT_SOCKS] = remove; - wearables_to_remove[WT_JACKET] = remove; - wearables_to_remove[WT_GLOVES] = remove; - wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; - wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; - wearables_to_remove[WT_SKIRT] = remove; - - S32 count = wearables.count(); - llassert( items.count() == count ); - - S32 i; - for( i = 0; i < count; i++ ) - { - LLWearable* new_wearable = wearables[i]; - LLPointer new_item = items[i]; - - EWearableType type = new_wearable->getType(); - wearables_to_remove[type] = FALSE; - - LLWearable* old_wearable = mWearableEntry[ type ].mWearable; - if( old_wearable ) - { - const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; - if( (old_wearable->getID() == new_wearable->getID()) && - (old_item_id == new_item->getUUID()) ) - { - lldebugs << "No change to wearable asset and item: " << LLWearable::typeToTypeName( type ) << llendl; - continue; - } - - gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id); - - // Assumes existing wearables are not dirty. - if( old_wearable->isDirty() ) - { - llassert(0); - continue; - } - } - - mWearableEntry[ type ].mItemID = new_item->getUUID(); - mWearableEntry[ type ].mWearable = new_wearable; - } - - std::vector wearables_being_removed; - - for( i = 0; i < WT_COUNT; i++ ) - { - if( wearables_to_remove[i] ) - { - wearables_being_removed.push_back(mWearableEntry[ i ].mWearable); - mWearableEntry[ i ].mWearable = NULL; - - gInventory.addChangedMask(LLInventoryObserver::LABEL, mWearableEntry[ i ].mItemID); - mWearableEntry[ i ].mItemID.setNull(); - } - } - - gInventory.notifyObservers(); - - queryWearableCache(); - - std::vector::iterator wearable_iter; - - for( wearable_iter = wearables_being_removed.begin(); - wearable_iter != wearables_being_removed.end(); - ++wearable_iter) - { - LLWearable* wearablep = *wearable_iter; - if (wearablep) - { - wearablep->removeFromAvatar( TRUE ); - } - } - - for( i = 0; i < count; i++ ) - { - wearables[i]->writeToAvatar( TRUE ); - } - - // Start rendering & update the server - mWearablesLoaded = TRUE; - sendAgentWearablesUpdate(); - sendAgentSetAppearance(); - - lldebugs << "setWearableOutfit() end" << llendl; -} - - -// User has picked "wear on avatar" from a menu. -void LLAgent::setWearable( LLInventoryItem* new_item, LLWearable* new_wearable ) -{ - EWearableType type = new_wearable->getType(); - - LLWearable* old_wearable = mWearableEntry[ type ].mWearable; - if( old_wearable ) - { - const LLUUID& old_item_id = mWearableEntry[ type ].mItemID; - if( (old_wearable->getID() == new_wearable->getID()) && - (old_item_id == new_item->getUUID()) ) - { - lldebugs << "No change to wearable asset and item: " << LLWearable::typeToTypeName( type ) << llendl; - return; - } - - if( old_wearable->isDirty() ) - { - // Bring up modal dialog: Save changes? Yes, No, Cancel - LLSD payload; - payload["item_id"] = new_item->getUUID(); - LLNotifications::instance().add( "WearableSave", LLSD(), payload, boost::bind(LLAgent::onSetWearableDialog, _1, _2, new_wearable)); - return; - } - } - - setWearableFinal( new_item, new_wearable ); -} - -// static -bool LLAgent::onSetWearableDialog( const LLSD& notification, const LLSD& response, LLWearable* wearable ) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - LLInventoryItem* new_item = gInventory.getItem( notification["payload"]["item_id"].asUUID()); - if( !new_item ) - { - delete wearable; - return false; - } - - switch( option ) - { - case 0: // "Save" - gAgent.saveWearable( wearable->getType() ); - gAgent.setWearableFinal( new_item, wearable ); - break; - - case 1: // "Don't Save" - gAgent.setWearableFinal( new_item, wearable ); - break; - - case 2: // "Cancel" - break; - - default: - llassert(0); - break; - } - - delete wearable; - return false; -} - -// Called from setWearable() and onSetWearableDialog() to actually set the wearable. -void LLAgent::setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable ) -{ - EWearableType type = new_wearable->getType(); - - // Replace the old wearable with a new one. - llassert( new_item->getAssetUUID() == new_wearable->getID() ); - LLUUID old_item_id = mWearableEntry[ type ].mItemID; - mWearableEntry[ type ].mItemID = new_item->getUUID(); - mWearableEntry[ type ].mWearable = new_wearable; - - if (old_item_id.notNull()) - { - gInventory.addChangedMask( LLInventoryObserver::LABEL, old_item_id ); - gInventory.notifyObservers(); - } - - //llinfos << "LLVOAvatar::setWearable()" << llendl; - queryWearableCache(); - new_wearable->writeToAvatar( TRUE ); - - // Update the server - sendAgentWearablesUpdate(); - sendAgentSetAppearance(); -} - -void LLAgent::queryWearableCache() +void LLAgent::sendAgentUserInfoRequest() { - if (!mWearablesLoaded) - { - return; - } - - // Look up affected baked textures. - // If they exist: - // disallow updates for affected layersets (until dataserver responds with cache request.) - // If cache miss, turn updates back on and invalidate composite. - // If cache hit, modify baked texture entries. - // - // Cache requests contain list of hashes for each baked texture entry. - // Response is list of valid baked texture assets. (same message) - - gMessageSystem->newMessageFast(_PREHASH_AgentCachedTexture); + if(getID().isNull()) + return; // not logged in + gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID()); - gMessageSystem->addS32Fast(_PREHASH_SerialNum, mTextureCacheQueryID); - - S32 num_queries = 0; - for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ ) - { - const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = LLVOAvatarDictionary::getInstance()->getWearable((EBakedTextureIndex)baked_index); - LLUUID hash; - for (U8 i=0; i < wearable_dict->mWearablesVec.size(); i++) - { - // EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num]; - const EWearableType wearable_type = wearable_dict->mWearablesVec[i]; - const LLWearable* wearable = getWearable(wearable_type); - if (wearable) - { - hash ^= wearable->getID(); - } - } - if (hash.notNull()) - { - hash ^= wearable_dict->mHashID; - num_queries++; - // *NOTE: make sure at least one request gets packed - - //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl; - gMessageSystem->nextBlockFast(_PREHASH_WearableData); - gMessageSystem->addUUIDFast(_PREHASH_ID, hash); - gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index); - } - - mActiveCacheQueries[ baked_index ] = mTextureCacheQueryID; - } - - llinfos << "Requesting texture cache entry for " << num_queries << " baked textures" << llendl; - gMessageSystem->sendReliable(getRegion()->getHost()); - mNumPendingQueries++; - mTextureCacheQueryID++; -} - -// User has picked "remove from avatar" from a menu. -// static -void LLAgent::userRemoveWearable( void* userdata ) -{ - EWearableType type = (EWearableType)(intptr_t)userdata; - - if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR ) ) //&& - //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) - { - gAgent.removeWearable( type ); - } -} - -void LLAgent::userRemoveAllClothes( void* userdata ) -{ - // We have to do this up front to avoid having to deal with the case of multiple wearables being dirty. - if( gFloaterCustomize ) - { - gFloaterCustomize->askToSaveIfDirty( LLAgent::userRemoveAllClothesStep2, NULL ); - } - else - { - LLAgent::userRemoveAllClothesStep2( TRUE, NULL ); - } -} - -void LLAgent::userRemoveAllClothesStep2( BOOL proceed, void* userdata ) -{ - if( proceed ) - { - gAgent.removeWearable( WT_SHIRT ); - gAgent.removeWearable( WT_PANTS ); - gAgent.removeWearable( WT_SHOES ); - gAgent.removeWearable( WT_SOCKS ); - gAgent.removeWearable( WT_JACKET ); - gAgent.removeWearable( WT_GLOVES ); - gAgent.removeWearable( WT_UNDERSHIRT ); - gAgent.removeWearable( WT_UNDERPANTS ); - gAgent.removeWearable( WT_SKIRT ); - } -} - -void LLAgent::userRemoveAllAttachments( void* userdata ) -{ - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if(!avatarp) - { - llwarns << "No avatar found." << llendl; - return; - } - - gMessageSystem->newMessage("ObjectDetach"); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) - { - LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - LLViewerObject* objectp = attachment->getObject(); - if (objectp) - { - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); - } - } - gMessageSystem->sendReliable( gAgent.getRegionHost() ); + sendReliableMessage(); } void LLAgent::observeFriends() @@ -7808,4 +6570,87 @@ void LLAgent::parseTeleportMessages(const std::string& xml_filename) }//end for (all message sets in xml file) } +// static +void LLAgent::createLandmarkHere() +{ + std::string landmark_name, landmark_desc; + + gAgent.buildLocationString(landmark_name, LLAgent::LOCATION_FORMAT_LANDMARK); + gAgent.buildLocationString(landmark_desc, LLAgent::LOCATION_FORMAT_FULL); + LLUUID folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + + createLandmarkHere(landmark_name, landmark_desc, folder_id); +} + +// static +void LLAgent::createLandmarkHere(const std::string& name, const std::string& desc, const LLUUID& folder_id) +{ + LLViewerRegion* agent_region = gAgent.getRegion(); + if(!agent_region) + { + llwarns << "No agent region" << llendl; + return; + } + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (!agent_parcel) + { + llwarns << "No agent parcel" << llendl; + return; + } + if (!agent_parcel->getAllowLandmark() + && !LLViewerParcelMgr::isParcelOwnedByAgent(agent_parcel, GP_LAND_ALLOW_LANDMARK)) + { + LLNotifications::instance().add("CannotCreateLandmarkNotOwner"); + return; + } + + create_inventory_item(gAgent.getID(), gAgent.getSessionID(), + folder_id, LLTransactionID::tnull, + name, desc, + LLAssetType::AT_LANDMARK, + LLInventoryType::IT_LANDMARK, + NOT_WEARABLE, PERM_ALL, + NULL); +} + +void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& directory_visibility ) +{ + gMessageSystem->newMessageFast(_PREHASH_UpdateUserInfo); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, getSessionID()); + gMessageSystem->nextBlockFast(_PREHASH_UserData); + gMessageSystem->addBOOLFast(_PREHASH_IMViaEMail, im_via_email); + gMessageSystem->addString("DirectoryVisibility", directory_visibility); + gAgent.sendReliableMessage(); +} + +// static +void LLAgent::dumpGroupInfo() +{ + llinfos << "group " << gAgent.mGroupName << llendl; + llinfos << "ID " << gAgent.mGroupID << llendl; + llinfos << "powers " << gAgent.mGroupPowers << llendl; + llinfos << "title " << gAgent.mGroupTitle << llendl; + //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl; +} + +/********************************************************************************/ +LLAgentQueryManager gAgentQueryManager; + +LLAgentQueryManager::LLAgentQueryManager() : + mWearablesCacheQueryID(0), + mNumPendingQueries(0), + mUpdateSerialNum(0) +{ + for (U32 i = 0; i < BAKED_NUM_INDICES; i++) + { + mActiveCacheQueries[i] = 0; + } +} + +LLAgentQueryManager::~LLAgentQueryManager() +{ +} + // EOF diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 27fcb07fd5..94f6229838 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -33,63 +33,25 @@ #ifndef LL_LLAGENT_H #define LL_LLAGENT_H -#include - #include "indra_constants.h" -#include "llmath.h" -#include "llcontrol.h" -#include "llcoordframe.h" -#include "llevent.h" +#include "llevent.h" // LLObservable base class +#include "llagentaccess.h" #include "llagentaccess.h" #include "llagentconstants.h" -#include "llanimationstates.h" -#include "lldbstrings.h" -#include "llhudeffectlookat.h" -#include "llhudeffectpointat.h" -#include "llmemory.h" -#include "llstring.h" -#include "lluuid.h" -#include "m3math.h" -#include "m4math.h" -#include "llquaternion.h" -#include "lltimer.h" -#include "v3dmath.h" -#include "v3math.h" -#include "v4color.h" -#include "v4math.h" -//#include "vmath.h" -#include "stdenums.h" -#include "llwearable.h" -#include "llcharacter.h" -#include "llinventory.h" -#include "llviewerinventory.h" -#include "llagentdata.h" - -// Ventrella -#include "llfollowcam.h" -// end Ventrella - -const U8 AGENT_STATE_TYPING = 0x04; // Typing indication -const U8 AGENT_STATE_EDITING = 0x10; // Set when agent has objects selected - -const BOOL ANIMATE = TRUE; - -typedef enum e_camera_modes -{ - CAMERA_MODE_THIRD_PERSON, - CAMERA_MODE_MOUSELOOK, - CAMERA_MODE_CUSTOMIZE_AVATAR, - CAMERA_MODE_FOLLOW -} ECameraMode; - -typedef enum e_anim_request -{ - ANIM_REQUEST_START, - ANIM_REQUEST_STOP -} EAnimRequest; +#include "llhudeffectpointat.h" // ELookAtType +#include "llhudeffectlookat.h" // EPointAtType +#include "llpointer.h" +#include "llcharacter.h" // LLAnimPauseRequest +#include "llfollowcam.h" // Ventrella +#include "llagentdata.h" // gAgentID, gAgentSessionID +#include "llvoavatardefines.h" + +extern const BOOL ANIMATE; +extern const U8 AGENT_STATE_TYPING; // Typing indication +extern const U8 AGENT_STATE_EDITING; // Set when agent has objects selected class LLChat; -class LLVOAvatar; +class LLVOAvatarSelf; class LLViewerRegion; class LLMotion; class LLToolset; @@ -98,6 +60,25 @@ class LLPermissions; class LLHost; class LLFriendObserver; class LLPickInfo; +class LLViewerObject; +class LLAgentDropGroupViewerNode; + +//-------------------------------------------------------------------- +// Types +//-------------------------------------------------------------------- +enum ECameraMode +{ + CAMERA_MODE_THIRD_PERSON, + CAMERA_MODE_MOUSELOOK, + CAMERA_MODE_CUSTOMIZE_AVATAR, + CAMERA_MODE_FOLLOW +}; + +enum EAnimRequest +{ + ANIM_REQUEST_START, + ANIM_REQUEST_STOP +}; struct LLGroupData { @@ -110,273 +91,437 @@ struct LLGroupData std::string mName; }; -inline bool operator==(const LLGroupData &a, const LLGroupData &b) -{ - return (a.mID == b.mID); -} - -// forward declarations - -// - +//------------------------------------------------------------------------ +// LLAgent +//------------------------------------------------------------------------ class LLAgent : public LLOldEvents::LLObservable { LOG_CLASS(LLAgent); - + public: - // When the agent hasn't typed anything for this duration, it leaves the - // typing state (for both chat and IM). - static const F32 TYPING_TIMEOUT_SECS; + friend class LLAgentDropGroupViewerNode; - LLAgent(); - ~LLAgent(); +/******************************************************************************** + ** ** + ** INITIALIZATION + **/ + //-------------------------------------------------------------------- + // Constructors / Destructors + //-------------------------------------------------------------------- +public: + LLAgent(); + virtual ~LLAgent(); void init(); void cleanup(); + void setAvatarObject(LLVOAvatarSelf *avatar); - // - // MANIPULATORS - // - // TODO: Put all non-const functions here. + //-------------------------------------------------------------------- + // Login + //-------------------------------------------------------------------- +public: + void onAppFocusGained(); + void setFirstLogin(BOOL b) { mFirstLogin = b; } + // Return TRUE if the database reported this login as the first for this particular user. + BOOL isFirstLogin() const { return mFirstLogin; } +public: + BOOL mInitialized; + BOOL mFirstLogin; + std::string mMOTD; // Message of the day - // Called whenever the agent moves. Puts camera back in default position, - // deselects items, etc. - void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); + //-------------------------------------------------------------------- + // Session + //-------------------------------------------------------------------- +public: + const LLUUID& getID() const { return gAgentID; } + const LLUUID& getSessionID() const { return gAgentSessionID; } + // Note: NEVER send this value in the clear or over any weakly + // encrypted channel (such as simple XOR masking). If you are unsure + // ask Aaron or MarkL. + const LLUUID& getSecureSessionID() const { return mSecureSessionID; } +public: + LLUUID mSecureSessionID; // Secure token for this login session + +/** Initialization + ** ** + *******************************************************************************/ - // Called on camera movement, to allow the camera to be unlocked from the - // default position behind the avatar. - void unlockView(); +/******************************************************************************** + ** ** + ** IDENTITY + **/ - void onAppFocusGained(); + //-------------------------------------------------------------------- + // Name + //-------------------------------------------------------------------- +public: + void getName(std::string& name) const; + void buildFullname(std::string &name) const; + void buildFullnameAndTitle(std::string &name) const; - void sendMessage(); // Send message to this agent's region. - void sendReliableMessage(); + //-------------------------------------------------------------------- + // Gender + //-------------------------------------------------------------------- +public: + // On the very first login, gender isn't chosen until the user clicks + // in a dialog. We don't render the avatar until they choose. + BOOL isGenderChosen() const { return mGenderChosen; } + void setGenderChosen(BOOL b) { mGenderChosen = b; } +private: + BOOL mGenderChosen; - LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target - LLVector3d calcFocusPositionTargetGlobal(); - LLVector3d calcThirdPersonFocusOffset(); - // target for this mode - LLVector3d getCameraPositionGlobal() const; - const LLVector3 &getCameraPositionAgent() const; - F32 calcCameraFOVZoomFactor(); - F32 getCameraMinOffGround(); // minimum height off ground for this mode, meters - void endAnimationUpdateUI(); - void setKey(const S32 direction, S32 &key); // sets key to +1 for +direction, -1 for -direction - void handleScrollWheel(S32 clicks); // mousewheel driven zoom +/** Identity + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** GENERAL ACCESSORS + **/ + +public: + LLVOAvatarSelf* getAvatarObject() const { return mAvatarObject; } + const LLUUID& getInventoryRootID() const { return mInventoryRootID; } + LLUUID& getInventoryRootID() { return mInventoryRootID; } +private: + LLUUID mInventoryRootID; + LLPointer mAvatarObject; // NULL until avatar object sent down from simulator + +/** General Accessors + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** POSITION + **/ + + //-------------------------------------------------------------------- + // Position + //-------------------------------------------------------------------- +public: + LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const; + LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const; + const LLVector3d &getPositionGlobal() const; + const LLVector3 &getPositionAgent(); + // Call once per frame to update position, angles (radians). + void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y); + void setPositionAgent(const LLVector3 ¢er); +protected: + void propagate(const F32 dt); // ! BUG ! Should roll into updateAgentPosition +private: + mutable LLVector3d mPositionGlobal; + + //-------------------------------------------------------------------- + // Velocity + //-------------------------------------------------------------------- +public: + LLVector3 getVelocity() const; + F32 getVelocityZ() const { return getVelocity().mV[VZ]; } // ! HACK ! - void setAvatarObject(LLVOAvatar *avatar); + //-------------------------------------------------------------------- + // Coordinate System + //-------------------------------------------------------------------- +public: + LLCoordFrame getFrameAgent() const { return mFrameAgent; } + void initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place + void resetAxes(); + void resetAxes(const LLVector3 &look_at); // Makes reasonable left and up + // The following three get*Axis functions return direction avatar is looking, not camera. + const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); } + const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); } + const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); } + LLQuaternion getQuat() const; // Returns the quat that represents the rotation of the agent in the absolute frame +private: + LLVector3d mAgentOriginGlobal; // Origin of agent coords from global coords + LLCoordFrame mFrameAgent; // Agent position and view, agent-region coordinates - // rendering state bitmask helpers - void startTyping(); - void stopTyping(); - void setRenderState(U8 newstate); - void clearRenderState(U8 clearstate); - U8 getRenderState(); - // Set the home data + //-------------------------------------------------------------------- + // Home + //-------------------------------------------------------------------- +public: + void setStartPosition(U32 location_id); // Marks current location as start, sends information to servers + void setHomePosRegion(const U64& region_handle, const LLVector3& pos_region); + BOOL getHomePosGlobal(LLVector3d* pos_global); +private: + BOOL mHaveHomePosition; + U64 mHomeRegionHandle; + LLVector3 mHomePosRegion; + + //-------------------------------------------------------------------- + // Region + //-------------------------------------------------------------------- +public: + enum ELocationFormat + { + LOCATION_FORMAT_NORMAL, + LOCATION_FORMAT_LANDMARK, + LOCATION_FORMAT_FULL, + }; void setRegion(LLViewerRegion *regionp); LLViewerRegion *getRegion() const; LLHost getRegionHost() const; std::string getSLURL() const; - - void updateAgentPosition(const F32 dt, const F32 yaw, const S32 mouse_x, const S32 mouse_y); // call once per frame to update position, angles radians - void updateLookAt(const S32 mouse_x, const S32 mouse_y); - + BOOL inPrelude(); + BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK); // Utility to build a location string + static void createLandmarkHere(); + static void createLandmarkHere(const std::string& name, const std::string& desc, const LLUUID& folder_id); +private: + LLViewerRegion *mRegionp; - void updateCamera(); // call once per frame to update camera location/orientation - void resetCamera(); // slam camera into its default position - void setupSitCamera(); - void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } + //-------------------------------------------------------------------- + // History + //-------------------------------------------------------------------- +public: + S32 getRegionsVisited() const; + F64 getDistanceTraveled() const; +private: + std::set mRegionsVisited; // Stat - what distinct regions has the avatar been to? + F64 mDistanceTraveled; // Stat - how far has the avatar moved? + LLVector3d mLastPositionGlobal; // Used to calculate travel distance + +/** Position + ** ** + *******************************************************************************/ - void changeCameraToDefault(); - void changeCameraToMouselook(BOOL animate = TRUE); - void changeCameraToThirdPerson(BOOL animate = TRUE); - void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // trigger transition animation - // Ventrella - void changeCameraToFollow(BOOL animate = TRUE); - //end Ventrella +/******************************************************************************** + ** ** + ** ACTIONS + **/ - void setFocusGlobal(const LLPickInfo& pick); - void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); - void setFocusOnAvatar(BOOL focus, BOOL animate); - void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); - void setSitCamera(const LLUUID &object_id, const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); - void clearFocusObject(); - void setFocusObject(LLViewerObject* object); - void setObjectTracking(BOOL track) { mTrackFocusObject = track; } -// void setLookingAtAvatar(BOOL looking); + //-------------------------------------------------------------------- + // Fidget + //-------------------------------------------------------------------- + // Trigger random fidget animations +public: + void fidget(); + static void stopFidget(); +private: + LLFrameTimer mFidgetTimer; + LLFrameTimer mFocusObjectFadeTimer; + F32 mNextFidgetTime; + S32 mCurrentFidget; + //-------------------------------------------------------------------- + // Fly + //-------------------------------------------------------------------- +public: + BOOL getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; } + void setFlying(BOOL fly); + static void toggleFlying(); + static bool enableFlying(); + BOOL canFly(); // Does this parcel allow you to fly? + + //-------------------------------------------------------------------- + // Chat + //-------------------------------------------------------------------- +public: void heardChat(const LLUUID& id); void lookAtLastChat(); - F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); } + F32 getTypingTime() { return mTypingTimer.getElapsedTimeF32(); } + LLUUID getLastChatter() const { return mLastChatterID; } + F32 getNearChatRadius() { return mNearChatRadius; } +protected: + void ageChat(); // Helper function to prematurely age chat when agent is moving +private: + LLFrameTimer mChatTimer; + LLUUID mLastChatterID; + F32 mNearChatRadius; + + //-------------------------------------------------------------------- + // Typing + //-------------------------------------------------------------------- +public: + void startTyping(); + void stopTyping(); +public: + // When the agent hasn't typed anything for this duration, it leaves the + // typing state (for both chat and IM). + static const F32 TYPING_TIMEOUT_SECS; +private: + LLFrameTimer mTypingTimer; + //-------------------------------------------------------------------- + // AFK + //-------------------------------------------------------------------- +public: void setAFK(); void clearAFK(); BOOL getAFK() const; - void setAlwaysRun() { mbAlwaysRun = true; } - void clearAlwaysRun() { mbAlwaysRun = false; } + //-------------------------------------------------------------------- + // Run + //-------------------------------------------------------------------- +public: + enum EDoubleTapRunMode + { + DOUBLETAP_NONE, + DOUBLETAP_FORWARD, + DOUBLETAP_BACKWARD, + DOUBLETAP_SLIDELEFT, + DOUBLETAP_SLIDERIGHT + }; - void setRunning() { mbRunning = true; } - void clearRunning() { mbRunning = false; } + void setAlwaysRun() { mbAlwaysRun = true; } + void clearAlwaysRun() { mbAlwaysRun = false; } + void setRunning() { mbRunning = true; } + void clearRunning() { mbRunning = false; } + void sendWalkRun(bool running); + bool getAlwaysRun() const { return mbAlwaysRun; } + bool getRunning() const { return mbRunning; } +public: + LLFrameTimer mDoubleTapRunTimer; + EDoubleTapRunMode mDoubleTapRunMode; +private: + bool mbAlwaysRun; // Should the avatar run by default rather than walk? + bool mbRunning; // Is the avatar trying to run right now? + //-------------------------------------------------------------------- + // Busy + //-------------------------------------------------------------------- +public: void setBusy(); void clearBusy(); BOOL getBusy() const; +private: + BOOL mIsBusy; - void setAdminOverride(BOOL b); - void setGodLevel(U8 god_level); - void setFirstLogin(BOOL b) { mFirstLogin = b; } - void setGenderChosen(BOOL b) { mGenderChosen = b; } - - // update internal datastructures and update the server with the - // new contribution level. Returns true if the group id was found - // and contribution could be set. - BOOL setGroupContribution(const LLUUID& group_id, S32 contribution); - BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile); - void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; } + //-------------------------------------------------------------------- + // Jump + //-------------------------------------------------------------------- +public: + BOOL getJump() const { return mbJump; } +private: + BOOL mbJump; - // - // ACCESSORS - // - // TODO: Put all read functions here, make them const + //-------------------------------------------------------------------- + // Grab + //-------------------------------------------------------------------- +public: + BOOL leftButtonGrabbed() const; + BOOL rotateGrabbed() const; + BOOL forwardGrabbed() const; + BOOL backwardGrabbed() const; + BOOL upGrabbed() const; + BOOL downGrabbed() const; - const LLUUID& getID() const { return gAgentID; } - const LLUUID& getSessionID() const { return gAgentSessionID; } - - const LLUUID& getSecureSessionID() const { return mSecureSessionID; } - // Note: NEVER send this value in the clear or over any weakly - // encrypted channel (such as simple XOR masking). If you are unsure - // ask Aaron or MarkL. - - BOOL isGodlike() const; - U8 getGodLevel() const; - // note: this is a prime candidate for pulling out into a Maturity class - // rather than just expose the preference setting, we're going to actually - // expose what the client code cares about -- what the user should see - // based on a combination of the is* and prefers* flags, combined with God bit. - bool wantsPGOnly() const; - bool canAccessMature() const; - bool canAccessAdult() const; - bool canAccessMaturityInRegion( U64 region_handle ) const; - bool canAccessMaturityAtGlobal( LLVector3d pos_global ) const; - bool prefersPG() const; - bool prefersMature() const; - bool prefersAdult() const; - bool isTeen() const; - bool isMature() const; - bool isAdult() const; - void setTeen(bool teen); - void setMaturity(char text); - static int convertTextToMaturity(char text); - bool sendMaturityPreferenceToServer(int preferredMaturity); + //-------------------------------------------------------------------- + // Controls + //-------------------------------------------------------------------- +public: + U32 getControlFlags(); + void setControlFlags(U32 mask); // Performs bitwise mControlFlags |= mask + void clearControlFlags(U32 mask); // Performs bitwise mControlFlags &= ~mask + BOOL controlFlagsDirty() const; + void enableControlFlagReset(); + void resetControlFlags(); + BOOL anyControlGrabbed() const; // True iff a script has taken over a control + BOOL isControlGrabbed(S32 control_index) const; + // Send message to simulator to force grabbed controls to be + // released, in case of a poorly written script. + void forceReleaseControls(); +private: + S32 mControlsTakenCount[TOTAL_CONTROLS]; + S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS]; + U32 mControlFlags; // Replacement for the mFooKey's + BOOL mbFlagsDirty; + BOOL mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries - const LLAgentAccess& getAgentAccess(); + //-------------------------------------------------------------------- + // Animations + //-------------------------------------------------------------------- +public: + void stopCurrentAnimations(); + void requestStopMotion(LLMotion* motion); + void onAnimStop(const LLUUID& id); + void sendAnimationRequests(LLDynamicArray &anim_ids, EAnimRequest request); + void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); + void endAnimationUpdateUI(); +private: + LLFrameTimer mAnimationTimer; // Seconds that transition animation has been active + F32 mAnimationDuration; // In seconds + BOOL mCustomAnim; // Current animation is ANIM_AGENT_CUSTOMIZE ? + LLAnimPauseRequest mPauseRequest; + BOOL mViewsPushed; // Keep track of whether or not we have pushed views - // This function can go away after the AO transition (see llstartup.cpp) - void setAOTransition(); +/** Animation + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** MOVEMENT + **/ - BOOL isGroupTitleHidden() const { return mHideGroupTitle; } - BOOL isGroupMember() const { return !mGroupID.isNull(); } // This is only used for building titles! - const LLUUID &getGroupID() const { return mGroupID; } - ECameraMode getCameraMode() const { return mCameraMode; } - BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } - LLPointer& getFocusObject() { return mFocusObject; } - F32 getFocusObjectDist() const { return mFocusObjectDist; } - BOOL inPrelude(); - BOOL canManageEstate() const; - BOOL getAdminOverride() const; - - LLUUID getLastChatter() const { return mLastChatterID; } - bool getAlwaysRun() const { return mbAlwaysRun; } - bool getRunning() const { return mbRunning; } - - const LLUUID& getInventoryRootID() const { return mInventoryRootID; } + //-------------------------------------------------------------------- + // Keys + //-------------------------------------------------------------------- +public: + void setKey(const S32 direction, S32 &key); // Sets key to +1 for +direction, -1 for -direction +private: + S32 mAtKey; // Either 1, 0, or -1. Indicates that movement key is pressed + S32 mWalkKey; // Like AtKey, but causes less forward thrust + S32 mLeftKey; + S32 mUpKey; + F32 mYawKey; + S32 mPitchKey; - void buildFullname(std::string &name) const; - void buildFullnameAndTitle(std::string &name) const; - - // Check against all groups in the entire agent group list. - BOOL isInGroup(const LLUUID& group_id) const; - BOOL hasPowerInGroup(const LLUUID& group_id, U64 power) const; - // Check for power in just the active group. - BOOL hasPowerInActiveGroup(const U64 power) const; - U64 getPowerInGroup(const LLUUID& group_id) const; - - // Get group information by group_id. if not in group, data is - // left unchanged and method returns FALSE. otherwise, values are - // copied and returns TRUE. - BOOL getGroupData(const LLUUID& group_id, LLGroupData& data) const; - // Get just the agent's contribution to the given group. - S32 getGroupContribution(const LLUUID& group_id) const; - - // return TRUE if the database reported this login as the first - // for this particular user. - BOOL isFirstLogin() const { return mFirstLogin; } - - // On the very first login, gender isn't chosen until the user clicks - // in a dialog. We don't render the avatar until they choose. - BOOL isGenderChosen() const { return mGenderChosen; } - - // utility to build a location string - void buildLocationString(std::string& str); - - LLQuaternion getHeadRotation(); - LLVOAvatar *getAvatarObject() const { return mAvatarObject; } - - BOOL needsRenderAvatar(); // TRUE when camera mode is such that your own avatar should draw - // Not const because timers can't be accessed in const-fashion. - BOOL needsRenderHead(); - BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } - BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } - BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } - BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } - - LLVector3 getPosAgentFromGlobal(const LLVector3d &pos_global) const; - LLVector3d getPosGlobalFromAgent(const LLVector3 &pos_agent) const; - - // Get the data members - const LLVector3& getAtAxis() const { return mFrameAgent.getAtAxis(); } // direction avatar is looking, not camera - const LLVector3& getUpAxis() const { return mFrameAgent.getUpAxis(); } // direction avatar is looking, not camera - const LLVector3& getLeftAxis() const { return mFrameAgent.getLeftAxis(); } // direction avatar is looking, not camera - - LLCoordFrame getFrameAgent() const { return mFrameAgent; } - LLVector3 getVelocity() const; - F32 getVelocityZ() const { return getVelocity().mV[VZ]; } // a hack - - const LLVector3d &getPositionGlobal() const; - const LLVector3 &getPositionAgent(); - S32 getRegionsVisited() const; - F64 getDistanceTraveled() const; - - const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } - const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } - - BOOL getJump() const { return mbJump; } - BOOL getAutoPilot() const { return mAutoPilot; } - LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; } - - LLQuaternion getQuat() const; // returns the quat that represents the rotation - // of the agent in the absolute frame -// BOOL getLookingAtAvatar() const; - - void getName(std::string& name); - - const LLColor4 &getEffectColor(); - void setEffectColor(const LLColor4 &color); - // - // UTILITIES - // - - // Set the physics data - void slamLookAt(const LLVector3 &look_at); - - void setPositionAgent(const LLVector3 ¢er); + //-------------------------------------------------------------------- + // Movement from user input + //-------------------------------------------------------------------- + // All set the appropriate animation flags. + // All turn off autopilot and make sure the camera is behind the avatar. + // Direction is either positive, zero, or negative +public: + void moveAt(S32 direction, bool reset_view = true); + void moveAtNudge(S32 direction); + void moveLeft(S32 direction); + void moveLeftNudge(S32 direction); + void moveUp(S32 direction); + void moveYaw(F32 mag, bool reset_view = true); + void movePitch(S32 direction); - void resetAxes(); - void resetAxes(const LLVector3 &look_at); // makes reasonable left and up + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- +public: + void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } + void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } + void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } + void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } + void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } + void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } +private: + F32 mOrbitLeftKey; + F32 mOrbitRightKey; + F32 mOrbitUpKey; + F32 mOrbitDownKey; + F32 mOrbitInKey; + F32 mOrbitOutKey; + + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- +public: + void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } + void setPanRightKey(F32 mag) { mPanRightKey = mag; } + void setPanUpKey(F32 mag) { mPanUpKey = mag; } + void setPanDownKey(F32 mag) { mPanDownKey = mag; } + void setPanInKey(F32 mag) { mPanInKey = mag; } + void setPanOutKey(F32 mag) { mPanOutKey = mag; } +private: + F32 mPanUpKey; + F32 mPanDownKey; + F32 mPanLeftKey; + F32 mPanRightKey; + F32 mPanInKey; + F32 mPanOutKey; - // Move the avatar's frame + //-------------------------------------------------------------------- + // Move the avatar's frame + //-------------------------------------------------------------------- +public: void rotate(F32 angle, const LLVector3 &axis); void rotate(F32 angle, F32 x, F32 y, F32 z); void rotate(const LLMatrix3 &matrix); @@ -387,201 +532,47 @@ public: LLVector3 getReferenceUpVector(); F32 clampPitchToLimits(F32 angle); - void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } - // Flight management - BOOL getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; } - void setFlying(BOOL fly); - void toggleFlying(); - - // Does this parcel allow you to fly? - BOOL canFly(); - - // Animation functions - void stopCurrentAnimations(); - void requestStopMotion( LLMotion* motion ); - void onAnimStop(const LLUUID& id); - - void sendAnimationRequests(LLDynamicArray &anim_ids, EAnimRequest request); - void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); - - LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); - BOOL calcCameraMinDistance(F32 &obj_min_distance); - - void startCameraAnimation(); - void stopCameraAnimation(); - - void cameraZoomIn(const F32 factor); // zoom in by fraction of current distance - void cameraOrbitAround(const F32 radians); // rotate camera CCW radians about build focus point - void cameraOrbitOver(const F32 radians); // rotate camera forward radians over build focus point - void cameraOrbitIn(const F32 meters); // move camera in toward build focus point - - F32 getCameraZoomFraction(); // get camera zoom as fraction of minimum and maximum zoom - void setCameraZoomFraction(F32 fraction); // set camera zoom as fraction of minimum and maximum zoom - - void cameraPanIn(const F32 meters); - void cameraPanLeft(const F32 meters); - void cameraPanUp(const F32 meters); - - void updateFocusOffset(); - void validateFocusObject(); - - void setUsingFollowCam( bool using_follow_cam); - - F32 calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global ); - - // marks current location as start, sends information to servers - void setStartPosition(U32 location_id); - - // Movement from user input. All set the appropriate animation flags. - // All turn off autopilot and make sure the camera is behind the avatar. - // direction is either positive, zero, or negative - void moveAt(S32 direction, bool reset_view = true); - void moveAtNudge(S32 direction); - void moveLeft(S32 direction); - void moveLeftNudge(S32 direction); - void moveUp(S32 direction); - void moveYaw(F32 mag, bool reset_view = true); - void movePitch(S32 direction); - - void setOrbitLeftKey(F32 mag) { mOrbitLeftKey = mag; } - void setOrbitRightKey(F32 mag) { mOrbitRightKey = mag; } - void setOrbitUpKey(F32 mag) { mOrbitUpKey = mag; } - void setOrbitDownKey(F32 mag) { mOrbitDownKey = mag; } - void setOrbitInKey(F32 mag) { mOrbitInKey = mag; } - void setOrbitOutKey(F32 mag) { mOrbitOutKey = mag; } - - void setPanLeftKey(F32 mag) { mPanLeftKey = mag; } - void setPanRightKey(F32 mag) { mPanRightKey = mag; } - void setPanUpKey(F32 mag) { mPanUpKey = mag; } - void setPanDownKey(F32 mag) { mPanDownKey = mag; } - void setPanInKey(F32 mag) { mPanInKey = mag; } - void setPanOutKey(F32 mag) { mPanOutKey = mag; } - - U32 getControlFlags(); - void setControlFlags(U32 mask); // performs bitwise mControlFlags |= mask - void clearControlFlags(U32 mask); // performs bitwise mControlFlags &= ~mask - BOOL controlFlagsDirty() const; - void enableControlFlagReset(); - void resetControlFlags(); - - void propagate(const F32 dt); // BUG: should roll into updateAgentPosition - - void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = std::string(), const LLQuaternion *target_rotation = NULL, - void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f); - + //-------------------------------------------------------------------- + // Autopilot + //-------------------------------------------------------------------- +public: + BOOL getAutoPilot() const { return mAutoPilot; } + LLVector3d getAutoPilotTargetGlobal() const { return mAutoPilotTargetGlobal; } + void startAutoPilotGlobal(const LLVector3d &pos_global, + const std::string& behavior_name = std::string(), + const LLQuaternion *target_rotation = NULL, + void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, + F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f); void startFollowPilot(const LLUUID &leader_id); void stopAutoPilot(BOOL user_cancel = FALSE); void setAutoPilotGlobal(const LLVector3d &pos_global); - void autoPilot(F32 *delta_yaw); // autopilot walking action, angles in radians + void autoPilot(F32 *delta_yaw); // Autopilot walking action, angles in radians void renderAutoPilotTarget(); +private: + BOOL mAutoPilot; + BOOL mAutoPilotFlyOnStop; + LLVector3d mAutoPilotTargetGlobal; + F32 mAutoPilotStopDistance; + BOOL mAutoPilotUseRotation; + LLVector3 mAutoPilotTargetFacing; + F32 mAutoPilotTargetDist; + S32 mAutoPilotNoProgressFrameCount; + F32 mAutoPilotRotationThreshold; + std::string mAutoPilotBehaviorName; + void (*mAutoPilotFinishedCallback)(BOOL, void *); + void* mAutoPilotCallbackData; + LLUUID mLeaderID; + +/** Movement + ** ** + *******************************************************************************/ - // - // teportation methods - // - - // go to a named location home - void teleportRequest( - const U64& region_handle, - const LLVector3& pos_local); - - // teleport to a landmark - void teleportViaLandmark(const LLUUID& landmark_id); - - // go home - void teleportHome() { teleportViaLandmark(LLUUID::null); } - - // to an invited location - void teleportViaLure(const LLUUID& lure_id, BOOL godlike); - - // to a global location - this will probably need to be - // deprecated. - void teleportViaLocation(const LLVector3d& pos_global); - - // cancel the teleport, may or may not be allowed by server - void teleportCancel(); - - void setTargetVelocity(const LLVector3 &vel); - const LLVector3 &getTargetVelocity() const; - - const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; } - - - // Setting the ability for this avatar to proxy for another avatar. - //static void processAddModifyAbility(LLMessageSystem* msg, void**); - //static void processGrantedProxies(LLMessageSystem* msg, void**); - //static void processRemoveModifyAbility(LLMessageSystem* msg, void**); - //BOOL isProxyFor(const LLUUID& agent_id);// *FIX should be const - - static void processAgentDataUpdate(LLMessageSystem *msg, void **); - static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **); - static void processAgentDropGroup(LLMessageSystem *msg, void **); - static void processScriptControlChange(LLMessageSystem *msg, void **); - static void processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data); - //static void processControlTake(LLMessageSystem *msg, void **); - //static void processControlRelease(LLMessageSystem *msg, void **); - - // This method checks to see if this agent can modify an object - // based on the permissions and the agent's proxy status. - BOOL isGrantedProxy(const LLPermissions& perm); - - BOOL allowOperation(PermissionBit op, - const LLPermissions& perm, - U64 group_proxy_power = 0, - U8 god_minimum = GOD_MAINTENANCE); - - friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere); - - void initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place! - djs 08/07/02 - - BOOL leftButtonGrabbed() const { return ( (!cameraMouselook() && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) - ||(cameraMouselook() && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) - ||(!cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) - ||(cameraMouselook() && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)); } - BOOL rotateGrabbed() const { return ( (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0) - ||(mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0)); } - BOOL forwardGrabbed() const { return ( (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0)); } - BOOL backwardGrabbed() const { return ( (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0)); } - BOOL upGrabbed() const { return ( (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0)); } - BOOL downGrabbed() const { return ( (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0)); } - - // True iff a script has taken over a control. - BOOL anyControlGrabbed() const; - - BOOL isControlGrabbed(S32 control_index) const; - - // Send message to simulator to force grabbed controls to be - // released, in case of a poorly written script. - void forceReleaseControls(); - - BOOL sitCameraEnabled() { return mSitCameraEnabled; } - - F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } - - // look at behavior - BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - ELookAtType getLookAtType(); - - // point at behavior - BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); - EPointAtType getPointAtType(); - - void setHomePosRegion( const U64& region_handle, const LLVector3& pos_region ); - BOOL getHomePosGlobal( LLVector3d* pos_global ); - void setCameraAnimating( BOOL b ) { mCameraAnimating = b; } - BOOL getCameraAnimating( ) { return mCameraAnimating; } - void setAnimationDuration( F32 seconds ) { mAnimationDuration = seconds; } - - F32 getNearChatRadius() { return mNearChatRadius; } - - enum EDoubleTapRunMode - { - DOUBLETAP_NONE, - DOUBLETAP_FORWARD, - DOUBLETAP_BACKWARD, - DOUBLETAP_SLIDELEFT, - DOUBLETAP_SLIDERIGHT - }; +/******************************************************************************** + ** ** + ** TELEPORT + **/ +public: enum ETeleportState { TELEPORT_NONE = 0, // No teleport in progress @@ -592,376 +583,487 @@ public: TELEPORT_ARRIVING = 5 // Make the user wait while content "pre-caches" }; - ETeleportState getTeleportState() const { return mTeleportState; } - void setTeleportState( ETeleportState state ); - const std::string& getTeleportMessage() const { return mTeleportMessage; } - void setTeleportMessage(const std::string& message) - { - mTeleportMessage = message; - } - - // trigger random fidget animations - void fidget(); - - void requestEnterGodMode(); - void requestLeaveGodMode(); - - void sendAgentSetAppearance(); - - void sendAgentDataUpdateRequest(); - - // Ventrella - LLFollowCam mFollowCam; - // end Ventrella +public: + static void parseTeleportMessages(const std::string& xml_filename); + const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; } +public: + // ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings. + static std::map sTeleportErrorMessages; + static std::map sTeleportProgressMessages; +private: + std::string mTeleportSourceSLURL; // SLURL where last TP began //-------------------------------------------------------------------- - // Wearables + // Teleport Actions //-------------------------------------------------------------------- - void setWearable( LLInventoryItem* new_item, LLWearable* wearable ); - static bool onSetWearableDialog( const LLSD& notification, const LLSD& response, LLWearable* wearable ); - void setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable ); - void setWearableOutfit( const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove ); - void queryWearableCache(); - - BOOL isWearableModifiable(EWearableType type); - BOOL isWearableCopyable(EWearableType type); - BOOL needsReplacement(EWearableType wearableType, S32 remove); - U32 getWearablePermMask(EWearableType type); - - LLInventoryItem* getWearableInventoryItem(EWearableType type); +public: + void teleportRequest(const U64& region_handle, + const LLVector3& pos_local); // Go to a named location home + void teleportViaLandmark(const LLUUID& landmark_id); // Teleport to a landmark + void teleportHome() { teleportViaLandmark(LLUUID::null); } // Go home + void teleportViaLure(const LLUUID& lure_id, BOOL godlike); // To an invited location + void teleportViaLocation(const LLVector3d& pos_global); // To a global location - this will probably need to be deprecated + void teleportCancel(); // May or may not be allowed by server +protected: + bool teleportCore(bool is_local = false); // Stuff for all teleports; returns true if the teleport can proceed - LLWearable* getWearable( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; } - BOOL isWearingItem( const LLUUID& item_id ); - LLWearable* getWearableFromWearableItem( const LLUUID& item_id ); - const LLUUID& getWearableItem( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null; } + //-------------------------------------------------------------------- + // Teleport State + //-------------------------------------------------------------------- +public: + ETeleportState getTeleportState() const { return mTeleportState; } + void setTeleportState(ETeleportState state); +private: + ETeleportState mTeleportState; - static EWearableType getTEWearableType( S32 te ); - static LLUUID getDefaultTEImageID( S32 te ); - - void copyWearableToInventory( EWearableType type ); - - void makeNewOutfit( - const std::string& new_folder_name, - const LLDynamicArray& wearables_to_include, - const LLDynamicArray& attachments_to_include, - BOOL rename_clothing); - void makeNewOutfitDone(S32 index); - - void removeWearable( EWearableType type ); - static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response ); - void removeWearableFinal( EWearableType type ); - - void sendAgentWearablesUpdate(); - - /** - * @brief Only public because of addWearableToAgentInventoryCallback. - * - * NOTE: Do not call this method unless you are the inventory callback. - * NOTE: This can suffer from race conditions when working on the - * same values for index. - * @param index The index in mWearableEntry. - * @param item_id The inventory item id of the new wearable to wear. - * @param wearable The actual wearable data. - */ - void addWearabletoAgentInventoryDone( - S32 index, - const LLUUID& item_id, - LLWearable* wearable); - - void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found ); - void saveWearable( EWearableType type, BOOL send_update = TRUE ); - void saveAllWearables(); + //-------------------------------------------------------------------- + // Teleport Message + //-------------------------------------------------------------------- +public: + const std::string& getTeleportMessage() const { return mTeleportMessage; } + void setTeleportMessage(const std::string& message) { mTeleportMessage = message; } +private: + std::string mTeleportMessage; - void revertWearable( EWearableType type ); - void revertAllWearables(); - - void setWearableName( const LLUUID& item_id, const std::string& new_name ); - void createStandardWearables(BOOL female); - void createStandardWearablesDone(S32 index); - void createStandardWearablesAllDone(); - - BOOL areWearablesLoaded() { return mWearablesLoaded; } +/** Teleport + ** ** + *******************************************************************************/ - void sendWalkRun(bool running); +/******************************************************************************** + ** ** + ** CAMERA + **/ - void observeFriends(); - void friendsChanged(); - - // statics - static void stopFidget(); - static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data); - static void userRemoveWearable( void* userdata ); // userdata is EWearableType - static void userRemoveAllClothes( void* userdata ); // userdata is NULL - static void userRemoveAllClothesStep2(BOOL proceed, void* userdata ); // userdata is NULL - static void userRemoveAllAttachments( void* userdata); // userdata is NULL - static BOOL selfHasWearable( void* userdata ); // userdata is EWearableType - - //debug methods - static void clearVisualParams(void *); - -protected: - // stuff to do for any sort of teleport. Returns true if the - // teleport can proceed. - bool teleportCore(bool is_local = false); + //-------------------------------------------------------------------- + // Mode + //-------------------------------------------------------------------- +public: + void changeCameraToDefault(); + void changeCameraToMouselook(BOOL animate = TRUE); + void changeCameraToThirdPerson(BOOL animate = TRUE); + void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // Trigger transition animation + void changeCameraToFollow(BOOL animate = TRUE); // Ventrella + BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); } + BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); } + BOOL cameraCustomizeAvatar() const { return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); } + BOOL cameraFollow() const { return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); } + ECameraMode getCameraMode() const { return mCameraMode; } + void updateCamera(); // Call once per frame to update camera location/orientation + void resetCamera(); // Slam camera into its default position +private: + ECameraMode mCameraMode; // Target mode after transition animation is done + ECameraMode mLastCameraMode; - // helper function to prematurely age chat when agent is moving - void ageChat(); + //-------------------------------------------------------------------- + // Position + //-------------------------------------------------------------------- +public: + LLVector3d getCameraPositionGlobal() const; + const LLVector3 &getCameraPositionAgent() const; + LLVector3d calcCameraPositionTargetGlobal(BOOL *hit_limit = NULL); // Calculate the camera position target + F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters + void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } + BOOL calcCameraMinDistance(F32 &obj_min_distance); + F32 calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global); + F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } +private: + F32 mCurrentCameraDistance; // Current camera offset from avatar + F32 mTargetCameraDistance; // Target camera offset from avatar + F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object + F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom + F32 mCameraFOVDefault; // Default field of view that is basis for FOV zoom effect + LLVector3 mCameraOffsetDefault; // Default third-person camera offset + LLVector4 mCameraCollidePlane; // Colliding plane for camera + F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom + LLVector3 mCameraPositionAgent; // Camera position in agent coordinates + LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom + LLVector3d mCameraSmoothingLastPositionGlobal; + LLVector3d mCameraSmoothingLastPositionAgent; + BOOL mCameraSmoothingStop; + LLVector3 mCameraLag; // Third person camera lag + LLVector3 mCameraUpVector; // Camera's up direction in world coordinates (determines the 'roll' of the view) - // internal wearable functions - void sendAgentWearablesRequest(); - static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata); - void recoverMissingWearable(EWearableType type); - void recoverMissingWearableDone(); - void addWearableToAgentInventory(LLPointer cb, - LLWearable* wearable, const LLUUID& category_id = LLUUID::null, - BOOL notify = TRUE); + //-------------------------------------------------------------------- + // Follow + //-------------------------------------------------------------------- public: - // TODO: Make these private! - LLUUID mSecureSessionID; // secure token for this login session + void setUsingFollowCam(bool using_follow_cam); +private: + LLFollowCam mFollowCam; // Ventrella - F32 mDrawDistance; + //-------------------------------------------------------------------- + // Sit + //-------------------------------------------------------------------- +public: + void setupSitCamera(); + BOOL sitCameraEnabled() { return mSitCameraEnabled; } + void setSitCamera(const LLUUID &object_id, + const LLVector3 &camera_pos = LLVector3::zero, const LLVector3 &camera_focus = LLVector3::zero); +private: + LLPointer mSitCameraReferenceObject; // Object to which camera is related when sitting + BOOL mSitCameraEnabled; // Use provided camera information when sitting? + LLVector3 mSitCameraPos; // Root relative camera pos when sitting + LLVector3 mSitCameraFocus; // Root relative camera target when sitting - U64 mGroupPowers; - BOOL mHideGroupTitle; - std::string mGroupTitle; // honorific, like "Sir" - std::string mGroupName; - LLUUID mGroupID; - //LLUUID mGroupInsigniaID; - LLUUID mInventoryRootID; - LLUUID mMapID; - F64 mMapOriginX; // Global x coord of mMapID's bottom left corner. - F64 mMapOriginY; // Global y coord of mMapID's bottom left corner. - S32 mMapWidth; // Width of map in meters - S32 mMapHeight; // Height of map in meters - std::string mMOTD; // message of the day + //-------------------------------------------------------------------- + // Animation + //-------------------------------------------------------------------- +public: + void setCameraAnimating(BOOL b) { mCameraAnimating = b; } + BOOL getCameraAnimating() { return mCameraAnimating; } + void setAnimationDuration(F32 seconds) { mAnimationDuration = seconds; } + void startCameraAnimation(); + void stopCameraAnimation(); +private: + BOOL mCameraAnimating; // Camera is transitioning from one mode to another + LLVector3d mAnimationCameraStartGlobal; // Camera start position, global coords + LLVector3d mAnimationFocusStartGlobal; // Camera focus point, global coords + //-------------------------------------------------------------------- + // Focus + //-------------------------------------------------------------------- +public: + LLVector3d calcFocusPositionTargetGlobal(); + LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y); + BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } + LLPointer& getFocusObject() { return mFocusObject; } + F32 getFocusObjectDist() const { return mFocusObjectDist; } + void updateFocusOffset(); + void validateFocusObject(); + void setFocusGlobal(const LLPickInfo& pick); + void setFocusGlobal(const LLVector3d &focus, const LLUUID &object_id = LLUUID::null); + void setFocusOnAvatar(BOOL focus, BOOL animate); + void setCameraPosAndFocusGlobal(const LLVector3d& pos, const LLVector3d& focus, const LLUUID &object_id); + void clearFocusObject(); + void setFocusObject(LLViewerObject* object); + void setObjectTracking(BOOL track) { mTrackFocusObject = track; } + const LLVector3d &getFocusGlobal() const { return mFocusGlobal; } + const LLVector3d &getFocusTargetGlobal() const { return mFocusTargetGlobal; } +private: + LLVector3d mCameraFocusOffset; // Offset from focus point in build mode + LLVector3d mCameraFocusOffsetTarget; // Target towards which we are lerping the camera's focus offset + BOOL mFocusOnAvatar; + LLVector3d mFocusGlobal; + LLVector3d mFocusTargetGlobal; + LLPointer mFocusObject; + F32 mFocusObjectDist; + LLVector3 mFocusObjectOffset; + F32 mFocusDotRadius; // Meters + BOOL mTrackFocusObject; + F32 mUIOffset; + + //-------------------------------------------------------------------- + // Lookat / Pointat + //-------------------------------------------------------------------- +public: + void updateLookAt(const S32 mouse_x, const S32 mouse_y); + BOOL setLookAt(ELookAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + ELookAtType getLookAtType(); + void slamLookAt(const LLVector3 &look_at); // Set the physics data + BOOL setPointAt(EPointAtType target_type, LLViewerObject *object = NULL, LLVector3 position = LLVector3::zero); + EPointAtType getPointAtType(); +public: LLPointer mLookAt; LLPointer mPointAt; - LLDynamicArray mGroups; + //-------------------------------------------------------------------- + // Third person + //-------------------------------------------------------------------- +public: + LLVector3d calcThirdPersonFocusOffset(); + void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; } +private: + LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position - F32 mHUDTargetZoom; // target zoom level for HUD objects (used when editing) - F32 mHUDCurZoom; // current animated zoom level for HUD objects + //-------------------------------------------------------------------- + // Orbit + //-------------------------------------------------------------------- +public: + void cameraOrbitAround(const F32 radians); // Rotate camera CCW radians about build focus point + void cameraOrbitOver(const F32 radians); // Rotate camera forward radians over build focus point + void cameraOrbitIn(const F32 meters); // Move camera in toward build focus point - BOOL mInitialized; + //-------------------------------------------------------------------- + // Zoom + //-------------------------------------------------------------------- +public: + void handleScrollWheel(S32 clicks); // Mousewheel driven zoom + void cameraZoomIn(const F32 factor); // Zoom in by fraction of current distance + F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom + void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom + F32 calcCameraFOVZoomFactor(); - S32 mNumPendingQueries; - S32* mActiveCacheQueries; + //-------------------------------------------------------------------- + // Pan + //-------------------------------------------------------------------- +public: + void cameraPanIn(const F32 meters); + void cameraPanLeft(const F32 meters); + void cameraPanUp(const F32 meters); + + //-------------------------------------------------------------------- + // View + //-------------------------------------------------------------------- +public: + // Called whenever the agent moves. Puts camera back in default position, deselects items, etc. + void resetView(BOOL reset_camera = TRUE, BOOL change_camera = FALSE); + // Called on camera movement. Unlocks camera from the default position behind the avatar. + void unlockView(); + //-------------------------------------------------------------------- + // Mouselook + //-------------------------------------------------------------------- +public: + BOOL getForceMouselook() const { return mForceMouselook; } + void setForceMouselook(BOOL mouselook) { mForceMouselook = mouselook; } +private: BOOL mForceMouselook; + + //-------------------------------------------------------------------- + // HUD + //-------------------------------------------------------------------- +public: + const LLColor4 &getEffectColor(); + void setEffectColor(const LLColor4 &color); +public: + F32 mHUDTargetZoom; // Target zoom level for HUD objects (used when editing) + F32 mHUDCurZoom; // Current animated zoom level for HUD objects +private: + LLColor4 mEffectColor; - static void parseTeleportMessages(const std::string& xml_filename); - //we should really define ERROR and PROGRESS enums here - //but I don't really feel like doing that, so I am just going - //to expose the mappings....yup - static std::map sTeleportErrorMessages; - static std::map sTeleportProgressMessages; +/** Camera + ** ** + *******************************************************************************/ - LLFrameTimer mDoubleTapRunTimer; - EDoubleTapRunMode mDoubleTapRunMode; +/******************************************************************************** + ** ** + ** ACCESS + **/ +public: + // Checks if agent can modify an object based on the permissions and the agent's proxy status. + BOOL isGrantedProxy(const LLPermissions& perm); + BOOL allowOperation(PermissionBit op, + const LLPermissions& perm, + U64 group_proxy_power = 0, + U8 god_minimum = GOD_MAINTENANCE); + const LLAgentAccess& getAgentAccess(); + BOOL canManageEstate() const; + BOOL getAdminOverride() const; + // ! BACKWARDS COMPATIBILITY ! This function can go away after the AO transition (see llstartup.cpp). + void setAOTransition(); private: - bool mbAlwaysRun; // should the avatar run by default rather than walk - bool mbRunning; // is the avatar trying to run right now - - LLAgentAccess mAgentAccess; + LLAgentAccess mAgentAccess; - ETeleportState mTeleportState; - std::string mTeleportMessage; - - S32 mControlsTakenCount[TOTAL_CONTROLS]; - S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS]; - - LLViewerRegion *mRegionp; - LLVector3d mAgentOriginGlobal; // Origin of agent coords from global coords - mutable LLVector3d mPositionGlobal; + //-------------------------------------------------------------------- + // God + //-------------------------------------------------------------------- +public: + BOOL isGodlike() const; + U8 getGodLevel() const; + void setAdminOverride(BOOL b); + void setGodLevel(U8 god_level); + void requestEnterGodMode(); + void requestLeaveGodMode(); - std::string mTeleportSourceSLURL; // SLURL where last TP began. + //-------------------------------------------------------------------- + // Maturity + //-------------------------------------------------------------------- +public: + // Note: this is a prime candidate for pulling out into a Maturity class. + // Rather than just expose the preference setting, we're going to actually + // expose what the client code cares about -- what the user should see + // based on a combination of the is* and prefers* flags, combined with god bit. + bool wantsPGOnly() const; + bool canAccessMature() const; + bool canAccessAdult() const; + bool canAccessMaturityInRegion( U64 region_handle ) const; + bool canAccessMaturityAtGlobal( LLVector3d pos_global ) const; + bool prefersPG() const; + bool prefersMature() const; + bool prefersAdult() const; + bool isTeen() const; + bool isMature() const; + bool isAdult() const; + void setTeen(bool teen); + void setMaturity(char text); + static int convertTextToMaturity(char text); + bool sendMaturityPreferenceToServer(int preferredMaturity); // ! "U8" instead of "int"? + + // Maturity callbacks for PreferredMaturity control variable + void handleMaturity(const LLSD& newvalue); + bool validateMaturity(const LLSD& newvalue); + + +/** Access + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** RENDERING + **/ - std::set mRegionsVisited; // stat - what distinct regions has the avatar been to? - F64 mDistanceTraveled; // stat - how far has the avatar moved? - LLVector3d mLastPositionGlobal; // Used to calculate travel distance +public: + LLQuaternion getHeadRotation(); + BOOL needsRenderAvatar(); // TRUE when camera mode is such that your own avatar should draw + BOOL needsRenderHead(); +public: + F32 mDrawDistance; +private: + BOOL mShowAvatar; // Should we render the avatar? + U32 mAppearanceSerialNum; + + //-------------------------------------------------------------------- + // Rendering state bitmap helpers + //-------------------------------------------------------------------- +public: + void setRenderState(U8 newstate); + void clearRenderState(U8 clearstate); + U8 getRenderState(); +private: + U8 mRenderState; // Current behavior state of agent - LLPointer mAvatarObject; // NULL until avatar object sent down from simulator +/** Rendering + ** ** + *******************************************************************************/ - U8 mRenderState; // Current behavior state of agent - LLFrameTimer mTypingTimer; +/******************************************************************************** + ** ** + ** GROUPS + **/ - ECameraMode mCameraMode; // target mode after transition animation is done - ECameraMode mLastCameraMode; - BOOL mViewsPushed; // keep track of whether or not we have pushed views. - - BOOL mCustomAnim ; //current animation is ANIM_AGENT_CUSTOMIZE ? - BOOL mShowAvatar; // should we render the avatar? - BOOL mCameraAnimating; // camera is transitioning from one mode to another - LLVector3d mAnimationCameraStartGlobal; // camera start position, global coords - LLVector3d mAnimationFocusStartGlobal; // camera focus point, global coords - LLFrameTimer mAnimationTimer; // seconds that transition animation has been active - F32 mAnimationDuration; // seconds - F32 mCameraFOVZoomFactor; // amount of fov zoom applied to camera when zeroing in on an object - F32 mCameraCurrentFOVZoomFactor; // interpolated fov zoom - F32 mCameraFOVDefault; // default field of view that is basis for FOV zoom effect - LLVector3d mCameraFocusOffset; // offset from focus point in build mode - LLVector3d mCameraFocusOffsetTarget; // target towards which we are lerping the camera's focus offset - LLVector3 mCameraOffsetDefault; // default third-person camera offset - LLVector4 mCameraCollidePlane; // colliding plane for camera - F32 mCurrentCameraDistance; // current camera offset from avatar - F32 mTargetCameraDistance; // target camera offset from avatar - F32 mCameraZoomFraction; // mousewheel driven fraction of zoom - LLVector3 mCameraLag; // third person camera lag - LLVector3 mThirdPersonHeadOffset; // head offset for third person camera position - LLVector3 mCameraPositionAgent; // camera position in agent coordinates - LLVector3 mCameraVirtualPositionAgent; // camera virtual position (target) before performing FOV zoom - BOOL mSitCameraEnabled; // use provided camera information when sitting? - LLVector3 mSitCameraPos; // root relative camera pos when sitting - LLVector3 mSitCameraFocus; // root relative camera target when sitting - LLVector3d mCameraSmoothingLastPositionGlobal; - LLVector3d mCameraSmoothingLastPositionAgent; - BOOL mCameraSmoothingStop; +public: + const LLUUID &getGroupID() const { return mGroupID; } + // Get group information by group_id, or FALSE if not in group. + BOOL getGroupData(const LLUUID& group_id, LLGroupData& data) const; + // Get just the agent's contribution to the given group. + S32 getGroupContribution(const LLUUID& group_id) const; + // Update internal datastructures and update the server. + BOOL setGroupContribution(const LLUUID& group_id, S32 contribution); + BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile); + const std::string &getGroupName() const { return mGroupName; } +private: + std::string mGroupName; + LLUUID mGroupID; - LLVector3 mCameraUpVector; // camera's up direction in world coordinates (determines the 'roll' of the view) + //-------------------------------------------------------------------- + // Group Membership + //-------------------------------------------------------------------- +public: + // Checks against all groups in the entire agent group list. + BOOL isInGroup(const LLUUID& group_id) const; +protected: + // Only used for building titles. + BOOL isGroupMember() const { return !mGroupID.isNull(); } +public: + LLDynamicArray mGroups; - LLPointer mSitCameraReferenceObject; // object to which camera is related when sitting + //-------------------------------------------------------------------- + // Group Title + //-------------------------------------------------------------------- +public: + void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; } + BOOL isGroupTitleHidden() const { return mHideGroupTitle; } +private: + std::string mGroupTitle; // Honorific, like "Sir" + BOOL mHideGroupTitle; - BOOL mFocusOnAvatar; - LLVector3d mFocusGlobal; - LLVector3d mFocusTargetGlobal; - LLPointer mFocusObject; - F32 mFocusObjectDist; - LLVector3 mFocusObjectOffset; - F32 mFocusDotRadius; // meters - BOOL mTrackFocusObject; - F32 mUIOffset; + //-------------------------------------------------------------------- + // Group Powers + //-------------------------------------------------------------------- +public: + BOOL hasPowerInGroup(const LLUUID& group_id, U64 power) const; + BOOL hasPowerInActiveGroup(const U64 power) const; + U64 getPowerInGroup(const LLUUID& group_id) const; + U64 mGroupPowers; - LLCoordFrame mFrameAgent; // Agent position and view, agent-region coordinates + //-------------------------------------------------------------------- + // Friends + //-------------------------------------------------------------------- +public: + void observeFriends(); + void friendsChanged(); +private: + LLFriendObserver* mFriendObserver; + std::set mProxyForAgents; - BOOL mIsBusy; +/** Groups + ** ** + *******************************************************************************/ - S32 mAtKey; // Either 1, 0, or -1... indicates that movement-key is pressed - S32 mWalkKey; // like AtKey, but causes less forward thrust - S32 mLeftKey; - S32 mUpKey; - F32 mYawKey; - S32 mPitchKey; +/******************************************************************************** + ** ** + ** MESSAGING + **/ - F32 mOrbitLeftKey; - F32 mOrbitRightKey; - F32 mOrbitUpKey; - F32 mOrbitDownKey; - F32 mOrbitInKey; - F32 mOrbitOutKey; + //-------------------------------------------------------------------- + // Send + //-------------------------------------------------------------------- +public: + void sendMessage(); // Send message to this agent's region + void sendReliableMessage(); + void sendAgentSetAppearance(); + void sendAgentDataUpdateRequest(); + void sendAgentUserInfoRequest(); + // IM to Email and Online visibility + void sendAgentUpdateUserInfo(bool im_to_email, const std::string& directory_visibility); - F32 mPanUpKey; - F32 mPanDownKey; - F32 mPanLeftKey; - F32 mPanRightKey; - F32 mPanInKey; - F32 mPanOutKey; + //-------------------------------------------------------------------- + // Receive + //-------------------------------------------------------------------- +public: + static void processAgentDataUpdate(LLMessageSystem *msg, void **); + static void processAgentGroupDataUpdate(LLMessageSystem *msg, void **); + static void processAgentDropGroup(LLMessageSystem *msg, void **); + static void processScriptControlChange(LLMessageSystem *msg, void **); + static void processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data); + +/** Messaging + ** ** + *******************************************************************************/ - U32 mControlFlags; // replacement for the mFooKey's - BOOL mbFlagsDirty; - BOOL mbFlagsNeedReset; // HACK for preventing incorrect flags sent when crossing region boundaries +/******************************************************************************** + ** ** + ** DEBUGGING + **/ - BOOL mbJump; +public: + static void dumpGroupInfo(); + static void clearVisualParams(void *); + friend std::ostream& operator<<(std::ostream &s, const LLAgent &sphere); - BOOL mAutoPilot; - BOOL mAutoPilotFlyOnStop; - LLVector3d mAutoPilotTargetGlobal; - F32 mAutoPilotStopDistance; - BOOL mAutoPilotUseRotation; - LLVector3 mAutoPilotTargetFacing; - F32 mAutoPilotTargetDist; - S32 mAutoPilotNoProgressFrameCount; - F32 mAutoPilotRotationThreshold; - std::string mAutoPilotBehaviorName; - void (*mAutoPilotFinishedCallback)(BOOL, void *); - void* mAutoPilotCallbackData; - LLUUID mLeaderID; +/** Debugging + ** ** + *******************************************************************************/ - std::set mProxyForAgents; +}; - LLColor4 mEffectColor; +extern LLAgent gAgent; - BOOL mHaveHomePosition; - U64 mHomeRegionHandle; - LLVector3 mHomePosRegion; - LLFrameTimer mChatTimer; - LLUUID mLastChatterID; - F32 mNearChatRadius; +inline bool operator==(const LLGroupData &a, const LLGroupData &b) +{ + return (a.mID == b.mID); +} - LLFrameTimer mFidgetTimer; - LLFrameTimer mFocusObjectFadeTimer; - F32 mNextFidgetTime; - S32 mCurrentFidget; - BOOL mFirstLogin; - BOOL mGenderChosen; +class LLAgentQueryManager +{ + friend class LLAgent; + friend class LLAgentWearables; - //-------------------------------------------------------------------- - // Wearables - //-------------------------------------------------------------------- - struct LLWearableEntry - { - LLWearableEntry() : mItemID( LLUUID::null ), mWearable( NULL ) {} - - LLUUID mItemID; // ID of the inventory item in the agent's inventory. - LLWearable* mWearable; - }; - LLWearableEntry mWearableEntry[ WT_COUNT ]; - U32 mAgentWearablesUpdateSerialNum; - BOOL mWearablesLoaded; - S32 mTextureCacheQueryID; - U32 mAppearanceSerialNum; - LLAnimPauseRequest mPauseRequest; - - class createStandardWearablesAllDoneCallback : public LLRefCount - { - protected: - ~createStandardWearablesAllDoneCallback(); - }; - class sendAgentWearablesUpdateCallback : public LLRefCount - { - protected: - ~sendAgentWearablesUpdateCallback(); - }; - - class addWearableToAgentInventoryCallback : public LLInventoryCallback - { - public: - enum { - CALL_NONE = 0, - CALL_UPDATE = 1, - CALL_RECOVERDONE = 2, - CALL_CREATESTANDARDDONE = 4, - CALL_MAKENEWOUTFITDONE = 8 - } EType; - - /** - * @brief Construct a callback for dealing with the wearables. - * - * Would like to pass the agent in here, but we can't safely - * count on it being around later. Just use gAgent directly. - * @param cb callback to execute on completion (??? unused ???) - * @param index Index for the wearable in the agent - * @param wearable The wearable data. - * @param todo Bitmask of actions to take on completion. - */ - addWearableToAgentInventoryCallback( - LLPointer cb, - S32 index, - LLWearable* wearable, - U32 todo = CALL_NONE); - virtual void fire(const LLUUID& inv_item); - - private: - S32 mIndex; - LLWearable* mWearable; - U32 mTodo; - LLPointer mCB; - }; - - LLFriendObserver* mFriendObserver; +public: + LLAgentQueryManager(); + virtual ~LLAgentQueryManager(); + + BOOL hasNoPendingQueries() const { return getNumPendingQueries() == 0; } + S32 getNumPendingQueries() const { return mNumPendingQueries; } +private: + S32 mNumPendingQueries; + S32 mWearablesCacheQueryID; + U32 mUpdateSerialNum; + S32 mActiveCacheQueries[LLVOAvatarDefines::BAKED_NUM_INDICES]; }; -extern LLAgent gAgent; +extern LLAgentQueryManager gAgentQueryManager; #endif diff --git a/indra/newview/llagentaccess.cpp b/indra/newview/llagentaccess.cpp index a4fbc04855..eb978eb6c1 100644 --- a/indra/newview/llagentaccess.cpp +++ b/indra/newview/llagentaccess.cpp @@ -3,16 +3,39 @@ * @brief LLAgentAccess class implementation - manages maturity and godmode info * * $LicenseInfo:firstyear=2001&license=viewergpl$ + * * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ #include "llviewerprecompiledheaders.h" #include "llagentaccess.h" #include "indra_constants.h" -#include "llcontrolgroupreader.h" +#include "llcontrol.h" -LLAgentAccess::LLAgentAccess(LLControlGroupReader& savedSettings) : +LLAgentAccess::LLAgentAccess(LLControlGroup& savedSettings) : mSavedSettings(savedSettings), mAccess(SIM_ACCESS_PG), mAdminOverride(false), @@ -140,6 +163,20 @@ int LLAgentAccess::convertTextToMaturity(char text) void LLAgentAccess::setMaturity(char text) { mAccess = LLAgentAccess::convertTextToMaturity(text); + U32 preferred_access = mSavedSettings.getU32("PreferredMaturity"); + while (!canSetMaturity(preferred_access)) + { + if (preferred_access == SIM_ACCESS_ADULT) + { + preferred_access = SIM_ACCESS_MATURE; + } + else + { + // Mature or invalid access gets set to PG + preferred_access = SIM_ACCESS_PG; + } + } + mSavedSettings.setU32("PreferredMaturity", preferred_access); } void LLAgentAccess::setTransition() @@ -152,3 +189,14 @@ bool LLAgentAccess::isInTransition() const return mAOTransition; } +bool LLAgentAccess::canSetMaturity(S32 maturity) +{ + if (isGodlike()) // Gods can always set their Maturity level + return true; + if (isAdult()) // Adults can always set their Maturity level + return true; + if (maturity == SIM_ACCESS_PG || (maturity == SIM_ACCESS_MATURE && isMature())) + return true; + else + return false; +} diff --git a/indra/newview/llagentaccess.h b/indra/newview/llagentaccess.h index dec0d76cc9..93d2f0a371 100644 --- a/indra/newview/llagentaccess.h +++ b/indra/newview/llagentaccess.h @@ -3,7 +3,30 @@ * @brief LLAgentAccess class implementation - manages maturity and godmode info * * $LicenseInfo:firstyear=2001&license=viewergpl$ + * * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -13,12 +36,12 @@ #include "stdtypes.h" // forward declaration so that we don't have to include the whole class -class LLControlGroupReader; +class LLControlGroup; class LLAgentAccess { public: - LLAgentAccess(LLControlGroupReader& savedSettings); + LLAgentAccess(LLControlGroup& savedSettings); bool getAdminOverride() const; void setAdminOverride(bool b); @@ -48,6 +71,7 @@ public: void setTransition(); // sets the transition bit, which defaults to false bool isInTransition() const; + bool canSetMaturity(S32 maturity); private: U8 mAccess; // SIM_ACCESS_MATURE etc @@ -61,9 +85,7 @@ private: // all of the code that depends on it. bool mAOTransition; - // we want this to be const but the getters for it aren't, so we're - // overriding it for now - /* const */ LLControlGroupReader& mSavedSettings; + LLControlGroup& mSavedSettings; }; #endif // LL_LLAGENTACCESS_H diff --git a/indra/newview/llagentlanguage.h b/indra/newview/llagentlanguage.h index 596c584232..45348a1e50 100644 --- a/indra/newview/llagentlanguage.h +++ b/indra/newview/llagentlanguage.h @@ -33,7 +33,7 @@ #ifndef LL_LLAGENTLANGUAGE_H #define LL_LLAGENTLANGUAGE_H -#include "llmemory.h" // LLSingleton<> +#include "llsingleton.h" // LLSingleton<> #include "llevent.h" class LLAgentLanguage: public LLSingleton, public LLOldEvents::LLSimpleListener diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 035c9426a1..8ffb97d8fc 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -38,13 +38,13 @@ #include "llagentpilot.h" #include "llagent.h" -#include "llframestats.h" #include "llappviewer.h" #include "llviewercontrol.h" LLAgentPilot gAgentPilot; BOOL LLAgentPilot::sLoop = TRUE; +BOOL LLAgentPilot::sReplaySession = FALSE; LLAgentPilot::LLAgentPilot() : mNumRuns(-1), @@ -177,6 +177,11 @@ void LLAgentPilot::stopPlayback() mTimer.reset(); gAgent.stopAutoPilot(); } + + if (sReplaySession) + { + LLAppViewer::instance()->forceQuit(); + } } void LLAgentPilot::updateTarget() @@ -198,7 +203,6 @@ void LLAgentPilot::updateTarget() { llinfos << "At start, beginning playback" << llendl; mTimer.reset(); - LLFrameStats::startLogging(NULL); mStarted = TRUE; } } @@ -215,7 +219,6 @@ void LLAgentPilot::updateTarget() else { stopPlayback(); - LLFrameStats::stopLogging(NULL); mNumRuns--; if (sLoop) { diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h index 0ad4772f68..dc034398a7 100644 --- a/indra/newview/llagentpilot.h +++ b/indra/newview/llagentpilot.h @@ -70,6 +70,7 @@ public: static void startPlayback(void *); static void stopPlayback(void *); static BOOL sLoop; + static BOOL sReplaySession; S32 mNumRuns; BOOL mQuitAfterRuns; diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp new file mode 100644 index 0000000000..1c756b1441 --- /dev/null +++ b/indra/newview/llagentwearables.cpp @@ -0,0 +1,1584 @@ +/** + * @file llagentwearables.cpp + * @brief LLAgentWearables class implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llagent.h" +#include "llagentwearables.h" + +#include "llfloatercustomize.h" +#include "llinventoryview.h" +#include "llinventorymodel.h" +#include "llnotify.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" +#include "llwearable.h" +#include "llwearablelist.h" + +LLAgentWearables gAgentWearables; + +BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE; + +using namespace LLVOAvatarDefines; + +void LLAgentWearables::dump() +{ + llinfos << "LLAgentWearablesDump" << llendl; + for (S32 i = 0; i < WT_COUNT; i++) + { + U32 count = getWearableCount((EWearableType)i); + llinfos << "Type: " << i << " count " << count << llendl; + for (U32 j=0; jmWearable == NULL) + { + llinfos << " " << j << " NULL wearable" << llendl; + continue; + } + llinfos << " " << j << " Name " << wearable_entry->mWearable->getName() + << " description " << wearable_entry->mWearable->getDescription() << llendl; + + } + } +} + +// MULTI-WEARABLE: debugging +struct LLAgentDumper +{ + LLAgentDumper(std::string name): + mName(name) + { + llinfos << llendl; + llinfos << "LLAgentDumper " << mName << llendl; + gAgentWearables.dump(); + } + + ~LLAgentDumper() + { + llinfos << llendl; + llinfos << "~LLAgentDumper " << mName << llendl; + gAgentWearables.dump(); + } + + std::string mName; +}; + +LLAgentWearables::LLAgentWearables() : + mWearablesLoaded(FALSE), + mAvatarObject(NULL) +{ + // MULTI-WEARABLE: TODO remove null entries. + for (U32 i = 0; i < WT_COUNT; i++) + { + mWearableDatas[(EWearableType)i].push_back(new LLWearableInv); + } +} + +LLAgentWearables::~LLAgentWearables() +{ + cleanup(); +} + +void LLAgentWearables::cleanup() +{ + for (wearableentry_map_t::iterator iter = mWearableDatas.begin(); + iter != mWearableDatas.end(); + iter++) + { + wearableentry_vec_t &wearables = iter->second; + for (U32 i = 0; i < wearables.size(); i++) + { + LLWearableInv *wearable = wearables[i]; + delete wearable; + wearables[i] = NULL; + } + } + mAvatarObject = NULL; +} + +void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) +{ + mAvatarObject = avatar; + if (avatar) + { + sendAgentWearablesRequest(); + } +} + +// wearables +LLAgentWearables::createStandardWearablesAllDoneCallback::~createStandardWearablesAllDoneCallback() +{ + gAgentWearables.createStandardWearablesAllDone(); +} + +LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCallback() +{ + gAgentWearables.sendAgentWearablesUpdate(); +} + +/** + * @brief Construct a callback for dealing with the wearables. + * + * Would like to pass the agent in here, but we can't safely + * count on it being around later. Just use gAgent directly. + * @param cb callback to execute on completion (??? unused ???) + * @param type Type for the wearable in the agent + * @param wearable The wearable data. + * @param todo Bitmask of actions to take on completion. + */ +LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback( + LLPointer cb, S32 type, U32 index, LLWearable* wearable, U32 todo) : + mType(type), + mIndex(index), + mWearable(wearable), + mTodo(todo), + mCB(cb) +{ +} + +void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& inv_item) +{ + if (inv_item.isNull()) + return; + + gAgentWearables.addWearabletoAgentInventoryDone(mType, mIndex, inv_item, mWearable); + + if (mTodo & CALL_UPDATE) + { + gAgentWearables.sendAgentWearablesUpdate(); + } + if (mTodo & CALL_RECOVERDONE) + { + gAgentWearables.recoverMissingWearableDone(); + } + /* + * Do this for every one in the loop + */ + if (mTodo & CALL_CREATESTANDARDDONE) + { + gAgentWearables.createStandardWearablesDone(mType, mIndex); + } + if (mTodo & CALL_MAKENEWOUTFITDONE) + { + gAgentWearables.makeNewOutfitDone(mType, mIndex); + } +} + +void LLAgentWearables::addWearabletoAgentInventoryDone(const S32 type, + const U32 index, + const LLUUID& item_id, + LLWearable* wearable) +{ + if (item_id.isNull()) + return; + + LLWearableInv* wearable_entry = getWearableInv((EWearableType)type, index); + + LLUUID old_item_id = wearable_entry->mItemID; + wearable_entry->mItemID = item_id; + wearable_entry->mWearable = wearable; + if (old_item_id.notNull()) + gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id); + gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + LLViewerInventoryItem* item = gInventory.getItem(item_id); + if (item && wearable) + { + // We're changing the asset id, so we both need to set it + // locally via setAssetUUID() and via setTransactionID() which + // will be decoded on the server. JC + item->setAssetUUID(wearable->getID()); + item->setTransactionID(wearable->getTransactionID()); + gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); + item->updateServer(FALSE); + } + gInventory.notifyObservers(); +} + +void LLAgentWearables::sendAgentWearablesUpdate() +{ + // MULTI-WEARABLE: call i "type" or something. + // First make sure that we have inventory items for each wearable + for (S32 i=0; i < WT_COUNT; ++i) + { + for (U32 j=0; j < getWearableCount((EWearableType)i); j++) + { + LLWearableInv* wearable_entry = getWearableInv((EWearableType)i,j); + LLWearable* wearable = wearable_entry->mWearable; + if (wearable) + { + if (wearable_entry->mItemID.isNull()) + { + LLPointer cb = + new addWearableToAgentInventoryCallback( + LLPointer(NULL), + i, + j, + wearable, + addWearableToAgentInventoryCallback::CALL_NONE); + addWearableToAgentInventory(cb, wearable); + } + else + { + gInventory.addChangedMask(LLInventoryObserver::LABEL, + wearable_entry->mItemID); + } + } + } + } + + // Then make sure the inventory is in sync with the avatar. + gInventory.notifyObservers(); + + // Send the AgentIsNowWearing + gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing); + + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + + lldebugs << "sendAgentWearablesUpdate()" << llendl; + // MULTI-WEARABLE: update for multi-wearables after server-side support is in. + for (S32 i=0; i < WT_COUNT; ++i) + { + gMessageSystem->nextBlockFast(_PREHASH_WearableData); + + U8 type_u8 = (U8)i; + gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8); + + // MULTI-WEARABLE: TODO: hacked index to 0, needs to loop over all once messages support this. + LLWearableInv* wearable_entry = getWearableInv((EWearableType)i, 0); + LLWearable* wearable = wearable_entry->mWearable; + if (wearable) + { + //llinfos << "Sending wearable " << wearable->getName() << llendl; + gMessageSystem->addUUIDFast(_PREHASH_ItemID, wearable_entry->mItemID); + } + else + { + //llinfos << "Not wearing wearable type " << LLWearableDictionary::getInstance()->getWearable((EWearableType)i) << llendl; + gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null); + } + + lldebugs << " " << LLWearableDictionary::getTypeLabel((EWearableType)i) << ": " << (wearable ? wearable->getID() : LLUUID::null) << llendl; + } + gAgent.sendReliableMessage(); +} + +// MULTI-WEARABLE: add index. +void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, BOOL send_update) +{ + LLWearableInv* wearable_entry = getWearableInv(type, index); + LLWearable* old_wearable = wearable_entry ? wearable_entry->mWearable : NULL; + if (old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion())) + { + LLWearable* new_wearable = LLWearableList::instance().createCopyFromAvatar(old_wearable); + wearable_entry->mWearable = new_wearable; + + LLInventoryItem* item = gInventory.getItem(wearable_entry->mItemID); + if (item) + { + // Update existing inventory item + LLPointer template_item = + new LLViewerInventoryItem(item->getUUID(), + item->getParentUUID(), + item->getPermissions(), + new_wearable->getID(), + new_wearable->getAssetType(), + item->getInventoryType(), + item->getName(), + item->getDescription(), + item->getSaleInfo(), + item->getFlags(), + item->getCreationDate()); + template_item->setTransactionID(new_wearable->getTransactionID()); + template_item->updateServer(FALSE); + gInventory.updateItem(template_item); + } + else + { + // Add a new inventory item (shouldn't ever happen here) + U32 todo = addWearableToAgentInventoryCallback::CALL_NONE; + if (send_update) + { + todo |= addWearableToAgentInventoryCallback::CALL_UPDATE; + } + LLPointer cb = + new addWearableToAgentInventoryCallback( + LLPointer(NULL), + (S32)type, + index, + new_wearable, + todo); + addWearableToAgentInventory(cb, new_wearable); + return; + } + + gAgent.getAvatarObject()->wearableUpdated( type ); + + if (send_update) + { + sendAgentWearablesUpdate(); + } + } +} + +// MULTI-WEARABLE: add index +void LLAgentWearables::saveWearableAs(const EWearableType type, + const U32 index, + const std::string& new_name, + BOOL save_in_lost_and_found) +{ + if (!isWearableCopyable(type, index)) + { + llwarns << "LLAgent::saveWearableAs() not copyable." << llendl; + return; + } + LLWearableInv* wearable_entry = getWearableInv(type, index); + LLWearable* old_wearable = wearable_entry->mWearable; + if (!old_wearable) + { + llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl; + return; + } + + LLInventoryItem* item = gInventory.getItem(wearable_entry->mItemID); + if (!item) + { + llwarns << "LLAgent::saveWearableAs() no inventory item." << llendl; + return; + } + std::string trunc_name(new_name); + LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN); + LLWearable* new_wearable = LLWearableList::instance().createCopyFromAvatar( + old_wearable, + trunc_name); + LLPointer cb = + new addWearableToAgentInventoryCallback( + LLPointer(NULL), + type, + index, + new_wearable, + addWearableToAgentInventoryCallback::CALL_UPDATE); + LLUUID category_id; + if (save_in_lost_and_found) + { + category_id = gInventory.findCategoryUUIDForType( + LLAssetType::AT_LOST_AND_FOUND); + } + else + { + // put in same folder as original + category_id = item->getParentUUID(); + } + + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + category_id, + new_name, + cb); +} + +void LLAgentWearables::revertWearable(const EWearableType type, const U32 index) +{ + LLWearableInv* wearable_entry = getWearableInv(type, index); + LLWearable* wearable = wearable_entry->mWearable; + if (wearable) + { + wearable->writeToAvatar(TRUE); + } + gAgent.sendAgentSetAppearance(); +} + +void LLAgentWearables::saveAllWearables() +{ + //if (!gInventory.isLoaded()) + //{ + // return; + //} + + for (S32 i=0; i < WT_COUNT; i++) + { + for (U32 j=0; j < getWearableCount((EWearableType)i); j++) + saveWearable((EWearableType)i, j, FALSE); + } + sendAgentWearablesUpdate(); +} + +// Called when the user changes the name of a wearable inventory item that is currently being worn. +void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name) +{ + for (S32 i=0; i < WT_COUNT; i++) + { + for (U32 j=0; j < getWearableCount((EWearableType)i); j++) + { + LLWearableInv* wearable_entry = getWearableInv((EWearableType)i,j); + if (wearable_entry->mItemID == item_id) + { + LLWearable* old_wearable = wearable_entry->mWearable; + llassert(old_wearable); + + std::string old_name = old_wearable->getName(); + old_wearable->setName(new_name); + LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable); + LLInventoryItem* item = gInventory.getItem(item_id); + if (item) + { + new_wearable->setPermissions(item->getPermissions()); + } + old_wearable->setName(old_name); + + wearable_entry->mWearable = new_wearable; + sendAgentWearablesUpdate(); + break; + } + } + } +} + + +BOOL LLAgentWearables::isWearableModifiable(EWearableType type, U32 index) const +{ + LLUUID item_id = getWearableItem(type, index); + if (!item_id.isNull()) + { + LLInventoryItem* item = gInventory.getItem(item_id); + if (item && item->getPermissions().allowModifyBy(gAgent.getID(), + gAgent.getGroupID())) + { + return TRUE; + } + } + return FALSE; +} + +BOOL LLAgentWearables::isWearableCopyable(EWearableType type, U32 index) const +{ + LLUUID item_id = getWearableItem(type, index); + if (!item_id.isNull()) + { + LLInventoryItem* item = gInventory.getItem(item_id); + if (item && item->getPermissions().allowCopyBy(gAgent.getID(), + gAgent.getGroupID())) + { + return TRUE; + } + } + return FALSE; +} + +/* + U32 LLAgentWearables::getWearablePermMask(EWearableType type) + { + LLUUID item_id = getWearableItem(type); + if (!item_id.isNull()) + { + LLInventoryItem* item = gInventory.getItem(item_id); + if (item) + { + return item->getPermissions().getMaskOwner(); + } + } + return PERM_NONE; + } +*/ + +LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type, U32 index) +{ + LLUUID item_id = getWearableItem(type,index); + LLInventoryItem* item = NULL; + if (item_id.notNull()) + { + item = gInventory.getItem(item_id); + } + return item; +} + +LLWearable* LLAgentWearables::getWearableFromWearableItem(const LLUUID& item_id) const +{ + for (S32 i=0; i < WT_COUNT; i++) + { + for (U32 j=0; j < getWearableCount((EWearableType)i); j++) + { + const LLWearableInv* wearable_entry = getWearableInv((EWearableType)i, j); + if (wearable_entry->mItemID == item_id) + { + return wearable_entry->mWearable; + } + } + } + return NULL; +} + +void LLAgentWearables::sendAgentWearablesRequest() +{ + gMessageSystem->newMessageFast(_PREHASH_AgentWearablesRequest); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gAgent.sendReliableMessage(); +} + +// MULTI-WEARABLE: update for multiple items per type. +// Used to enable/disable menu items. +// static +BOOL LLAgentWearables::selfHasWearable(void* userdata) +{ + EWearableType type = (EWearableType)(intptr_t)userdata; + // MULTI-WEARABLE: TODO could be getWearableCount > 0, once null entries have been eliminated. + return gAgentWearables.getWearableInv(type,0)->mWearable != NULL; +} + +const LLAgentWearables::LLWearableInv LLAgentWearables::s_null_wearable; + +LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index) +{ + LLWearableInv* inv = getWearableInv(type,index); + return inv->mWearable; +} + +const LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index) const +{ + const LLWearableInv* inv = getWearableInv(type,index); + return inv->mWearable; +} + +//MULTI-WEARABLE: this will give wrong values until we get rid of the "always one empty object" scheme. +U32 LLAgentWearables::getWearableCount(const EWearableType type) const +{ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter == mWearableDatas.end()) + { + return 0; + } + const wearableentry_vec_t& wearable_vec = wearable_iter->second; + return wearable_vec.size(); +} + +LLAgentWearables::LLWearableInv* LLAgentWearables::getWearableInv(const EWearableType type, U32 index) +{ + wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter == mWearableDatas.end()) + { + return NULL; + } + wearableentry_vec_t& wearable_vec = wearable_iter->second; + if (index>=wearable_vec.size()) + { + return NULL; + } + else + { + return wearable_vec[index]; + } +} + +const LLAgentWearables::LLWearableInv* LLAgentWearables::getWearableInv(const EWearableType type, U32 index) const +{ + wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); + if (wearable_iter == mWearableDatas.end()) return &s_null_wearable; + const wearableentry_vec_t& wearable_vec = wearable_iter->second; + if (index>=wearable_vec.size()) + return &s_null_wearable; + else + return wearable_vec[index]; +} + +const LLUUID& LLAgentWearables::getWearableItem(EWearableType type, U32 index) const +{ + return getWearableInv(type,index)->mItemID; +} + + +BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const +{ + return (getWearableFromWearableItem(item_id) != NULL); +} + +// MULTI-WEARABLE: update for multiple +// static +void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data) +{ + // We should only receive this message a single time. Ignore subsequent AgentWearablesUpdates + // that may result from AgentWearablesRequest having been sent more than once. + if (mInitialWearablesUpdateReceived) + return; + mInitialWearablesUpdateReceived = true; + + LLUUID agent_id; + gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + + LLVOAvatar* avatar = gAgent.getAvatarObject(); + if (avatar && (agent_id == avatar->getID())) + { + gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum); + + S32 num_wearables = gMessageSystem->getNumberOfBlocksFast(_PREHASH_WearableData); + if (num_wearables < 4) + { + // Transitional state. Avatars should always have at least their body parts (hair, eyes, shape and skin). + // The fact that they don't have any here (only a dummy is sent) implies that this account existed + // before we had wearables, or that the database has gotten messed up. + return; + } + + //lldebugs << "processAgentInitialWearablesUpdate()" << llendl; + // Add wearables + LLUUID asset_id_array[WT_COUNT]; + // MULTI-WEARABLE: TODO: update once messages change. Currently use results to populate the zeroth element. + for (S32 i=0; i < num_wearables; i++) + { + U8 type_u8 = 0; + gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i); + if (type_u8 >= WT_COUNT) + { + continue; + } + const EWearableType type = (EWearableType) type_u8; + + LLUUID item_id; + gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i); + + LLUUID asset_id; + gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i); + if (asset_id.isNull()) + { + LLWearable::removeFromAvatar(type, FALSE); + } + else + { + LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(type); + if (asset_type == LLAssetType::AT_NONE) + { + continue; + } + // MULTI-WEARABLE: TODO FIXME: assumes zeroth element always exists and can be safely written to. + LLWearableInv* wearable_entry = gAgentWearables.getWearableInv(type,0); + wearable_entry->mItemID = item_id; + asset_id_array[type] = asset_id; + } + + lldebugs << " " << LLWearableDictionary::getTypeLabel(type) << llendl; + } + + // now that we have the asset ids...request the wearable assets + for (S32 i = 0; i < WT_COUNT; i++) + { + // MULTI-WEARABLE: TODO: update once messages change. Currently use results to populate the zeroth element. + LLWearableInv* wearable_entry = gAgentWearables.getWearableInv((EWearableType)i, 0); + if (!wearable_entry->mItemID.isNull()) + { + LLWearableList::instance().getAsset(asset_id_array[i], + LLStringUtil::null, + LLWearableDictionary::getAssetType((EWearableType) i), + onInitialWearableAssetArrived, (void*)(intptr_t)i); + } + } + } +} + +// A single wearable that the avatar was wearing on start-up has arrived from the database. +// static +void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void* userdata) +{ + const EWearableType type = (EWearableType)(intptr_t)userdata; + + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); + if (!avatar) + { + return; + } + + if (wearable) + { + llassert(type == wearable->getType()); + // MULTI-WEARABLE: is this always zeroth element? Change sometime. + LLWearableInv* wearable_entry = gAgentWearables.getWearableInv(type,0); + wearable_entry->mWearable = wearable; + + // disable composites if initial textures are baked + avatar->setupComposites(); + gAgentWearables.queryWearableCache(); + + wearable->writeToAvatar(FALSE); + avatar->setCompositeUpdatesEnabled(TRUE); + gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable_entry->mItemID); + } + else + { + // Somehow the asset doesn't exist in the database. + // MULTI-WEARABLE: assuming zeroth elt + gAgentWearables.recoverMissingWearable(type,0); + } + + gInventory.notifyObservers(); + + // Have all the wearables that the avatar was wearing at log-in arrived? + // MULTI-WEARABLE: update when multiple wearables can arrive per type. + if (!gAgentWearables.mWearablesLoaded) + { + gAgentWearables.mWearablesLoaded = TRUE; + for (S32 i = 0; i < WT_COUNT; i++) + { + LLWearableInv* wearable_entry = gAgentWearables.getWearableInv((EWearableType)i,0); + if (!wearable_entry->mItemID.isNull() && !wearable_entry->mWearable) + { + gAgentWearables.mWearablesLoaded = FALSE; + break; + } + } + } + + if (gAgentWearables.mWearablesLoaded) + { + + // Can't query cache until all wearables have arrived, so calling this earlier is a no-op. + gAgentWearables.queryWearableCache(); + + // Make sure that the server's idea of the avatar's wearables actually match the wearables. + gAgent.sendAgentSetAppearance(); + + // Check to see if there are any baked textures that we hadn't uploaded before we logged off last time. + // If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive. + if (gAgent.cameraCustomizeAvatar()) + { + avatar->requestLayerSetUploads(); + } + } +} + +// Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the +// database. If for some reason, we can't load one of those assets, we can try to reconstruct it so that +// the user isn't left without a shape, for example. (We can do that only after the inventory has loaded.) +void LLAgentWearables::recoverMissingWearable(const EWearableType type, U32 index) +{ + // Try to recover by replacing missing wearable with a new one. + LLNotifications::instance().add("ReplacedMissingWearable"); + lldebugs << "Wearable " << LLWearableDictionary::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; + LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type); + + S32 type_s32 = (S32) type; + LLWearableInv* wearable_entry = getWearableInv(type, index); + wearable_entry->mWearable = new_wearable; + new_wearable->writeToAvatar(TRUE); + + // Add a new one in the lost and found folder. + // (We used to overwrite the "not found" one, but that could potentially + // destory content.) JC + LLUUID lost_and_found_id = + gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); + LLPointer cb = + new addWearableToAgentInventoryCallback( + LLPointer(NULL), + type_s32, + index, + new_wearable, + addWearableToAgentInventoryCallback::CALL_RECOVERDONE); + addWearableToAgentInventory(cb, new_wearable, lost_and_found_id, TRUE); +} + +void LLAgentWearables::recoverMissingWearableDone() +{ + // Have all the wearables that the avatar was wearing at log-in arrived or been fabricated? + mWearablesLoaded = TRUE; + for (S32 i = 0; i < WT_COUNT; i++) + { + // MULTI-WEARABLE: assuming zeroth elt - fix when messages change. + LLWearableInv* wearable_entry = getWearableInv((EWearableType)i,0); + if (!wearable_entry->mItemID.isNull() && !wearable_entry->mWearable) + { + mWearablesLoaded = FALSE; + break; + } + } + + if (mWearablesLoaded) + { + // Make sure that the server's idea of the avatar's wearables actually match the wearables. + gAgent.sendAgentSetAppearance(); + } + else + { + gInventory.addChangedMask(LLInventoryObserver::LABEL, LLUUID::null); + gInventory.notifyObservers(); + } +} + +void LLAgentWearables::createStandardWearables(BOOL female) +{ + llwarns << "Creating Standard " << (female ? "female" : "male") + << " Wearables" << llendl; + + if (mAvatarObject.isNull()) + { + return; + } + + mAvatarObject->setSex(female ? SEX_FEMALE : SEX_MALE); + + const BOOL create[WT_COUNT] = + { + TRUE, //WT_SHAPE + TRUE, //WT_SKIN + TRUE, //WT_HAIR + TRUE, //WT_EYES + TRUE, //WT_SHIRT + TRUE, //WT_PANTS + TRUE, //WT_SHOES + TRUE, //WT_SOCKS + FALSE, //WT_JACKET + FALSE, //WT_GLOVES + TRUE, //WT_UNDERSHIRT + TRUE, //WT_UNDERPANTS + FALSE //WT_SKIRT + }; + + for (S32 i=0; i < WT_COUNT; i++) + { + bool once = false; + LLPointer donecb = NULL; + if (create[i]) + { + if (!once) + { + once = true; + donecb = new createStandardWearablesAllDoneCallback; + } + // MULTI_WEARABLE: only elt 0, may be the right thing? + LLWearableInv* wearable_entry = getWearableInv((EWearableType)i,0); + llassert(wearable_entry->mWearable == NULL); + LLWearable* wearable = LLWearableList::instance().createNewWearable((EWearableType)i); + wearable_entry->mWearable = wearable; + // no need to update here... + // MULTI_WEARABLE: hardwired index = 0 here. + LLPointer cb = + new addWearableToAgentInventoryCallback( + donecb, + i, + 0, + wearable, + addWearableToAgentInventoryCallback::CALL_CREATESTANDARDDONE); + addWearableToAgentInventory(cb, wearable, LLUUID::null, FALSE); + } + } +} + +void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index) +{ + LLWearable* wearable = getWearable((EWearableType)type, index); + + if (wearable) + { + wearable->writeToAvatar(TRUE); + } +} + +void LLAgentWearables::createStandardWearablesAllDone() +{ + // ... because sendAgentWearablesUpdate will notify inventory + // observers. + mWearablesLoaded = TRUE; + updateServer(); + + // Treat this as the first texture entry message, if none received yet + mAvatarObject->onFirstTEMessageReceived(); +} + +void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name, + const LLDynamicArray& wearables_to_include, + const LLDynamicArray& attachments_to_include, + BOOL rename_clothing) +{ + if (mAvatarObject.isNull()) + { + return; + } + + // First, make a folder in the Clothes directory. + LLUUID folder_id = gInventory.createNewCategory( + gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING), + LLAssetType::AT_NONE, + new_folder_name); + + bool found_first_item = false; + + /////////////////// + // Wearables + + if (wearables_to_include.count()) + { + // Then, iterate though each of the wearables and save copies of them in the folder. + S32 i; + S32 count = wearables_to_include.count(); + LLDynamicArray delete_items; + LLPointer cbdone = NULL; + for (i = 0; i < count; ++i) + { + const S32 type = wearables_to_include[i]; + for (U32 j=0; jmWearable; + if (old_wearable) + { + std::string new_name; + LLWearable* new_wearable; + new_wearable = LLWearableList::instance().createCopy(old_wearable); + if (rename_clothing) + { + new_name = new_folder_name; + new_name.append(" "); + new_name.append(old_wearable->getTypeLabel()); + LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); + new_wearable->setName(new_name); + } + + LLViewerInventoryItem* item = gInventory.getItem(wearable_entry->mItemID); + S32 todo = addWearableToAgentInventoryCallback::CALL_NONE; + if (!found_first_item) + { + found_first_item = true; + /* set the focus to the first item */ + todo |= addWearableToAgentInventoryCallback::CALL_MAKENEWOUTFITDONE; + /* send the agent wearables update when done */ + cbdone = new sendAgentWearablesUpdateCallback; + } + LLPointer cb = + new addWearableToAgentInventoryCallback( + cbdone, + type, + j, + new_wearable, + todo); + if (isWearableCopyable((EWearableType)type, j)) + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + folder_id, + new_name, + cb); + } + else + { + move_inventory_item( + gAgent.getID(), + gAgent.getSessionID(), + item->getUUID(), + folder_id, + new_name, + cb); + } + } + } + } + gInventory.notifyObservers(); + } + + + /////////////////// + // Attachments + + if (attachments_to_include.count()) + { + BOOL msg_started = FALSE; + LLMessageSystem* msg = gMessageSystem; + for (S32 i = 0; i < attachments_to_include.count(); i++) + { + S32 attachment_pt = attachments_to_include[i]; + LLViewerJointAttachment* attachment = get_if_there(mAvatarObject->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL); + if (!attachment) continue; + LLViewerObject* attached_object = attachment->getObject(); + if (!attached_object) continue; + const LLUUID& item_id = attachment->getItemID(); + if (item_id.isNull()) continue; + LLInventoryItem* item = gInventory.getItem(item_id); + if (!item) continue; + if (!msg_started) + { + msg_started = TRUE; + msg->newMessage("CreateNewOutfitAttachments"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("HeaderData"); + msg->addUUID("NewFolderID", folder_id); + } + msg->nextBlock("ObjectData"); + msg->addUUID("OldItemID", item_id); + msg->addUUID("OldFolderID", item->getParentUUID()); + } + + if (msg_started) + { + gAgent.sendReliableMessage(); + } + + } +} + +void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index) +{ + LLWearableInv* wearable_entry = getWearableInv((EWearableType)type, index); + LLUUID first_item_id = wearable_entry->mItemID; + // Open the inventory and select the first item we added. + if (first_item_id.notNull()) + { + LLInventoryView* view = LLInventoryView::getActiveInventory(); + if (view) + { + view->getPanel()->setSelection(first_item_id, TAKE_FOCUS_NO); + } + } +} + + +void LLAgentWearables::addWearableToAgentInventory(LLPointer cb, + LLWearable* wearable, + const LLUUID& category_id, + BOOL notify) +{ + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + category_id, + wearable->getTransactionID(), + wearable->getName(), + wearable->getDescription(), + wearable->getAssetType(), + LLInventoryType::IT_WEARABLE, + wearable->getType(), + wearable->getPermissions().getMaskNextOwner(), + cb); +} + +void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_all, U32 index) +{ + + if (do_remove_all) + { + removeWearableFinal(type, do_remove_all, index); + } + else + { +// MULTI_WEARABLE: handle vector changes from arbitrary removal. + LLWearable* old_wearable = getWearable(type,index); + + if ((gAgent.isTeen()) + && (type == WT_UNDERSHIRT || type == WT_UNDERPANTS)) + { + // Can't take off underclothing in simple UI mode or on PG accounts + return; + } + + if (old_wearable) + { + if (old_wearable->isDirty()) + { + LLSD payload; + payload["wearable_type"] = (S32)type; + // Bring up view-modal dialog: Save changes? Yes, No, Cancel + LLNotifications::instance().add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog); + return; + } + else + { + removeWearableFinal(type, do_remove_all, index); + } + } + } +} + + +// MULTI_WEARABLE: assuming one wearable per type. +// MULTI_WEARABLE: hardwiring 0th elt for now - notification needs to change. +// static +bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger(); + switch(option) + { + case 0: // "Save" + gAgentWearables.saveWearable(type, 0); + gAgentWearables.removeWearableFinal(type, false, 0); + break; + + case 1: // "Don't Save" + gAgentWearables.removeWearableFinal(type, false, 0); + break; + + case 2: // "Cancel" + break; + + default: + llassert(0); + break; + } + return false; +} + +// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal. +void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_remove_all, U32 index) +{ + //LLAgentDumper dumper("removeWearable"); + if (do_remove_all) + { + S32 max_entry = mWearableDatas[type].size()-1; + for (S32 i=max_entry; i>=0; i--) + { + LLWearableInv *wearable_entry = getWearableInv(type,i); + LLWearable* old_wearable = wearable_entry->mWearable; + gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable_entry->mItemID); + wearable_entry->mWearable = NULL; + wearable_entry->mItemID.setNull(); + //queryWearableCache(); // BAP moved below + // MULTI_WEARABLE: FIXME - currently we keep a null entry, so can't delete the last one. + if (i>0) + { + mWearableDatas[type].pop_back(); + delete wearable_entry; + } + if (old_wearable) + { + old_wearable->removeFromAvatar(TRUE); + } + } + } + else + { + LLWearableInv* wearable_entry = getWearableInv(type, index); + LLWearable* old_wearable = wearable_entry->mWearable; + + gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable_entry->mItemID); + + wearable_entry->mWearable = NULL; + wearable_entry->mItemID.setNull(); + + //queryWearableCache(); // BAP moved below + + if (old_wearable) + { + old_wearable->removeFromAvatar(TRUE); + } + + // MULTI_WEARABLE: logic changes if null entries go away + if (getWearableCount(type)>1) + { + // Have to shrink the vector and clean up the item. + wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); + llassert_always(wearable_iter != mWearableDatas.end()); + wearableentry_vec_t& wearable_vec = wearable_iter->second; + wearable_vec.erase( wearable_vec.begin() + index ); + delete(wearable_entry); + } + } + + queryWearableCache(); + + // Update the server + updateServer(); + gInventory.notifyObservers(); +} + +// Assumes existing wearables are not dirty. +// MULTI_WEARABLE: assumes one wearable per type. +void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items, + const LLDynamicArray< LLWearable* >& wearables, + BOOL remove) +{ + lldebugs << "setWearableOutfit() start" << llendl; + + BOOL wearables_to_remove[WT_COUNT]; + wearables_to_remove[WT_SHAPE] = FALSE; + wearables_to_remove[WT_SKIN] = FALSE; + wearables_to_remove[WT_HAIR] = FALSE; + wearables_to_remove[WT_EYES] = FALSE; + wearables_to_remove[WT_SHIRT] = remove; + wearables_to_remove[WT_PANTS] = remove; + wearables_to_remove[WT_SHOES] = remove; + wearables_to_remove[WT_SOCKS] = remove; + wearables_to_remove[WT_JACKET] = remove; + wearables_to_remove[WT_GLOVES] = remove; + wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) & remove; + wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) & remove; + wearables_to_remove[WT_SKIRT] = remove; + + S32 count = wearables.count(); + llassert(items.count() == count); + + S32 i; + for (i = 0; i < count; i++) + { + LLWearable* new_wearable = wearables[i]; + LLPointer new_item = items[i]; + + const EWearableType type = new_wearable->getType(); + wearables_to_remove[type] = FALSE; + + // MULTI_WEARABLE: using 0th + LLWearableInv* old_wearable_entry = getWearableInv(type, 0); + LLWearable* old_wearable = old_wearable_entry->mWearable; + if (old_wearable) + { + const LLUUID& old_item_id = old_wearable_entry->mItemID; + if ((old_wearable->getID() == new_wearable->getID()) && + (old_item_id == new_item->getUUID())) + { + lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl; + continue; + } + + gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id); + + // Assumes existing wearables are not dirty. + if (old_wearable->isDirty()) + { + llassert(0); + continue; + } + } + + old_wearable_entry->mItemID = new_item->getUUID(); + old_wearable_entry->mWearable = new_wearable; + } + + std::vector wearables_being_removed; + + for (i = 0; i < WT_COUNT; i++) + { + if (wearables_to_remove[i]) + { + // MULTI_WEARABLE: assuming 0th + LLWearableInv* wearable_entry = getWearableInv((EWearableType)i, 0); + wearables_being_removed.push_back(wearable_entry->mWearable); + wearable_entry->mWearable = NULL; + + gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable_entry->mItemID); + wearable_entry->mItemID.setNull(); + } + } + + gInventory.notifyObservers(); + + queryWearableCache(); + + std::vector::iterator wearable_iter; + + for (wearable_iter = wearables_being_removed.begin(); + wearable_iter != wearables_being_removed.end(); + ++wearable_iter) + { + LLWearable* wearablep = *wearable_iter; + if (wearablep) + { + wearablep->removeFromAvatar(TRUE); + } + } + + for (i = 0; i < count; i++) + { + wearables[i]->writeToAvatar(TRUE); + } + + // Start rendering & update the server + mWearablesLoaded = TRUE; + updateServer(); + + lldebugs << "setWearableOutfit() end" << llendl; +} + + +// User has picked "wear on avatar" from a menu. +void LLAgentWearables::setWearable(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append) +{ + //LLAgentDumper dumper("setWearable"); + if (isWearingItem(new_item->getUUID())) + { + llwarns << "wearable " << new_item->getUUID() << " is already worn" << llendl; + return; + } + + const EWearableType type = new_wearable->getType(); + + if (!do_append) + { + // Remove old wearable, if any + // MULTI_WEARABLE: hardwired to 0 + LLWearableInv* old_wearable_entry = getWearableInv(type,0); + LLWearable* old_wearable = old_wearable_entry->mWearable; + if (old_wearable) + { + const LLUUID& old_item_id = old_wearable_entry->mItemID; + if ((old_wearable->getID() == new_wearable->getID()) && + (old_item_id == new_item->getUUID())) + { + lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl; + return; + } + + if (old_wearable->isDirty()) + { + // Bring up modal dialog: Save changes? Yes, No, Cancel + LLSD payload; + payload["item_id"] = new_item->getUUID(); + LLNotifications::instance().add("WearableSave", LLSD(), payload, boost::bind(onSetWearableDialog, _1, _2, new_wearable)); + return; + } + } + } + + setWearableFinal(new_item, new_wearable, do_append); +} + +// static +bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID()); + if (!new_item) + { + delete wearable; + return false; + } + + switch(option) + { + case 0: // "Save" +// MULTI_WEARABLE: assuming 0th + gAgentWearables.saveWearable(wearable->getType(),0); + gAgentWearables.setWearableFinal(new_item, wearable); + break; + + case 1: // "Don't Save" + gAgentWearables.setWearableFinal(new_item, wearable); + break; + + case 2: // "Cancel" + break; + + default: + llassert(0); + break; + } + + delete wearable; + return false; +} + +// Called from setWearable() and onSetWearableDialog() to actually set the wearable. +// MULTI_WEARABLE: unify code after null objects are gone. +void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append) +{ + const EWearableType type = new_wearable->getType(); + + if (do_append && getWearableInv(type,0)->mItemID.notNull()) + { + LLWearableInv *new_wearable_entry = new LLWearableInv; + new_wearable_entry->mItemID = new_item->getUUID(); + new_wearable_entry->mWearable = new_wearable; + mWearableDatas[type].push_back(new_wearable_entry); + llinfos << "Added additional wearable for type " << type + << " size is now " << mWearableDatas[type].size() << llendl; + } + else + { + LLWearableInv* wearable_entry = getWearableInv(type,0); + // Replace the old wearable with a new one. + llassert(new_item->getAssetUUID() == new_wearable->getID()); + LLUUID old_item_id = wearable_entry->mItemID; + wearable_entry->mItemID = new_item->getUUID(); + wearable_entry->mWearable = new_wearable; + + if (old_item_id.notNull()) + { + gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id); + gInventory.notifyObservers(); + } + llinfos << "Replaced current element 0 for type " << type + << " size is now " << mWearableDatas[type].size() << llendl; + } + + //llinfos << "LLVOAvatar::setWearable()" << llendl; + queryWearableCache(); + new_wearable->writeToAvatar(TRUE); + + updateServer(); +} + +void LLAgentWearables::queryWearableCache() +{ + if (!mWearablesLoaded) + { + return; + } + + // Look up affected baked textures. + // If they exist: + // disallow updates for affected layersets (until dataserver responds with cache request.) + // If cache miss, turn updates back on and invalidate composite. + // If cache hit, modify baked texture entries. + // + // Cache requests contain list of hashes for each baked texture entry. + // Response is list of valid baked texture assets. (same message) + + gMessageSystem->newMessageFast(_PREHASH_AgentCachedTexture); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gMessageSystem->addS32Fast(_PREHASH_SerialNum, gAgentQueryManager.mWearablesCacheQueryID); + + S32 num_queries = 0; + for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) + { + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + LLUUID hash; + for (U8 i=0; i < baked_dict->mWearables.size(); i++) + { + // EWearableType baked_type = gBakedWearableMap[baked_index][baked_num]; + const EWearableType baked_type = baked_dict->mWearables[i]; + // MULTI_WEARABLE: assuming 0th + const LLWearable* wearable = getWearableInv(baked_type,0)->mWearable; + if (wearable) + { + hash ^= wearable->getID(); + } + } + if (hash.notNull()) + { + hash ^= baked_dict->mWearablesHashID; + num_queries++; + // *NOTE: make sure at least one request gets packed + + //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl; + gMessageSystem->nextBlockFast(_PREHASH_WearableData); + gMessageSystem->addUUIDFast(_PREHASH_ID, hash); + gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index); + } + + gAgentQueryManager.mActiveCacheQueries[baked_index] = gAgentQueryManager.mWearablesCacheQueryID; + } + + llinfos << "Requesting texture cache entry for " << num_queries << " baked textures" << llendl; + gMessageSystem->sendReliable(gAgent.getRegion()->getHost()); + gAgentQueryManager.mNumPendingQueries++; + gAgentQueryManager.mWearablesCacheQueryID++; +} + +// MULTI_WEARABLE: need a way to specify by wearable rather than by type. +// User has picked "remove from avatar" from a menu. +// static +void LLAgentWearables::userRemoveWearable(void* userdata) +{ + EWearableType type = (EWearableType)(intptr_t)userdata; + + if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR)) //&& + //!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT))) + { + // MULTI_WEARABLE: fixed to 0th for now. + gAgentWearables.removeWearable(type,false,0); + } +} + +// static +void LLAgentWearables::userRemoveAllClothes(void* userdata) +{ + // We have to do this up front to avoid having to deal with the case of multiple wearables being dirty. + if (gFloaterCustomize) + { + gFloaterCustomize->askToSaveIfDirty(userRemoveAllClothesStep2); + } + else + { + userRemoveAllClothesStep2(TRUE); + } +} + +// static +// MULTI_WEARABLE: removing all here. +void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed) +{ + if (proceed) + { + gAgentWearables.removeWearable(WT_SHIRT,true,0); + gAgentWearables.removeWearable(WT_PANTS,true,0); + gAgentWearables.removeWearable(WT_SHOES,true,0); + gAgentWearables.removeWearable(WT_SOCKS,true,0); + gAgentWearables.removeWearable(WT_JACKET,true,0); + gAgentWearables.removeWearable(WT_GLOVES,true,0); + gAgentWearables.removeWearable(WT_UNDERSHIRT,true,0); + gAgentWearables.removeWearable(WT_UNDERPANTS,true,0); + gAgentWearables.removeWearable(WT_SKIRT,true,0); + } +} + +void LLAgentWearables::userRemoveAllAttachments(void* userdata) +{ + LLVOAvatar* avatarp = gAgent.getAvatarObject(); + if (!avatarp) + { + llwarns << "No avatar found." << llendl; + return; + } + + gMessageSystem->newMessage("ObjectDetach"); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + + for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); + iter != avatarp->mAttachmentPoints.end();) + { + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + LLViewerObject* objectp = attachment->getObject(); + if (objectp) + { + gMessageSystem->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); + } + } + gMessageSystem->sendReliable(gAgent.getRegionHost()); +} + +void LLAgentWearables::updateServer() +{ + sendAgentWearablesUpdate(); + gAgent.sendAgentSetAppearance(); +} diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h new file mode 100644 index 0000000000..98f49203d3 --- /dev/null +++ b/indra/newview/llagentwearables.h @@ -0,0 +1,235 @@ +/** + * @file llagentwearables.h + * @brief LLAgentWearables class header file + * + * $LicenseInfo:firstyear=2000&license=viewergpl$ + * + * Copyright (c) 2000-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLAGENTWEARABLES_H +#define LL_LLAGENTWEARABLES_H + +#include "llmemory.h" +#include "lluuid.h" +#include "llinventory.h" +#include "llviewerinventory.h" + +class LLInventoryItem; +class LLVOAvatarSelf; +class LLWearable; + +class LLAgentWearables +{ + //-------------------------------------------------------------------- + // Constructors / destructors / Initializers + //-------------------------------------------------------------------- +public: + LLAgentWearables(); + virtual ~LLAgentWearables(); + void setAvatarObject(LLVOAvatarSelf *avatar); + void createStandardWearables(BOOL female); + void cleanup(); + void dump(); +protected: + // MULTI-WEARABLE: assuming one per type. Type is called index - rename. + void createStandardWearablesDone(S32 type, U32 index/* = 0*/); + void createStandardWearablesAllDone(); + + //-------------------------------------------------------------------- + // Queries + //-------------------------------------------------------------------- +public: + BOOL isWearingItem(const LLUUID& item_id) const; + BOOL isWearableModifiable(EWearableType type, U32 index /*= 0*/) const; + BOOL isWearableCopyable(EWearableType type, U32 index /*= 0*/) const; + BOOL areWearablesLoaded() const { return mWearablesLoaded; } + + //-------------------------------------------------------------------- + // Accessors + //-------------------------------------------------------------------- +public: + const LLUUID& getWearableItem(EWearableType type, U32 index /*= 0*/) const; + LLWearable* getWearableFromWearableItem(const LLUUID& item_id) const; + LLInventoryItem* getWearableInventoryItem(EWearableType type, U32 index /*= 0*/); + // MULTI-WEARABLE: assuming one per type. + static BOOL selfHasWearable(void* userdata); // userdata is EWearableType + LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/); + const LLWearable* getWearable(const EWearableType type, U32 index /*= 0*/) const; + U32 getWearableCount(const EWearableType type) const; + +private: + struct LLWearableInv; + LLWearableInv* getWearableInv(const EWearableType type, U32 index /*= 0*/); + const LLWearableInv* getWearableInv(const EWearableType type, U32 /*index = 0*/) const; + //-------------------------------------------------------------------- + // Setters + //-------------------------------------------------------------------- +public: + void setWearable(LLInventoryItem* new_item, LLWearable* wearable, bool do_append = false); + void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove); + void setWearableName(const LLUUID& item_id, const std::string& new_name); +protected: + void setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append = false); + static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable); + + void addWearableToAgentInventory(LLPointer cb, + LLWearable* wearable, + const LLUUID& category_id = LLUUID::null, + BOOL notify = TRUE); + void addWearabletoAgentInventoryDone(const S32 type, + const U32 index, + const LLUUID& item_id, + LLWearable* wearable); + void recoverMissingWearable(const EWearableType type, U32 index /*= 0*/); + void recoverMissingWearableDone(); + + //-------------------------------------------------------------------- + // Removing wearables + //-------------------------------------------------------------------- +public: + void removeWearable(const EWearableType type, bool do_remove_all /*= false*/, U32 index /*= 0*/); +private: + void removeWearableFinal(const EWearableType type, bool do_remove_all /*= false*/, U32 index /*= 0*/); +protected: + static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response); + static void userRemoveAllClothesStep2(BOOL proceed); // userdata is NULL + + //-------------------------------------------------------------------- + // Server Communication + //-------------------------------------------------------------------- +public: + static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data); +protected: + void sendAgentWearablesUpdate(); + void sendAgentWearablesRequest(); + void queryWearableCache(); + void updateServer(); + static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata); + + //-------------------------------------------------------------------- + // Outfits + //-------------------------------------------------------------------- +public: + void makeNewOutfit(const std::string& new_folder_name, + const LLDynamicArray& wearables_to_include, + const LLDynamicArray& attachments_to_include, + BOOL rename_clothing);protected: +private: + void makeNewOutfitDone(S32 type, U32 index); + + //-------------------------------------------------------------------- + // Save Wearables + //-------------------------------------------------------------------- +public: + // MULTI-WEARABLE: assumes one per type. + void saveWearableAs(const EWearableType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found); + void saveWearable(const EWearableType type, const U32 index, BOOL send_update = TRUE); + void saveAllWearables(); + void revertWearable(const EWearableType type, const U32 index); + + //-------------------------------------------------------------------- + // Static UI hooks + //-------------------------------------------------------------------- +public: + // MULTI-WEARABLE: assuming one wearable per type. Need upstream changes. + static void userRemoveWearable(void* userdata); // userdata is EWearableType + static void userRemoveAllClothes(void* userdata); // userdata is NULL + static void userRemoveAllAttachments(void* userdata); // userdata is NULL + + //-------------------------------------------------------------------- + // Member variables + //-------------------------------------------------------------------- +private: + typedef std::vector wearableentry_vec_t; // all wearables of a certain type (EG all shirts) + typedef std::map wearableentry_map_t; // wearable "categories" arranged by wearable type + wearableentry_map_t mWearableDatas; + + static BOOL mInitialWearablesUpdateReceived; + BOOL mWearablesLoaded; + LLPointer mAvatarObject; // NULL until avatar object sent down from simulator + + //-------------------------------------------------------------------------------- + // Support classes + //-------------------------------------------------------------------------------- +private: + class createStandardWearablesAllDoneCallback : public LLRefCount + { + protected: + ~createStandardWearablesAllDoneCallback(); + }; + class sendAgentWearablesUpdateCallback : public LLRefCount + { + protected: + ~sendAgentWearablesUpdateCallback(); + }; + + class addWearableToAgentInventoryCallback : public LLInventoryCallback + { + public: + enum EType + { + CALL_NONE = 0, + CALL_UPDATE = 1, + CALL_RECOVERDONE = 2, + CALL_CREATESTANDARDDONE = 4, + CALL_MAKENEWOUTFITDONE = 8 + }; + + // MULTI-WEARABLE: index is an EWearableType - more confusing usage. + // MULTI-WEARABLE: need to have type and index args both? + addWearableToAgentInventoryCallback(LLPointer cb, + S32 type, + U32 index, + LLWearable* wearable, + U32 todo = CALL_NONE); + virtual void fire(const LLUUID& inv_item); + private: + S32 mType; + U32 mIndex; + LLWearable* mWearable; + U32 mTodo; + LLPointer mCB; + }; + + struct LLWearableInv // Make this subclass of llwearable? + { + LLWearableInv() : mItemID(LLUUID::null), mWearable(NULL) {} + // BOOL exists() const; + LLUUID mItemID; // ID of the inventory item in the agent's inventory. + LLWearable* mWearable; + }; + const static LLWearableInv s_null_wearable; + +}; // LLAgentWearables + +extern LLAgentWearables gAgentWearables; + +//-------------------------------------------------------------------- +// Types +//-------------------------------------------------------------------- + +#endif // LL_AGENTWEARABLES_H diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index b66b514597..ce66bb6180 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -30,9 +30,10 @@ * $/LicenseInfo$ */ - #include "llviewerprecompiledheaders.h" + #include "llappviewer.h" + #include "llprimitive.h" #include "llversionviewer.h" @@ -44,19 +45,20 @@ #include "llviewerimagelist.h" #include "llgroupmgr.h" #include "llagent.h" +#include "llagentwearables.h" #include "llwindow.h" #include "llviewerstats.h" #include "llmd5.h" #include "llpumpio.h" #include "llimpanel.h" #include "llmimetypes.h" +#include "llslurl.h" #include "llstartup.h" #include "llfocusmgr.h" #include "llviewerjoystick.h" -#include "llfloaterjoystick.h" +#include "llallocator.h" #include "llares.h" #include "llcurl.h" -#include "llfloatersnapshot.h" #include "llviewerwindow.h" #include "llviewerdisplay.h" #include "llviewermedia.h" @@ -64,14 +66,20 @@ #include "llviewerobjectlist.h" #include "llworldmap.h" #include "llmutelist.h" +#include "lluicolortable.h" #include "llurldispatcher.h" #include "llurlhistory.h" #include "llfirstuse.h" #include "llrender.h" - +#include "lllocationhistory.h" +#include "llfasttimerview.h" #include "llweb.h" #include "llsecondlifeurls.h" +// Linden library includes +#include "llmemory.h" + +// Third party library includes #include #if LL_WINDOWS @@ -105,7 +113,6 @@ #include "llviewermenu.h" #include "llselectmgr.h" #include "lltrans.h" -#include "lluitrans.h" #include "lltracker.h" #include "llviewerparcelmgr.h" #include "llworldmapview.h" @@ -116,9 +123,7 @@ #include "lldebugview.h" #include "llconsole.h" #include "llcontainerview.h" -#include "llfloaterstats.h" #include "llhoverview.h" -#include "llfloatermemleak.h" #include "llsdserialize.h" @@ -139,12 +144,16 @@ #include "llvoavatar.h" #include "llfolderview.h" #include "lltoolbar.h" -#include "llframestats.h" #include "llagentpilot.h" #include "llsrv.h" #include "llvovolume.h" #include "llflexibleobject.h" #include "llvosurfacepatch.h" +#include "llviewerfloaterreg.h" +#include "llcommandlineparser.h" +#include "llfloatermemleak.h" +#include "llfloatersnapshot.h" +#include "llinventoryview.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -161,11 +170,6 @@ #include "llviewerthrottle.h" #include "llparcel.h" - -#include "llinventoryview.h" - -#include "llcommandlineparser.h" - // *FIX: These extern globals should be cleaned up. // The globals either represent state/config/resource-storage of either // this app, or another 'component' of the viewer. App globals should be @@ -181,10 +185,6 @@ ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor // -#if LL_WINDOWS && LL_LCD_COMPILE - #include "lllcd.h" -#endif - //---------------------------------------------------------------------------- // viewer.cpp - these are only used in viewer, should be easily moved. @@ -284,12 +284,23 @@ static std::string gLaunchFileOnQuit; // Used on Win32 for other apps to identify our window (eg, win_setup) const char* const VIEWER_WINDOW_CLASSNAME = "Second Life"; +//---------------------------------------------------------------------------- + +// List of entries from strings.xml to always replace +static std::set default_trans_args; +void init_default_trans_args() +{ + default_trans_args.insert("SECOND_LIFE"); // World + default_trans_args.insert("SECOND_LIFE_VIEWER"); + default_trans_args.insert("SECOND_LIFE_GRID"); + default_trans_args.insert("SECOND_LIFE_SUPPORT"); +} + //---------------------------------------------------------------------------- // File scope definitons const char *VFS_DATA_FILE_BASE = "data.db2.x."; const char *VFS_INDEX_FILE_BASE = "index.db2.x."; -static std::string gSecondLife; static std::string gWindowTitle; std::string gLoginPage; @@ -366,7 +377,6 @@ static void settings_to_globals() MENU_BAR_HEIGHT = gSavedSettings.getS32("MenuBarHeight"); MENU_BAR_WIDTH = gSavedSettings.getS32("MenuBarWidth"); - STATUS_BAR_HEIGHT = gSavedSettings.getS32("StatusBarHeight"); LLCOMBOBOX_HEIGHT = BTN_HEIGHT - 2; LLCOMBOBOX_WIDTH = 128; @@ -388,10 +398,9 @@ static void settings_to_globals() LLSelectMgr::sRenderHiddenSelections = gSavedSettings.getBOOL("RenderHiddenSelections"); LLSelectMgr::sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius"); - gFrameStats.setTrackStats(gSavedSettings.getBOOL("StatsSessionTrackFrameStats")); gAgentPilot.mNumRuns = gSavedSettings.getS32("StatsNumRuns"); gAgentPilot.mQuitAfterRuns = gSavedSettings.getBOOL("StatsQuitAfterRuns"); - gAgent.mHideGroupTitle = gSavedSettings.getBOOL("RenderHideGroupTitle"); + gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle")); gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun"); @@ -408,7 +417,7 @@ static void settings_modify() LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] - gDebugGL = gSavedSettings.getBOOL("RenderDebugGL"); + gDebugGL = gSavedSettings.getBOOL("RenderDebugGL") || gDebugSession; gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); #if LL_VECTORIZE @@ -446,6 +455,38 @@ static void settings_modify() #endif } +class LLFastTimerLogThread : public LLThread +{ +public: + std::string mFile; + + LLFastTimerLogThread() : LLThread("fast timer log") + { + if(LLFastTimer::sLog) + { + mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "performance.slp"); + } + if(LLFastTimer::sMetricLog) + { + mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "metric.slp"); + } + } + + void run() + { + std::ofstream os(mFile.c_str()); + + while (!LLAppViewer::instance()->isQuitting()) + { + LLFastTimer::writeLog(os); + os.flush(); + ms_sleep(32); + } + + os.close(); + } +}; + void LLAppViewer::initGridChoice() { // Load up the initial grid choice from: @@ -497,8 +538,6 @@ bool LLAppViewer::sendURLToOtherInstance(const std::string& url) LLAppViewer* LLAppViewer::sInstance = NULL; const std::string LLAppViewer::sGlobalSettingsName = "Global"; -const std::string LLAppViewer::sPerAccountSettingsName = "PerAccount"; -const std::string LLAppViewer::sCrashSettingsName = "CrashSettings"; LLTextureCache* LLAppViewer::sTextureCache = NULL; LLWorkerThread* LLAppViewer::sImageDecodeThread = NULL; @@ -513,11 +552,15 @@ LLAppViewer::LLAppViewer() : mPurgeOnExit(false), mSecondInstance(false), mSavedFinalSnapshot(false), + mForceGraphicsDetail(false), mQuitRequested(false), mLogoutRequestSent(false), mYieldTime(-1), mMainloopTimeout(NULL), - mAgentRegionLastAlive(false) + mAgentRegionLastAlive(false), + mFastTimerLogThread(NULL), + mRandomizeFramerate(LLCachedControl(gSavedSettings,"Randomize Framerate", FALSE)), + mPeriodicSlowFrame(LLCachedControl(gSavedSettings,"Periodic Slow Frame", FALSE)) { if(NULL != sInstance) { @@ -558,8 +601,13 @@ bool LLAppViewer::init() // // OK to write stuff to logs now, we've now crash reported if necessary // - if (!initConfiguration()) + + init_default_trans_args(); + + if (!initConfiguration()) return false; + + mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling")); // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. @@ -612,34 +660,36 @@ bool LLAppViewer::init() LLError::setPrintLocation(true); } - // Load art UUID information, don't require these strings to be declared in code. - std::string colors_base_filename = gDirUtilp->findSkinnedFilename("colors_base.xml"); - LL_DEBUGS("InitInfo") << "Loading base colors from " << colors_base_filename << LL_ENDL; - gColors.loadFromFileLegacy(colors_base_filename, FALSE, TYPE_COL4U); - - // Load overrides from user colors file - std::string user_colors_filename = gDirUtilp->findSkinnedFilename("colors.xml"); - LL_DEBUGS("InitInfo") << "Loading user colors from " << user_colors_filename << LL_ENDL; - if (gColors.loadFromFileLegacy(user_colors_filename, FALSE, TYPE_COL4U) == 0) - { - LL_DEBUGS("InitInfo") << "Cannot load user colors from " << user_colors_filename << LL_ENDL; - } - // Widget construction depends on LLUI being initialized - LLUI::initClass(&gSavedSettings, - &gSavedSettings, - &gColors, + LLUI::settings_map_t settings_map; + settings_map["config"] = &gSavedSettings; + settings_map["color"] = &gSavedSkinSettings; + settings_map["ignores"] = &gWarningSettings; + settings_map["floater"] = &gSavedSettings; // *TODO: New settings file + settings_map["account"] = &gSavedPerAccountSettings; + + LLUI::initClass(settings_map, LLUIImageList::getInstance(), ui_audio_callback, &LLUI::sGLScaleFactor); + + // Setup paths and LLTrans after LLUI::initClass has been called + LLUI::setupPaths(); + LLTrans::parseStrings("strings.xml", default_trans_args); + LLWeb::initClass(); // do this after LLUI LLTextEditor::setURLCallbacks(&LLWeb::loadURL, &LLURLDispatcher::dispatchFromTextEditor, &LLURLDispatcher::dispatchFromTextEditor); - LLUICtrlFactory::getInstance()->setupPaths(); // update paths with correct language set + ///////////////////////////////////////////////// + + LLToolMgr::getInstance(); // Initialize tool manager if not already instantiated + + LLViewerFloaterReg::registerFloaters(); + ///////////////////////////////////////////////// // // Load settings files @@ -692,18 +742,8 @@ bool LLAppViewer::init() if (!initCache()) { std::ostringstream msg; - msg << - gSecondLife << " is unable to access a file that it needs.\n" - "\n" - "This can be because you somehow have multiple copies running, " - "or your system incorrectly thinks a file is open. " - "If this message persists, restart your computer and try again. " - "If it continues to persist, you may need to completely uninstall " << - gSecondLife << " and reinstall it."; - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); + msg << LLTrans::getString("MBUnableToAccessFile"); + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return 1; } @@ -820,6 +860,7 @@ bool LLAppViewer::init() bool LLAppViewer::mainLoop() { + LLMemType mt1(LLMemType::MTYPE_MAIN); mMainloopTimeout = new LLWatchdogTimeout(); // *FIX:Mani - Make this a setting, once new settings exist in this branch. @@ -837,7 +878,6 @@ bool LLAppViewer::mainLoop() LLVoiceChannel::initClass(); LLVoiceClient::init(gServicePump); - LLMemType mt1(LLMemType::MTYPE_MAIN); LLTimer frameTimer,idleTimer; LLTimer debugTime; LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); @@ -853,12 +893,12 @@ bool LLAppViewer::mainLoop() // Handle messages while (!LLApp::isExiting()) { - LLFastTimer::reset(); // Should be outside of any timer instances + LLFastTimer::nextFrame(); // Should be outside of any timer instances try { - LLFastTimer t(LLFastTimer::FTM_FRAME); pingMainloopTimeout("Main:MiscNativeWindowEvents"); - + + if (gViewerWindow) { LLFastTimer t2(LLFastTimer::FTM_MESSAGES); gViewerWindow->mWindow->processMiscNativeEvents(); @@ -866,6 +906,7 @@ bool LLAppViewer::mainLoop() pingMainloopTimeout("Main:GatherInput"); + if (gViewerWindow) { LLFastTimer t2(LLFastTimer::FTM_MESSAGES); if (!restoreErrorTrap()) @@ -907,6 +948,7 @@ bool LLAppViewer::mainLoop() && !gViewerWindow->getShowProgress() && !gFocusMgr.focusLocked()) { + LLMemType mjk(LLMemType::MTYPE_JOY_KEY); joystick->scanJoystick(); gKeyboard->scanKeyboard(); } @@ -920,6 +962,7 @@ bool LLAppViewer::mainLoop() if (gAres != NULL && gAres->isInitialized()) { + LLMemType mt_ip(LLMemType::MTYPE_IDLE_PUMP); pingMainloopTimeout("Main:ServicePump"); LLFastTimer t4(LLFastTimer::FTM_PUMP); gAres->process(); @@ -947,12 +990,6 @@ bool LLAppViewer::mainLoop() pingMainloopTimeout("Main:Snapshot"); LLFloaterSnapshot::update(); // take snapshots - -#if LL_LCD_COMPILE - // update LCD Screen - pingMainloopTimeout("Main:LCD"); - gLcdScreen->UpdateDisplay(); -#endif } } @@ -963,6 +1000,7 @@ bool LLAppViewer::mainLoop() // Sleep and run background threads { + LLMemType mt_sleep(LLMemType::MTYPE_SLEEP); LLFastTimer t2(LLFastTimer::FTM_SLEEP); bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads"); @@ -974,7 +1012,7 @@ bool LLAppViewer::mainLoop() // yield cooperatively when not running as foreground window if ( gNoRender - || !gViewerWindow->mWindow->getVisible() + || (gViewerWindow && !gViewerWindow->mWindow->getVisible()) || !gFocusMgr.getAppHasFocus()) { // Sleep if we're not rendering, or the window is minimized. @@ -990,12 +1028,12 @@ bool LLAppViewer::mainLoop() } } - if (gRandomizeFramerate) + if (mRandomizeFramerate) { ms_sleep(rand() % 200); } - if (gPeriodicSlowFrame + if (mPeriodicSlowFrame && (gFrameCount % 10 == 0)) { llinfos << "Periodic slow frame - sleeping 500 ms" << llendl; @@ -1221,22 +1259,26 @@ bool LLAppViewer::cleanup() llinfos << "Shutting down." << llendflush; // Destroy the UI - gViewerWindow->shutdownViews(); + if( gViewerWindow) + gViewerWindow->shutdownViews(); // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); // Shut down OpenGL - gViewerWindow->shutdownGL(); + if( gViewerWindow) + { + gViewerWindow->shutdownGL(); + + // Destroy window, and make sure we're not fullscreen + // This may generate window reshape and activation events. + // Therefore must do this before destroying the message system. + delete gViewerWindow; + gViewerWindow = NULL; + llinfos << "ViewerWindow deleted" << llendflush; + } - // Destroy window, and make sure we're not fullscreen - // This may generate window reshape and activation events. - // Therefore must do this before destroying the message system. - delete gViewerWindow; - gViewerWindow = NULL; - llinfos << "ViewerWindow deleted" << llendflush; - // viewer UI relies on keyboard so keep it aound until viewer UI isa gone delete gKeyboard; gKeyboard = NULL; @@ -1256,12 +1298,6 @@ bool LLAppViewer::cleanup() // gDXHardware.cleanup(); //#endif // LL_WINDOWS -#if LL_LCD_COMPILE - // shut down the LCD window on a logitech keyboard, if there is one - delete gLcdScreen; - gLcdScreen = NULL; -#endif - LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager(); if (!volume_manager->cleanup()) { @@ -1303,8 +1339,10 @@ bool LLAppViewer::cleanup() // Must do this after all panels have been deleted because panels that have persistent rects // save their rects on delete. - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + + //*FIX: don't overwrite user color tweaks with *all* colors + gSavedSkinSettings.saveToFile(gSavedSettings.getString("SkinningSettingsFile"), TRUE); // PerAccountSettingsFile should be empty if no use has been logged on. // *FIX:Mani This should get really saved in a "logoff" mode. gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); @@ -1314,8 +1352,11 @@ bool LLAppViewer::cleanup() // save all settings, even if equals defaults gCrashSettings.saveToFile(crash_settings_filename, FALSE); + std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings")); + gWarningSettings.saveToFile(warnings_settings_filename, TRUE); + gSavedSettings.cleanup(); - gColors.cleanup(); + gSavedSkinSettings.cleanup(); gCrashSettings.cleanup(); // Save URL history file @@ -1360,6 +1401,7 @@ bool LLAppViewer::cleanup() sTextureCache->shutdown(); sTextureFetch->shutdown(); sImageDecodeThread->shutdown(); + delete sTextureCache; sTextureCache = NULL; delete sTextureFetch; @@ -1367,6 +1409,31 @@ bool LLAppViewer::cleanup() delete sImageDecodeThread; sImageDecodeThread = NULL; + LLLocationHistory::getInstance()->save(); + delete mFastTimerLogThread; + mFastTimerLogThread = NULL; + + if (LLFastTimerView::sAnalyzePerformance) + { + llinfos << "Analyzing performance" << llendl; + + if(LLFastTimer::sLog) + { + LLFastTimerView::doAnalysis( + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "performance_baseline.slp"), + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "performance.slp"), + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "performance_report.csv")); + } + if(LLFastTimer::sMetricLog) + { + LLFastTimerView::doAnalysis( + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "metric_baseline.slp"), + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "metric.slp"), + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "metric_report.csv")); + } + } + LLMetricPerformanceTester::cleanClass() ; + //Note: //LLViewerMedia::cleanupClass() has to be put before gImageList.shutdown() //because some new image might be generated during cleaning up media. --bao @@ -1419,6 +1486,8 @@ bool LLAppViewer::cleanup() llinfos << "File launched." << llendflush; } + ll_close_fail_log(); + llinfos << "Goodbye" << llendflush; // return 0; @@ -1469,6 +1538,13 @@ bool LLAppViewer::initThreads() LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), enable_threads && false); LLImage::initClass(LLAppViewer::getImageDecodeThread()); + if (LLFastTimer::sLog || LLFastTimer::sMetricLog) + { + LLFastTimer::sLogLock = new LLMutex(NULL); + mFastTimerLogThread = new LLFastTimerLogThread(); + mFastTimerLogThread->start(); + } + // *FIX: no error handling here! return true; } @@ -1476,7 +1552,7 @@ bool LLAppViewer::initThreads() void errorCallback(const std::string &error_string) { #ifndef LL_RELEASE_FOR_DOWNLOAD - OSMessageBox(error_string, "Fatal Error", OSMB_OK); + OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK); #endif //Set the ErrorActivated global so we know to create a marker file @@ -1544,7 +1620,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, llinfos << "Attempting to load settings for the group " << settings_group << " - from location " << location_key << llendl; - if(gSettings.find(settings_group) == gSettings.end()) + if(!LLControlGroup::getInstance(settings_group)) { llwarns << "No matching settings group for name " << settings_group << llendl; continue; @@ -1558,10 +1634,10 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string custom_name_setting = file.get("NameFromSetting"); // *NOTE: Regardless of the group currently being lodaed, // this setting is always read from the Global settings. - if(gSettings[sGlobalSettingsName]->controlExists(custom_name_setting)) + if(LLControlGroup::getInstance(sGlobalSettingsName)->controlExists(custom_name_setting)) { std::string file_name = - gSettings[sGlobalSettingsName]->getString(custom_name_setting); + LLControlGroup::getInstance(sGlobalSettingsName)->getString(custom_name_setting); full_settings_path = file_name; } } @@ -1578,7 +1654,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, requirement = file.get("Requirement").asInteger(); } - if(!gSettings[settings_group]->loadFromFile(full_settings_path, set_defaults)) + if(!LLControlGroup::getInstance(settings_group)->loadFromFile(full_settings_path, set_defaults)) { if(requirement == 1) { @@ -1618,17 +1694,53 @@ std::string LLAppViewer::getSettingsFilename(const std::string& location_key, return std::string(); } +void LLAppViewer::loadColorSettings() +{ + gSavedSkinSettings.cleanup(); + + loadSettingsFromDirectory("DefaultSkin"); + loadSettingsFromDirectory("CurrentSkin", true); + loadSettingsFromDirectory("UserSkin"); + + class ColorConverterFunctor : public LLControlGroup::ApplyFunctor + { + public: + explicit ColorConverterFunctor(LLUIColorTable::Params& result) + :mResult(result) + { + } + + void apply(const std::string& name, LLControlVariable* control) + { + if(control->isType(TYPE_COL4)) + { + LLUIColorTable::ColorParams color; + color.value = control->getValue(); + + LLUIColorTable::ColorEntryParams color_entry; + color_entry.name = name; + color_entry.color = color; + + mResult.color_entries.add(color_entry); + } + } + + private: + LLUIColorTable::Params& mResult; + }; + + LLUIColorTable::Params params; + ColorConverterFunctor ccf(params); + LLControlGroup::getInstance("Skinning")->applyToAll(&ccf); + LLUIColorTable::instance().init(params); +} + bool LLAppViewer::initConfiguration() { - //Set up internal pointers - gSettings[sGlobalSettingsName] = &gSavedSettings; - gSettings[sPerAccountSettingsName] = &gSavedPerAccountSettings; - gSettings[sCrashSettingsName] = &gCrashSettings; - //Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); - LLControlGroup settings_control; - llinfos << "Loading settings file list" << settings_file_list << llendl; + LLControlGroup settings_control("SettingsFiles"); + llinfos << "Loading settings file list " << settings_file_list << llendl; if (0 == settings_control.loadFromFile(settings_file_list)) { llerrs << "Cannot load default configuration file " << settings_file_list << llendl; @@ -1651,21 +1763,22 @@ bool LLAppViewer::initConfiguration() if(!loadSettingsFromDirectory("Default", set_defaults)) { std::ostringstream msg; - msg << "Second Life could not load its default settings file. \n" - << "The installation may be corrupted. \n"; - - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); - + msg << "Unable to load default settings file. The installation may be corrupted."; + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return false; } - - // - set procedural settings + + LLUI::setupPaths(); // setup paths for LLTrans based on settings files only + LLTrans::parseStrings("strings.xml", default_trans_args); + + // - set procedural settings + // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet gSavedSettings.setString("ClientSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); + gSavedSettings.setString("SkinningSettingsFile", + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("UserSkin", "Skinning"))); + gSavedSettings.setString("VersionChannelName", LL_CHANNEL); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -1685,7 +1798,7 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setBOOL("WatchdogEnabled", FALSE); #endif - gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _1)); + gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _2)); // These are warnings that appear on the first experience of that condition. // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse @@ -1719,22 +1832,13 @@ bool LLAppViewer::initConfiguration() if(!initParseCommandLine(clp)) { - llwarns - << "Error parsing command line options. Command Line options ignored." - << llendl; - + llwarns << "Error parsing command line options. Command Line options ignored." << llendl; + llinfos << "Command line usage:\n" << clp << llendl; std::ostringstream msg; - msg << "Second Life found an error parsing the command line. \n" - << "Please see: http://wiki.secondlife.com/wiki/Client_parameters \n" - << "Error: " << clp.getErrorMessage(); - - OSMessageBox( - msg.str(), - LLStringUtil::null, - OSMB_OK); - + msg << LLTrans::getString("MBCmdLineError") << clp.getErrorMessage(); + OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return false; } @@ -1754,7 +1858,6 @@ bool LLAppViewer::initConfiguration() // - load overrides from user_settings loadSettingsFromDirectory("User"); - // - apply command line settings clp.notify(); @@ -1768,7 +1871,7 @@ bool LLAppViewer::initConfiguration() if(clp.hasOption("help")) { std::ostringstream msg; - msg << "Command line usage:\n" << clp; + msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp; llinfos << msg.str() << llendl; OSMessageBox( @@ -1779,36 +1882,6 @@ bool LLAppViewer::initConfiguration() return false; } - ////////////////////////// - // Apply settings... - if(clp.hasOption("setdefault")) - { - //const LLCommandLineParser::token_vector_t& setdefault = clp.getOption("setdefault"); - //if(0x1 & setdefault.size()) - //{ - // llwarns << "Invalid '--setdefault' parameter count." << llendl; - //} - //else - //{ - // LLCommandLineParser::token_vector_t::const_iterator itr = setdefault.begin(); - // for(; itr != setdefault.end(); ++itr) - // { - // const std::string& name = *itr; - // const std::string& value = *(++itr); - // LLControlVariable* c = gSettings[sGlobalSettingsName]->getControl(name); - // if(c) - // { - // c->setDefault(value); - // } - // else - // { - // llwarns << "'--setdefault' specified with unknown setting: '" - // << name << "'." << llendl; - // } - // } - //} - } - if(clp.hasOption("set")) { const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); @@ -1823,7 +1896,7 @@ bool LLAppViewer::initConfiguration() { const std::string& name = *itr; const std::string& value = *(++itr); - LLControlVariable* c = gSettings[sGlobalSettingsName]->getControl(name); + LLControlVariable* c = LLControlGroup::getInstance(sGlobalSettingsName)->getControl(name); if(c) { c->setValue(value, false); @@ -1845,6 +1918,68 @@ bool LLAppViewer::initConfiguration() gCrashOnStartup = TRUE; } + if (clp.hasOption("logperformance")) + { + LLFastTimer::sLog = TRUE; + } + + if(clp.hasOption("logmetrics")) + { + LLFastTimer::sMetricLog = TRUE ; + } + + if (clp.hasOption("graphicslevel")) + { + const LLCommandLineParser::token_vector_t& value = clp.getOption("graphicslevel"); + if(value.size() != 1) + { + llwarns << "Usage: -graphicslevel <0-3>" << llendl; + } + else + { + std::string detail = value.front(); + mForceGraphicsDetail = TRUE; + + switch (detail.c_str()[0]) + { + case '0': + gSavedSettings.setU32("RenderQualityPerformance", 0); + break; + case '1': + gSavedSettings.setU32("RenderQualityPerformance", 1); + break; + case '2': + gSavedSettings.setU32("RenderQualityPerformance", 2); + break; + case '3': + gSavedSettings.setU32("RenderQualityPerformance", 3); + break; + default: + mForceGraphicsDetail = FALSE; + llwarns << "Usage: -graphicslevel <0-3>" << llendl; + break; + } + } + } + + if (clp.hasOption("analyzeperformance")) + { + LLFastTimerView::sAnalyzePerformance = TRUE; + } + + if (clp.hasOption("replaysession")) + { + LLAgentPilot::sReplaySession = TRUE; + } + + if (clp.hasOption("debugsession")) + { + gDebugSession = TRUE; + gDebugGL = TRUE; + + ll_init_fail_log(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "test_failures.log")); + } + // Handle slurl use. NOTE: Don't let SL-55321 reappear. // *FIX: This init code should be made more robust to prevent @@ -1865,7 +2000,7 @@ bool LLAppViewer::initConfiguration() if(clp.hasOption("url")) { std::string slurl = clp.getOption("url")[0]; - if (LLURLDispatcher::isSLURLCommand(slurl)) + if (LLSLURL::isSLURLCommand(slurl)) { LLStartUp::sSLURLCommand = slurl; } @@ -1877,9 +2012,9 @@ bool LLAppViewer::initConfiguration() else if(clp.hasOption("slurl")) { std::string slurl = clp.getOption("slurl")[0]; - if(LLURLDispatcher::isSLURL(slurl)) + if(LLSLURL::isSLURL(slurl)) { - if (LLURLDispatcher::isSLURLCommand(slurl)) + if (LLSLURL::isSLURLCommand(slurl)) { LLStartUp::sSLURLCommand = slurl; } @@ -1894,12 +2029,12 @@ bool LLAppViewer::initConfiguration() if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) { gDirUtilp->setSkinFolder(skinfolder->getValue().asString()); + + gSavedSettings.setString("SkinningSettingsFile", + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("UserSkin", "Skinning"))); } mYieldTime = gSavedSettings.getS32("YieldTime"); - - // XUI:translate - gSecondLife = "Second Life"; // Read skin/branding settings if specified. //if (! gDirUtilp->getSkinDir().empty() ) @@ -1916,7 +2051,7 @@ bool LLAppViewer::initConfiguration() #if LL_DARWIN // Initialize apple menubar and various callbacks - init_apple_menu(gSecondLife.c_str()); + init_apple_menu(LLTrans::getString("SECOND_LIFE_VIEWER").c_str()); #if __ppc__ // If the CPU doesn't have Altivec (i.e. it's not at least a G4), don't go any further. @@ -1924,7 +2059,7 @@ bool LLAppViewer::initConfiguration() if(!gSysCPU.hasAltivec()) { std::ostringstream msg; - msg << gSecondLife << " requires a processor with AltiVec (G4 or later)."; + msg << LLTrans::getString("MBRequiresAltiVec"); OSMessageBox( msg.str(), LLStringUtil::null, @@ -1939,7 +2074,7 @@ bool LLAppViewer::initConfiguration() // Display splash screen. Must be after above check for previous // crash as this dialog is always frontmost. std::ostringstream splash_msg; - splash_msg << "Loading " << gSecondLife << "..."; + splash_msg << "Loading " << LLTrans::getString("SECOND_LIFE") << "..."; LLSplashScreen::show(); LLSplashScreen::update(splash_msg.str()); @@ -1955,12 +2090,11 @@ bool LLAppViewer::initConfiguration() // // Set the name of the window // -#if LL_RELEASE_FOR_DOWNLOAD - gWindowTitle = gSecondLife; -#elif LL_DEBUG - gWindowTitle = gSecondLife + std::string(" [DEBUG] ") + gArgs; + gWindowTitle = LLTrans::getString("SECOND_LIFE_VIEWER"); +#if LL_DEBUG + gWindowTitle += std::string(" [DEBUG] ") + gArgs; #else - gWindowTitle = gSecondLife + std::string(" ") + gArgs; + gWindowTitle += std::string(" ") + gArgs; #endif LLStringUtil::truncate(gWindowTitle, 255); @@ -1997,11 +2131,7 @@ bool LLAppViewer::initConfiguration() if (mSecondInstance) { std::ostringstream msg; - msg << - gSecondLife << " is already running.\n" - "\n" - "Check your task bar for a minimized copy of the program.\n" - "If this message persists, restart your computer.", + msg << LLTrans::getString("MBAlreadyRunning"); OSMessageBox( msg.str(), LLStringUtil::null, @@ -2046,6 +2176,8 @@ bool LLAppViewer::initConfiguration() gLastRunVersion = gSavedSettings.getString("LastRunVersion"); + loadColorSettings(); + return true; // Config was successful. } @@ -2053,7 +2185,7 @@ bool LLAppViewer::initConfiguration() void LLAppViewer::checkForCrash(void) { -#if 1 //*REMOVE:Mani LL_SEND_CRASH_REPORTS +#if LL_SEND_CRASH_REPORTS //*NOTE:Mani The current state of the crash handler has the MacOSX // sending all crash reports as freezes, in order to let // the MacOSX CrashRepoter generate stacks before spawning the @@ -2063,23 +2195,32 @@ void LLAppViewer::checkForCrash(void) #if LL_DARWIN if(gLastExecEvent != LAST_EXEC_NORMAL) #else - if (gLastExecEvent == LAST_EXEC_FROZE || gLastExecEvent == LAST_EXEC_OTHER_CRASH) + if (gLastExecEvent == LAST_EXEC_FROZE) #endif { llinfos << "Last execution froze, requesting to send crash report." << llendl; // // Pop up a freeze or crash warning dialog // - std::ostringstream msg; - msg << gSecondLife - << " appears to have frozen or crashed on the previous run.\n" - << "Would you like to send a crash report?"; - std::string alert; - alert = gSecondLife; - alert += " Alert"; - S32 choice = OSMessageBox(msg.str(), + S32 choice; + if(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) == CRASH_BEHAVIOR_ASK) + { + std::ostringstream msg; + msg << LLTrans::getString("MBFrozenCrashed"); + std::string alert = LLTrans::getString("SECOND_LIFE_VIEWER") + " " + LLTrans::getString("MBAlert"); + choice = OSMessageBox(msg.str(), alert, OSMB_YESNO); + } + else if(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) == CRASH_BEHAVIOR_NEVER_SEND) + { + choice = OSBTN_NO; + } + else + { + choice = OSBTN_YES; + } + if (OSBTN_YES == choice) { llinfos << "Sending crash report." << llendl; @@ -2114,7 +2255,7 @@ bool LLAppViewer::initWindow() gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), FALSE, ignorePixelDepth); - if (gSavedSettings.getBOOL("FullScreen")) + if (!gSavedSettings.getBOOL("NotFullScreen")) { gViewerWindow->toggleFullscreen(FALSE); // request to go full screen... which will be delayed until login @@ -2132,6 +2273,11 @@ bool LLAppViewer::initWindow() // Initialize GL stuff // + if (mForceGraphicsDetail) + { + LLFeatureManager::getInstance()->setGraphicsLevel(gSavedSettings.getU32("RenderQualityPerformance"), false); + } + // Set this flag in case we crash while initializing GL gSavedSettings.setBOOL("RenderInitError", TRUE); gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); @@ -2152,9 +2298,6 @@ bool LLAppViewer::initWindow() LLUI::sWindow = gViewerWindow->getWindow(); - LLTrans::parseStrings("strings.xml"); - LLUITrans::parseStrings("ui_strings.xml"); - // Show watch cursor gViewerWindow->setCursor(UI_CURSOR_WAIT); @@ -2274,7 +2417,7 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; // Dump some debugging info - LL_INFOS("SystemInfo") << gSecondLife + LL_INFOS("SystemInfo") << LLTrans::getString("SECOND_LIFE_VIEWER") << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << LL_ENDL; @@ -2352,7 +2495,9 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["CurrentPath"] = gDirUtilp->getCurPath(); gDebugInfo["SessionLength"] = F32(LLFrameTimer::getElapsedSeconds()); gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); - gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer) getCurrentRSS() >> 10; + gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer) LLMemory::getCurrentRSS() >> 10; + gDebugInfo["FirstLogin"] = (LLSD::Boolean) gAgent.isFirstLogin(); + gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall"); if(gLogoutInProgress) { @@ -2946,12 +3091,12 @@ void LLAppViewer::purgeCache() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); } -const std::string& LLAppViewer::getSecondLifeTitle() const +std::string LLAppViewer::getSecondLifeTitle() const { - return gSecondLife; + return LLTrans::getString("SECOND_LIFE_VIEWER"); } -const std::string& LLAppViewer::getWindowTitle() const +std::string LLAppViewer::getWindowTitle() const { return gWindowTitle; } @@ -2985,7 +3130,7 @@ void LLAppViewer::forceDisconnect(const std::string& mesg) return; } - // Translate the message if possible + // *TODO: Translate the message if possible std::string big_reason = LLAgent::sTeleportErrorMessages[mesg]; if ( big_reason.size() == 0 ) { @@ -3121,6 +3266,7 @@ public: /////////////////////////////////////////////////////// void LLAppViewer::idle() { + LLMemType mt_idle(LLMemType::MTYPE_IDLE); pingMainloopTimeout("Main:Idle"); // Update frame timers @@ -3164,7 +3310,6 @@ void LLAppViewer::idle() // // Special case idle if still starting up // - if (LLStartUp::getStartupState() < STATE_STARTED) { // Skip rest if idle startup returns false (essentially, no world yet) @@ -3204,7 +3349,7 @@ void LLAppViewer::idle() // When appropriate, update agent location to the simulator. F32 agent_update_time = agent_update_timer.getElapsedTimeF32(); BOOL flags_changed = gAgent.controlFlagsDirty() || (last_control_flags != gAgent.getControlFlags()); - + if (flags_changed || (agent_update_time > (1.0f / (F32) AGENT_UPDATES_PER_SECOND))) { // Send avatar and camera info @@ -3219,7 +3364,6 @@ void LLAppViewer::idle() // Manage statistics // // - { // Initialize the viewer_stats_timer with an already elapsed time // of SEND_STATS_PERIOD so that the initial stats report will @@ -3257,9 +3401,8 @@ void LLAppViewer::idle() gObjectList.mNumUnknownUpdates = 0; } } - gFrameStats.addFrameData(); } - + if (!gDisconnected) { LLFastTimer t(LLFastTimer::FTM_NETWORK); @@ -3272,12 +3415,10 @@ void LLAppViewer::idle() // floating throughout the various object lists. // - gFrameStats.start(LLFrameStats::IDLE_NETWORK); stop_glerror(); idleNetwork(); stop_glerror(); - gFrameStats.start(LLFrameStats::AGENT_MISC); // Check for away from keyboard, kick idle agents. idle_afk_check(); @@ -3306,7 +3447,7 @@ void LLAppViewer::idle() return; } - gViewerWindow->handlePerFrameHover(); + gViewerWindow->updateUI(); /////////////////////////////////////// // Agent and camera movement @@ -3329,7 +3470,6 @@ void LLAppViewer::idle() { LLFastTimer t(LLFastTimer::FTM_OBJECTLIST_UPDATE); // Actually "object update" - gFrameStats.start(LLFrameStats::OBJECT_UPDATE); if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { @@ -3345,7 +3485,6 @@ void LLAppViewer::idle() { LLFastTimer t(LLFastTimer::FTM_CLEANUP); - gFrameStats.start(LLFrameStats::CLEAN_DEAD); gObjectList.cleanDeadObjects(); LLDrawable::cleanupDeadDrawables(); } @@ -3364,7 +3503,6 @@ void LLAppViewer::idle() // { - gFrameStats.start(LLFrameStats::UPDATE_EFFECTS); LLSelectMgr::getInstance()->updateEffects(); LLHUDManager::getInstance()->cleanupEffects(); LLHUDManager::getInstance()->sendEffects(); @@ -3438,10 +3576,8 @@ void LLAppViewer::idle() if (!gNoRender) { LLFastTimer t(LLFastTimer::FTM_WORLD_UPDATE); - gFrameStats.start(LLFrameStats::UPDATE_MOVE); gPipeline.updateMove(); - gFrameStats.start(LLFrameStats::UPDATE_PARTICLES); LLWorld::getInstance()->updateParticles(); } stop_glerror(); @@ -3467,7 +3603,6 @@ void LLAppViewer::idle() } { - gFrameStats.start(LLFrameStats::AUDIO); LLFastTimer t(LLFastTimer::FTM_AUDIO_UPDATE); if (gAudiop) @@ -3610,6 +3745,7 @@ static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; void LLAppViewer::idleNetwork() { + LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK); pingMainloopTimeout("idleNetwork"); LLError::LLCallStacks::clear() ; llpushcallstacks ; @@ -3629,7 +3765,8 @@ void LLAppViewer::idleNetwork() stop_glerror(); const S64 frame_count = gFrameCount; // U32->S64 F32 total_time = 0.0f; - while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) + + while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) { if (gDoDisconnect) { @@ -3658,6 +3795,7 @@ void LLAppViewer::idleNetwork() break; #endif } + // Handle per-frame message system processing. gMessageSystem->processAcks(); @@ -3696,7 +3834,7 @@ void LLAppViewer::idleNetwork() } } llpushcallstacks ; - gObjectList.mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects); + LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects); // Retransmit unacknowledged packets. gXferManager->retransmitUnackedPackets(); @@ -3737,7 +3875,6 @@ void LLAppViewer::disconnectViewer() llinfos << "Disconnecting viewer!" << llendl; // Dump our frame statistics - gFrameStats.dump(); // Remember if we were flying gSavedSettings.setBOOL("FlyingAtExit", gAgent.getFlying() ); @@ -3749,35 +3886,6 @@ void LLAppViewer::disconnectViewer() { gFloaterView->restoreAll(); } - - - std::list floaters_to_close; - for(LLView::child_list_const_iter_t it = gFloaterView->getChildList()->begin(); - it != gFloaterView->getChildList()->end(); - ++it) - { - // The following names are defined in the - // floater_image_preview.xml - // floater_sound_preview.xml - // floater_animation_preview.xml - // files. - LLFloater* fl = static_cast(*it); - if(fl - && (fl->getName() == "Image Preview" - || fl->getName() == "Sound Preview" - || fl->getName() == "Animation Preview" - )) - { - floaters_to_close.push_back(fl); - } - } - - while(!floaters_to_close.empty()) - { - LLFloater* fl = floaters_to_close.front(); - floaters_to_close.pop_front(); - fl->close(); - } } if (LLSelectMgr::getInstance()) @@ -3800,6 +3908,8 @@ void LLAppViewer::disconnectViewer() // close inventory interface, close all windows LLInventoryView::cleanup(); + gAgentWearables.cleanup(); + // Also writes cached agent settings to gSavedSettings gAgent.cleanup(); @@ -3915,6 +4025,8 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) void LLAppViewer::handleLoginComplete() { + gViewerWindow->handleLoginComplete(); + initMainloopTimeout("Mainloop Init"); // Store some data to DebugInfo in case of a freeze. diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index a3b84759f5..75033698b6 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -33,11 +33,15 @@ #ifndef LL_LLAPPVIEWER_H #define LL_LLAPPVIEWER_H +#include "llcontrol.h" + class LLTextureCache; class LLWorkerThread; class LLTextureFetch; class LLWatchdogTimeout; class LLCommandLineParser; +class LLAllocator; + class LLAppViewer : public LLApp { @@ -96,8 +100,8 @@ public: bool getPurgeCache() const { return mPurgeCache; } - const std::string& getSecondLifeTitle() const; // The Second Life title. - const std::string& getWindowTitle() const; // The window display name. + std::string getSecondLifeTitle() const; // The Second Life title. + std::string getWindowTitle() const; // The window display name. void forceDisconnect(const std::string& msg); // Force disconnection, with a message to the user. void badNetworkHandler(); // Cause a crash state due to bad network packet. @@ -119,14 +123,13 @@ public: virtual void forceErrorSoftwareException(); virtual void forceErrorDriverCrash(); - // *NOTE: There are currently 3 settings files: - // "Global", "PerAccount" and "CrashSettings" // The list is found in app_settings/settings_files.xml // but since they are used explicitly in code, // the follow consts should also do the trick. static const std::string sGlobalSettingsName; - static const std::string sPerAccountSettingsName; - static const std::string sCrashSettingsName; + + LLCachedControl mRandomizeFramerate; + LLCachedControl mPeriodicSlowFrame; // Load settings from the location specified by loction_key. // Key availale and rules for loading, are specified in @@ -136,6 +139,7 @@ public: std::string getSettingsFilename(const std::string& location_key, const std::string& file); + void loadColorSettings(); // For thread debugging. // llstartup needs to control init. @@ -150,6 +154,8 @@ public: // *NOTE:Mani Fix this for login abstraction!! void handleLoginComplete(); + LLAllocator & getAllocator() { return mAlloc; } + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. @@ -221,6 +227,8 @@ private: bool mSavedFinalSnapshot; + bool mForceGraphicsDetail; + bool mQuitRequested; // User wants to quit, may have modified documents open. bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. S32 mYieldTime; @@ -228,10 +236,13 @@ private: LLWatchdogTimeout* mMainloopTimeout; + LLThread* mFastTimerLogThread; // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; LLUUID mAgentRegionLastID; + LLAllocator mAlloc; + public: //some information for updater typedef struct diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 7c2e341bed..ca005946c9 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -135,31 +135,6 @@ bool LLAppViewerMacOSX::init() return LLAppViewer::init(); } -bool LLAppViewerMacOSX::initLogging() -{ - // Remove the crash stack log from previous executions. - // Since we've started logging a new instance of the app, we can assume - // The old crash stack is invalid for the next crash report. - char path[MAX_PATH]; - FSRef folder; - if(FSFindFolder(kUserDomain, kLogsFolderType, false, &folder) == noErr) - { - // folder is an FSRef to ~/Library/Logs/ - if(FSRefMakePath(&folder, (UInt8*)&path, sizeof(path)) == noErr) - { - std::string pathname = std::string(path) + std::string("/CrashReporter/"); - std::string mask = "Second Life*"; - std::string file_name; - while(gDirUtilp->getNextFileInDir(pathname, mask, file_name, false)) - { - LLFile::remove(pathname + file_name); - } - } - } - - return LLAppViewer::initLogging(); -} - // MacOSX may add and addition command line arguement for the process serial number. // The option takes a form like '-psn_0_12345'. The following method should be able to recognize // and either ignore or return a pair of values for the option. @@ -213,7 +188,7 @@ bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp) // in the "General" tab, click the "Add Localization" button // create a new localization for the language you're adding // set the contents of the new localization of the file to the string corresponding to our localization - // (i.e. "en-us", "ja", etc. Use the existing ones as a guide.) + // (i.e. "en", "ja", etc. Use the existing ones as a guide.) CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL); char path[MAX_PATH]; if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path))) @@ -416,6 +391,28 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze) { _exit(1); } + + // TODO:palmer REMOVE THIS VERY SOON. THIS WILL NOT BE IN VIEWER 2.0 + // Remove the crash stack log from previous executions. + // Since we've started logging a new instance of the app, we can assume + // The old crash stack is invalid for the next crash report. + char path[MAX_PATH]; + FSRef folder; + if(FSFindFolder(kUserDomain, kLogsFolderType, false, &folder) == noErr) + { + // folder is an FSRef to ~/Library/Logs/ + if(FSRefMakePath(&folder, (UInt8*)&path, sizeof(path)) == noErr) + { + std::string pathname = std::string(path) + std::string("/CrashReporter/"); + std::string mask = "Second Life*"; + std::string file_name; + while(gDirUtilp->getNextFileInDir(pathname, mask, file_name, false)) + { + LLFile::remove(pathname + file_name); + } + } + } + } std::string LLAppViewerMacOSX::generateSerialNumber() diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 16928923bf..98d7ab712b 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -64,6 +64,7 @@ #include "llfindlocale.h" #include "llcommandlineparser.h" +#include "lltrans.h" // *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib // The lib was compiled under VS2005 - in VS2003 we need to remap assert @@ -84,7 +85,7 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti { // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. //OSMessageBox("Attach Debugger Now", "Error", OSMB_OK); - // Translate the signals/exceptions into cross-platform stuff + // *TODO: Translate the signals/exceptions into cross-platform stuff // Windows implementation _tprintf( _T("Entering Windows Exception Handler...\n") ); llinfos << "Entering Windows Exception Handler..." << llendl; @@ -159,9 +160,31 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, int nCmdShow) { LLMemType mt1(LLMemType::MTYPE_STARTUP); + + const S32 MAX_HEAPS = 255; + DWORD heap_enable_lfh_error[MAX_HEAPS]; + S32 num_heaps = 0; #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit +#elif 1 + // Experimental - enable the low fragmentation heap + // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) + // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 + + _CrtSetDbgFlag(0); // default, just making explicit + + ULONG ulEnableLFH = 2; + HANDLE* hHeaps = new HANDLE[MAX_HEAPS]; + num_heaps = GetProcessHeaps(MAX_HEAPS, hHeaps); + for(S32 i = 0; i < num_heaps; i++) + { + bool success = HeapSetInformation(hHeaps[i], HeapCompatibilityInformation, &ulEnableLFH, sizeof(ulEnableLFH)); + if (success) + heap_enable_lfh_error[i] = 0; + else + heap_enable_lfh_error[i] = GetLastError(); + } #endif // *FIX: global @@ -183,8 +206,21 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, llwarns << "Application init failed." << llendl; return -1; } - - // Run the application main loop + + // Have to wait until after logging is initialized to display LFH info + if (num_heaps > 0) + { + llinfos << "Attempted to enable LFH for " << num_heaps << " heaps." << llendl; + for(S32 i = 0; i < num_heaps; i++) + { + if (heap_enable_lfh_error[i]) + { + llinfos << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << llendl; + } + } + } + + // Run the application main loop if(!LLApp::isQuitting()) { viewer_app_ptr->mainLoop(); @@ -409,33 +445,24 @@ bool LLAppViewerWin32::initHardwareTest() // but vram. vram_only = TRUE; - LLSplashScreen::update("Detecting hardware..."); + LLSplashScreen::update(LLTrans::getString("StartupDetectingHardware")); LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL; gDXHardware.setWriteDebugFunc(write_debug_dx); BOOL probe_ok = gDXHardware.getInfo(vram_only); if (!probe_ok - && gSavedSettings.getWarning("AboutDirectX9")) + && gWarningSettings.getBOOL("AboutDirectX9")) { LL_WARNS("AppInit") << "DirectX probe failed, alerting user." << LL_ENDL; // Warn them that runnin without DirectX 9 will // not allow us to tell them about driver issues std::ostringstream msg; - msg << - LLAppViewer::instance()->getSecondLifeTitle() << " is unable to detect DirectX 9.0b or greater.\n" - "\n" << - LLAppViewer::instance()->getSecondLifeTitle() << " uses DirectX to detect hardware and/or\n" - "outdated drivers that can cause stability problems,\n" - "poor performance and crashes. While you can run\n" << - LLAppViewer::instance()->getSecondLifeTitle() << " without it, we highly recommend running\n" - "with DirectX 9.0b\n" - "\n" - "Do you wish to continue?\n"; + msg << LLTrans::getString ("MBNoDirectX"); S32 button = OSMessageBox( msg.str(), - "Warning", + LLTrans::getString("MBWarning"), OSMB_YESNO); if (OSBTN_NO== button) { @@ -443,7 +470,7 @@ bool LLAppViewerWin32::initHardwareTest() LLWeb::loadURLExternal(DIRECTX_9_URL); return false; } - gSavedSettings.setWarning("AboutDirectX9", FALSE); + gWarningSettings.setBOOL("AboutDirectX9", FALSE); } LL_DEBUGS("AppInit") << "Done polling DirectX for hardware info" << LL_ENDL; @@ -452,7 +479,7 @@ bool LLAppViewerWin32::initHardwareTest() // Disable so debugger can work std::ostringstream splash_msg; - splash_msg << "Loading " << LLAppViewer::instance()->getSecondLifeTitle() << "..."; + splash_msg << LLTrans::getString("StartupLoading") << " " << LLAppViewer::instance()->getSecondLifeTitle() << "..."; LLSplashScreen::update(splash_msg.str()); } diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 4fca9b1f19..4cd9647603 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -59,6 +59,7 @@ // library includes #include "lleconomy.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "llscrolllistctrl.h" #include "llsdserialize.h" @@ -337,11 +338,11 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) } LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data, - const LLUUID& vfile_id, - LLAssetType::EType asset_type, - LLBakedUploadData * baked_upload_data) - : LLAssetUploadResponder(post_data, vfile_id, asset_type), - mBakedUploadData(baked_upload_data) + const LLUUID& vfile_id, + LLAssetType::EType asset_type, + LLBakedUploadData * baked_upload_data) : + LLAssetUploadResponder(post_data, vfile_id, asset_type), + mBakedUploadData(baked_upload_data) { } @@ -419,72 +420,68 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) LLInventoryType::EType inventory_type = new_item->getInventoryType(); switch(inventory_type) { - case LLInventoryType::IT_NOTECARD: - { - - // Update the UI with the new asset. - LLPreviewNotecard* nc; - nc = (LLPreviewNotecard*)LLPreview::find(new_item->getUUID()); - if(nc) - { - // *HACK: we have to delete the asset in the VFS so - // that the viewer will redownload it. This is only - // really necessary if the asset had to be modified by - // the uploader, so this can be optimized away in some - // cases. A better design is to have a new uuid if the - // script actually changed the asset. - if(nc->hasEmbeddedInventory()) - { - gVFS->removeFile( - content["new_asset"].asUUID(), - LLAssetType::AT_NOTECARD); - } - nc->refreshFromInventory(); - } - } - break; - case LLInventoryType::IT_LSL: - { - // Find our window and close it if requested. - LLPreviewLSL* preview = (LLPreviewLSL*)LLPreview::find(item_id); - if (preview) - { - // Bytecode save completed - if (content["compiled"]) - { - preview->callbackLSLCompileSucceeded(); - } - else - { - preview->callbackLSLCompileFailed(content["errors"]); - } - } - } - break; - - case LLInventoryType::IT_GESTURE: - { - // If this gesture is active, then we need to update the in-memory - // active map with the new pointer. - if (gGestureManager.isGestureActive(item_id)) - { - LLUUID asset_id = new_item->getAssetUUID(); - gGestureManager.replaceGesture(item_id, asset_id); - gInventory.notifyObservers(); - } - - //gesture will have a new asset_id - LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id); - if(previewp) - { - previewp->onUpdateSucceeded(); - } + case LLInventoryType::IT_NOTECARD: + { + // Update the UI with the new asset. + LLPreviewNotecard* nc = LLFloaterReg::findTypedInstance("preview_notecard", LLSD(item_id)); + if(nc) + { + // *HACK: we have to delete the asset in the VFS so + // that the viewer will redownload it. This is only + // really necessary if the asset had to be modified by + // the uploader, so this can be optimized away in some + // cases. A better design is to have a new uuid if the + // script actually changed the asset. + if(nc->hasEmbeddedInventory()) + { + gVFS->removeFile(content["new_asset"].asUUID(), LLAssetType::AT_NOTECARD); + } + nc->refreshFromInventory(new_item->getUUID()); + } + break; + } + case LLInventoryType::IT_LSL: + { + // Find our window and close it if requested. + LLPreviewLSL* preview = LLFloaterReg::findTypedInstance("preview_script", LLSD(item_id)); + if (preview) + { + // Bytecode save completed + if (content["compiled"]) + { + preview->callbackLSLCompileSucceeded(); + } + else + { + preview->callbackLSLCompileFailed(content["errors"]); + } + } + break; + } + + case LLInventoryType::IT_GESTURE: + { + // If this gesture is active, then we need to update the in-memory + // active map with the new pointer. + if (gGestureManager.isGestureActive(item_id)) + { + LLUUID asset_id = new_item->getAssetUUID(); + gGestureManager.replaceGesture(item_id, asset_id); + gInventory.notifyObservers(); + } + + //gesture will have a new asset_id + LLPreviewGesture* previewp = LLFloaterReg::findTypedInstance("preview_gesture", LLSD(item_id)); + if(previewp) + { + previewp->onUpdateSucceeded(); + } - } - break; - case LLInventoryType::IT_WEARABLE: - default: - break; + break; + } + case LLInventoryType::IT_WEARABLE: + default: + break; } } @@ -522,64 +519,57 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content) switch(mAssetType) { - case LLAssetType::AT_NOTECARD: - { - - // Update the UI with the new asset. - LLPreviewNotecard* nc; - nc = (LLPreviewNotecard*)LLPreview::find(item_id); - if(nc) - { - // *HACK: we have to delete the asset in the VFS so - // that the viewer will redownload it. This is only - // really necessary if the asset had to be modified by - // the uploader, so this can be optimized away in some - // cases. A better design is to have a new uuid if the - // script actually changed the asset. - if(nc->hasEmbeddedInventory()) - { - gVFS->removeFile( - content["new_asset"].asUUID(), - LLAssetType::AT_NOTECARD); - } - - nc->refreshFromInventory(); - } - } - break; - case LLAssetType::AT_LSL_TEXT: - { - if(mQueueId.notNull()) - { - LLFloaterCompileQueue* queue = - (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); - if(NULL != queue) - { - queue->removeItemByItemID(item_id); - } - } - else - { - LLLiveLSLEditor* preview = LLLiveLSLEditor::find(item_id, task_id); - if (preview) - { - // Bytecode save completed - if (content["compiled"]) - { - preview->callbackLSLCompileSucceeded( - task_id, - item_id, - mPostData["is_script_running"]); - } - else - { - preview->callbackLSLCompileFailed(content["errors"]); - } - } - } - } - break; - default: + case LLAssetType::AT_NOTECARD: + { + // Update the UI with the new asset. + LLPreviewNotecard* nc = LLFloaterReg::findTypedInstance("preview_notecard", LLSD(item_id)); + if(nc) + { + // *HACK: we have to delete the asset in the VFS so + // that the viewer will redownload it. This is only + // really necessary if the asset had to be modified by + // the uploader, so this can be optimized away in some + // cases. A better design is to have a new uuid if the + // script actually changed the asset. + if(nc->hasEmbeddedInventory()) + { + gVFS->removeFile(content["new_asset"].asUUID(), + LLAssetType::AT_NOTECARD); + } + + nc->refreshFromInventory(); + } + break; + } + case LLAssetType::AT_LSL_TEXT: + { + if(mQueueId.notNull()) + { + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", mQueueId); + if(NULL != queue) + { + queue->removeItemByItemID(item_id); + } + } + else + { + LLLiveLSLEditor* preview = LLFloaterReg::findTypedInstance("preview_scriptedit", LLSD(item_id)); + if (preview) + { + // Bytecode save completed + if (content["compiled"]) + { + preview->callbackLSLCompileSucceeded(task_id, item_id, mPostData["is_script_running"]); + } + else + { + preview->callbackLSLCompileFailed(content["errors"]); + } + } + } + break; + } + default: break; } } diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp new file mode 100644 index 0000000000..807f2f035c --- /dev/null +++ b/indra/newview/llavatariconctrl.cpp @@ -0,0 +1,255 @@ +/** + * @file llavatariconctrl.cpp + * @brief LLAvatarIconCtrl class implementation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llagent.h" +#include "llavatarconstants.h" +#include "llavatariconctrl.h" +#include "llcallingcard.h" // for LLAvatarTracker +#include "llfriendactions.h" +#include "llimview.h" +#include "llmenugl.h" +#include "lluictrlfactory.h" + +#define MENU_ITEM_VIEW_PROFILE 0 +#define MENU_ITEM_SEND_IM 1 + +static LLDefaultWidgetRegistry::Register r("avatar_icon"); + +LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p) +: LLIconCtrl(p), + mDrawTooltip(p.draw_tooltip) +{ + LLRect rect = p.rect; + + static LLUICachedControl llavatariconctrl_symbol_hpad("UIAvatariconctrlSymbolHPad", 2); + static LLUICachedControl llavatariconctrl_symbol_vpad("UIAvatariconctrlSymbolVPad", 2); + static LLUICachedControl llavatariconctrl_symbol_size("UIAvatariconctrlSymbolSize", 5); + static LLUICachedControl llavatariconctrl_symbol_pos("UIAvatariconctrlSymbolPosition", "BottomRight"); + + // BottomRight is the default position + S32 left = rect.getWidth() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_hpad; + S32 bottom = llavatariconctrl_symbol_vpad; + + if ("BottomLeft" == (std::string)llavatariconctrl_symbol_pos) + { + left = llavatariconctrl_symbol_hpad; + bottom = llavatariconctrl_symbol_vpad; + } + else if ("TopLeft" == (std::string)llavatariconctrl_symbol_pos) + { + left = llavatariconctrl_symbol_hpad; + bottom = rect.getHeight() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_vpad; + } + else if ("TopRight" == (std::string)llavatariconctrl_symbol_pos) + { + left = rect.getWidth() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_hpad; + bottom = rect.getHeight() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_vpad; + } + + rect.setOriginAndSize(left, bottom, llavatariconctrl_symbol_size, llavatariconctrl_symbol_size); + + LLIconCtrl::Params icparams; + icparams.name ("Status Symbol"); + icparams.follows.flags (FOLLOWS_RIGHT | FOLLOWS_BOTTOM); + icparams.rect (rect); + mStatusSymbol = LLUICtrlFactory::create (icparams); + mStatusSymbol->setValue("circle.tga"); + mStatusSymbol->setColor(LLColor4::grey); + + addChild(mStatusSymbol); + + if (p.avatar_id.isProvided()) + { + LLSD value(p.avatar_id); + setValue(value); + } + else + { + LLIconCtrl::setValue("default_profile_picture.j2c"); + } + + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + + registrar.add("AvatarIcon.Action", boost::bind(&LLAvatarIconCtrl::onAvatarIconContextMenuItemClicked, this, _2)); + + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_avatar_icon.xml", gMenuHolder); + + mPopupMenuHandle = menu->getHandle(); +} + +LLAvatarIconCtrl::~LLAvatarIconCtrl() +{ + if (mAvatarId.notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this); + // Name callbacks will be automatically disconnected since LLUICtrl is trackable + } + + LLView::deleteViewByHandle(mPopupMenuHandle); +} + +//virtual +void LLAvatarIconCtrl::setValue(const LLSD& value) +{ + if (value.isUUID()) + { + if (mAvatarId.notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this); + } + + if (mAvatarId != value.asUUID()) + { + LLAvatarPropertiesProcessor::getInstance()->addObserver(value.asUUID(), this); + LLAvatarPropertiesProcessor::getInstance()->sendDataRequest(value.asUUID(),APT_PROPERTIES); + mAvatarId = value.asUUID(); + } + } + else + { + LLIconCtrl::setValue(value); + } + + gCacheName->get(mAvatarId, FALSE, boost::bind(&LLAvatarIconCtrl::nameUpdatedCallback, this, _1, _2, _3, _4)); +} + +//virtual +void LLAvatarIconCtrl::processProperties(void* data, EAvatarProcessorType type) +{ + if (APT_PROPERTIES == type) + { + LLAvatarData* avatar_data = static_cast(data); + if (avatar_data) + { + if (avatar_data->avatar_id != mAvatarId) + { + return; + } + + // Update the avatar + if (avatar_data->image_id.notNull()) + { + LLIconCtrl::setValue(avatar_data->image_id); + } + else + { + LLIconCtrl::setValue("default_profile_picture.j2c"); + } + + // Update color of status symbol and tool tip + if (avatar_data->flags & AVATAR_ONLINE) + { + mStatusSymbol->setColor(LLColor4::green); + if (mDrawTooltip) + { + setToolTip((LLStringExplicit)"Online"); + } + } + else + { + mStatusSymbol->setColor(LLColor4::grey); + if (mDrawTooltip) + { + setToolTip((LLStringExplicit)"Offline"); + } + } + } + } +} + +BOOL LLAvatarIconCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + + if(menu) + { + bool is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarId) != NULL; + + menu->setItemEnabled("Add Friend", !is_friend); + menu->setItemEnabled("Remove Friend", is_friend); + + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, menu, x, y); + } + + return TRUE; +} + +void LLAvatarIconCtrl::nameUpdatedCallback( + const LLUUID& id, + const std::string& first, + const std::string& last, + BOOL is_group) +{ + if (id == mAvatarId) + { + mFirstName = first; + mLastName = last; + } +} + +void LLAvatarIconCtrl::onAvatarIconContextMenuItemClicked(const LLSD& userdata) +{ + std::string level = userdata.asString(); + LLUUID id = getAvatarId(); + + if (level == "profile") + { + LLFriendActions::showProfile(id); + } + else if (level == "im") + { + std::string name; + name.assign(getFirstName()); + name.append(" "); + name.append(getLastName()); + + gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id); + } + else if (level == "add") + { + std::string name; + name.assign(getFirstName()); + name.append(" "); + name.append(getLastName()); + + LLFriendActions::requestFriendshipDialog(id, name); + } + else if (level == "remove") + { + LLFriendActions::removeFriendDialog(id); + } +} diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h new file mode 100644 index 0000000000..cb1e9584ba --- /dev/null +++ b/indra/newview/llavatariconctrl.h @@ -0,0 +1,89 @@ +/** + * @file llavatariconctrl.h + * @brief LLAvatarIconCtrl base class + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLAVATARICONCTRL_H +#define LL_LLAVATARICONCTRL_H + +#include "lliconctrl.h" +#include "llavatarpropertiesprocessor.h" +#include "llviewermenu.h" + +class LLAvatarIconCtrl +: public LLIconCtrl, public LLAvatarPropertiesObserver +{ +public: + struct Params : public LLInitParam::Block + { + Optional avatar_id; + Optional draw_tooltip; + Params() + { + name = "avatar_icon"; + draw_tooltip = TRUE; + } + }; +protected: + LLAvatarIconCtrl(const Params&); + friend class LLUICtrlFactory; + + void onAvatarIconContextMenuItemClicked(const LLSD& userdata); + +public: + virtual ~LLAvatarIconCtrl(); + + virtual void setValue(const LLSD& value); + + // LLAvatarPropertiesProcessor observer trigger + virtual void processProperties(void* data, EAvatarProcessorType type); + + BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + + void nameUpdatedCallback( + const LLUUID& id, + const std::string& first, + const std::string& last, + BOOL is_group); + + const LLUUID& getAvatarId() const { return mAvatarId; } + const std::string& getFirstName() const { return mFirstName; } + const std::string& getLastName() const { return mLastName; } + +protected: + LLIconCtrl* mStatusSymbol; + LLUUID mAvatarId; + std::string mFirstName; + std::string mLastName; + LLHandle mPopupMenuHandle; + bool mDrawTooltip; +}; + +#endif // LL_LLAVATARICONCTRL_H diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp new file mode 100644 index 0000000000..08f0cf8842 --- /dev/null +++ b/indra/newview/llavatarlist.cpp @@ -0,0 +1,163 @@ +/** + * @file llavatarlist.h + * @brief Generic avatar list + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llavatarlist.h" + +// newview +#include "llcallingcard.h" // for LLAvatarTracker +#include "llcachename.h" + +static LLDefaultWidgetRegistry::Register r("avatar_list"); + +LLAvatarList::Params::Params() +{ + draw_heading = true; + draw_stripes = false; + multi_select = false; + column_padding = 0; + search_column = LIST_NAME; + sort_column = LIST_NAME; +} + +LLAvatarList::LLAvatarList(const Params& p) +: LLScrollListCtrl(p) +{ + setCommitOnSelectionChange(TRUE); // there's no such param in LLScrollListCtrl::Params + + // "name" column + { + LLScrollListColumn::Params col_params; + col_params.name = "name"; + col_params.header.label = "Name"; // *TODO: localize or remove the header + col_params.width.dynamic_width = true; + addColumn(col_params); + } + + // invisible "id" column + { + LLScrollListColumn::Params col_params; + col_params.name = "id"; + col_params.width.pixel_width = 0; + addColumn(col_params); + } + + // The corresponding parameters don't work because we create columns dynamically. + sortByColumnIndex(LIST_NAME, TRUE); + setSearchColumn(LIST_NAME); +} + +std::vector LLAvatarList::getSelectedIDs() +{ + LLUUID selected_id; + std::vector avatar_ids; + std::vector selected = getAllSelected(); + for(std::vector::iterator itr = selected.begin(); itr != selected.end(); ++itr) + { + avatar_ids.push_back((*itr)->getUUID()); + } + return avatar_ids; +} + +void LLAvatarList::addItem(const LLUUID& id, const std::string& name, BOOL is_bold, EAddPosition pos) +{ + std::string fullname; + + // Populate list item. + LLSD element; + element["id"] = id; + + LLSD& friend_column = element["columns"][LIST_NAME]; + friend_column["column"] = "name"; + friend_column["value"] = name; + + LLScrollListItem* new_itemp = addElement(element, pos); + + // Indicate buddy online status. + // (looks like parsing font parameters from LLSD is broken) + if (is_bold) + { + LLScrollListText* name_textp = dynamic_cast(new_itemp->getColumn(LIST_NAME)); + if (name_textp) + name_textp->setFontStyle(LLFontGL::BOLD); + else + { + llwarns << "Name column not found" << llendl; + } + } +} + +BOOL LLAvatarList::updateList(const std::vector& all_buddies) +{ + BOOL have_names = TRUE; + + // Save selection. + std::vector selected_ids = getSelectedIDs(); + LLUUID current_id = getCurrentID(); + S32 pos = getScrollPos(); + + std::vector::const_iterator buddy_it = all_buddies.begin(); + deleteAllItems(); + for(; buddy_it != all_buddies.end(); ++buddy_it) + { + std::string name; + const LLUUID& buddy_id = *buddy_it; + have_names &= gCacheName->getFullName(buddy_id, name); + addItem(buddy_id, name, LLAvatarTracker::instance().isBuddyOnline(buddy_id)); + } + + // Changed item in place, need to request sort and update columns + // because we might have changed data in a column on which the user + // has already sorted. JC + sortItems(); + + // re-select items + selectMultiple(selected_ids); + setCurrentByID(current_id); +#if 0 + // Restore selection. + if(selected_ids.size() > 0) + { + // only non-null if friends was already found. This may fail, + // but we don't really care here, because refreshUI() will + // clean up the interface. + for(std::vector::iterator itr = selected_ids.begin(); itr != selected_ids.end(); ++itr) + { + setSelectedByValue(*itr, true); + } + } +#endif + setScrollPos(pos); + + return have_names; +} diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h new file mode 100644 index 0000000000..9bd9ce8e0e --- /dev/null +++ b/indra/newview/llavatarlist.h @@ -0,0 +1,63 @@ +/** + * @file llavatarlist.h + * @brief Generic avatar list + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLAVATARLIST_H +#define LL_LLAVATARLIST_H + +#include + +// *TODO: derive from ListView when it's ready. +class LLAvatarList : public LLScrollListCtrl +{ + LOG_CLASS(LLAvatarList); +public: + struct Params : public LLInitParam::Block + { + Params(); + }; + + enum AVATAR_LIST_COLUMN_ORDER + { + LIST_NAME, + }; + + LLAvatarList(const Params&); + virtual ~LLAvatarList() {} + + BOOL updateList(const std::vector& all_buddies); + +protected: + std::vector getSelectedIDs(); + void addItem(const LLUUID& id, const std::string& name, BOOL is_bold, EAddPosition pos = ADD_BOTTOM); +}; + +#endif // LL_LLAVATARLIST_H diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp new file mode 100644 index 0000000000..80b80dc228 --- /dev/null +++ b/indra/newview/llavatarlistitem.cpp @@ -0,0 +1,273 @@ +/** + * @file llavatarlistitem.cpp + * @avatar list item source file + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" +#include "llavatarlistitem.h" +#include "llagent.h" + + + +//--------------------------------------------------------------------------------- +LLAvatarListItem::LLAvatarListItem(const Params& p) : LLPanel() +{ + mNeedsArrange = false; + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); + + mStatus = NULL; + mInfo = NULL; + mProfile = NULL; + mini_inspector = NULL; + + mAvatar = getChild("avatar_icon"); + //mAvatar->setValue(p.avatar_icon); + mName = getChild("name"); + //mName->setText(p.user_name); + + init(p); + + +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::init(const Params& p) +{ + mLocator = getChild("locator"); + + mStatus = getChild("user_status"); + + mInfo = getChild("info_btn"); + mInfo->setVisible(false); + + mProfile = getChild("profile_btn"); + mProfile->setVisible(false); + + if(!p.buttons.locator) + { + mLocator->setVisible(false); + delete mLocator; + mLocator = NULL; + } + + if(!p.buttons.status) + { + mStatus->setVisible(false); + delete mStatus; + mStatus = NULL; + } + + if(!p.buttons.info) + { + delete mInfo; + mInfo = NULL; + } + else + { + mInfo->setClickedCallback(boost::bind(&LLAvatarListItem::onInfoBtnClick, this)); + } + + if(!p.buttons.profile) + { + delete mProfile; + mProfile = NULL; + + LLRect rect; + + rect.setLeftTopAndSize(mName->getRect().mLeft, mName->getRect().mTop, mName->getRect().getWidth() + 30, mName->getRect().getHeight()); + mName->setRect(rect); + + if(mStatus) + { + rect.setLeftTopAndSize(mStatus->getRect().mLeft + 30, mStatus->getRect().mTop, mStatus->getRect().getWidth(), mStatus->getRect().getHeight()); + mStatus->setRect(rect); + } + + if(mLocator) + { + rect.setLeftTopAndSize(mLocator->getRect().mLeft + 30, mLocator->getRect().mTop, mLocator->getRect().getWidth(), mLocator->getRect().getHeight()); + mLocator->setRect(rect); + } + + if(mInfo) + { + rect.setLeftTopAndSize(mInfo->getRect().mLeft + 30, mInfo->getRect().mTop, mInfo->getRect().getWidth(), mInfo->getRect().getHeight()); + mInfo->setRect(rect); + } + } + +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + if(!mNeedsArrange) + { + LLView::reshape(width, height, called_from_parent); + return; + } + + LLRect rect; + S32 profile_delta = 0; + S32 width_delta = getRect().getWidth() - width; + + if(!mProfile) + { + profile_delta = 30; + } + else + { + rect.setLeftTopAndSize(mProfile->getRect().mLeft - width_delta, mProfile->getRect().mTop, mProfile->getRect().getWidth(), mProfile->getRect().getHeight()); + mProfile->setRect(rect); + } + + width_delta += profile_delta; + + if(mInfo) + { + rect.setLeftTopAndSize(mInfo->getRect().mLeft - width_delta, mInfo->getRect().mTop, mInfo->getRect().getWidth(), mInfo->getRect().getHeight()); + mInfo->setRect(rect); + } + + if(mLocator) + { + rect.setLeftTopAndSize(mLocator->getRect().mLeft - width_delta, mLocator->getRect().mTop, mLocator->getRect().getWidth(), mLocator->getRect().getHeight()); + mLocator->setRect(rect); + } + + if(mStatus) + { + rect.setLeftTopAndSize(mStatus->getRect().mLeft - width_delta, mStatus->getRect().mTop, mStatus->getRect().getWidth(), mStatus->getRect().getHeight()); + mStatus->setRect(rect); + } + + mNeedsArrange = false; + LLView::reshape(width, height, called_from_parent); +} + +//--------------------------------------------------------------------------------- +LLAvatarListItem::~LLAvatarListItem() +{ +} +//--------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------- +BOOL LLAvatarListItem::handleHover(S32 x, S32 y, MASK mask) +{ + mYPos = y; + mXPos = x; + + return true; +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + setTransparentColor( *(new LLColor4((F32)0.4, (F32)0.4, (F32)0.4)) ); + + if(mInfo) + mInfo->setVisible(true); + + if(mProfile) + mProfile->setVisible(true); +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + if(mInfo) + { + if( mInfo->getRect().pointInRect(x, y) ) + return; + + mInfo->setVisible(false); + } + + if(mProfile) + { + if( mProfile->getRect().pointInRect(x, y) ) + return; + + mProfile->setVisible(false); + } + + setTransparentColor( *(new LLColor4((F32)0.3, (F32)0.3, (F32)0.3)) ); +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::setStatus(int status) +{ +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::setName(std::string name) +{ +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::setAvatar(LLSD& data) +{ +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::onInfoBtnClick() +{ + mini_inspector = LLFloaterReg::showInstance("mini_inspector", gAgent.getID()); + + if (!mini_inspector) + return; + + LLRect rect; + localPointToScreen(mXPos, mYPos, &mXPos, &mYPos); + + + // *TODO Vadim: rewrite this. "+= -" looks weird. + S32 delta = mYPos - mini_inspector->getRect().getHeight(); + if(delta < 0) + { + mYPos += -delta; + } + + rect.setLeftTopAndSize(mXPos, mYPos, mini_inspector->getRect().getWidth(), mini_inspector->getRect().getHeight()); + mini_inspector->setRect(rect); + mini_inspector->setFrontmost(true); + mini_inspector->setVisible(true); + +} + +//--------------------------------------------------------------------------------- +void LLAvatarListItem::onProfileBtnClick() +{ +} + +//--------------------------------------------------------------------------------- diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h new file mode 100644 index 0000000000..5835a4c6b4 --- /dev/null +++ b/indra/newview/llavatarlistitem.h @@ -0,0 +1,102 @@ +/** + * @file llavatarlistitem.h + * @avatar list item header file + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llavatariconctrl.h" +#include +#include +#include +#include +#include +#include + +#include "llfloaterminiinspector.h" + +class LLAvatarListItem : public LLPanel +{ +public: + struct Params : public LLInitParam::Block + { + Optional avatar_icon; + Optional user_name; + struct avatar_list_item_buttons + { + bool status; + bool info; + bool profile; + bool locator; + avatar_list_item_buttons() : status(true), info(true), profile(true), locator(true) + {}; + } buttons; + + Params() : avatar_icon("avatar_icon",LLUUID()), user_name("user_name","") + {}; + }; + + + LLAvatarListItem(const Params& p); + virtual ~LLAvatarListItem(); + + void reshape(S32 width, S32 height, BOOL called_from_parent); + + //interface + void setStatus(int status); + void setName(std::string name); + void setAvatar(LLSD& data); + void needsArrange( void ) {mNeedsArrange = true;} + + + //event handlers + //mouse + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual void onMouseLeave(S32 x, S32 y, MASK mask); + virtual void onMouseEnter(S32 x, S32 y, MASK mask); + //buttons + void onInfoBtnClick(); + void onProfileBtnClick(); + +private: + LLAvatarIconCtrl* mAvatar; + LLIconCtrl* mLocator; + LLTextBox* mName; + LLTextBox* mStatus; + LLButton* mInfo; + LLButton* mProfile; + + S32 mYPos; + S32 mXPos; + + LLFloater* mini_inspector; + bool mNeedsArrange; + + // + void init(const Params& p); +}; diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp new file mode 100644 index 0000000000..e27da5663b --- /dev/null +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -0,0 +1,441 @@ +/** + * @file llavatarpropertiesprocessor.cpp + * @brief LLAvatarPropertiesProcessor class implementation + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llavatarpropertiesprocessor.h" + +#include "message.h" +#include "llagent.h" +#include "llviewergenericmessage.h" + +LLAvatarPropertiesProcessor::LLAvatarPropertiesProcessor() +{ +} + +void LLAvatarPropertiesProcessor::addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer) +{ + // Check if that observer is already in mObservers for that avatar_id + observer_multimap_t::iterator it; + + // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE + it = mObservers.find(avatar_id); + while (it != mObservers.end()) + { + if (it->second == observer) + { + return; + } + else + { + ++it; + } + } + + mObservers.insert(std::pair(avatar_id, observer)); +} + +void LLAvatarPropertiesProcessor::removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer) +{ + if (!observer) + { + return; + } + + observer_multimap_t::iterator it; + it = mObservers.find(avatar_id); + while (it != mObservers.end()) + { + if (it->second == observer) + { + mObservers.erase(it); + break; + } + else + { + ++it; + } + } +} + +void LLAvatarPropertiesProcessor::sendDataRequest(const LLUUID& avatar_id, EAvatarProcessorType type, + const void * data) +{ + switch(type) + { + case APT_PROPERTIES: + sendAvatarPropertiesRequest(avatar_id); + break; + case APT_PICKS: + sendGenericRequest(avatar_id, "avatarpicksrequest"); + break; + case APT_PICK_INFO: + if (data) { + sendPickInfoRequest(avatar_id, *static_cast(data)); + } + case APT_NOTES: + sendGenericRequest(avatar_id, "avatarnotesrequest"); + break; + case APT_GROUPS: + sendGenericRequest(avatar_id, "avatargroupsrequest"); + break; + default: + break; + } +} + +void LLAvatarPropertiesProcessor::sendGenericRequest(const LLUUID& avatar_id, const std::string method) +{ + std::vector strings; + strings.push_back( avatar_id.asString() ); + send_generic_message(method, strings); +} + +void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id) +{ + LLMessageSystem *msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_AvatarPropertiesRequest); + msg->nextBlockFast( _PREHASH_AgentData); + msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast( _PREHASH_AvatarID, avatar_id); + gAgent.sendReliableMessage(); +} + +void LLAvatarPropertiesProcessor::sendDataUpdate(const void* data, EAvatarProcessorType type) +{ + switch(type) + { + case APT_PROPERTIES: + sendAvatarPropertiesUpdate(data); + break; + case APT_PICK_INFO: + sendPicInfoUpdate(data); + case APT_PICKS: +// sendGenericRequest(avatar_id, "avatarpicksrequest"); + break; + case APT_NOTES: +// sendGenericRequest(avatar_id, "avatarnotesrequest"); + break; + case APT_GROUPS: +// sendGenericRequest(avatar_id, "avatargroupsrequest"); + break; + default: + break; + } + +} +void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const void* data) +{ + llinfos << "Sending avatarinfo update" << llendl; + + const LLAvatarData* avatar_props = static_cast(data); + // This value is required by sendAvatarPropertiesUpdate method. + //A profile should never be mature. (From the original code) + BOOL mature = FALSE; + + + + LLMessageSystem *msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_AvatarPropertiesUpdate); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); + msg->nextBlockFast(_PREHASH_PropertiesData); + + msg->addUUIDFast( _PREHASH_ImageID, avatar_props->image_id); + msg->addUUIDFast( _PREHASH_FLImageID, avatar_props->fl_image_id); + msg->addStringFast( _PREHASH_AboutText, avatar_props->about_text); + msg->addStringFast( _PREHASH_FLAboutText, avatar_props->fl_about_text); + + msg->addBOOL(_PREHASH_AllowPublish, avatar_props->allow_publish); + msg->addBOOL(_PREHASH_MaturePublish, mature); + msg->addString(_PREHASH_ProfileURL, avatar_props->profile_url); + gAgent.sendReliableMessage(); +} + +void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) +{ + LLAvatarData avatar_data; + + msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id); + msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, avatar_data.avatar_id); + msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, avatar_data.image_id); + msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, avatar_data.fl_image_id); + msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_PartnerID, avatar_data.partner_id); + msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_AboutText, avatar_data.about_text); + msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_FLAboutText, avatar_data.fl_about_text); + msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, avatar_data.born_on); + msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url); + msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags); + + + avatar_data.caption_index = 0; + + S32 charter_member_size = 0; + charter_member_size = msg->getSize(_PREHASH_PropertiesData, _PREHASH_CharterMember); + if(1 == charter_member_size) + { + msg->getBinaryData(_PREHASH_PropertiesData, _PREHASH_CharterMember, &avatar_data.caption_index, 1); + } + else if(1 < charter_member_size) + { + msg->getString(_PREHASH_PropertiesData, _PREHASH_CharterMember, avatar_data.caption_text); + } + notifyObservers(avatar_data.avatar_id,&avatar_data,APT_PROPERTIES); +} + +void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) +{ +/* + AvatarInterestsReply is automatically sent by the server in response to the + AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message). + If the interests panel is no longer part of the design (?) we should just register the message + to a handler function that does nothing. + That will suppress the warnings and be compatible with old server versions. + WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply +*/ +} +void LLAvatarPropertiesProcessor::processAvatarClassifiedReply(LLMessageSystem* msg, void**) +{ + // avatarclassifiedsrequest is not sent according to new UI design but + // keep this method according to resolved issues. +} +void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**) +{ + LLAvatarNotes avatar_notes; + + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id); + msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id); + msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes); + + notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES); +} + +void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**) +{ + LLAvatarPicks avatar_picks; + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_picks.target_id); + msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, avatar_picks.target_id); + + S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data); + for (int block = 0; block < block_count; ++block) + { + LLUUID pick_id; + std::string pick_name; + + msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); + msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); + + avatar_picks.picks_list.push_back(std::make_pair(pick_id,pick_name)); + } + notifyObservers(avatar_picks.target_id,&avatar_picks,APT_PICKS); +} + +void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, void**) +{ + LLPickData pick_data; + + // Extract the agent id and verify the message is for this + // client. + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, pick_data.agent_id ); + msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_data.pick_id); + msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, pick_data.creator_id); + + // ** top_pick should be deleted, not being used anymore - angela + msg->getBOOL(_PREHASH_Data, _PREHASH_TopPick, pick_data.top_pick); + msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, pick_data.parcel_id); + msg->getString(_PREHASH_Data, _PREHASH_Name, pick_data.name); + msg->getString(_PREHASH_Data, _PREHASH_Desc, pick_data.desc); + msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, pick_data.snapshot_id); + + // "Location text" is actually the owner name, the original + // name that owner gave the parcel, and the location. + msg->getString(_PREHASH_Data, _PREHASH_User, pick_data.location_text); + pick_data.location_text.append(", "); + + msg->getString(_PREHASH_Data, _PREHASH_OriginalName, pick_data.original_name); + if (!pick_data.original_name.empty()) + { + pick_data.location_text.append(pick_data.original_name); + pick_data.location_text.append(", "); + } + + msg->getString(_PREHASH_Data, _PREHASH_SimName, pick_data.sim_name); + pick_data.location_text.append(pick_data.sim_name); + pick_data.location_text.append(" "); + + msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, pick_data.pos_global); + S32 region_x = llround((F32)pick_data.pos_global.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = llround((F32)pick_data.pos_global.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_z = llround((F32)pick_data.pos_global.mdV[VZ]); + pick_data.location_text.append(llformat("(%d, %d, %d)", region_x, region_y, region_z)); + + msg->getS32(_PREHASH_Data, _PREHASH_SortOrder, pick_data.sort_order); + msg->getBOOL(_PREHASH_Data, _PREHASH_Enabled, pick_data.enabled); + + notifyObservers(pick_data.agent_id, &pick_data, APT_PICK_INFO); +} + +void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, void**) +{ + LLAvatarGroups avatar_groups; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id ); + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id ); + + S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); + for(S32 i = 0; i < group_count; ++i) + { + LLAvatarGroups::LLGroupData group_data; + + msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i ); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i ); + msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); + msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); + + avatar_groups.group_list.push_back(group_data); + } + + notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS); +} + +void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type) +{ + LLAvatarPropertiesProcessor::observer_multimap_t observers = LLAvatarPropertiesProcessor::getInstance()->mObservers; + + observer_multimap_t::iterator oi = observers.lower_bound(id); + observer_multimap_t::iterator end = observers.upper_bound(id); + for (; oi != end; ++oi) + { + oi->second->processProperties(data,type); + } +} + +void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 rights) +{ + if(!avatar_id.isNull()) + { + LLMessageSystem* msg = gMessageSystem; + + // setup message header + msg->newMessageFast(_PREHASH_GrantUserRights); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlockFast(_PREHASH_Rights); + msg->addUUID(_PREHASH_AgentRelated, avatar_id); + msg->addS32(_PREHASH_RelatedRights, rights); + + gAgent.sendReliableMessage(); + } +} + +void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std::string notes) +{ + if(!avatar_id.isNull()) + { + LLMessageSystem* msg = gMessageSystem; + + // setup message header + msg->newMessageFast(_PREHASH_AvatarNotesUpdate); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlockFast(_PREHASH_Data); + msg->addUUID(_PREHASH_TargetID, avatar_id); + msg->addString(_PREHASH_Notes, notes); + + gAgent.sendReliableMessage(); + } +} + + +void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessage(_PREHASH_PickDelete); + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_PickID, pick_id); + gAgent.sendReliableMessage(); +} + +void LLAvatarPropertiesProcessor::sendPicInfoUpdate(const void* pick_data) +{ + if (!pick_data) return; + const LLPickData *new_pick = static_cast(pick_data); + if (!new_pick) return; + + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage(_PREHASH_PickInfoUpdate); + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_PickID, new_pick->pick_id); + msg->addUUID(_PREHASH_CreatorID, new_pick->creator_id); + + //legacy var need to be deleted + msg->addBOOL(_PREHASH_TopPick, FALSE); + + // fills in on simulator if null + msg->addUUID(_PREHASH_ParcelID, new_pick->parcel_id); + msg->addString(_PREHASH_Name, new_pick->name); + msg->addString(_PREHASH_Desc, new_pick->desc); + msg->addUUID(_PREHASH_SnapshotID, new_pick->snapshot_id); + msg->addVector3d(_PREHASH_PosGlobal, new_pick->pos_global); + + // Only top picks have a sort order + msg->addS32(_PREHASH_SortOrder, 0); + + msg->addBOOL(_PREHASH_Enabled, new_pick->enabled); + gAgent.sendReliableMessage(); +} + +void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id) +{ + // Must ask for a pick based on the creator id because + // the pick database is distributed to the inventory cluster. JC + std::vector request_params; + request_params.push_back(creator_id.asString() ); + request_params.push_back(pick_id.asString() ); + send_generic_message("pickinforequest", request_params); +} diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h new file mode 100644 index 0000000000..4d50541d9a --- /dev/null +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -0,0 +1,206 @@ +/** + * @file llavatarpropertiesprocessor.h + * @brief LLAvatatIconCtrl base class + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLAVATARPROPERTIESPROCESSOR_H +#define LL_LLAVATARPROPERTIESPROCESSOR_H + +#include "lluuid.h" +#include + +/* +*TODO Vadim: This needs some refactoring: +- Remove EAvatarProcessorType in favor of separate observers, derived from a common parent (to get rid of void*). +*/ + +/* +*TODO: mantipov: get rid of sendDataRequest and sendDataUpdate methods. Use exact methods instead of. +*/ + +class LLMessageSystem; + +enum EAvatarProcessorType +{ + APT_PROPERTIES, + APT_NOTES, + APT_GROUPS, + APT_PICKS, + APT_PICK_INFO +}; + +struct LLAvatarData +{ + LLUUID agent_id; + LLUUID avatar_id; //target id + LLUUID image_id; + LLUUID fl_image_id; + LLUUID partner_id; + std::string about_text; + std::string fl_about_text; + std::string born_on; + std::string profile_url; + U8 caption_index; + std::string caption_text; + U32 flags; + BOOL allow_publish; +}; + +struct LLAvatarPicks +{ + LLUUID agent_id; + LLUUID target_id; //target id + + typedef std::pair pick_data_t; + typedef std::list< pick_data_t> picks_list_t; + picks_list_t picks_list; +}; + +struct LLPickData +{ + LLUUID agent_id; + LLUUID pick_id; + LLUUID creator_id; + BOOL top_pick; + LLUUID parcel_id; + std::string name; + std::string desc; + LLUUID snapshot_id; + LLVector3d pos_global; + S32 sort_order; + BOOL enabled; + + //used only in read requests + std::string location_text; + std::string original_name; + std::string sim_name; + + //used only in write (update) requests + LLUUID session_id; + +}; + +struct LLAvatarNotes +{ + LLUUID agent_id; + LLUUID target_id; //target id + std::string notes; +}; + +struct LLAvatarGroups +{ + LLUUID agent_id; + LLUUID avatar_id; //target id + BOOL list_in_profile; + + struct LLGroupData; + typedef std::list group_list_t; + + group_list_t group_list; + + struct LLGroupData + { + U64 group_powers; + BOOL accept_notices; + std::string group_title; + LLUUID group_id; + std::string group_name; + LLUUID group_insignia_id; + }; +}; + +class LLAvatarPropertiesObserver +{ +public: + virtual ~LLAvatarPropertiesObserver() {} + virtual void processProperties(void* data, EAvatarProcessorType type) = 0; +}; + +class LLAvatarPropertiesProcessor + : public LLSingleton +{ +public: + + LLAvatarPropertiesProcessor(); + virtual ~LLAvatarPropertiesProcessor() + {} + + void addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer); + + void removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer); + + void sendDataRequest(const LLUUID& avatar_id, EAvatarProcessorType type, const void * data = NULL); + + void sendDataUpdate(const void* data, EAvatarProcessorType type); + + void sendFriendRights(const LLUUID& avatar_id, S32 rights); + + void sendNotes(const LLUUID& avatar_id, const std::string notes); + + void sendPickDelete(const LLUUID& pick_id); + + static void processAvatarPropertiesReply(LLMessageSystem* msg, void**); + + static void processAvatarInterestsReply(LLMessageSystem* msg, void**); + + static void processAvatarClassifiedReply(LLMessageSystem* msg, void**); + + static void processAvatarGroupsReply(LLMessageSystem* msg, void**); + + static void processAvatarNotesReply(LLMessageSystem* msg, void**); + + static void processAvatarPicksReply(LLMessageSystem* msg, void**); + + static void processPickInfoReply(LLMessageSystem* msg, void**); +protected: + + void sendAvatarPropertiesRequest(const LLUUID& avatar_id); + + void sendGenericRequest(const LLUUID& avatar_id, const std::string method); + + void sendAvatarPropertiesUpdate(const void* data); + + void sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id); + + void sendPicInfoUpdate(const void * pick_data); + + static void notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type); + + typedef void* (*processor_method_t)(LLMessageSystem*); + static processor_method_t getProcessor(EAvatarProcessorType type); + +protected: + + typedef std::multimap observer_multimap_t; + + observer_multimap_t mObservers; +}; + +#endif // LL_LLAVATARPROPERTIESPROCESSOR_H diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp new file mode 100644 index 0000000000..f33dd2a32a --- /dev/null +++ b/indra/newview/llbottomtray.cpp @@ -0,0 +1,343 @@ +/** +* @file llbottomtray.cpp +* @brief LLBottomTray class implementation +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" // must be first include +#include "llbottomtray.h" +#include "llagent.h" +#include "llchiclet.h" +#include "lllayoutstack.h" +#include "llkeyboard.h" +#include "llgesturemgr.h" +#include "llanimationstates.h" + +//FIXME: temporary, for send_chat_from_viewer() proto +#include "llchatbar.h" + +LLBottomTray::LLBottomTray() + :mLastSpecialChatChannel(0) +{ + LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); + + mChicletPanel = getChild("chiclet_list",TRUE,FALSE); + + LLLineEditor* chat_box = getChatBox(); + chat_box->setCommitCallback(boost::bind(&LLBottomTray::onChatBoxCommit, this)); + chat_box->setKeystrokeCallback(&onChatBoxKeystroke, this); + chat_box->setFocusLostCallback(&onChatBoxFocusLost, this); + + LLIMMgr::getInstance()->addSessionObserver(this); +} + +LLBottomTray::~LLBottomTray() +{ + LLIMMgr::getInstance()->removeSessionObserver(this); +} + +LLLineEditor* LLBottomTray::getChatBox() +{ + return getChild("chat_box",TRUE,FALSE); +} + +void LLBottomTray::onChatBoxCommit() +{ + if (getChatBox()->getText().length() > 0) + { + sendChat(CHAT_TYPE_NORMAL); + + LLLineEditor* chat_box = getChatBox(); + + if (chat_box) + { + chat_box->setText(LLStringExplicit("")); + } + + gAgent.stopTyping(); + } +} + +void LLBottomTray::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) +{ + sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); +} + +void LLBottomTray::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) +{ + // Look for "/20 foo" channel chats. + S32 channel = 0; + LLWString out_text = stripChannelNumber(wtext, &channel); + std::string utf8_out_text = wstring_to_utf8str(out_text); + std::string utf8_text = wstring_to_utf8str(wtext); + + utf8_text = utf8str_trim(utf8_text); + if (!utf8_text.empty()) + { + utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); + } + + // Don't animate for chats people can't hear (chat to scripts) + if (animate && (channel == 0)) + { + if (type == CHAT_TYPE_WHISPER) + { + lldebugs << "You whisper " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); + } + else if (type == CHAT_TYPE_NORMAL) + { + lldebugs << "You say " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); + } + else if (type == CHAT_TYPE_SHOUT) + { + lldebugs << "You shout " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); + } + else + { + llinfos << "send_chat_from_viewer() - invalid volume" << llendl; + return; + } + } + else + { + if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) + { + lldebugs << "Channel chat: " << utf8_text << llendl; + } + } + + send_chat_from_viewer(utf8_out_text, type, channel); +} + +// static +void LLBottomTray::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) +{ + LLBottomTray* self = (LLBottomTray *)userdata; + + LLWString raw_text; + if (self->getChatBox()) raw_text = self->getChatBox()->getWText(); + + // Can't trim the end, because that will cause autocompletion + // to eat trailing spaces that might be part of a gesture. + LLWStringUtil::trimHead(raw_text); + + S32 length = raw_text.length(); + + if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences + { + gAgent.startTyping(); + } + else + { + gAgent.stopTyping(); + } + + /* Doesn't work -- can't tell the difference between a backspace + that killed the selection vs. backspace at the end of line. + if (length > 1 + && text[0] == '/' + && key == KEY_BACKSPACE) + { + // the selection will already be deleted, but we need to trim + // off the character before + std::string new_text = raw_text.substr(0, length-1); + self->mInputEditor->setText( new_text ); + self->mInputEditor->setCursorToEnd(); + length = length - 1; + } + */ + + KEY key = gKeyboard->currentKey(); + + // Ignore "special" keys, like backspace, arrows, etc. + if (length > 1 + && raw_text[0] == '/' + && key < KEY_SPECIAL) + { + // we're starting a gesture, attempt to autocomplete + + std::string utf8_trigger = wstring_to_utf8str(raw_text); + std::string utf8_out_str(utf8_trigger); + + if (gGestureManager.matchPrefix(utf8_trigger, &utf8_out_str)) + { + if (self->getChatBox()) + { + std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); + self->getChatBox()->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part + S32 outlength = self->getChatBox()->getLength(); // in characters + + // Select to end of line, starting from the character + // after the last one the user typed. + self->getChatBox()->setSelection(length, outlength); + } + } + + //llinfos << "GESTUREDEBUG " << trigger + // << " len " << length + // << " outlen " << out_str.getLength() + // << llendl; + } +} + +// static +void LLBottomTray::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata) +{ + // stop typing animation + gAgent.stopTyping(); +} + + +//virtual +void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + if(getChicletPanel()) + { + LLSD sid(session_id); + + if(getChicletPanel()->findIMChiclet(&sid)) + { + + } + else + { + LLIMChiclet* chicklet = (LLIMChiclet *)getChicletPanel()->createChiclet(&sid); + chicklet->setIMSessionName(name); + chicklet->setOtherParticipantId(other_participant_id); + + getChicletPanel()->arrange(); + } + } +} + +//virtual +void LLBottomTray::sessionRemoved(const LLUUID& session_id) +{ + if(getChicletPanel()) + { + LLSD sid(session_id); + getChicletPanel()->removeIMChiclet(&sid); + getChicletPanel()->arrange(); + } +} + +void LLBottomTray::sendChat( EChatType type ) +{ + LLLineEditor* chat_box = getChatBox(); + + if (chat_box) + { + LLWString text = chat_box->getConvertedText(); + if (!text.empty()) + { + // store sent line in history, duplicates will get filtered + chat_box->updateHistory(); + // Check if this is destined for another channel + S32 channel = 0; + stripChannelNumber(text, &channel); + + std::string utf8text = wstring_to_utf8str(text); + // Try to trigger a gesture, if not chat to a script. + std::string utf8_revised_text; + if (0 == channel) + { + // discard returned "found" boolean + gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text); + } + else + { + utf8_revised_text = utf8text; + } + + utf8_revised_text = utf8str_trim(utf8_revised_text); + + if (!utf8_revised_text.empty()) + { + // Chat with animation + sendChatFromViewer(utf8_revised_text, type, TRUE); + } + } + } + + gAgent.stopTyping(); +} + +// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. +// Otherwise returns input and channel 0. +LLWString LLBottomTray::stripChannelNumber(const LLWString &mesg, S32* channel) +{ + if (mesg[0] == '/' + && mesg[1] == '/') + { + // This is a "repeat channel send" + *channel = mLastSpecialChatChannel; + return mesg.substr(2, mesg.length() - 2); + } + else if (mesg[0] == '/' + && mesg[1] + && LLStringOps::isDigit(mesg[1])) + { + // This a special "/20" speak on a channel + S32 pos = 0; + + // Copy the channel number into a string + LLWString channel_string; + llwchar c; + do + { + c = mesg[pos+1]; + channel_string.push_back(c); + pos++; + } + while(c && pos < 64 && LLStringOps::isDigit(c)); + + // Move the pointer forward to the first non-whitespace char + // Check isspace before looping, so we can handle "/33foo" + // as well as "/33 foo" + while(c && iswspace(c)) + { + c = mesg[pos+1]; + pos++; + } + + mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); + *channel = mLastSpecialChatChannel; + return mesg.substr(pos, mesg.length() - pos); + } + else + { + // This is normal chat. + *channel = 0; + return mesg; + } +} + diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h new file mode 100644 index 0000000000..780e1b270d --- /dev/null +++ b/indra/newview/llbottomtray.h @@ -0,0 +1,91 @@ +/** +* @file llbottomtray.h +* @brief LLBottomTray class header file +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#ifndef LL_LLBOTTOMPANEL_H +#define LL_LLBOTTOMPANEL_H + +#include "llpanel.h" +#include "llflyoutbutton.h" +#include "llimview.h" +#include "llchat.h" + +class LLChicletPanel; +class LLNotificationChiclet; +class LLNotificationChiclet; +class LLTalkButton; + +class LLBottomTray + : public LLSingleton + , public LLPanel + , public LLIMSessionObserver +{ +public: + LLBottomTray(); + + ~LLBottomTray(); + + LLLineEditor* getChatBox(); + + LLChicletPanel* getChicletPanel() {return mChicletPanel;}; + + LLNotificationChiclet* getIMWell() {return mIMWell;}; + + LLNotificationChiclet* getNotificationWell(){return mNotificationWell;}; + + void onChatBoxCommit(); + void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); + void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); + static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata); + static void onChatBoxFocusLost(LLFocusableElement* caller, void* userdata); + + // LLIMSessionObserver observe triggers + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + virtual void sessionRemoved(const LLUUID& session_id); + +protected: + + void sendChat( EChatType type ); + LLWString stripChannelNumber(const LLWString &mesg, S32* channel); + + // Which non-zero channel did we last chat on? + S32 mLastSpecialChatChannel; + + LLChicletPanel* mChicletPanel; + LLNotificationChiclet* mIMWell; + LLNotificationChiclet* mNotificationWell; + LLTalkButton* mTalkBtn; +}; + +extern LLBottomTray* gBottomTray; +extern S32 BOTTOM_TRAY_HEIGHT; + +#endif // LL_LLBOTTOMPANEL_H diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index db28c7ad38..1844934e6a 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -684,7 +684,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) { std::string notifyMsg = notification->getMessage(); if (!notifyMsg.empty()) - floater->addHistoryLine(notifyMsg,gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(notifyMsg,gSavedSkinSettings.getColor4("SystemChatColor")); } } diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 2395f3c5ae..5e97157694 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -67,7 +67,7 @@ #include "llui.h" #include "llviewermenu.h" #include "lluictrlfactory.h" - +#include "llbottomtray.h" // // Globals @@ -76,11 +76,6 @@ const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds LLChatBar *gChatBar = NULL; -// legacy calllback glue -void toggleChatHistory(void* user_data); -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); - - class LLChatBarGestureObserver : public LLGestureManagerObserver { public: @@ -97,7 +92,7 @@ private: // LLChatBar::LLChatBar() -: LLPanel(LLStringUtil::null, LLRect(), BORDER_NO), +: LLPanel(), mInputEditor(NULL), mGestureLabelTimer(), mLastSpecialChatChannel(0), @@ -107,7 +102,7 @@ LLChatBar::LLChatBar() { setIsChrome(TRUE); - #if !LL_RELEASE_FOR_DOWNLOAD +#if !LL_RELEASE_FOR_DOWNLOAD childDisplayNotFound(); #endif } @@ -123,34 +118,23 @@ LLChatBar::~LLChatBar() BOOL LLChatBar::postBuild() { - childSetAction("History", toggleChatHistory, this); - childSetCommitCallback("Say", onClickSay, this); + getChild("Say")->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1)); // attempt to bind to an existing combo box named gesture - setGestureCombo(getChild( "Gesture")); - - LLButton * sayp = getChild("Say"); - if(sayp) - { - setDefaultBtn(sayp); - } + setGestureCombo(getChild( "Gesture", TRUE, FALSE)); mInputEditor = getChild("Chat Editor"); - if (mInputEditor) - { - mInputEditor->setCallbackUserData(this); - mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke); - mInputEditor->setFocusLostCallback(&onInputEditorFocusLost, this); - mInputEditor->setFocusReceivedCallback( &onInputEditorGainFocus, this ); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setRevertOnEsc( FALSE ); - mInputEditor->setIgnoreTab(TRUE); - mInputEditor->setPassDelete(TRUE); - mInputEditor->setReplaceNewlinesWithSpaces(FALSE); - - mInputEditor->setMaxTextLength(1023); - mInputEditor->setEnableLineHistory(TRUE); - } + mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke, this); + mInputEditor->setFocusLostCallback(&onInputEditorFocusLost, this); + mInputEditor->setFocusReceivedCallback( &onInputEditorGainFocus, this ); + mInputEditor->setCommitOnFocusLost( FALSE ); + mInputEditor->setRevertOnEsc( FALSE ); + mInputEditor->setIgnoreTab(TRUE); + mInputEditor->setPassDelete(TRUE); + mInputEditor->setReplaceNewlinesWithSpaces(FALSE); + + mInputEditor->setMaxTextLength(1023); + mInputEditor->setEnableLineHistory(TRUE); mIsBuilt = TRUE; @@ -209,10 +193,7 @@ void LLChatBar::refresh() gAgent.stopTyping(); } - childSetValue("History", LLFloaterChat::instanceVisible(LLSD())); - childSetEnabled("Say", mInputEditor->getText().size() > 0); - childSetEnabled("Shout", mInputEditor->getText().size() > 0); } @@ -311,8 +292,7 @@ void LLChatBar::setGestureCombo(LLComboBox* combo) mGestureCombo = combo; if (mGestureCombo) { - mGestureCombo->setCommitCallback(onCommitGesture); - mGestureCombo->setCallbackUserData(this); + mGestureCombo->setCommitCallback(boost::bind(&LLChatBar::onCommitGesture, this, _1)); // now register observer since we have a place to put the results mObserver = new LLChatBarGestureObserver(this); @@ -434,17 +414,25 @@ void LLChatBar::sendChat( EChatType type ) // static void LLChatBar::startChat(const char* line) { - gChatBar->setVisible(TRUE); - gChatBar->setKeyboardFocus(TRUE); - gSavedSettings.setBOOL("ChatVisible", TRUE); - - if (line && gChatBar->mInputEditor) + //TODO* remove DUMMY chat + if(LLBottomTray::getInstance()->getChatBox()) { - std::string line_string(line); - gChatBar->mInputEditor->setText(line_string); + LLBottomTray::getInstance()->getChatBox()->setFocus(TRUE); } - // always move cursor to end so users don't obliterate chat when accidentally hitting WASD - gChatBar->mInputEditor->setCursorToEnd(); + + // *TODO Vadim: Why was this code commented out? + +// gChatBar->setVisible(TRUE); +// gChatBar->setKeyboardFocus(TRUE); +// gSavedSettings.setBOOL("ChatVisible", TRUE); +// +// if (line && gChatBar->mInputEditor) +// { +// std::string line_string(line); +// gChatBar->mInputEditor->setText(line_string); +// } +// // always move cursor to end so users don't obliterate chat when accidentally hitting WASD +// gChatBar->mInputEditor->setCursorToEnd(); } @@ -452,21 +440,29 @@ void LLChatBar::startChat(const char* line) // static void LLChatBar::stopChat() { - // In simple UI mode, we never release focus from the chat bar - gChatBar->setKeyboardFocus(FALSE); - - // If we typed a movement key and pressed return during the - // same frame, the keyboard handlers will see the key as having - // gone down this frame and try to move the avatar. - gKeyboard->resetKeys(); - gKeyboard->resetMaskKeys(); - - // stop typing animation - gAgent.stopTyping(); + //TODO* remove DUMMY chat + if(LLBottomTray::getInstance()->getChatBox()) + { + LLBottomTray::getInstance()->getChatBox()->setFocus(FALSE); + } - // hide chat bar so it doesn't grab focus back - gChatBar->setVisible(FALSE); - gSavedSettings.setBOOL("ChatVisible", FALSE); + // *TODO Vadim: Why was this code commented out? + +// // In simple UI mode, we never release focus from the chat bar +// gChatBar->setKeyboardFocus(FALSE); +// +// // If we typed a movement key and pressed return during the +// // same frame, the keyboard handlers will see the key as having +// // gone down this frame and try to move the avatar. +// gKeyboard->resetKeys(); +// gKeyboard->resetMaskKeys(); +// +// // stop typing animation +// gAgent.stopTyping(); +// +// // hide chat bar so it doesn't grab focus back +// gChatBar->setVisible(FALSE); +// gSavedSettings.setBOOL("ChatVisible", FALSE); } // static @@ -553,20 +549,19 @@ void LLChatBar::onInputEditorGainFocus( LLFocusableElement* caller, void* userda LLFloaterChat::setHistoryCursorAndScrollToEnd(); } -// static -void LLChatBar::onClickSay( LLUICtrl* ctrl, void* userdata ) +void LLChatBar::onClickSay( LLUICtrl* ctrl ) { + std::string cmd = ctrl->getValue().asString(); e_chat_type chat_type = CHAT_TYPE_NORMAL; - if (ctrl->getValue().asString() == "shout") + if (cmd == "shout") { chat_type = CHAT_TYPE_SHOUT; } - else if (ctrl->getValue().asString() == "whisper") + else if (cmd == "whisper") { chat_type = CHAT_TYPE_WHISPER; } - LLChatBar* self = (LLChatBar*) userdata; - self->sendChat(chat_type); + sendChat(chat_type); } void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) @@ -641,11 +636,9 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 } -// static -void LLChatBar::onCommitGesture(LLUICtrl* ctrl, void* data) +void LLChatBar::onCommitGesture(LLUICtrl* ctrl) { - LLChatBar* self = (LLChatBar*)data; - LLCtrlListInterface* gestures = self->mGestureCombo ? self->mGestureCombo->getListInterface() : NULL; + LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; if (gestures) { S32 index = gestures->getFirstSelectedIndex(); @@ -665,23 +658,17 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl, void* data) if (!revised_text.empty()) { // Don't play nodding animation - self->sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); + sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); } } - self->mGestureLabelTimer.start(); - if (self->mGestureCombo != NULL) + mGestureLabelTimer.start(); + if (mGestureCombo != NULL) { // free focus back to chat bar - self->mGestureCombo->setFocus(FALSE); + mGestureCombo->setFocus(FALSE); } } -void toggleChatHistory(void* user_data) -{ - LLFloaterChat::toggleInstance(LLSD()); -} - - class LLChatHandler : public LLCommandHandler { public: diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h index 56a98a78f9..e0e324af6b 100644 --- a/indra/newview/llchatbar.h +++ b/indra/newview/llchatbar.h @@ -45,6 +45,9 @@ class LLFrameTimer; class LLChatBarGestureObserver; class LLComboBox; +// legacy calllback glue +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); + class LLChatBar : public LLPanel { @@ -82,14 +85,14 @@ public: LLWString stripChannelNumber(const LLWString &mesg, S32* channel); // callbacks - static void onClickSay( LLUICtrl*, void* userdata ); + void onClickSay(LLUICtrl* ctrl); static void onTabClick( void* userdata ); static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); static void onInputEditorFocusLost(LLFocusableElement* caller,void* userdata); static void onInputEditorGainFocus(LLFocusableElement* caller,void* userdata); - static void onCommitGesture(LLUICtrl* ctrl, void* data); + void onCommitGesture(LLUICtrl* ctrl); static void startChat(const char* line); static void stopChat(); diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp new file mode 100644 index 0000000000..1c72e9c5ac --- /dev/null +++ b/indra/newview/llchiclet.cpp @@ -0,0 +1,725 @@ +/** +* @file llchiclet.cpp +* @brief LLChiclet class implementation +* +* $LicenseInfo:firstyear=2002&license=viewergpl$ +* +* Copyright (c) 2002-2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" // must be first include +#include "llchiclet.h" +#include "llfloaterreg.h" +#include "llvoiceclient.h" +#include "llagent.h" +#include "lltextbox.h" +#include "lliconctrl.h" +#include "llvoicecontrolpanel.h" +#include "lloutputmonitorctrl.h" +#include "llimview.h" +#include "llbottomtray.h" + +static const S32 CHICLET_HEIGHT = 25; +static const S32 CHICLET_SPACING = 0; +static const S32 CHICLET_PADDING = 3; +static const S32 AVATAR_WIDTH = 25; +static const S32 SPEAKER_WIDTH = 20; +static const S32 COUNTER_WIDTH = 20; +static const S32 SCROLL_BUTTON_WIDTH = 19; +static const S32 SCROLL_BUTTON_HEIGHT = 20; +static const S32 NOTIFICATION_TEXT_TOP_PAD = 5; + +static LLDefaultWidgetRegistry::Register t1("chiclet_panel"); +static LLDefaultWidgetRegistry::Register t2("chiclet_talk"); +static LLDefaultWidgetRegistry::Register t3("chiclet_notification"); +static LLDefaultWidgetRegistry::Register t4("chiclet_panel"); + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLNotificationChiclet::Params::Params() +: image_unselected("image_unselected") +, image_selected("image_selected") +, image_overlay("image_overlay") +{ +} + +LLNotificationChiclet::LLNotificationChiclet(const Params& p) +: LLChiclet(p) +, mButton(NULL) +, mCounterText(NULL) +{ + LLRect rc(p.rect); + + LLButton::Params button_params; + button_params.name("btn"); + button_params.label(LLStringUtil::null); + button_params.rect(LLRect(0,rc.getHeight(),rc.getWidth(),0)); + button_params.image_overlay(p.image_overlay); + button_params.image_unselected(p.image_unselected); + button_params.image_selected(p.image_selected); + button_params.tab_stop(false); + mButton = LLUICtrlFactory::create(button_params); + addChild(mButton); + + LLTextBox::Params textbox_params; + textbox_params.name("txt"); + textbox_params.rect(LLRect(p.label_left,rc.getHeight(), + rc.getWidth()-p.label_left,0)); + textbox_params.mouse_opaque(false); + textbox_params.v_pad(NOTIFICATION_TEXT_TOP_PAD); + textbox_params.font.style("SansSerif"); + textbox_params.font_halign(LLFontGL::HCENTER); + mCounterText = LLUICtrlFactory::create(textbox_params); + addChild(mCounterText); + mCounterText->setColor(LLColor4::white); + mCounterText->setText(LLStringUtil::null); +} + +LLNotificationChiclet::~LLNotificationChiclet() +{ + +} + +LLChiclet* LLNotificationChiclet::create(const Params& p) +{ + LLChiclet* chiclet = new LLNotificationChiclet(p); + return chiclet; +} + +void LLNotificationChiclet::setCounter(S32 counter) +{ + std::stringstream stream; + mCounter = counter; + stream << mCounter; + mCounterText->setText(stream.str()); +} + +boost::signals::connection LLNotificationChiclet::setClickCallback( + const commit_callback_t& cb) +{ + return mButton->setClickedCallback(cb); +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLChiclet::LLChiclet(const Params& p) +: LLUICtrl(p) +, mCounter(0) +, mShowCounter(true) +{ + +} + +LLChiclet::~LLChiclet() +{ + +} + +boost::signals::connection LLChiclet::setLeftButtonClickCallback( + const commit_callback_t& cb) +{ + return mCommitSignal.connect(cb); +} + +BOOL LLChiclet::handleMouseDown(S32 x, S32 y, MASK mask) +{ + onCommit(); + childrenHandleMouseDown(x,y,mask); + return TRUE; +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLIMChiclet::LLIMChiclet(const LLChiclet::Params& p) +: LLChiclet(p) +, mAvatar(NULL) +, mCounterText(NULL) +, mSpeaker(NULL) +, mIMSessionId() +, mShowSpeaker(false) +, mSpeakerStatus(SPEAKER_IDLE) +{ + LLAvatarIconCtrl::Params avatar_params; + avatar_params.control_name("avatar"); + avatar_params.draw_tooltip = FALSE; + mAvatar = LLUICtrlFactory::create(avatar_params); + + addChild(mAvatar); + + LLTextBox::Params unread_params; + unread_params.font.style("SansSerif"); + unread_params.font_halign(LLFontGL::HCENTER); + unread_params.v_pad(5); + mCounterText = LLUICtrlFactory::create(unread_params); + addChild(mCounterText); + mCounterText->setColor(LLColor4::white); + setCounter(getCounter()); + + LLIconCtrl::Params speaker_params; + speaker_params.image( LLUI::getUIImage("icn_voice_ptt-on-lvl2.tga") ); + mSpeaker = LLUICtrlFactory::create(speaker_params); + addChild(mSpeaker); + mSpeaker->setVisible(getShowSpeaker()); + + S32 left = 0; + mAvatar->setRect(LLRect(left,CHICLET_HEIGHT,AVATAR_WIDTH,0)); + left += AVATAR_WIDTH + CHICLET_SPACING; + mCounterText->setRect(LLRect(left,CHICLET_HEIGHT,left + COUNTER_WIDTH,0)); + left += COUNTER_WIDTH + CHICLET_SPACING; + mSpeaker->setRect(LLRect(left,CHICLET_HEIGHT,left + SPEAKER_WIDTH,0)); +} + +LLIMChiclet::~LLIMChiclet() +{ + +} + +LLChiclet* LLIMChiclet::create(LLSD* imSessionId /* = NULL */) +{ + LLIMChiclet* chiclet = new LLIMChiclet(LLChiclet::Params()); + chiclet->setIMSessionId(imSessionId); + return chiclet; +} + +void LLIMChiclet::setCounter(S32 counter) +{ + mCounter = counter; + std::stringstream stream; + stream << mCounter; + mCounterText->setText(stream.str()); + + LLRect rc = mCounterText->getRect(); + rc.mRight = rc.mLeft + calcCounterWidth(); + mCounterText->setRect(rc); +} + +LLRect LLIMChiclet::getRequiredRect() +{ + LLRect rect(0,CHICLET_HEIGHT,AVATAR_WIDTH,0); + if(getShowCounter()) + { + rect.mRight += CHICLET_SPACING + calcCounterWidth(); + } + if(getShowSpeaker()) + { + rect.mRight += CHICLET_SPACING + SPEAKER_WIDTH; + } + return rect; +} + +void LLIMChiclet::setShowCounter(bool show) +{ + LLChiclet::setShowCounter(show); + mCounterText->setVisible(getShowCounter()); +} + +void LLIMChiclet::setIMSessionName(const std::string& name) +{ + setToolTip(name); +} + +void LLIMChiclet::setOtherParticipantId(const LLUUID& other_participant_id) +{ + if (mAvatar) + { + mAvatar->setValue(other_participant_id); + } +} + +void LLIMChiclet::setShowSpeaker(bool show) +{ + mShowSpeaker = show; + mSpeaker->setVisible(getShowSpeaker()); +} + +void LLIMChiclet::draw() +{ + LLUICtrl::draw(); + gl_rect_2d(1, getRect().getHeight(), getRect().getWidth(), 1, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE); +} + +S32 LLIMChiclet::calcCounterWidth() +{ + S32 font_width = mCounterText->getFont()->getWidth("0"); + S32 text_size = mCounterText->getText().size(); + + return llmax(font_width * text_size, COUNTER_WIDTH); +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLChicletPanel::LLChicletPanel(const Params&p) +: LLPanel(p) +, mLeftScroll(NULL) +, mRightScroll(NULL) +, mFirstToShow(0) +{ + LLButton::Params params; + + params.name("scroll_left"); + params.label(LLStringUtil::null); + params.tab_stop(false); + params.image_selected(LLUI::getUIImage("scroll_left.tga")); + params.image_unselected(LLUI::getUIImage("scroll_left.tga")); + params.image_hover_selected(LLUI::getUIImage("scroll_left.tga")); + mLeftScroll = LLUICtrlFactory::create(params); + addChild(mLeftScroll); + mLeftScroll->setClickedCallback(boost::bind(&LLChicletPanel::onLeftScrollClick,this)); + mLeftScroll->setEnabled(false); + + params.name("scroll_right"); + params.image_selected(LLUI::getUIImage("scroll_right.tga")); + params.image_unselected(LLUI::getUIImage("scroll_right.tga")); + params.image_hover_selected(LLUI::getUIImage("scroll_right.tga")); + mRightScroll = LLUICtrlFactory::create(params); + addChild(mRightScroll); + mRightScroll->setClickedCallback(boost::bind(&LLChicletPanel::onRightScrollClick,this)); + mRightScroll->setEnabled(false); + + LLPanel::Params panel_params; + mScrollArea = LLUICtrlFactory::create(panel_params,this); + addChild(mScrollArea); +} + +LLChicletPanel::~LLChicletPanel() +{ + +} + +LLChicletPanel* LLChicletPanel::create() +{ + LLChicletPanel* panel = new LLChicletPanel(LLChicletPanel::Params()); + return panel; +} + +BOOL LLChicletPanel::postBuild() +{ + LLPanel::postBuild(); + + return TRUE; +} + +LLChiclet* LLChicletPanel::createChiclet(LLSD* imSessionId, S32 pos) +{ + LLChiclet* chiclet = LLIMChiclet::create(imSessionId); + if(!chiclet) + { + assert(false); + return NULL; + } + + if(!addChiclet(chiclet, pos)) + { + assert(false); + return NULL; + } + + return chiclet; +} + +bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 pos) +{ + if(mScrollArea->addChild(chiclet)) + { + mChicletList.insert(mChicletList.begin() + pos, chiclet); + + chiclet->setLeftButtonClickCallback(boost::bind(&LLChicletPanel::onChicletClick, this, _1, _2)); + + return true; + } + + return false; +} + +void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD¶m) +{ + LLIMChiclet* chiclet = dynamic_cast(ctrl); + if (chiclet) + { + LLFloaterReg::showInstance("communicate", chiclet->getIMSessionId().asUUID()); + } + + mCommitSignal(ctrl,param); +} + +LLChiclet* LLChicletPanel::findIMChiclet(LLSD* imSessionId) +{ + chiclet_list_t::const_iterator it = mChicletList.begin(); + for( ; mChicletList.end() != it; ++it) + { + LLIMChiclet* chiclet = dynamic_cast(*it); + if(!chiclet) + { + continue; + } + + if(chiclet->getIMSessionId().asUUID() == imSessionId->asUUID()) + { + return chiclet; + } + } + return NULL; +} + +LLChiclet* LLChicletPanel::getChiclet(S32 pos) +{ + return mChicletList.at(pos); +} + +void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it) +{ + mScrollArea->removeChild(*it); + delete *it; + mChicletList.erase(it); + mLeftScroll->setEnabled(canScrollLeft()); + mRightScroll->setEnabled(canScrollRight()); +} + +void LLChicletPanel::removeChiclet(S32 pos) +{ + if(0 > pos || getChicletCount() >= pos) + { + return; + } + removeChiclet(mChicletList.begin() + pos); +} + +void LLChicletPanel::removeChiclet(LLChiclet*chiclet) +{ + chiclet_list_t::iterator it = mChicletList.begin(); + for( ; mChicletList.end() != it; ++it) + { + LLChiclet* temp = *it; + if(temp == chiclet) + { + removeChiclet(it); + return; + } + } +} + +void LLChicletPanel::removeIMChiclet(LLSD* imSessionId) +{ + chiclet_list_t::iterator it = mChicletList.begin(); + for( ; mChicletList.end() != it; ++it) + { + LLIMChiclet* chiclet = dynamic_cast(*it); + if(!chiclet) + { + continue; + } + + if(chiclet->getIMSessionId().asUUID() == imSessionId->asUUID()) + { + removeChiclet(it); + return; + } + } +} + +void LLChicletPanel::removeAll() +{ + mScrollArea->deleteAllChildren(); + + mChicletList.erase(mChicletList.begin(), mChicletList.end()); + mLeftScroll->setEnabled(false); + mRightScroll->setEnabled(false); +} + +void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent ) +{ + LLPanel::reshape(width,height,called_from_parent); + + mLeftScroll->setRect(LLRect(0,CHICLET_HEIGHT,SCROLL_BUTTON_WIDTH, + CHICLET_HEIGHT - SCROLL_BUTTON_HEIGHT)); + mRightScroll->setRect(LLRect(getRect().getWidth()-SCROLL_BUTTON_WIDTH,CHICLET_HEIGHT, + getRect().getWidth(),CHICLET_HEIGHT - SCROLL_BUTTON_HEIGHT)); + + mScrollArea->setRect(LLRect(SCROLL_BUTTON_WIDTH + 5,CHICLET_HEIGHT + 1, + getRect().getWidth() - SCROLL_BUTTON_WIDTH - 5, 0)); + + + arrange(); +} + +void LLChicletPanel::arrange() +{ + S32 left = 0; + S32 size = getChicletCount(); + + for( int n = mFirstToShow; n < size; ++n) + { + LLChiclet* chiclet = getChiclet(n); + S32 chiclet_width = chiclet->getRequiredRect().getWidth(); + LLRect rc(left, CHICLET_HEIGHT, left + chiclet_width, 0); + + chiclet->setRect(rc); + chiclet->reshape(rc.getWidth(),rc.getHeight()); + + left += chiclet_width + CHICLET_PADDING; + } + + mLeftScroll->setEnabled(canScrollLeft()); + mRightScroll->setEnabled(canScrollRight()); +} + +void LLChicletPanel::draw() +{ + //gl_rect_2d(0,getRect().getHeight(),getRect().getWidth(),0,LLColor4(0.f,1.f,1.f,1.f),TRUE); + + child_list_const_iter_t it = getChildList()->begin(); + for( ; getChildList()->end() != it; ++it) + { + LLView* child = *it; + if(child == dynamic_cast(mScrollArea)) + { + LLLocalClipRect clip(mScrollArea->getRect()); + drawChild(mScrollArea); + } + else + { + drawChild(child); + } + } +} + +bool LLChicletPanel::canScrollRight() +{ + S32 width = 0; + LLRect visible_rect = mScrollArea->getRect(); + + chiclet_list_t::const_iterator it = mChicletList.begin() + mFirstToShow; + for(;mChicletList.end() != it; ++it) + { + LLChiclet* chiclet = *it; + width += chiclet->getRect().getWidth() + CHICLET_PADDING; + if(width > visible_rect.getWidth()) + return true; + } + return false; +} + +bool LLChicletPanel::canScrollLeft() +{ + return mFirstToShow > 0; +} + +void LLChicletPanel::scroll(ScrollDirection direction) +{ + S32 elem = 0; + if(SCROLL_LEFT == direction) + elem = mFirstToShow; + else if(SCROLL_RIGHT) + elem = mFirstToShow - 1; + + S32 offset = mChicletList[elem]->getRect().getWidth() + + CHICLET_PADDING; + offset *= direction; + + chiclet_list_t::const_iterator it = mChicletList.begin(); + for(;mChicletList.end() != it; ++it) + { + LLChiclet* chiclet = *it; + chiclet->translate(offset,0); + } +} + +void LLChicletPanel::scrollLeft() +{ + if(canScrollLeft()) + { + --mFirstToShow; + scroll(SCROLL_LEFT); + mLeftScroll->setEnabled(canScrollLeft()); + mRightScroll->setEnabled(canScrollRight()); + } +} + +void LLChicletPanel::scrollRight() +{ + if(canScrollRight()) + { + ++mFirstToShow; + scroll(SCROLL_RIGHT); + mLeftScroll->setEnabled(canScrollLeft()); + mRightScroll->setEnabled(canScrollRight()); + } +} + +void LLChicletPanel::onLeftScrollClick() +{ + scrollLeft(); +} + +void LLChicletPanel::onRightScrollClick() +{ + scrollRight(); +} + +boost::signals::connection LLChicletPanel::setChicletClickCallback( + const commit_callback_t& cb) +{ + return mCommitSignal.connect(cb); +} + +BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks) +{ + if(clicks > 0) + { + scrollRight(); + } + else + { + scrollLeft(); + } + return TRUE; +} + +LLTalkButton::LLTalkButton(const LLUICtrl::Params& p) +: LLUICtrl(p) +{ + static S32 DROPDOWN_BTN_WIDTH = 20; + + LLRect rc(p.rect); + + LLButton::Params speak_params; + speak_params.name("left"); + speak_params.rect(LLRect(0,rc.getHeight(),rc.getWidth()-DROPDOWN_BTN_WIDTH,0)); + speak_params.label("Speak"); + speak_params.label_selected("Speak"); + speak_params.font(LLFontGL::getFontSansSerifSmall()); + speak_params.label_color(LLColor4::black); + speak_params.label_color_selected(LLColor4::black); + speak_params.tab_stop(false); + speak_params.is_toggle(true); + speak_params.picture_style(true); + speak_params.image_selected(LLUI::getUIImage("flyout_btn_left_selected.tga")); + speak_params.image_unselected(LLUI::getUIImage("flyout_btn_left.tga")); + mSpeakBtn = LLUICtrlFactory::create(speak_params); + addChild(mSpeakBtn); + + mSpeakBtn->setClickedCallback(boost::bind(&LLTalkButton::onClick_SpeakBtn, this)); + mSpeakBtn->setToggleState(false); + + LLButton::Params show_params; + show_params.name("right"); + show_params.rect(LLRect(rc.getWidth()-DROPDOWN_BTN_WIDTH,rc.getHeight(),rc.getWidth(),0)); + show_params.label(""); + show_params.tab_stop(false); + show_params.is_toggle(true); + show_params.picture_style(true); + show_params.image_selected(LLUI::getUIImage("show_btn_selected.tga")); + show_params.image_unselected(LLUI::getUIImage("show_btn.tga")); + mShowBtn = LLUICtrlFactory::create(show_params); + addChild(mShowBtn); + + mShowBtn->setClickedCallback(boost::bind(&LLTalkButton::onClick_ShowBtn, this)); + mShowBtn->setToggleState(false); + + mSpeakBtn->setToggleState(FALSE); + mShowBtn->setToggleState(FALSE); + + rc = mSpeakBtn->getRect(); + + LLOutputMonitorCtrl::Params monitor_param; + monitor_param.name("monitor"); + monitor_param.draw_border(false); + monitor_param.rect(LLRect(rc.getWidth()-20,18,rc.getWidth()-3,2)); + monitor_param.visible(true); + mOutputMonitor = LLUICtrlFactory::create(monitor_param); + + mSpeakBtn->addChild(mOutputMonitor); + + mPrivateCallPanel = NULL; +} + +LLTalkButton::~LLTalkButton() +{ +} + +void LLTalkButton::draw() +{ + if(mSpeakBtn->getToggleState()) + { + mOutputMonitor->setPower(gVoiceClient->getCurrentPower(gAgent.getID())); + } + + LLUICtrl::draw(); +} + +void LLTalkButton::onClick_SpeakBtn() +{ + bool speaking = mSpeakBtn->getToggleState(); + gVoiceClient->setUserPTTState(speaking); + mOutputMonitor->setIsMuted(!speaking); +} + +void LLTalkButton::onClick_ShowBtn() +{ + if(!mShowBtn->getToggleState()) + { + mPrivateCallPanel->onClickClose(mPrivateCallPanel); + delete mPrivateCallPanel; + mPrivateCallPanel = NULL; + mShowBtn->setToggleState(FALSE); + return; + } + + S32 x = mSpeakBtn->getRect().mLeft; + S32 y = 0; + + localPointToScreen(x, y, &x, &y); + + mPrivateCallPanel = new LLVoiceControlPanel; + getRootView()->addChild(mPrivateCallPanel); + + y = LLBottomTray::getInstance()->getRect().getHeight() + + mPrivateCallPanel->getRect().getHeight(); + + LLRect rect; + rect.setLeftTopAndSize(x, y, mPrivateCallPanel->getRect().getWidth(), mPrivateCallPanel->getRect().getHeight()); + mPrivateCallPanel->setRect(rect); + + LLAvatarListItem::Params p; + p.buttons.status = true; + p.buttons.info = true; + p.buttons.profile = false; + p.buttons.locator = true; + + mPrivateCallPanel->addItem(new LLAvatarListItem(p)); + mPrivateCallPanel->setVisible(TRUE); + mPrivateCallPanel->setFrontmost(TRUE); + + mShowBtn->setToggleState(TRUE); +} diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h new file mode 100644 index 0000000000..f2b859a090 --- /dev/null +++ b/indra/newview/llchiclet.h @@ -0,0 +1,286 @@ +/** +* @file llchiclet.h +* @brief LLChiclet class header file +* +* $LicenseInfo:firstyear=2002&license=viewergpl$ +* +* Copyright (c) 2002-2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#ifndef LL_LLCHICLET_H +#define LL_LLCHICLET_H + +#include "llpanel.h" + +class LLTextBox; +class LLIconCtrl; +class LLAvatarIconCtrl; +class LLVoiceControlPanel; +class LLOutputMonitorCtrl; + +class LLChiclet : public LLUICtrl +{ +public: + + struct Params : public LLInitParam::Block + { + Params(){}; + }; + + virtual ~LLChiclet(); + + virtual void setCounter(S32 counter) = 0; + + virtual S32 getCounter() = 0; + + virtual void setShowCounter(bool show) {mShowCounter = show;}; + + virtual bool getShowCounter() {return mShowCounter;}; + + virtual boost::signals::connection setLeftButtonClickCallback( + const commit_callback_t& cb); + +protected: + + friend class LLUICtrlFactory; + LLChiclet(const Params& p); + + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + +protected: + S32 mCounter; + bool mShowCounter; +}; + +class LLIMChiclet : public LLChiclet +{ +public: + static LLChiclet* create(LLSD* imSessionId = NULL); + + void setCounter(S32); + + S32 getCounter() {return mCounter;}; + + const LLSD& getIMSessionId() const {return mIMSessionId;}; + + void setIMSessionId(LLSD* imSessionId) {if (imSessionId) mIMSessionId = *imSessionId;}; + void setIMSessionName(const std::string& name); + void setOtherParticipantId(const LLUUID& other_participant_id); + + void setShowSpeaker(bool show); + + bool getShowSpeaker() {return mShowSpeaker;}; + + enum SpeakerStatus + { + SPREAKER_ACTIVE, + SPEAKER_IDLE + }; + + void setSpeakerStatus(SpeakerStatus status); + + SpeakerStatus getSpeakerStatus() {return mSpeakerStatus;}; + + ~LLIMChiclet(); + +protected: + LLIMChiclet(const LLChiclet::Params& p); + friend class LLUICtrlFactory; + + S32 calcCounterWidth(); + + //overrides +public: + + void setShowCounter(bool show); + + void draw(); + + LLRect getRequiredRect(); + +protected: + LLAvatarIconCtrl* mAvatar; + LLTextBox* mCounterText; + LLIconCtrl* mSpeaker; + + LLSD mIMSessionId; + bool mShowSpeaker; + SpeakerStatus mSpeakerStatus; +}; + +class LLNotificationChiclet : public LLChiclet +{ +public: + + struct Params : public LLInitParam::Block + { + Optional + image_unselected, + image_selected, + image_hover_selected, + image_hover_unselected, + image_disabled_selected, + image_disabled, + image_overlay; + + Optional + label_left; + + Params(); + }; + + static LLChiclet* create(const Params& p); + + void setCounter(S32 counter); + + S32 getCounter() {return mCounter;}; + + boost::signals::connection setClickCallback(const commit_callback_t& cb); + + virtual ~ LLNotificationChiclet(); + +protected: + LLNotificationChiclet(const Params& p); + friend class LLUICtrlFactory; + +protected: + LLButton* mButton; + LLTextBox* mCounterText; +}; + +class LLChicletPanel : public LLPanel +{ +public: + + struct Params : public LLInitParam::Block + { + Params(){}; + }; + + static LLChicletPanel* create(); + + LLChiclet* createChiclet(LLSD* imSessionId = NULL, S32 pos = 0); + + bool addChiclet(LLChiclet*, S32 pos); + + LLChiclet* getChiclet(S32 pos); + + LLChiclet* findIMChiclet(LLSD* imSessionId); + + S32 getChicletCount() {return mChicletList.size();}; + + void removeChiclet(S32 pos); + + void removeChiclet(LLChiclet*); + + void removeIMChiclet(LLSD* imSessionId); + + void removeAll(); + + void arrange(); + + ~LLChicletPanel(); + + void scrollLeft(); + + void scrollRight(); + + void onLeftScrollClick(); + + void onRightScrollClick(); + + boost::signals::connection setChicletClickCallback( + const commit_callback_t& cb); + + void onChicletClick(LLUICtrl*ctrl,const LLSD¶m); + + //overrides +public: + + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE ); + + void draw(); + + BOOL postBuild(); + +protected: + LLChicletPanel(const Params&p); + friend class LLUICtrlFactory; + + bool needsScrolling(); + + bool canScrollRight(); + + bool canScrollLeft(); + + enum ScrollDirection + { + SCROLL_LEFT = 1, + SCROLL_RIGHT = -1 + }; + + void scroll(ScrollDirection direction); + + typedef std::vector chiclet_list_t; + + void removeChiclet(chiclet_list_t::iterator it); + + BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + +protected: + + chiclet_list_t mChicletList; + LLButton* mLeftScroll; + LLButton* mRightScroll; + S32 mFirstToShow; + S32 mLastToShow; + LLPanel* mScrollArea; +}; + + +class LLTalkButton : public LLUICtrl +{ +public: + + virtual ~LLTalkButton(); + + void onClick_SpeakBtn(); + void onClick_ShowBtn(); + + void draw(); + +protected: + friend class LLUICtrlFactory; + LLTalkButton(const LLUICtrl::Params& p); + +private: + LLButton* mSpeakBtn; + LLButton* mShowBtn; + LLVoiceControlPanel* mPrivateCallPanel; + LLOutputMonitorCtrl* mOutputMonitor; +}; + +#endif // LL_LLCHICLET_H diff --git a/indra/newview/llcloud.h b/indra/newview/llcloud.h index f4ae03b689..155bf4eae9 100644 --- a/indra/newview/llcloud.h +++ b/indra/newview/llcloud.h @@ -72,7 +72,7 @@ #include "v3dmath.h" #include "v4math.h" #include "v4color.h" -#include "llmemory.h" +#include "llpointer.h" #include "lldarray.h" #include "llframetimer.h" diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 5f8d9ed27b..33aaac542b 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -37,12 +37,12 @@ // Linden library includes #include "v4color.h" +#include "llwindow.h" // setCursor() // Project includes #include "llui.h" #include "llrender.h" #include "lluiconstants.h" -#include "llviewerwindow.h" #include "llviewercontrol.h" #include "llbutton.h" #include "lltextbox.h" @@ -51,60 +51,55 @@ #include "llviewerimagelist.h" #include "llfocusmgr.h" -static LLRegisterWidget r("color_swatch"); +static LLDefaultWidgetRegistry::Register r("color_swatch"); -LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, - void (*commit_callback)(LLUICtrl* ctrl, void* userdata), - void* userdata ) -: LLUICtrl(name, rect, TRUE, commit_callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), - mValid( TRUE ), - mColor( color ), - mBorderColor( gColors.getColor("DefaultHighlightLight") ), - mCanApplyImmediately(FALSE), - mOnCancelCallback(NULL), - mOnSelectCallback(NULL) +LLColorSwatchCtrl::Params::Params() +: color("color", LLColor4::white), + can_apply_immediately("can_apply_immediately", false), + alpha_background_image("alpha_background_image"), + border_color("border_color"), + label_width("label_width", -1), + caption_text("caption_text"), + border("border") { - mCaption = new LLTextBox( name, - LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), - name, - LLFontGL::getFontSansSerifSmall() ); - mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); - addChild( mCaption ); - - // Scalable UI made this off-by-one, I don't know why. JC - LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); - border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); - addChild(mBorder); - - mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); + name = "colorswatch"; } -LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color, - void (*commit_callback)(LLUICtrl* ctrl, void* userdata), - void* userdata ) -: LLUICtrl(name, rect, TRUE, commit_callback, userdata, FOLLOWS_LEFT | FOLLOWS_TOP), +LLColorSwatchCtrl::LLColorSwatchCtrl(const Params& p) +: LLUICtrl(p), mValid( TRUE ), - mColor( color ), - mBorderColor( gColors.getColor("DefaultHighlightLight") ), - mCanApplyImmediately(FALSE), - mOnCancelCallback(NULL), - mOnSelectCallback(NULL) -{ - mCaption = new LLTextBox( label, - LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), - label, - LLFontGL::getFontSansSerifSmall() ); - mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); + mColor(p.color), + mCanApplyImmediately(p.can_apply_immediately), + mAlphaGradientImage(p.alpha_background_image), + mOnCancelCallback(p.cancel_callback()), + mOnSelectCallback(p.select_callback()), + mBorderColor(p.border_color()), + mLabelWidth(p.label_width) +{ + LLTextBox::Params tp = p.caption_text; + // label_width is specified, not -1 + if(mLabelWidth!= -1) + { + tp.rect(LLRect( 0, BTN_HEIGHT_SMALL, mLabelWidth, 0 )); + } + else + { + tp.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 )); + } + + tp.text(p.label); + mCaption = LLUICtrlFactory::create(tp); addChild( mCaption ); - // Scalable UI made this off-by-one, I don't know why. JC - LLRect border_rect(0, getRect().getHeight()-1, getRect().getWidth()-1, 0); + LLRect border_rect = getLocalRect(); + border_rect.mTop -= 1; + border_rect.mRight -=1; border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); - addChild(mBorder); - mAlphaGradientImage = LLUI::getUIImage("color_swatch_alpha.tga"); + LLViewBorder::Params params = p.border; + params.rect(border_rect); + mBorder = LLUICtrlFactory::create (params); + addChild(mBorder); } LLColorSwatchCtrl::~LLColorSwatchCtrl () @@ -114,9 +109,8 @@ LLColorSwatchCtrl::~LLColorSwatchCtrl () if (pickerp) { pickerp->cancelSelection(); - pickerp->close(); + pickerp->closeFloater(); } - mAlphaGradientImage = NULL; } BOOL LLColorSwatchCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) @@ -206,7 +200,7 @@ void LLColorSwatchCtrl::draw() mBorder->setKeyboardFocusHighlight(hasFocus()); // Draw border LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); - gl_rect_2d( border, mBorderColor, FALSE ); + gl_rect_2d( border, mBorderColor.get(), FALSE ); LLRect interior = border; interior.stretch( -1 ); @@ -264,7 +258,7 @@ void LLColorSwatchCtrl::setEnabled( BOOL enabled ) if (pickerp) { pickerp->cancelSelection(); - pickerp->close(); + pickerp->closeFloater(); } } } @@ -295,11 +289,11 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) if (pick_op == COLOR_CANCEL && subject->mOnCancelCallback) { - subject->mOnCancelCallback(subject, subject->mCallbackUserData); + subject->mOnCancelCallback( subject, LLSD()); } else if (pick_op == COLOR_SELECT && subject->mOnSelectCallback) { - subject->mOnSelectCallback(subject, subject->mCallbackUserData); + subject->mOnSelectCallback( subject, LLSD() ); } else { @@ -343,59 +337,3 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus) } } -// virtual -LLXMLNodePtr LLColorSwatchCtrl::getXML(bool save_children) const -{ - LLXMLNodePtr node = LLUICtrl::getXML(); - - node->createChild("color", TRUE)->setFloatValue(4, mColor.mV); - - node->createChild("border_color", TRUE)->setFloatValue(4, mBorderColor.mV); - - if (mCaption) - { - node->createChild("label", TRUE)->setStringValue(mCaption->getText()); - } - - node->createChild("can_apply_immediately", TRUE)->setBoolValue(mCanApplyImmediately); - - return node; -} - -LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("colorswatch"); - node->getAttributeString("name", name); - - std::string label; - node->getAttributeString("label", label); - - LLColor4 color(1.f, 1.f, 1.f, 1.f); - node->getAttributeColor("initial_color", color); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - BOOL can_apply_immediately = FALSE; - node->getAttributeBOOL("can_apply_immediately", can_apply_immediately); - - LLUICtrlCallback callback = NULL; - - if (label.empty()) - { - label.assign(node->getValue()); - } - - LLColorSwatchCtrl* color_swatch = new LLColorSwatchCtrl( - name, - rect, - label, - color, - callback, - NULL ); - - color_swatch->setCanApplyImmediately(can_apply_immediately); - color_swatch->initFromXML(node, parent); - - return color_swatch; -} diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index 0dd021f51f..a05926c2f5 100644 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -37,6 +37,7 @@ #include "v4color.h" #include "llfloater.h" #include "llviewerimage.h" +#include "lltextbox.h" // // Classes @@ -57,53 +58,65 @@ public: COLOR_CANCEL } EColorPickOp; - LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata); - LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata); + struct Params : public LLInitParam::Block + { + Optional color; + Optional can_apply_immediately; + Optional alpha_background_image; + Optional cancel_callback; + Optional select_callback; + Optional border_color; + Optional label_width; + + Optional caption_text; + Optional border; + Params(); + }; +protected: + LLColorSwatchCtrl(const Params& p); + friend class LLUICtrlFactory; +public: ~LLColorSwatchCtrl (); - virtual void setValue(const LLSD& value); + /*virtual*/ void setValue(const LLSD& value); - virtual LLSD getValue() const { return mColor.getValue(); } + /*virtual*/ LLSD getValue() const { return mColor.getValue(); } const LLColor4& get() { return mColor; } void set(const LLColor4& color, BOOL update_picker = FALSE, BOOL from_event = FALSE); void setOriginal(const LLColor4& color); void setValid(BOOL valid); void setLabel(const std::string& label); + void setLabelWidth(S32 label_width) {mLabelWidth =label_width;} void setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; } - void setOnCancelCallback(LLUICtrlCallback cb) { mOnCancelCallback = cb; } - void setOnSelectCallback(LLUICtrlCallback cb) { mOnSelectCallback = cb; } + void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; } + void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; } void setFallbackImageName(const std::string& name) { mFallbackImageName = name; } void showPicker(BOOL take_focus); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x,S32 y,MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual void draw(); - virtual void setEnabled( BOOL enabled ); - virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ void draw(); + /*virtual*/ void setEnabled( BOOL enabled ); static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE ); protected: BOOL mValid; LLColor4 mColor; - LLColor4 mBorderColor; + LLUIColor mBorderColor; LLTextBox* mCaption; LLHandle mPickerHandle; LLViewBorder* mBorder; BOOL mCanApplyImmediately; - LLUICtrlCallback mOnCancelCallback; - LLUICtrlCallback mOnSelectCallback; + commit_callback_t mOnCancelCallback; + commit_callback_t mOnSelectCallback; + S32 mLabelWidth; LLPointer mAlphaGradientImage; std::string mFallbackImageName; diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 689033a07b..096777ddd4 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -46,6 +46,7 @@ #include "llassetuploadqueue.h" #include "llassetuploadresponders.h" #include "llchat.h" +#include "llfloaterreg.h" #include "llviewerwindow.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -60,23 +61,17 @@ #include "llfloaterchat.h" #include "llviewerstats.h" #include "lluictrlfactory.h" +#include "lltrans.h" #include "llselectmgr.h" +// *TODO: This should be separated into the script queue, and the floater views of that queue. +// There should only be one floater class that can view any queue type + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -// *TODO:Translate -const std::string COMPILE_QUEUE_TITLE("Recompilation Progress"); -const std::string COMPILE_START_STRING("recompile"); -const std::string RESET_QUEUE_TITLE("Reset Progress"); -const std::string RESET_START_STRING("reset"); -const std::string RUN_QUEUE_TITLE("Set Running Progress"); -const std::string RUN_START_STRING("set running"); -const std::string NOT_RUN_QUEUE_TITLE("Set Not Running Progress"); -const std::string NOT_RUN_START_STRING("set not running"); - struct LLScriptQueueData { LLUUID mQueueID; @@ -92,54 +87,26 @@ struct LLScriptQueueData /// Class LLFloaterScriptQueue ///---------------------------------------------------------------------------- -// static -LLMap LLFloaterScriptQueue::sInstances; - - // Default constructor -LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name, - const LLRect& rect, - const std::string& title, - const std::string& start_string) : - LLFloater(name, rect, title, - RESIZE_YES, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, - DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) +LLFloaterScriptQueue::LLFloaterScriptQueue(const LLSD& key) : + LLFloater(key), + mDone(FALSE) { - mID.generate(); - - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_queue.xml"); - - childSetAction("close",onCloseBtn,this); - childSetEnabled("close",FALSE); - - setTitle(title); - - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - - mStartString = start_string; - mDone = FALSE; - sInstances.addData(mID, this); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_queue.xml", FALSE); } // Destroys the object LLFloaterScriptQueue::~LLFloaterScriptQueue() { - sInstances.removeData(mID); } -// find an instance by ID. Return NULL if it does not exist. -// static -LLFloaterScriptQueue* LLFloaterScriptQueue::findInstance(const LLUUID& id) +BOOL LLFloaterScriptQueue::postBuild() { - if(sInstances.checkData(id)) - { - return sInstances.getData(id); - } - return NULL; + childSetAction("close",onCloseBtn,this); + childSetEnabled("close",FALSE); + return TRUE; } - // This is the callback method for the viewer object currently being // worked on. // NOT static, virtual! @@ -185,7 +152,7 @@ void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, void LLFloaterScriptQueue::onCloseBtn(void* user_data) { LLFloaterScriptQueue* self = (LLFloaterScriptQueue*)user_data; - self->close(); + self->closeFloater(); } void LLFloaterScriptQueue::addObject(const LLUUID& id) @@ -210,10 +177,12 @@ BOOL LLFloaterScriptQueue::start() n_objects = selectHandle->getRootObjectCount(); } - buffer = llformat("Starting %s of %d items.", mStartString.c_str(), n_objects); // *TODO: Translate + LLStringUtil::format_map_t args; + args["[START]"] = mStartString; + args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); + buffer = getString ("Starting", args); - LLScrollListCtrl* list = getChild("queue output"); - list->addCommentText(buffer); + getChild("queue output")->setCommentText(buffer); return nextObject(); } @@ -245,12 +214,8 @@ BOOL LLFloaterScriptQueue::nextObject() } while((mObjectIDs.count() > 0) && !successful_start); if(isDone() && !mDone) { - - LLScrollListCtrl* list = getChild("queue output"); - mDone = TRUE; - std::string buffer = "Done."; // *TODO: Translate - list->addCommentText(buffer); + getChild("queue output")->setCommentText(getString("Done")); childSetEnabled("close",TRUE); } return successful_start; @@ -275,7 +240,7 @@ BOOL LLFloaterScriptQueue::popNext() { llinfos << "LLFloaterScriptQueue::popNext() requesting inv for " << mCurrentObjectID << llendl; - LLUUID* id = new LLUUID(mID); + LLUUID* id = new LLUUID(getKey().asUUID()); registerVOInventoryListener(obj,id); requestVOInventory(); rv = TRUE; @@ -289,64 +254,48 @@ BOOL LLFloaterScriptQueue::popNext() /// Class LLFloaterCompileQueue ///---------------------------------------------------------------------------- -// static -LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) +class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("CompileOutputRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", rect); +public: - class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier + LLCompileFloaterUploadQueueSupplier(const LLUUID& queue_id) : + mQueueId(queue_id) { - public: - - LLCompileFloaterUploadQueueSupplier(const LLUUID& queue_id) : - mQueueId(queue_id) - { - } + } - virtual LLAssetUploadQueue* get() const + virtual LLAssetUploadQueue* get() const + { + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", LLSD(mQueueId)); + if(NULL == queue) { - LLFloaterCompileQueue* queue = - (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); - - if(NULL == queue) - { - return NULL; - } - - return queue->mUploadQueue; + return NULL; } + return queue->getUploadQueue(); + } - virtual void log(std::string message) const + virtual void log(std::string message) const + { + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", LLSD(mQueueId)); + if(NULL == queue) { - LLFloaterCompileQueue* queue = - (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); - - if(NULL == queue) - { - return; - } - - LLScrollListCtrl* list = queue->getChild("queue output"); - list->addCommentText(message.c_str()); + return; } + + queue->getChild("queue output")->setCommentText(message); + } - private: - LLUUID mQueueId; - }; - - new_queue->mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(new_queue->getID())); - new_queue->mMono = mono; - new_queue->open(); - return new_queue; -} +private: + LLUUID mQueueId; +}; -LLFloaterCompileQueue::LLFloaterCompileQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, COMPILE_QUEUE_TITLE, COMPILE_START_STRING) -{ } +LLFloaterCompileQueue::LLFloaterCompileQueue(const LLSD& key) + : LLFloaterScriptQueue(key) +{ + setTitle(LLTrans::getString("CompileQueueTitle")); + setStartString(LLTrans::getString("CompileQueueStart")); + + mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(key.asUUID())); +} LLFloaterCompileQueue::~LLFloaterCompileQueue() { @@ -391,7 +340,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, for(iter = asset_item_map.begin(); iter != asset_item_map.end(); iter++) { LLInventoryItem *itemp = iter->second; - LLScriptQueueData* datap = new LLScriptQueueData(getID(), + LLScriptQueueData* datap = new LLScriptQueueData(getKey().asUUID(), itemp->getName(), viewer_object->getID(), itemp->getUUID()); @@ -419,9 +368,12 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, { llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl; LLScriptQueueData* data = (LLScriptQueueData*)user_data; - if(!data) return; - LLFloaterCompileQueue* queue = static_cast - (LLFloaterScriptQueue::findInstance(data->mQueueID)); + if(!data) + { + return; + } + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", data->mQueueID); + std::string buffer; if(queue && (0 == status)) { @@ -447,13 +399,13 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, file.read(script_data, script_size); queue->mUploadQueue->queue(filename, data->mTaskId, - data->mItemId, is_running, queue->mMono, queue->getID(), - script_data, script_size, data->mScriptName); + data->mItemId, is_running, queue->mMono, queue->getKey().asUUID(), + script_data, script_size, data->mScriptName); } else { // It's now in the file, now compile it. - buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate + buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName; // Write script to local file for compilation. LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ @@ -492,19 +444,19 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { - LLChat chat(std::string("Script not found on server.")); // *TODO: Translate + LLChat chat(LLTrans::getString("CompileQueueScriptNotFound")); LLFloaterChat::addChat(chat); - buffer = std::string("Problem downloading: ") + data->mScriptName; // *TODO: Translate + buffer = LLTrans::getString("CompileQueueProblemDownloading") + (": ") + data->mScriptName; } else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) { - LLChat chat(std::string("Insufficient permissions to download a script.")); // *TODO: Translate + LLChat chat(LLTrans::getString("CompileQueueInsufficientPermDownload")); LLFloaterChat::addChat(chat); - buffer = std::string("Insufficient permissions for: ") + data->mScriptName; // *TODO: Translate + buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + (": ") + data->mScriptName; } else { - buffer = std::string("Unknown failure to download ") + data->mScriptName; // *TODO: Translate + buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mScriptName; } llwarns << "Problem downloading script asset." << llendl; @@ -512,8 +464,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } if(queue && (buffer.size() > 0)) { - LLScrollListCtrl* list = queue->getChild("queue output"); - list->addCommentText(buffer); + queue->getChild("queue output")->setCommentText(buffer); } delete data; } @@ -536,8 +487,7 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* { llinfos << "LLFloaterCompileQueue::onSaveBytecodeComplete()" << llendl; LLCompileQueueData* data = (LLCompileQueueData*)user_data; - LLFloaterCompileQueue* queue = static_cast - (LLFloaterScriptQueue::findInstance(data->mQueueID)); + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", data->mQueueID); if(queue && (0 == status) && data) { queue->saveItemByItemID(data->mItemId); @@ -587,7 +537,7 @@ void LLFloaterCompileQueue::compile(const std::string& filename, llinfos << "compile successful." << llendl; // Save LSL bytecode - LLCompileQueueData* data = new LLCompileQueueData(mID, item_id); + LLCompileQueueData* data = new LLCompileQueueData(getKey().asUUID(), item_id); gAssetStorage->storeAssetData(dst_filename, new_asset_id, LLAssetType::AT_LSL_BYTECODE, &LLFloaterCompileQueue::onSaveBytecodeComplete, @@ -656,23 +606,13 @@ void LLFloaterCompileQueue::saveItemByItemID(const LLUUID& asset_id) /// Class LLFloaterResetQueue ///---------------------------------------------------------------------------- -// static -LLFloaterResetQueue* LLFloaterResetQueue::create() +LLFloaterResetQueue::LLFloaterResetQueue(const LLSD& key) + : LLFloaterScriptQueue(key) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("CompileOutputRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterResetQueue* new_queue = new LLFloaterResetQueue("queue", rect); - gFloaterView->addChild(new_queue); - new_queue->open(); - return new_queue; + setTitle(LLTrans::getString("ResetQueueTitle")); + setStartString(LLTrans::getString("ResetQueueStart")); } -LLFloaterResetQueue::LLFloaterResetQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, RESET_QUEUE_TITLE, RESET_START_STRING) -{ } - LLFloaterResetQueue::~LLFloaterResetQueue() { } @@ -695,10 +635,9 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = getChild("queue output"); std::string buffer; - buffer = std::string("Resetting: ") + item->getName(); // *TODO: Translate - list->addCommentText(buffer); + buffer = getString("Resetting") + (": ") + item->getName(); + getChild("queue output")->setCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ScriptReset); msg->nextBlockFast(_PREHASH_AgentData); @@ -719,22 +658,13 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, /// Class LLFloaterRunQueue ///---------------------------------------------------------------------------- -// static -LLFloaterRunQueue* LLFloaterRunQueue::create() +LLFloaterRunQueue::LLFloaterRunQueue(const LLSD& key) + : LLFloaterScriptQueue(key) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("CompileOutputRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterRunQueue* new_queue = new LLFloaterRunQueue("queue", rect); - new_queue->open(); /*Flawfinder: ignore*/ - return new_queue; + setTitle(LLTrans::getString("RunQueueTitle")); + setStartString(LLTrans::getString("RunQueueStart")); } -LLFloaterRunQueue::LLFloaterRunQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, RUN_QUEUE_TITLE, RUN_START_STRING) -{ } - LLFloaterRunQueue::~LLFloaterRunQueue() { } @@ -759,8 +689,8 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild("queue output"); std::string buffer; - buffer = std::string("Running: ") + item->getName(); // *TODO: Translate - list->addCommentText(buffer); + buffer = getString("Running") + (": ") + item->getName(); + list->setCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetScriptRunning); @@ -783,22 +713,13 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, /// Class LLFloaterNotRunQueue ///---------------------------------------------------------------------------- -// static -LLFloaterNotRunQueue* LLFloaterNotRunQueue::create() +LLFloaterNotRunQueue::LLFloaterNotRunQueue(const LLSD& key) + : LLFloaterScriptQueue(key) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("CompileOutputRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLFloaterNotRunQueue* new_queue = new LLFloaterNotRunQueue("queue", rect); - new_queue->open(); /*Flawfinder: ignore*/ - return new_queue; + setTitle(LLTrans::getString("NotRunQueueTitle")); + setStartString(LLTrans::getString("NotRunQueueStart")); } -LLFloaterNotRunQueue::LLFloaterNotRunQueue(const std::string& name, const LLRect& rect) -: LLFloaterScriptQueue(name, rect, NOT_RUN_QUEUE_TITLE, NOT_RUN_START_STRING) -{ } - LLFloaterNotRunQueue::~LLFloaterNotRunQueue() { } @@ -823,8 +744,8 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); LLScrollListCtrl* list = getChild("queue output"); std::string buffer; - buffer = std::string("Not running: ") +item->getName(); // *TODO: Translate - list->addCommentText(buffer); + buffer = getString("NotRunning") + (": ") +item->getName(); + list->setCommentText(buffer); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetScriptRunning); diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 51240423ba..063d573239 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -59,20 +59,20 @@ class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener { public: + LLFloaterScriptQueue(const LLSD& key); + virtual ~LLFloaterScriptQueue(); + + /*virtual*/ BOOL postBuild(); + + void setMono(bool mono) { mMono = mono; } + // addObject() accepts an object id. void addObject(const LLUUID& id); // start() returns TRUE if the queue has started, otherwise FALSE. BOOL start(); - - // find an instance by ID. Return NULL if it does not exist. - static LLFloaterScriptQueue* findInstance(const LLUUID& id); - + protected: - LLFloaterScriptQueue(const std::string& name, const LLRect& rect, - const std::string& title, const std::string& start_string); - virtual ~LLFloaterScriptQueue(); - // This is the callback method for the viewer object currently // being worked on. /*virtual*/ void inventoryChanged(LLViewerObject* obj, @@ -94,8 +94,7 @@ protected: BOOL nextObject(); BOOL popNext(); - // Get this instances ID. - const LLUUID& getID() const { return mID; } + void setStartString(const std::string& s) { mStartString = s; } protected: // UI @@ -107,10 +106,8 @@ protected: LLUUID mCurrentObjectID; BOOL mDone; - LLUUID mID; - static LLMap sInstances; - std::string mStartString; + BOOL mMono; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -131,20 +128,19 @@ class LLAssetUploadQueue; class LLFloaterCompileQueue : public LLFloaterScriptQueue { + friend class LLFloaterReg; public: - // Use this method to create a compile queue. Once created, it - // will be responsible for it's own destruction. - static LLFloaterCompileQueue* create(BOOL mono); - static void onSaveBytecodeComplete(const LLUUID& asset_id, void* user_data, S32 status); // remove any object in mScriptScripts with the matching uuid. void removeItemByItemID(const LLUUID& item_id); + + LLAssetUploadQueue* getUploadQueue() { return mUploadQueue; } protected: - LLFloaterCompileQueue(const std::string& name, const LLRect& rect); + LLFloaterCompileQueue(const LLSD& key); virtual ~LLFloaterCompileQueue(); // This is called by inventoryChanged @@ -173,12 +169,11 @@ protected: // find InventoryItem given item id. const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const; - + protected: LLViewerInventoryItem::item_array_t mCurrentScripts; private: - BOOL mMono; // Compile to mono. LLAssetUploadQueue* mUploadQueue; }; @@ -190,20 +185,14 @@ private: class LLFloaterResetQueue : public LLFloaterScriptQueue { -public: - // Use this method to create a reset queue. Once created, it - // will be responsible for it's own destruction. - static LLFloaterResetQueue* create(); - + friend class LLFloaterReg; protected: - LLFloaterResetQueue(const std::string& name, const LLRect& rect); + LLFloaterResetQueue(const LLSD& key); virtual ~LLFloaterResetQueue(); // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv); - -protected: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -214,20 +203,14 @@ protected: class LLFloaterRunQueue : public LLFloaterScriptQueue { -public: - // Use this method to create a run queue. Once created, it - // will be responsible for it's own destruction. - static LLFloaterRunQueue* create(); - + friend class LLFloaterReg; protected: - LLFloaterRunQueue(const std::string& name, const LLRect& rect); + LLFloaterRunQueue(const LLSD& key); virtual ~LLFloaterRunQueue(); // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv); - -protected: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -238,20 +221,14 @@ protected: class LLFloaterNotRunQueue : public LLFloaterScriptQueue { -public: - // Use this method to create a not run queue. Once created, it - // will be responsible for it's own destruction. - static LLFloaterNotRunQueue* create(); - + friend class LLFloaterReg; protected: - LLFloaterNotRunQueue(const std::string& name, const LLRect& rect); + LLFloaterNotRunQueue(const LLSD& key); virtual ~LLFloaterNotRunQueue(); // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv); - -protected: }; #endif // LL_LLCOMPILEQUEUE_H diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp index 86821249a0..9957694727 100644 --- a/indra/newview/llcurrencyuimanager.cpp +++ b/indra/newview/llcurrencyuimanager.cpp @@ -46,6 +46,7 @@ #include "llviewchildren.h" #include "llxmlrpctransaction.h" #include "llviewernetwork.h" +#include "llpanel.h" const F64 CURRENCY_ESTIMATE_FREQUENCY = 2.0; @@ -356,8 +357,7 @@ void LLCurrencyUIManager::Impl::prepare() if (lindenAmount) { lindenAmount->setPrevalidate(LLLineEditor::prevalidateNonNegativeS32); - lindenAmount->setKeystrokeCallback(onCurrencyKey); - lindenAmount->setCallbackUserData(this); + lindenAmount->setKeystrokeCallback(onCurrencyKey, this); } } diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index 4188ecc0e2..9eee3b239c 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -50,32 +50,69 @@ std::map LLDebugVarMessageBox::sInstances; LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) : - LLFloater(std::string("msg box"), LLRect(10,160,400,10), title), + LLFloater(), mVarType(var_type), mVarData(var), mAnimate(FALSE) { + setRect(LLRect(10,160,400,10)); + + LLSliderCtrl::Params slider_p; + slider_p.label(title); + slider_p.label_width(70); + slider_p.text_width(40); + slider_p.can_edit_text(true); + slider_p.show_text(true); + + mSlider1 = NULL; + mSlider2 = NULL; + mSlider3 = NULL; + switch(var_type) { case VAR_TYPE_F32: - mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, *((F32*)var), -100.f, 100.f, 0.1f, LLStringUtil::null); - mSlider1->setPrecision(3); + slider_p.name("slider 1"); + slider_p.rect(LLRect(20,130,190,110)); + slider_p.initial_value(*((F32*)var)); + slider_p.min_value(-100.f); + slider_p.max_value(100.f); + slider_p.increment(0.1f); + slider_p.decimal_digits(3); + mSlider1 = LLUICtrlFactory::create(slider_p); addChild(mSlider1); - mSlider2 = NULL; - mSlider3 = NULL; break; case VAR_TYPE_S32: - mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,100,190,80), title, NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, (F32)*((S32*)var), -255.f, 255.f, 1.f, LLStringUtil::null); - mSlider1->setPrecision(0); + slider_p.name("slider 1"); + slider_p.rect(LLRect(20,100,190,80)); + slider_p.initial_value((F32)*((S32*)var)); + slider_p.min_value(-255.f); + slider_p.max_value(255.f); + slider_p.increment(1.f); + slider_p.decimal_digits(0); + mSlider1 = LLUICtrlFactory::create(slider_p); addChild(mSlider1); - mSlider2 = NULL; - mSlider3 = NULL; break; case VAR_TYPE_VEC3: - mSlider1 = new LLSliderCtrl(std::string("slider 1"), LLRect(20,130,190,110), std::string("x: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VX], -100.f, 100.f, 0.1f, LLStringUtil::null); - mSlider1->setPrecision(3); - mSlider2 = new LLSliderCtrl(std::string("slider 2"), LLRect(20,100,190,80), std::string("y: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VY], -100.f, 100.f, 0.1f, LLStringUtil::null); - mSlider2->setPrecision(3); - mSlider3 = new LLSliderCtrl(std::string("slider 3"), LLRect(20,70,190,50), std::string("z: "), NULL, 70, 130, TRUE, TRUE, FALSE, NULL, NULL, ((LLVector3*)var)->mV[VZ], -100.f, 100.f, 0.1f, LLStringUtil::null); - mSlider3->setPrecision(3); + slider_p.name("slider 1"); + slider_p.label("x: "); + slider_p.rect(LLRect(20,130,190,110)); + slider_p.initial_value(((LLVector3*)var)->mV[VX]); + slider_p.min_value(-100.f); + slider_p.max_value(100.f); + slider_p.increment(0.1f); + slider_p.decimal_digits(3); + mSlider1 = LLUICtrlFactory::create(slider_p); + + slider_p.name("slider 2"); + slider_p.label("y: "); + slider_p.rect(LLRect(20,100,190,80)); + slider_p.initial_value(((LLVector3*)var)->mV[VY]); + mSlider2 = LLUICtrlFactory::create(slider_p); + + slider_p.name("slider 3"); + slider_p.label("z: "); + slider_p.rect(LLRect(20,70,190,50)); + slider_p.initial_value(((LLVector3*)var)->mV[VZ]); + mSlider2 = LLUICtrlFactory::create(slider_p); + addChild(mSlider1); addChild(mSlider2); addChild(mSlider3); @@ -85,10 +122,18 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy break; } - mAnimateButton = new LLButton(std::string("Animate"), LLRect(20, 45, 180, 25), LLStringUtil::null, onAnimateClicked, this); + LLButton::Params p; + p.name(std::string("Animate")); + p.rect(LLRect(20, 45, 180, 25)); + p.click_callback.function(boost::bind(&LLDebugVarMessageBox::onAnimateClicked, this, _2)); + mAnimateButton = LLUICtrlFactory::create(p); addChild(mAnimateButton); - mText = new LLTextBox(std::string("value"), LLRect(20,20,190,0)); + LLTextBox::Params params; + params.name("value"); + params.text(params.name); + params.rect(LLRect(20,20,190,0)); + mText = LLUICtrlFactory::create (params); addChild(mText); //disable hitting enter closes dialog @@ -112,8 +157,7 @@ void LLDebugVarMessageBox::show(const std::string& title, F32 *var, F32 max_valu { box->mSlider1->setValue(*var); } - box->mSlider1->setCommitCallback(slider_changed); - box->mSlider1->setCallbackUserData(box); + box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2)); #endif } @@ -129,8 +173,7 @@ void LLDebugVarMessageBox::show(const std::string& title, S32 *var, S32 max_valu { box->mSlider1->setValue((F32)*var); } - box->mSlider1->setCommitCallback(slider_changed); - box->mSlider1->setCallbackUserData(box); + box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2)); #endif } @@ -142,20 +185,17 @@ void LLDebugVarMessageBox::show(const std::string& title, LLVector3 *var, LLVect box->mSlider1->setMaxValue(max_value.mV[VX]); box->mSlider1->setMinValue(-max_value.mV[VX]); box->mSlider1->setIncrement(increment.mV[VX]); - box->mSlider1->setCommitCallback(slider_changed); - box->mSlider1->setCallbackUserData(box); + box->mSlider1->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2)); box->mSlider2->setMaxValue(max_value.mV[VX]); box->mSlider2->setMinValue(-max_value.mV[VX]); box->mSlider2->setIncrement(increment.mV[VX]); - box->mSlider2->setCommitCallback(slider_changed); - box->mSlider2->setCallbackUserData(box); + box->mSlider2->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2)); box->mSlider3->setMaxValue(max_value.mV[VX]); box->mSlider3->setMinValue(-max_value.mV[VX]); box->mSlider3->setIncrement(increment.mV[VX]); - box->mSlider3->setCommitCallback(slider_changed); - box->mSlider3->setCallbackUserData(box); + box->mSlider3->setCommitCallback(boost::bind(&LLDebugVarMessageBox::sliderChanged, box, _2)); #endif } @@ -170,45 +210,44 @@ LLDebugVarMessageBox* LLDebugVarMessageBox::show(const std::string& title, EDebu sInstances[title_string] = box; gFloaterView->addChild(box); box->reshape(200,150); - box->open(); /*Flawfinder: ignore*/ + box->openFloater(); box->mTitle = title_string; } return box; } -void LLDebugVarMessageBox::slider_changed(LLUICtrl* ctrl, void* user_data) +void LLDebugVarMessageBox::sliderChanged(const LLSD& data) { - LLDebugVarMessageBox *msg_box = (LLDebugVarMessageBox*)user_data; - if (!msg_box || !msg_box->mVarData) return; + if (!mVarData) + return; - switch(msg_box->mVarType) + switch(mVarType) { case VAR_TYPE_F32: - *((F32*)msg_box->mVarData) = (F32)msg_box->mSlider1->getValue().asReal(); + *((F32*)mVarData) = (F32)mSlider1->getValue().asReal(); break; case VAR_TYPE_S32: - *((S32*)msg_box->mVarData) = (S32)msg_box->mSlider1->getValue().asInteger(); + *((S32*)mVarData) = (S32)mSlider1->getValue().asInteger(); break; case VAR_TYPE_VEC3: { - LLVector3* vec_p = (LLVector3*)msg_box->mVarData; - vec_p->setVec((F32)msg_box->mSlider1->getValue().asReal(), - (F32)msg_box->mSlider2->getValue().asReal(), - (F32)msg_box->mSlider3->getValue().asReal()); + LLVector3* vec_p = (LLVector3*)mVarData; + vec_p->setVec((F32)mSlider1->getValue().asReal(), + (F32)mSlider2->getValue().asReal(), + (F32)mSlider3->getValue().asReal()); break; } default: - llwarns << "Unhandled var type " << msg_box->mVarType << llendl; + llwarns << "Unhandled var type " << mVarType << llendl; break; } } -void LLDebugVarMessageBox::onAnimateClicked(void* user_data) +void LLDebugVarMessageBox::onAnimateClicked(const LLSD& data) { - LLDebugVarMessageBox* msg_boxp = (LLDebugVarMessageBox*)user_data; - msg_boxp->mAnimate = !msg_boxp->mAnimate; - msg_boxp->mAnimateButton->setToggleState(msg_boxp->mAnimate); + mAnimate = !mAnimate; + mAnimateButton->setToggleState(mAnimate); } void LLDebugVarMessageBox::onClose(bool app_quitting) @@ -245,16 +284,16 @@ void LLDebugVarMessageBox::draw() { F32 animated_val = clamp_rescale(fmodf((F32)LLFrameTimer::getElapsedSeconds() / 5.f, 1.f), 0.f, 1.f, 0.f, mSlider1->getMaxValue()); mSlider1->setValue(animated_val); - slider_changed(mSlider1, this); + sliderChanged(LLSD()); if (mSlider2) { mSlider2->setValue(animated_val); - slider_changed(mSlider2, this); + sliderChanged(LLSD()); } if (mSlider3) { mSlider3->setValue(animated_val); - slider_changed(mSlider3, this); + sliderChanged(LLSD()); } } } diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h index 07062218ac..76e128cfc1 100644 --- a/indra/newview/lldebugmessagebox.h +++ b/indra/newview/lldebugmessagebox.h @@ -66,8 +66,8 @@ protected: ~LLDebugVarMessageBox(); static LLDebugVarMessageBox* show(const std::string& title, EDebugVarType var_type, void *var); - static void slider_changed(LLUICtrl* ctrl, void* user_data); - static void onAnimateClicked(void* user_data); + void sliderChanged(const LLSD& data); + void onAnimateClicked(const LLSD& data); public: static void show(const std::string& title, F32 *var, F32 max_value = 100.f, F32 increment = 0.1f); diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 40f5202067..bd5b9c30a2 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -35,16 +35,16 @@ #include "lldebugview.h" // library includes -#include "llframestatview.h" #include "llfasttimerview.h" #include "llmemoryview.h" #include "llconsole.h" #include "lltextureview.h" #include "llresmgr.h" #include "imageids.h" -#include "llvelocitybar.h" +#include "llviewercontrol.h" #include "llviewerwindow.h" -#include "llfloaterstats.h" +#include "llappviewer.h" +#include "llmemoryview.h" // // Globals @@ -56,57 +56,52 @@ LLDebugView* gDebugView = NULL; // Methods // -LLDebugView::LLDebugView(const std::string& name, const LLRect &rect) -: LLView(name, rect, FALSE) +LLDebugView::LLDebugView(const LLDebugView::Params& p) +: LLView(p) { LLRect r; + LLRect rect(p.rect); r.set(10, rect.getHeight() - 100, rect.getWidth()/2, 100); - mDebugConsolep = new LLConsole("debug console", 20, r, -1, 0.f ); - mDebugConsolep->setFollowsBottom(); - mDebugConsolep->setFollowsLeft(); - mDebugConsolep->setVisible( FALSE ); + LLConsole::Params cp; + cp.name("debug console"); + cp.max_lines(20); + cp.rect(r); + cp.font(LLFontGL::getFontMonospace()); + cp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_LEFT); + cp.visible(false); + mDebugConsolep = LLUICtrlFactory::create(cp); addChild(mDebugConsolep); r.set(150 - 25, rect.getHeight() - 50, rect.getWidth()/2 - 25, rect.getHeight() - 450); - mFrameStatView = new LLFrameStatView("frame stat", r); - mFrameStatView->setFollowsTop(); - mFrameStatView->setFollowsLeft(); - mFrameStatView->setVisible(FALSE); // start invisible - addChild(mFrameStatView); r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f)); - mFastTimerView = new LLFastTimerView("fast timers", r); + mFastTimerView = new LLFastTimerView(r); mFastTimerView->setFollowsTop(); mFastTimerView->setFollowsLeft(); mFastTimerView->setVisible(FALSE); // start invisible addChild(mFastTimerView); - r.set(25, rect.getHeight() - 50, rect.getWidth()/2, rect.getHeight() - 450); - mMemoryView = new LLMemoryView("memory", r); - mMemoryView->setFollowsTop(); - mMemoryView->setFollowsLeft(); - mMemoryView->setVisible(FALSE); // start invisible + r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), + (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f)); + LLMemoryView::Params mp; + mp.name("memory"); + mp.rect(r); + mp.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); + mp.visible(false); + mMemoryView = LLUICtrlFactory::create(mp); addChild(mMemoryView); r.set(150, rect.getHeight() - 50, 820, 100); - gTextureView = new LLTextureView("gTextureView", r); - gTextureView->setRect(r); - gTextureView->setFollowsBottom(); - gTextureView->setFollowsLeft(); + LLTextureView::Params tvp; + tvp.name("gTextureView"); + tvp.rect(r); + tvp.follows.flags(FOLLOWS_BOTTOM|FOLLOWS_LEFT); + tvp.visible(false); + gTextureView = LLUICtrlFactory::create(tvp); addChild(gTextureView); //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); - - const S32 VELOCITY_LEFT = 10; // 370; - const S32 VELOCITY_WIDTH = 500; - const S32 VELOCITY_TOP = 140; - const S32 VELOCITY_HEIGHT = 45; - r.setLeftTopAndSize( VELOCITY_LEFT, VELOCITY_TOP, VELOCITY_WIDTH, VELOCITY_HEIGHT ); - gVelocityBar = new LLVelocityBar("Velocity Bar", r); - gVelocityBar->setFollowsBottom(); - gVelocityBar->setFollowsLeft(); - addChild(gVelocityBar); } diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h index 189efd3a3f..9cf2a59a0a 100644 --- a/indra/newview/lldebugview.h +++ b/indra/newview/lldebugview.h @@ -40,9 +40,7 @@ // declarations class LLButton; -class LLToolView; class LLStatusPanel; -class LLFrameStatView; class LLFastTimerView; class LLMemoryView; class LLConsole; @@ -52,10 +50,18 @@ class LLFloaterStats; class LLDebugView : public LLView { public: - LLDebugView(const std::string& name, const LLRect &rect); + struct Params : public LLInitParam::Block + { + Params() + { + mouse_opaque = false; + } + }; + LLDebugView(const Params&); ~LLDebugView(); - LLFrameStatView* mFrameStatView; + void setStatsVisible(BOOL visible); + LLFastTimerView* mFastTimerView; LLMemoryView* mMemoryView; LLConsole* mDebugConsolep; diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index 8b0ed39eb0..a720dc46b5 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -40,6 +40,7 @@ #include "lldir.h" #include "llframetimer.h" #include "lltrans.h" +#include "llwindow.h" // beforeDialog() #if LL_LINUX || LL_SOLARIS # include "llfilepicker.h" diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index f5a66a3a78..f3ef0753e7 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -46,7 +46,6 @@ #include "llmemtype.h" #include "llprimitive.h" #include "lldarray.h" -#include "llstat.h" #include "llviewerobject.h" #include "llrect.h" #include "llappviewer.h" // for gFrameTimeSeconds @@ -151,7 +150,7 @@ public: void updateTexture(); void updateMaterial(); - virtual void updateDistance(LLCamera& camera); + virtual void updateDistance(LLCamera& camera, bool force_update); BOOL updateGeometry(BOOL priority); void updateFaceSize(S32 idx); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 80c7d73e6a..51f4bbac5c 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -95,11 +95,9 @@ static BOOL sRenderingSkinned = FALSE; S32 normal_channel = -1; S32 specular_channel = -1; -LLDrawPoolAvatar::LLDrawPoolAvatar() : -LLFacePool(POOL_AVATAR) +LLDrawPoolAvatar::LLDrawPoolAvatar() : + LLFacePool(POOL_AVATAR) { - //LLDebugVarMessageBox::show("acceleration", &CLOTHING_ACCEL_FORCE_FACTOR, 10.f, 0.1f); - //LLDebugVarMessageBox::show("gravity", &CLOTHING_GRAVITY_EFFECT, 10.f, 0.1f); } //----------------------------------------------------------------------------- @@ -110,7 +108,6 @@ LLDrawPool *LLDrawPoolAvatar::instancePool() return new LLDrawPoolAvatar(); } -BOOL gRenderAvatar = TRUE; S32 LLDrawPoolAvatar::getVertexShaderLevel() const { @@ -288,10 +285,6 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass) void LLDrawPoolAvatar::renderShadow(S32 pass) { LLFastTimer t(LLFastTimer::FTM_SHADOW_AVATAR); - if (!gRenderAvatar) - { - return; - } if (mDrawFace.empty()) { @@ -609,13 +602,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - - - if (!gRenderAvatar) - { - return; - } - if (mDrawFace.empty() && !single_avatar) { return; @@ -761,10 +747,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) //----------------------------------------------------------------------------- void LLDrawPoolAvatar::renderForSelect() { - if (!gRenderAvatar) - { - return; - } + if (mDrawFace.empty()) { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index b11dcc1608..ed6e55b7bc 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -127,9 +127,9 @@ void LLStandardBumpmap::restoreGL() { // *NOTE: This buffer size is hard coded into scanf() below. char label[2048] = ""; /* Flawfinder: ignore */ - char bump_file[2048] = ""; /* Flawfinder: ignore */ + char bump_image_id[2048] = ""; /* Flawfinder: ignore */ fields_read = fscanf( /* Flawfinder: ignore */ - file, "\n%2047s %2047s", label, bump_file); + file, "\n%2047s %2047s", label, bump_image_id); if( EOF == fields_read ) { break; @@ -140,10 +140,10 @@ void LLStandardBumpmap::restoreGL() return; } -// llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl; +// llinfos << "Loading bumpmap: " << bump_image_id << " from viewerart" << llendl; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = - gImageList.getImageFromFile(bump_file, + gImageList.getImage(LLUUID(bump_image_id), TRUE, FALSE, 0, diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index 7f21adcc94..a9e0948ecf 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -43,7 +43,6 @@ #include "llviewercamera.h" #include "llviewerimagelist.h" #include "llviewerregion.h" -#include "llviewerwindow.h" #include "llvosky.h" #include "llworld.h" // To get water height #include "pipeline.h" @@ -61,8 +60,8 @@ LLDrawPool *LLDrawPoolSky::instancePool() void LLDrawPoolSky::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); -// gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable); + mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); + gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable); } void LLDrawPoolSky::render(S32 pass) @@ -97,7 +96,6 @@ void LLDrawPoolSky::render(S32 pass) } - LLVOSky *voskyp = gSky.mVOSkyp; LLGLSPipelineSkyBox gls_skybox; LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); @@ -120,43 +118,9 @@ void LLDrawPoolSky::render(S32 pass) { renderSkyCubeFace(i); } - - LLFace *hbfaces[3]; - hbfaces[0] = NULL; - hbfaces[1] = NULL; - hbfaces[2] = NULL; - for (S32 curr_face = 0; curr_face < face_count; curr_face++) - { - LLFace* facep = mDrawFace[curr_face]; - if (voskyp->isSameFace(LLVOSky::FACE_SUN, facep)) - { - hbfaces[0] = facep; - } - if (voskyp->isSameFace(LLVOSky::FACE_MOON, facep)) - { - hbfaces[1] = facep; - } - if (voskyp->isSameFace(LLVOSky::FACE_BLOOM, facep)) - { - hbfaces[2] = facep; - } - } LLGLEnable blend(GL_BLEND); - if (hbfaces[2]) - { - // renderSunHalo(hbfaces[2]); - } - if (hbfaces[0]) - { - // renderHeavenlyBody(0, hbfaces[0]); - } - if (hbfaces[1]) - { - // renderHeavenlyBody(1, hbfaces[1]); - } - glPopMatrix(); } @@ -181,35 +145,6 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side) } } -void LLDrawPoolSky::renderHeavenlyBody(U8 hb, LLFace* face) -{ - if ( !mHB[hb]->getDraw() ) return; - if (! face->getGeomCount()) return; - - LLImageGL* tex = face->getTexture(); - gGL.getTexUnit(0)->bind(tex); - LLColor4 color(mHB[hb]->getInterpColor()); - LLOverrideFaceColor override(this, color); - face->renderIndexed(); -} - - - -void LLDrawPoolSky::renderSunHalo(LLFace* face) -{ - if (! mHB[0]->getDraw()) return; - if (! face->getGeomCount()) return; - - LLImageGL* tex = face->getTexture(); - gGL.getTexUnit(0)->bind(tex); - LLColor4 color(mHB[0]->getInterpColor()); - color.mV[3] = llclamp(mHB[0]->getHaloBrighness(), 0.f, 1.f); - - LLOverrideFaceColor override(this, color); - face->renderIndexed(); -} - - void LLDrawPoolSky::renderForSelect() { } diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 2f2b07232a..22634d96b0 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -37,7 +37,6 @@ #include "lldrawable.h" #include "llface.h" #include "llsky.h" -#include "llviewerwindow.h" #include "llvotree.h" #include "pipeline.h" #include "llviewercamera.h" diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index ce3425dd9e..4a593ac4f8 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -45,7 +45,6 @@ #include "lldrawable.h" #include "llface.h" #include "llsky.h" -#include "llviewercamera.h" // to get OGL_TO_CFR_ROTATION #include "llviewerimagelist.h" #include "llviewerregion.h" #include "llvosky.h" diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 62fcf60e7f..1953c29068 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -33,7 +33,12 @@ #include "llviewerprecompiledheaders.h" #include "lldynamictexture.h" + +// Linden library includes #include "llglheaders.h" +#include "llwindow.h" // getPosition() + +// Viewer includes #include "llviewerwindow.h" #include "llviewercamera.h" #include "llviewercontrol.h" @@ -174,7 +179,7 @@ void LLDynamicTexture::postRender(BOOL success) } // restore viewport - gViewerWindow->setupViewport(); + gViewerWindow->setup2DViewport(); // restore camera LLViewerCamera::getInstance()->setOrigin(mCamera); diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index e7403c2903..c0fe327815 100644 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -38,6 +38,7 @@ #include "llnotify.h" #include "lleventinfo.h" +#include "llfloaterreg.h" #include "llfloaterdirectory.h" #include "llfloaterworldmap.h" #include "llagent.h" @@ -192,11 +193,11 @@ bool LLEventNotification::handleResponse(const LLSD& notification, const LLSD& r { case 0: gAgent.teleportViaLocation(getEventPosGlobal()); - gFloaterWorldMap->trackLocation(getEventPosGlobal()); + LLFloaterWorldMap::getInstance()->trackLocation(getEventPosGlobal()); break; case 1: gDisplayEventHack = TRUE; - LLFloaterDirectory::showEvents(getEventID()); + LLFloaterReg::showInstance("search", LLSD().insert("panel", "event").insert("id", S32(getEventID()))); break; case 2: break; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 4a551ff261..8332eec19c 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -46,7 +46,6 @@ #include "lldarrayptr.h" #include "llvertexbuffer.h" #include "llviewerimage.h" -#include "llstat.h" #include "lldrawable.h" class LLFacePool; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index c9037d0fbb..b373dd2241 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -41,6 +41,7 @@ #include "llrender.h" #include "llmath.h" #include "llfontgl.h" +#include "llsdserialize.h" #include "llappviewer.h" #include "llviewerimagelist.h" @@ -49,287 +50,108 @@ #include "llstat.h" #include "llfasttimer.h" - +#include "lltreeiterators.h" +#include "llmetricperformancetester.h" ////////////////////////////////////////////////////////////////////////////// static const S32 MAX_VISIBLE_HISTORY = 10; static const S32 LINE_GRAPH_HEIGHT = 240; -struct ft_display_info { - int timer; - const char *desc; - const LLColor4 *color; - S32 disabled; // initialized to 0 - int level; // calculated based on desc - int parent; // calculated -}; - -static const LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f); -static const LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f); -static const LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f); -static const LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f); - -static const LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f); -static const LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f); -static const LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f); - -// green(6), blue, yellow, orange, pink(2), cyan -// red (5) magenta (4) -static struct ft_display_info ft_display_table[] = -{ - { LLFastTimer::FTM_FRAME, "Frame", &LLColor4::white, 0 }, - { LLFastTimer::FTM_MESSAGES, " System Messages", &LLColor4::grey1, 1 }, - { LLFastTimer::FTM_MOUSEHANDLER, " Mouse", &LLColor4::grey1, 0 }, - { LLFastTimer::FTM_KEYHANDLER, " Keyboard", &LLColor4::grey1, 0 }, - { LLFastTimer::FTM_SLEEP, " Sleep", &LLColor4::grey2, 0 }, - { LLFastTimer::FTM_IDLE, " Idle", &blue0, 0 }, - { LLFastTimer::FTM_PUMP, " Pump", &LLColor4::magenta2, 1 }, - { LLFastTimer::FTM_CURL, " Curl", &LLColor4::magenta3, 0 }, - { LLFastTimer::FTM_INVENTORY, " Inventory Update", &LLColor4::purple6, 1 }, - { LLFastTimer::FTM_AUTO_SELECT, " Open and Select", &LLColor4::red, 0 }, - { LLFastTimer::FTM_FILTER, " Filter", &LLColor4::red2, 0 }, - { LLFastTimer::FTM_ARRANGE, " Arrange", &LLColor4::red3, 0 }, - { LLFastTimer::FTM_REFRESH, " Refresh", &LLColor4::red4, 0 }, - { LLFastTimer::FTM_SORT, " Sort", &LLColor4::red5, 0 }, - { LLFastTimer::FTM_RESET_DRAWORDER, " ResetDrawOrder", &LLColor4::pink1, 0 }, - { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 }, - { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 }, - { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 }, - { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_OBJECTLIST_UPDATE, " Object Update", &LLColor4::purple1, 1 }, - { LLFastTimer::FTM_AVATAR_UPDATE, " Avatars", &LLColor4::purple2, 0 }, - { LLFastTimer::FTM_JOINT_UPDATE, " Joints", &LLColor4::purple3, 0 }, - { LLFastTimer::FTM_ATTACHMENT_UPDATE, " Attachments", &LLColor4::purple4, 0 }, - { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 }, - { LLFastTimer::FTM_FLEXIBLE_UPDATE, " Flex Update", &LLColor4::pink2, 0 }, - { LLFastTimer::FTM_LOD_UPDATE, " LOD Update", &LLColor4::magenta1, 0 }, - { LLFastTimer::FTM_REGION_UPDATE, " Region Update", &LLColor4::cyan2, 0 }, - { LLFastTimer::FTM_NETWORK, " Network", &LLColor4::orange1, 1 }, - { LLFastTimer::FTM_IDLE_NETWORK, " Decode Msgs", &LLColor4::orange2, 0 }, - { LLFastTimer::FTM_PROCESS_MESSAGES, " Process Msgs", &LLColor4::orange3, 0 }, - { LLFastTimer::FTM_PROCESS_OBJECTS, " Object Updates",&LLColor4::orange4, 0 }, - { LLFastTimer::FTM_CREATE_OBJECT, " Create Obj", &LLColor4::orange5, 0 }, -// { LLFastTimer::FTM_LOAD_AVATAR, " Load Avatar", &LLColor4::pink2, 0 }, - { LLFastTimer::FTM_PROCESS_IMAGES, " Image Updates",&LLColor4::orange6, 0 }, - { LLFastTimer::FTM_PIPELINE, " Pipeline", &LLColor4::magenta4, 0 }, - { LLFastTimer::FTM_CLEANUP, " Cleanup", &LLColor4::cyan3, 0 }, - { LLFastTimer::FTM_AUDIO_UPDATE, " Audio Update", &LLColor4::yellow3, 0 }, - { LLFastTimer::FTM_VFILE_WAIT, " VFile Wait", &LLColor4::cyan6, 0 }, -// { LLFastTimer::FTM_IDLE_CB, " Callbacks", &LLColor4::pink1, 0 }, - { LLFastTimer::FTM_RENDER, " Render", &green0, 1 }, - { LLFastTimer::FTM_PICK, " Pick", &LLColor4::purple, 1 }, - { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 }, - { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 }, - { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 }, - { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 }, - { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 1 }, - { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 }, - { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 }, - { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 }, - { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 }, - { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 }, - { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 }, - { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 }, - { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 }, - { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 }, - { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 }, - { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 }, - { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 }, - { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 }, - { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 }, - { LLFastTimer::FTM_GEO_SKY, " Sky", &LLColor4::yellow3, 0 }, - { LLFastTimer::FTM_UPDATE_WLPARAM, " Windlight Param",&LLColor4::magenta2, 0 }, - { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 }, - { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 }, - { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 }, - { LLFastTimer::FTM_IMAGE_UPDATE, " Image Update", &LLColor4::yellow4, 1 }, - { LLFastTimer::FTM_IMAGE_CREATE, " Image CreateGL",&LLColor4::yellow5, 0 }, - { LLFastTimer::FTM_IMAGE_DECODE, " Image Decode", &LLColor4::yellow6, 0 }, - { LLFastTimer::FTM_IMAGE_MARK_DIRTY, " Dirty Textures",&LLColor4::red1, 0 }, - { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 }, - { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 }, - { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 }, - { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 }, - { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 }, - { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 }, -// { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 }, -// { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 }, -// { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 }, - { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 }, -// { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 }, -// { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 }, - { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 }, -// { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 }, - { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 }, - { LLFastTimer::FTM_SHADOW_RENDER, " Shadow", &LLColor4::green5, 1 }, - { LLFastTimer::FTM_SHADOW_SIMPLE, " Simple", &LLColor4::yellow2, 1 }, - { LLFastTimer::FTM_SHADOW_ALPHA, " Alpha", &LLColor4::yellow6, 1 }, - { LLFastTimer::FTM_SHADOW_TERRAIN, " Terrain", &LLColor4::green6, 1 }, - { LLFastTimer::FTM_SHADOW_AVATAR, " Avatar", &LLColor4::yellow1, 1 }, - { LLFastTimer::FTM_SHADOW_TREE, " Tree", &LLColor4::yellow8, 1 }, - { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 }, - { LLFastTimer::FTM_POOLS, " Pools", &LLColor4::green3, 1 }, - { LLFastTimer::FTM_POOLRENDER, " RenderPool", &LLColor4::green4, 1 }, - { LLFastTimer::FTM_RENDER_TERRAIN, " Terrain", &LLColor4::green6, 0 }, - { LLFastTimer::FTM_RENDER_CHARACTERS, " Avatars", &LLColor4::yellow1, 0 }, - { LLFastTimer::FTM_RENDER_SIMPLE, " Simple", &LLColor4::yellow2, 0 }, - { LLFastTimer::FTM_RENDER_FULLBRIGHT, " Fullbright", &LLColor4::yellow5, 0 }, - { LLFastTimer::FTM_RENDER_GLOW, " Glow", &LLColor4::orange1, 0 }, - { LLFastTimer::FTM_RENDER_GRASS, " Grass", &LLColor4::yellow6, 0 }, - { LLFastTimer::FTM_RENDER_INVISIBLE, " Invisible", &LLColor4::red2, 0 }, - { LLFastTimer::FTM_RENDER_SHINY, " Shiny", &LLColor4::yellow3, 0 }, - { LLFastTimer::FTM_RENDER_BUMP, " Bump", &LLColor4::yellow4, 0 }, - { LLFastTimer::FTM_RENDER_TREES, " Trees", &LLColor4::yellow8, 0 }, - { LLFastTimer::FTM_RENDER_OCCLUSION, " Occlusion", &LLColor4::red1, 0 }, - { LLFastTimer::FTM_RENDER_CLOUDS, " Clouds", &LLColor4::yellow5, 0 }, - { LLFastTimer::FTM_RENDER_ALPHA, " Alpha", &LLColor4::yellow6, 0 }, - { LLFastTimer::FTM_RENDER_HUD, " HUD", &LLColor4::yellow7, 0 }, - { LLFastTimer::FTM_RENDER_WATER, " Water", &LLColor4::yellow9, 0 }, - { LLFastTimer::FTM_RENDER_WL_SKY, " WL Sky", &LLColor4::blue3, 0 }, - { LLFastTimer::FTM_RENDER_FAKE_VBO_UPDATE," Fake VBO update", &LLColor4::red2, 0 }, - { LLFastTimer::FTM_RENDER_BLOOM, " Bloom", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_RENDER_BLOOM_FBO, " First FBO", &LLColor4::blue, 0 }, - { LLFastTimer::FTM_RENDER_UI, " UI", &LLColor4::cyan4, 1 }, - { LLFastTimer::FTM_RENDER_TIMER, " Timers", &LLColor4::cyan5, 1, 0 }, - { LLFastTimer::FTM_RENDER_FONTS, " Fonts", &LLColor4::pink1, 0 }, - { LLFastTimer::FTM_SWAP, " Swap", &LLColor4::pink2, 0 }, - { LLFastTimer::FTM_CLIENT_COPY, " Client Copy", &LLColor4::red1, 1}, - -#if 0 || !LL_RELEASE_FOR_DOWNLOAD - { LLFastTimer::FTM_TEMP1, " Temp1", &LLColor4::red1, 0 }, - { LLFastTimer::FTM_TEMP2, " Temp2", &LLColor4::magenta1, 0 }, - { LLFastTimer::FTM_TEMP3, " Temp3", &LLColor4::red2, 0 }, - { LLFastTimer::FTM_TEMP4, " Temp4", &LLColor4::magenta2, 0 }, - { LLFastTimer::FTM_TEMP5, " Temp5", &LLColor4::red3, 0 }, - { LLFastTimer::FTM_TEMP6, " Temp6", &LLColor4::magenta3, 0 }, - { LLFastTimer::FTM_TEMP7, " Temp7", &LLColor4::red4, 0 }, - { LLFastTimer::FTM_TEMP8, " Temp8", &LLColor4::magenta4, 0 }, -#endif - - { LLFastTimer::FTM_OTHER, " Other", &red0 } -}; -static int ft_display_didcalc = 0; -static const int FTV_DISPLAY_NUM = LL_ARRAY_SIZE(ft_display_table); +//static const int FTV_DISPLAY_NUM = (sizeof(ft_display_table)/sizeof(ft_display_table[0])); +static S32 FTV_NUM_TIMERS; +const S32 FTV_MAX_DEPTH = 8; + +std::vector ft_display_idx; // line of table entry for display purposes (for collapse) + +typedef LLTreeDFSIter timer_tree_iterator_t; -S32 ft_display_idx[FTV_DISPLAY_NUM]; // line of table entry for display purposes (for collapse) +BOOL LLFastTimerView::sAnalyzePerformance = FALSE; + +static timer_tree_iterator_t begin_timer_tree(LLFastTimer::NamedTimer& id) +{ + return timer_tree_iterator_t(&id, + boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::beginChildren), _1), + boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::endChildren), _1)); +} + +static timer_tree_iterator_t end_timer_tree() +{ + return timer_tree_iterator_t(); +} -LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect) - : LLFloater(name, rect, std::string("Fast Timers")) +LLFastTimerView::LLFastTimerView(const LLRect& rect) +: LLFloater(), + mHoverTimer(NULL) { + setRect(rect); setVisible(FALSE); mDisplayMode = 0; mAvgCountTotal = 0; mMaxCountTotal = 0; - mDisplayCenter = 1; + mDisplayCenter = ALIGN_CENTER; mDisplayCalls = 0; mDisplayHz = 0; mScrollIndex = 0; - mHoverIndex = -1; + mHoverID = NULL; mHoverBarIndex = -1; - mBarStart = new S32[(MAX_VISIBLE_HISTORY + 1) * FTV_DISPLAY_NUM]; - memset(mBarStart, 0, (MAX_VISIBLE_HISTORY + 1) * FTV_DISPLAY_NUM * sizeof(S32)); - mBarEnd = new S32[(MAX_VISIBLE_HISTORY + 1) * FTV_DISPLAY_NUM]; - memset(mBarEnd, 0, (MAX_VISIBLE_HISTORY + 1) * FTV_DISPLAY_NUM * sizeof(S32)); - mSubtractHidden = 0; + FTV_NUM_TIMERS = LLFastTimer::NamedTimer::instanceCount(); mPrintStats = -1; - - // One-time setup - if (!ft_display_didcalc) - { - int pidx[FTV_DISPLAY_NUM]; - int pdisabled[FTV_DISPLAY_NUM]; - for (S32 i=0; i < FTV_DISPLAY_NUM; i++) - { - int level = 0; - const char *text = ft_display_table[i].desc; - while(text[0] == ' ') - { - text++; - level++; - } - llassert(level < FTV_DISPLAY_NUM); - ft_display_table[i].desc = text; - ft_display_table[i].level = level; - if (level > 0) - { - ft_display_table[i].parent = pidx[level-1]; - if (pdisabled[level-1]) - { - ft_display_table[i].disabled = 3; - } - } - else - { - ft_display_table[i].parent = -1; - } - ft_display_idx[i] = i; - pidx[level] = i; - pdisabled[level] = ft_display_table[i].disabled; - } - ft_display_didcalc = 1; - } } -LLFastTimerView::~LLFastTimerView() -{ - delete[] mBarStart; - delete[] mBarEnd; -} BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if (mBarRect.pointInRect(x, y)) + if (mHoverTimer ) + { + // right click collapses timers + if (!mHoverTimer->getCollapsed()) + { + mHoverTimer->setCollapsed(true); + } + else if (mHoverTimer->getParent()) + { + mHoverTimer->getParent()->setCollapsed(true); + } + } + else if (mBarRect.pointInRect(x, y)) { S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); mPrintStats = bar_idx; -// return TRUE; // for now, pass all mouse events through } return FALSE; } -S32 LLFastTimerView::getLegendIndex(S32 y) +LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y) { S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::getFontMonospace()->getLineHeight()+2) - 5; - if (idx >= 0 && idx < FTV_DISPLAY_NUM) + + if (idx >= 0 && idx < (S32)ft_display_idx.size()) { return ft_display_idx[idx]; } - return -1; + return NULL; } BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { if (x < mBarRect.mLeft) { - S32 legend_index = getLegendIndex(y); - if (legend_index >= 0 && legend_index < FTV_DISPLAY_NUM) + LLFastTimer::NamedTimer* idp = getLegendID(y); + if (idp) { - S32 disabled = ft_display_table[legend_index].disabled; - if (++disabled > 2) - disabled = 0; - ft_display_table[legend_index].disabled = disabled; - S32 level = ft_display_table[legend_index].level; - - // propagate enable/disable to all children - legend_index++; - while (legend_index < FTV_DISPLAY_NUM && ft_display_table[legend_index].level > level) - { - ft_display_table[legend_index].disabled = disabled ? 3 : 0; - legend_index++; - } + idp->setCollapsed(!idp->getCollapsed()); } } + else if (mHoverTimer) + { + //left click drills down by expanding timers + mHoverTimer->setCollapsed(false); + } else if (mask & MASK_ALT) { - if (mask & MASK_SHIFT) - { - mSubtractHidden = !mSubtractHidden; - } - else if (mask & MASK_CONTROL) + if (mask & MASK_CONTROL) { mDisplayHz = !mDisplayHz; } @@ -345,8 +167,7 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) } else if (mask & MASK_CONTROL) { - if (++mDisplayCenter > 2) - mDisplayCenter = 0; + mDisplayCenter = (ChildAlignment)((mDisplayCenter + 1) % ALIGN_COUNT); } else { @@ -367,13 +188,14 @@ BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) return FALSE; } - BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) { + mHoverTimer = NULL; + mHoverID = NULL; + if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) { - mHoverIndex = -1; - mHoverBarIndex = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); + mHoverBarIndex = llmin(LLFastTimer::getCurFrameIndex() - 1, MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight())); if (mHoverBarIndex == 0) { return TRUE; @@ -382,39 +204,88 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) { mHoverBarIndex = 0; } - for (S32 i = 0; i < FTV_DISPLAY_NUM; i++) + + S32 i = 0; + for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != end_timer_tree(); + ++it, ++i) { - if (x > mBarStart[mHoverBarIndex * FTV_DISPLAY_NUM + i] && - x < mBarEnd[mHoverBarIndex * FTV_DISPLAY_NUM + i] && - ft_display_table[i].disabled <= 1) + // is mouse over bar for this timer? + if (x > mBarStart[mHoverBarIndex][i] && + x < mBarEnd[mHoverBarIndex][i]) + { + mHoverID = (*it); + mHoverTimer = (*it); + mToolTipRect.set(mBarStart[mHoverBarIndex][i], + mBarRect.mBottom + llround(((F32)mHoverBarIndex + 1.f) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f))), + mBarEnd[mHoverBarIndex][i], + mBarRect.mBottom + llround((F32)mHoverBarIndex * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f)))); + } + + if ((*it)->getCollapsed()) { - mHoverIndex = i; + it.skipDescendants(); } } } else if (x < mBarRect.mLeft) { - S32 legend_index = getLegendIndex(y); - if (legend_index >= 0 && legend_index < FTV_DISPLAY_NUM) + LLFastTimer::NamedTimer* timer_id = getLegendID(y); + if (timer_id) { - mHoverIndex = legend_index; + mHoverID = timer_id; } } return FALSE; } + +BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) +{ + if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) + { + // tooltips for timer bars + if (mHoverTimer) + { + msg = mHoverTimer->getToolTip(LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex); + return TRUE; + } + } + else + { + // tooltips for timer legend + if (x < mBarRect.mLeft) + { + LLFastTimer::NamedTimer* idp = getLegendID(y); + if (idp) + { + msg = idp->getToolTip(); + return TRUE; + } + } + + } + + return FALSE; +} + BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLFastTimer::sPauseHistory = TRUE; mScrollIndex = llclamp(mScrollIndex - clicks, - 0, llmin(LLFastTimer::sLastFrameIndex, (S32)LLFastTimer::FTM_HISTORY_NUM-MAX_VISIBLE_HISTORY)); + 0, + llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); return TRUE; } +static LLFastTimer::DeclareTimer FTM_RENDER_TIMER("Timers", true); + +static std::map sTimerColors; + void LLFastTimerView::draw() { - LLFastTimer t(LLFastTimer::FTM_RENDER_TIMER); + LLFastTimer t(FTM_RENDER_TIMER); std::string tdesc; @@ -433,47 +304,9 @@ void LLFastTimerView::draw() S32 texth, textw; LLPointer box_imagep = LLUI::getUIImage("rounded_square.tga"); - // Make sure all timers are accounted for - // Set 'FTM_OTHER' to unaccounted ticks last frame - { - S32 display_timer[LLFastTimer::FTM_NUM_TYPES]; - S32 hidx = LLFastTimer::sLastFrameIndex % LLFastTimer::FTM_HISTORY_NUM; - for (S32 i=0; i < LLFastTimer::FTM_NUM_TYPES; i++) - { - display_timer[i] = 0; - } - for (S32 i=0; i < FTV_DISPLAY_NUM; i++) - { - S32 tidx = ft_display_table[i].timer; - display_timer[tidx] = 1; - } - LLFastTimer::sCountHistory[hidx][LLFastTimer::FTM_OTHER] = 0; - LLFastTimer::sCallHistory[hidx][LLFastTimer::FTM_OTHER] = 0; - for (S32 tidx = 0; tidx < LLFastTimer::FTM_NUM_TYPES; tidx++) - { - U64 counts = LLFastTimer::sCountHistory[hidx][tidx]; - if (counts > 0 && display_timer[tidx] == 0) - { - LLFastTimer::sCountHistory[hidx][LLFastTimer::FTM_OTHER] += counts; - LLFastTimer::sCallHistory[hidx][LLFastTimer::FTM_OTHER] += 1; - } - } - LLFastTimer::sCountAverage[LLFastTimer::FTM_OTHER] = 0; - LLFastTimer::sCallAverage[LLFastTimer::FTM_OTHER] = 0; - for (S32 h = 0; h < LLFastTimer::FTM_HISTORY_NUM; h++) - { - LLFastTimer::sCountAverage[LLFastTimer::FTM_OTHER] += LLFastTimer::sCountHistory[h][LLFastTimer::FTM_OTHER]; - LLFastTimer::sCallAverage[LLFastTimer::FTM_OTHER] += LLFastTimer::sCallHistory[h][LLFastTimer::FTM_OTHER]; - } - LLFastTimer::sCountAverage[LLFastTimer::FTM_OTHER] /= LLFastTimer::FTM_HISTORY_NUM; - LLFastTimer::sCallAverage[LLFastTimer::FTM_OTHER] /= LLFastTimer::FTM_HISTORY_NUM; - } - // Draw the window background - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); - } + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); S32 xleft = margin; S32 ytop = margin; @@ -512,148 +345,135 @@ void LLFastTimerView::draw() y -= (texth + 2); } - // Calc the total ticks - S32 histmax = llmin(LLFastTimer::sLastFrameIndex+1, MAX_VISIBLE_HISTORY); - U64 ticks_sum[LLFastTimer::FTM_HISTORY_NUM+1][FTV_DISPLAY_NUM]; - for (S32 j=-1; j= 0) - hidx = (LLFastTimer::sLastFrameIndex+j) % LLFastTimer::FTM_HISTORY_NUM; - else - hidx = -1; - - // calculate tick info by adding child ticks to parents - for (S32 i=0; i < FTV_DISPLAY_NUM; i++) - { - if (mSubtractHidden && ft_display_table[i].disabled > 1) - { - continue; - } - // Get ticks - S32 tidx = ft_display_table[i].timer; - if (hidx >= 0) - ticks_sum[j+1][i] = LLFastTimer::sCountHistory[hidx][tidx]; - else - ticks_sum[j+1][i] = LLFastTimer::sCountAverage[tidx]; - S32 pidx = ft_display_table[i].parent; - // Add ticks to parents - while (pidx >= 0) - { - ticks_sum[j+1][pidx] += ticks_sum[j+1][i]; - pidx = ft_display_table[pidx].parent; - } - } - } + S32 histmax = llmin(LLFastTimer::getLastFrameIndex()+1, MAX_VISIBLE_HISTORY); // Draw the legend - - S32 legendwidth = 0; xleft = margin; ytop = y; y -= (texth + 2); - S32 cur_line = 0; - S32 display_line[FTV_DISPLAY_NUM]; - for (S32 i=0; igetDepth(), 0.f, 3.f, 0.f, 1.f); + // lightness alternates with depth + F32 lightness = idp->getDepth() % 2 ? 0.5f : 0.6f; - int tidx = ft_display_table[i].timer; - F32 ms = 0; - S32 calls = 0; - if (mHoverBarIndex > 0 && mHoverIndex >= 0) - { - S32 hidx = (LLFastTimer::sLastFrameIndex + (mHoverBarIndex - 1) - mScrollIndex) % LLFastTimer::FTM_HISTORY_NUM; - S32 bidx = LLFastTimer::FTM_HISTORY_NUM - mScrollIndex - mHoverBarIndex; - U64 ticks = ticks_sum[bidx+1][i]; // : LLFastTimer::sCountHistory[hidx][tidx]; - ms = (F32)((F64)ticks * iclock_freq); - calls = (S32)LLFastTimer::sCallHistory[hidx][tidx]; - } - else - { - U64 ticks = ticks_sum[0][i]; - ms = (F32)((F64)ticks * iclock_freq); - calls = (S32)LLFastTimer::sCallAverage[tidx]; - } - if (mDisplayCalls) - { - tdesc = llformat("%s (%d)",ft_display_table[i].desc,calls); - } - else - { - tdesc = llformat("%s [%.1f]",ft_display_table[i].desc,ms); - } - dx = (texth+4) + level*8; + LLColor4 child_color; + child_color.setHSL(hue, saturation, lightness); + + sTimerColors[idp] = child_color; + } - LLColor4 color = disabled > 1 ? LLColor4::grey : LLColor4::white; - if (level > 0) + const S32 LEGEND_WIDTH = 220; + { + LLLocalClipRect clip(LLRect(margin, y, LEGEND_WIDTH, margin)); + S32 cur_line = 0; + ft_display_idx.clear(); + std::map display_line; + for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != timer_tree_iterator_t(); + ++it) { - S32 line_start_y = (top + bottom) / 2; - S32 line_end_y = line_start_y + ((texth + 2) * (display_line[i] - display_line[parent])) - (texth / 2); - gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color); - S32 line_x = x + (texth + 4) + ((level - 1) * 8); - gl_line_2d(line_x, line_start_y, line_x, line_end_y, color); - if (disabled == 1) + LLFastTimer::NamedTimer* idp = (*it); + display_line[idp] = cur_line; + ft_display_idx.push_back(idp); + cur_line++; + + x = xleft; + + left = x; right = x + texth; + top = y; bottom = y - texth; + S32 scale_offset = 0; + if (idp == mHoverID) { - gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color); + scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f); } - } + gl_rect_2d(left - scale_offset, top + scale_offset, right + scale_offset, bottom - scale_offset, sTimerColors[idp]); - x += dx; - BOOL is_child_of_hover_item = (i == mHoverIndex); - S32 next_parent = ft_display_table[i].parent; - while(!is_child_of_hover_item && next_parent >= 0) - { - is_child_of_hover_item = (mHoverIndex == next_parent); - next_parent = ft_display_table[next_parent].parent; - } + F32 ms = 0; + S32 calls = 0; + if (mHoverBarIndex > 0 && mHoverID) + { + S32 hidx = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex; + U64 ticks = idp->getHistoricalCount(hidx); + ms = (F32)((F64)ticks * iclock_freq); + calls = (S32)idp->getHistoricalCalls(hidx); + } + else + { + U64 ticks = idp->getCountAverage(); + ms = (F32)((F64)ticks * iclock_freq); + calls = (S32)idp->getCallAverage(); + } - if (is_child_of_hover_item) - { - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD); - } - else - { - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP); - } - y -= (texth + 2); + if (mDisplayCalls) + { + tdesc = llformat("%s (%d)",idp->getName().c_str(),calls); + } + else + { + tdesc = llformat("%s [%.1f]",idp->getName().c_str(),ms); + } + dx = (texth+4) + idp->getDepth()*8; - textw = dx + LLFontGL::getFontMonospace()->getWidth(std::string(ft_display_table[i].desc)) + 40; - if (textw > legendwidth) - legendwidth = textw; - } - for (S32 i=cur_line; igetDepth() > 0) + { + S32 line_start_y = (top + bottom) / 2; + S32 line_end_y = line_start_y + ((texth + 2) * (cur_line - display_line[idp->getParent()])) - texth; + gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color); + S32 line_x = x + (texth + 4) + ((idp->getDepth() - 1) * 8); + gl_line_2d(line_x, line_start_y, line_x, line_end_y, color); + if (idp->getCollapsed() && !idp->getChildren().empty()) + { + gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color); + } + } + + x += dx; + BOOL is_child_of_hover_item = (idp == mHoverID); + LLFastTimer::NamedTimer* next_parent = idp->getParent(); + while(!is_child_of_hover_item && next_parent) + { + is_child_of_hover_item = (mHoverID == next_parent); + next_parent = next_parent->getParent(); + } + + LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, + x, y, + color, + LLFontGL::LEFT, LLFontGL::TOP, + is_child_of_hover_item ? LLFontGL::BOLD : LLFontGL::NORMAL); + + y -= (texth + 2); + + textw = dx + LLFontGL::getFontMonospace()->getWidth(idp->getName()) + 40; + + if (idp->getCollapsed()) + { + it.skipDescendants(); + } + } } - xleft += legendwidth + 8; + + xleft += LEGEND_WIDTH + 8; // ytop = ytop; // update rectangle that includes timer bars mBarRect.mLeft = xleft; - mBarRect.mRight = getRect().mRight - xleft; + mBarRect.mRight = getRect().getWidth(); mBarRect.mTop = ytop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT; @@ -665,25 +485,18 @@ void LLFastTimerView::draw() barw = width - xleft - margin; // Draw the history bars - if (LLFastTimer::sLastFrameIndex >= 0) + if (LLFastTimer::getLastFrameIndex() >= 0) { + LLLocalClipRect clip(LLRect(xleft, ytop - margin, getRect().getWidth() - margin, margin)); + U64 totalticks; if (!LLFastTimer::sPauseHistory) { - U64 ticks = 0; - int hidx = (LLFastTimer::sLastFrameIndex - mScrollIndex) % LLFastTimer::FTM_HISTORY_NUM; - for (S32 i=0; i 1) - { - continue; - } - int tidx = ft_display_table[i].timer; - ticks += LLFastTimer::sCountHistory[hidx][tidx]; - } - if (LLFastTimer::sCurFrameIndex >= 10) + U64 ticks = LLFastTimer::NamedTimer::getRootNamedTimer().getHistoricalCount(mScrollIndex); + + if (LLFastTimer::getCurFrameIndex() >= 10) { - U64 framec = LLFastTimer::sCurFrameIndex; + U64 framec = LLFastTimer::getCurFrameIndex(); U64 avg = (U64)mAvgCountTotal; mAvgCountTotal = (avg*framec + ticks) / (framec + 1); if (ticks > mMaxCountTotal) @@ -691,11 +504,13 @@ void LLFastTimerView::draw() mMaxCountTotal = ticks; } } -#if 1 + if (ticks < mAvgCountTotal/100 || ticks > mAvgCountTotal*100) - LLFastTimer::sResetHistory = 1; -#endif - if (LLFastTimer::sCurFrameIndex < 10 || LLFastTimer::sResetHistory) + { + LLFastTimer::sResetHistory = true; + } + + if (LLFastTimer::getCurFrameIndex() < 10 || LLFastTimer::sResetHistory) { mAvgCountTotal = ticks; mMaxCountTotal = ticks; @@ -716,16 +531,8 @@ void LLFastTimerView::draw() totalticks = 0; for (S32 j=0; j 1) - { - continue; - } - int tidx = ft_display_table[i].timer; - ticks += LLFastTimer::sCountHistory[j][tidx]; - } + U64 ticks = LLFastTimer::NamedTimer::getRootNamedTimer().getHistoricalCount(j); + if (ticks > totalticks) totalticks = ticks; } @@ -798,18 +605,23 @@ void LLFastTimerView::draw() gl_rect_2d(graph_rect, FALSE); } + mBarStart.clear(); + mBarEnd.clear(); + // Draw bars for each history entry // Special: -1 = show running average gGL.getTexUnit(0)->bind(box_imagep->getImage()); for (S32 j=-1; j LINE_GRAPH_HEIGHT; j++) { - int sublevel_dx[FTV_DISPLAY_NUM+1]; - int sublevel_left[FTV_DISPLAY_NUM+1]; - int sublevel_right[FTV_DISPLAY_NUM+1]; + mBarStart.push_back(std::vector()); + mBarEnd.push_back(std::vector()); + int sublevel_dx[FTV_MAX_DEPTH]; + int sublevel_left[FTV_MAX_DEPTH]; + int sublevel_right[FTV_MAX_DEPTH]; S32 tidx; if (j >= 0) { - tidx = LLFastTimer::FTM_HISTORY_NUM - j - 1 - mScrollIndex; + tidx = LLFastTimer::NamedTimer::HISTORY_NUM - j - 1 - mScrollIndex; } else { @@ -819,88 +631,75 @@ void LLFastTimerView::draw() x = xleft; // draw the bars for each stat - int xpos[FTV_DISPLAY_NUM+1]; - int deltax[FTV_DISPLAY_NUM+1]; - xpos[0] = xleft; + std::vector xpos; + std::vector deltax; + xpos.push_back(xleft); + + LLFastTimer::NamedTimer* prev_id = NULL; - for (S32 i = 0; i < FTV_DISPLAY_NUM; i++) + S32 i = 0; + for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != end_timer_tree(); + ++it, ++i) { - if (ft_display_table[i].disabled > 1) - { - continue; - } - - F32 frac = (F32)ticks_sum[tidx+1][i] / (F32)totalticks; + LLFastTimer::NamedTimer* idp = (*it); + F32 frac = tidx == -1 + ? (F32)idp->getCountAverage() / (F32)totalticks + : (F32)idp->getHistoricalCount(tidx) / (F32)totalticks; dx = llround(frac * (F32)barw); - deltax[i] = dx; + S32 prev_delta_x = deltax.empty() ? 0 : deltax.back(); + deltax.push_back(dx); - int level = ft_display_table[i].level; - int parent = ft_display_table[i].parent; - llassert(level < FTV_DISPLAY_NUM); - llassert(parent < FTV_DISPLAY_NUM); + int level = idp->getDepth() - 1; - left = xpos[level]; - - S32 prev_idx = i - 1; - while (prev_idx > 0) - { - if (ft_display_table[prev_idx].disabled <= 1) - { - break; - } - prev_idx--; - } - S32 next_idx = i + 1; - while (next_idx < FTV_DISPLAY_NUM) + while ((S32)xpos.size() > level + 1) { - if (ft_display_table[next_idx].disabled <= 1) - { - break; - } - next_idx++; + xpos.pop_back(); } - + left = xpos.back(); + if (level == 0) - { + { sublevel_left[level] = xleft; sublevel_dx[level] = dx; sublevel_right[level] = sublevel_left[level] + sublevel_dx[level]; - } - else if (i==0 || ft_display_table[prev_idx].level < level) + } + else if (prev_id && prev_id->getDepth() < idp->getDepth()) { - // If we are the first entry at a new sublevel block, calc the - // total width of this sublevel and modify left to align block. - U64 sublevelticks = ticks_sum[tidx+1][i]; - for (S32 k=i+1; kbeginChildren(); + it != prev_id->endChildren(); + ++it) + { + sublevelticks += (tidx == -1) + ? (*it)->getCountAverage() + : (*it)->getHistoricalCount(tidx); + } + + F32 subfrac = (F32)sublevelticks / (F32)totalticks; sublevel_dx[level] = (int)(subfrac * (F32)barw + .5f); - if (mDisplayCenter == 1) // center aligned + if (mDisplayCenter == ALIGN_CENTER) { - left += (deltax[parent] - sublevel_dx[level])/2; + left += (prev_delta_x - sublevel_dx[level])/2; } - else if (mDisplayCenter == 2) // right aligned + else if (mDisplayCenter == ALIGN_RIGHT) { - left += (deltax[parent] - sublevel_dx[level]); - } + left += (prev_delta_x - sublevel_dx[level]); + } sublevel_left[level] = left; sublevel_right[level] = sublevel_left[level] + sublevel_dx[level]; } right = left + dx; - xpos[level] = right; - xpos[level+1] = left; + xpos.back() = right; + xpos.push_back(left); - mBarStart[(j + 1) * FTV_DISPLAY_NUM + i] = left; - mBarEnd[(j + 1) * FTV_DISPLAY_NUM + i] = right; + mBarStart.back().push_back(left); + mBarEnd.back().push_back(right); top = y; bottom = y - barh; @@ -908,23 +707,23 @@ void LLFastTimerView::draw() if (right > left) { //U32 rounded_edges = 0; - LLColor4 color = *ft_display_table[i].color; + LLColor4 color = sTimerColors[idp];//*ft_display_table[i].color; S32 scale_offset = 0; - BOOL is_child_of_hover_item = (i == mHoverIndex); - S32 next_parent = ft_display_table[i].parent; - while(!is_child_of_hover_item && next_parent >= 0) + BOOL is_child_of_hover_item = (idp == mHoverID); + LLFastTimer::NamedTimer* next_parent = idp->getParent(); + while(!is_child_of_hover_item && next_parent) { - is_child_of_hover_item = (mHoverIndex == next_parent); - next_parent = ft_display_table[next_parent].parent; + is_child_of_hover_item = (mHoverID == next_parent); + next_parent = next_parent->getParent(); } - if (i == mHoverIndex) + if (idp == mHoverID) { scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f); //color = lerp(color, LLColor4::black, -0.4f); } - else if (mHoverIndex >= 0 && !is_child_of_hover_item) + else if (mHoverID != NULL && !is_child_of_hover_item) { color = lerp(color, LLColor4::grey, 0.8f); } @@ -935,7 +734,13 @@ void LLFastTimerView::draw() gl_segmented_rect_2d_fragment_tex(sublevel_left[level], top - level + scale_offset, sublevel_right[level], bottom + level - scale_offset, box_imagep->getTextureWidth(), box_imagep->getTextureHeight(), 16, start_fragment, end_fragment); } - + + if ((*it)->getCollapsed()) + { + it.skipDescendants(); + } + + prev_id = idp; } y -= (barh + dy); if (j < 0) @@ -970,10 +775,10 @@ void LLFastTimerView::draw() //highlight visible range { - S32 first_frame = LLFastTimer::FTM_HISTORY_NUM - mScrollIndex; + S32 first_frame = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex; S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; - F32 frame_delta = ((F32) (graph_rect.getWidth()))/(LLFastTimer::FTM_HISTORY_NUM-1); + F32 frame_delta = ((F32) (graph_rect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1); F32 right = (F32) graph_rect.mLeft + frame_delta*first_frame; F32 left = (F32) graph_rect.mLeft + frame_delta*last_frame; @@ -996,28 +801,27 @@ void LLFastTimerView::draw() } U64 cur_max = 0; - for (S32 idx = 0; idx < FTV_DISPLAY_NUM; ++idx) + for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != end_timer_tree(); + ++it) { - if (ft_display_table[idx].disabled > 1) - { //skip disabled timers - continue; - } + LLFastTimer::NamedTimer* idp = (*it); //fatten highlighted timer - if (mHoverIndex == idx) + if (mHoverID == idp) { gGL.flush(); glLineWidth(3); } - const F32 * col = ft_display_table[idx].color->mV; + const F32 * col = sTimerColors[idp].mV;// ft_display_table[idx].color->mV; F32 alpha = 1.f; - if (mHoverIndex >= 0 && - idx != mHoverIndex) + if (mHoverID != NULL && + idp != mHoverID) { //fade out non-hihglighted timers - if (ft_display_table[idx].parent != mHoverIndex) + if (idp->getParent() != mHoverID) { alpha = alpha_interp; } @@ -1025,9 +829,9 @@ void LLFastTimerView::draw() gGL.color4f(col[0], col[1], col[2], alpha); gGL.begin(LLRender::LINE_STRIP); - for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++) + for (U32 j = 0; j < LLFastTimer::NamedTimer::HISTORY_NUM; j++) { - U64 ticks = ticks_sum[j+1][idx]; + U64 ticks = idp->getHistoricalCount(j); if (mDisplayHz) { @@ -1037,26 +841,31 @@ void LLFastTimerView::draw() } else if (mDisplayCalls) { - S32 tidx = ft_display_table[idx].timer; - S32 hidx = (LLFastTimer::sLastFrameIndex + j) % LLFastTimer::FTM_HISTORY_NUM; - ticks = (S32)LLFastTimer::sCallHistory[hidx][tidx]; + ticks = (S32)idp->getHistoricalCalls(j); } if (alpha == 1.f) - { //normalize to highlighted timer + { + //normalize to highlighted timer cur_max = llmax(cur_max, ticks); } - F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::FTM_HISTORY_NUM-1)*j; + F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1)*j; F32 y = graph_rect.mBottom + (F32) graph_rect.getHeight()/max_ticks*ticks; gGL.vertex2f(x,y); } gGL.end(); - if (mHoverIndex == idx) + if (mHoverID == idp) { gGL.flush(); glLineWidth(1); } + + if (idp->getCollapsed()) + { + //skip hidden timers + it.skipDescendants(); + } } //interpolate towards new maximum @@ -1068,12 +877,16 @@ void LLFastTimerView::draw() alpha_interp = alpha_interp + (alpha_target-alpha_interp) * dt; - if (mHoverIndex >= 0) + if (mHoverID != NULL) { x = (graph_rect.mRight + graph_rect.mLeft)/2; y = graph_rect.mBottom + 8; - LLFontGL::getFontMonospace()->renderUTF8(std::string(ft_display_table[mHoverIndex].desc), 0, x, y, LLColor4::white, + LLFontGL::getFontMonospace()->renderUTF8( + mHoverID->getName(), + 0, + x, y, + LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM); } } @@ -1083,87 +896,269 @@ void LLFastTimerView::draw() if (mPrintStats >= 0) { std::string legend_stat; - S32 stat_num; - S32 first = 1; - for (stat_num = 0; stat_num < FTV_DISPLAY_NUM; stat_num++) + bool first = true; + for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != end_timer_tree(); + ++it) { - if (ft_display_table[stat_num].disabled > 1) - continue; + LLFastTimer::NamedTimer* idp = (*it); + if (!first) + { legend_stat += ", "; - first=0; - legend_stat += ft_display_table[stat_num].desc; + } + first = true; + legend_stat += idp->getName(); + + if (idp->getCollapsed()) + { + it.skipDescendants(); + } } llinfos << legend_stat << llendl; std::string timer_stat; - first = 1; - for (stat_num = 0; stat_num < FTV_DISPLAY_NUM; stat_num++) + first = true; + for(timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != end_timer_tree(); + ++it) { - S32 disabled = ft_display_table[stat_num].disabled; - if (disabled > 1) - continue; + LLFastTimer::NamedTimer* idp = (*it); + if (!first) + { timer_stat += ", "; - first=0; + } + first = false; + U64 ticks; - S32 tidx = ft_display_table[stat_num].timer; if (mPrintStats > 0) { - S32 hidx = (LLFastTimer::sLastFrameIndex+(mPrintStats-1)-mScrollIndex) % LLFastTimer::FTM_HISTORY_NUM; - ticks = disabled >= 1 ? ticks_sum[mPrintStats][stat_num] : LLFastTimer::sCountHistory[hidx][tidx]; + S32 hidx = (mPrintStats - 1) - mScrollIndex; + ticks = idp->getHistoricalCount(hidx); } else { - ticks = disabled >= 1 ? ticks_sum[0][stat_num] : LLFastTimer::sCountAverage[tidx]; + ticks = idp->getCountAverage(); } F32 ms = (F32)((F64)ticks * iclock_freq); timer_stat += llformat("%.1f",ms); + + if (idp->getCollapsed()) + { + it.skipDescendants(); + } } llinfos << timer_stat << llendl; mPrintStats = -1; } - mHoverIndex = -1; + mHoverID = NULL; mHoverBarIndex = -1; LLView::draw(); } -F64 LLFastTimerView::getTime(LLFastTimer::EFastTimerType tidx) +F64 LLFastTimerView::getTime(LLFastTimer::NamedTimer::FrameState& id) { - // Find table index - S32 i; - for (i=0; igetCountAverage() / (F64)LLFastTimer::countsPerSecond(); +} + +//static +LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is) +{ + LLSD ret; + + LLSD cur; + + LLSD::Real total_time = 0.0; + LLSD::Integer total_frames = 0; + + while (!is.eof() && LLSDSerialize::fromXML(cur, is)) { - if (tidx == ft_display_table[i].timer) + for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) { - break; + std::string label = iter->first; + + F64 time = iter->second["Time"].asReal(); + + total_time += time; + + if (time > 0.0) + { + ret[label]["TotalTime"] = ret[label]["TotalTime"].asReal() + time; + ret[label]["MaxTime"] = llmax(time, ret[label]["MaxTime"].asReal()); + + if (ret[label]["MinTime"].asReal() == 0) + { + ret[label]["MinTime"] = time; + } + else + { + ret[label]["MinTime"] = llmin(ret[label]["MinTime"].asReal(), time); + } + + LLSD::Integer samples = iter->second["Calls"].asInteger(); + + ret[label]["Samples"] = ret[label]["Samples"].asInteger() + samples; + ret[label]["MaxSamples"] = llmax(ret[label]["MaxSamples"].asInteger(), samples); + + if (ret[label]["MinSamples"].asInteger() == 0) + { + ret[label]["MinSamples"] = samples; + } + else + { + ret[label]["MinSamples"] = llmin(ret[label]["MinSamples"].asInteger(), samples); + } + } } + total_frames++; } + + ret["SessionTime"] = total_time; + ret["FrameCount"] = total_frames; - if (i == FTV_DISPLAY_NUM) + return ret; + +} + +//static +void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target, std::string output) +{ + + //analyze baseline + std::ifstream base_is(baseline.c_str()); + LLSD base = analyzePerformanceLogDefault(base_is); + base_is.close(); + + //analyze current + std::ifstream target_is(target.c_str()); + LLSD current = analyzePerformanceLogDefault(target_is); + target_is.close(); + + //output comparision + std::ofstream os(output.c_str()); + + LLSD::Real session_time = current["SessionTime"].asReal(); + + os << "Label, % Change, % of Session, Cur Min, Cur Max, Cur Mean, Cur Total, Cur Samples, Base Min, Base Max, Base Mean, Base Total, Base Samples\n"; + for (LLSD::map_iterator iter = base.beginMap(); iter != base.endMap(); ++iter) { - // walked off the end of ft_display_table without finding - // the desired timer type - llwarns << "Timer type " << tidx << " not known." << llendl; - return F64(0.0); + LLSD::String label = iter->first; + + if (current[label]["Samples"].asInteger() == 0 || + base[label]["Samples"].asInteger() == 0) + { + //cannot compare + continue; + } + LLSD::Real a = base[label]["TotalTime"].asReal() / base[label]["Samples"].asReal(); + LLSD::Real b = current[label]["TotalTime"].asReal() / base[label]["Samples"].asReal(); + + LLSD::Real diff = b-a; + + LLSD::Real perc = diff/a * 100; + + os << llformat("%s, %.2f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %.4f, %.4f, %.4f, %.4f, %d\n", + label.c_str(), + (F32) perc, + (F32) (current[label]["TotalTime"].asReal()/session_time * 100.0), + (F32) current[label]["MinTime"].asReal(), + (F32) current[label]["MaxTime"].asReal(), + (F32) b, + (F32) current[label]["TotalTime"].asReal(), + current[label]["Samples"].asInteger(), + (F32) base[label]["MinTime"].asReal(), + (F32) base[label]["MaxTime"].asReal(), + (F32) a, + (F32) base[label]["TotalTime"].asReal(), + base[label]["Samples"].asInteger()); } - S32 table_idx = i; - // Add child ticks to parent - U64 ticks = LLFastTimer::sCountAverage[tidx]; - S32 level = ft_display_table[table_idx].level; - for (i=table_idx+1; ifirst; + + LLMetricPerformanceTester* tester = LLMetricPerformanceTester::getTester(iter->second["Name"].asString()) ; + if(tester) + { + ret[label]["Name"] = iter->second["Name"] ; + + S32 num_of_strings = tester->getNumOfMetricStrings() ; + for(S32 index = 0 ; index < num_of_strings ; index++) + { + ret[label][ tester->getMetricString(index) ] = iter->second[ tester->getMetricString(index) ] ; + } + } } - ticks += LLFastTimer::sCountAverage[ft_display_table[i].timer]; } + + return ret; +} + +//static +void LLFastTimerView::doAnalysisMetrics(std::string baseline, std::string target, std::string output) +{ + if(!LLMetricPerformanceTester::hasMetricPerformanceTesters()) + { + return ; + } + + //analyze baseline + std::ifstream base_is(baseline.c_str()); + LLSD base = analyzeMetricPerformanceLog(base_is); + base_is.close(); + + //analyze current + std::ifstream target_is(target.c_str()); + LLSD current = analyzeMetricPerformanceLog(target_is); + target_is.close(); - return (F64)ticks / (F64)LLFastTimer::countsPerSecond(); + //output comparision + std::ofstream os(output.c_str()); + + os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; + for(LLMetricPerformanceTester::name_tester_map_t::iterator iter = LLMetricPerformanceTester::sTesterMap.begin() ; + iter != LLMetricPerformanceTester::sTesterMap.end() ; ++iter) + { + LLMetricPerformanceTester* tester = ((LLMetricPerformanceTester*)iter->second) ; + tester->analyzePerformance(&os, &base, ¤t) ; + } + + os.flush(); + os.close(); } + +//static +void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output) +{ + if(LLFastTimer::sLog) + { + doAnalysisDefault(baseline, target, output) ; + return ; + } + + if(LLFastTimer::sMetricLog) + { + doAnalysisMetrics(baseline, target, output) ; + return ; + } +} + + diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 86fc194610..78ca7b50d6 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -34,39 +34,62 @@ #define LL_LLFASTTIMERVIEW_H #include "llfloater.h" -#include "llframetimer.h" +#include "llfasttimer.h" class LLFastTimerView : public LLFloater { public: - LLFastTimerView(const std::string& name, const LLRect& rect); - virtual ~LLFastTimerView(); + LLFastTimerView(const LLRect& rect); + + static BOOL sAnalyzePerformance; + + static void doAnalysis(std::string baseline, std::string target, std::string output); + +private: + static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ; + static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ; + static LLSD analyzeMetricPerformanceLog(std::istream& is) ; + static LLSD analyzePerformanceLogDefault(std::istream& is) ; + +public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void draw(); - S32 getLegendIndex(S32 y); - F64 getTime(LLFastTimer::EFastTimerType tidx); + LLFastTimer::NamedTimer* getLegendID(S32 y); + F64 getTime(LLFastTimer::NamedTimer::FrameState& id); private: - S32* mBarStart; - S32* mBarEnd; + typedef std::vector > bar_positions_t; + bar_positions_t mBarStart; + bar_positions_t mBarEnd; S32 mDisplayMode; - S32 mDisplayCenter; + + typedef enum child_alignment + { + ALIGN_LEFT, + ALIGN_CENTER, + ALIGN_RIGHT, + ALIGN_COUNT + } ChildAlignment; + + ChildAlignment mDisplayCenter; S32 mDisplayCalls; S32 mDisplayHz; U64 mAvgCountTotal; U64 mMaxCountTotal; LLRect mBarRect; S32 mScrollIndex; - S32 mHoverIndex; + LLFastTimer::NamedTimer* mHoverID; + LLFastTimer::NamedTimer* mHoverTimer; + LLRect mToolTipRect; S32 mHoverBarIndex; LLFrameTimer mHighlightTimer; - S32 mSubtractHidden; S32 mPrintStats; }; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp new file mode 100644 index 0000000000..7719af2bd7 --- /dev/null +++ b/indra/newview/llfavoritesbar.cpp @@ -0,0 +1,579 @@ +/** + * @file llfavoritesbar.cpp + * @brief LLFavoritesBarCtrl class implementation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfavoritesbar.h" + +#include "llbutton.h" +#include "llfloaterreg.h" +#include "llinventory.h" +#include "lluictrlfactory.h" +#include "llmenugl.h" + +#include "llagent.h" +#include "llinventorybridge.h" +#include "llinventorymodel.h" +#include "llviewerinventory.h" +#include "llviewermenu.h" +#include "llviewermenu.h" + +static LLDefaultWidgetRegistry::Register r("favorites_bar"); + +// updateButtons's helper +struct LLFavoritesSort +{ + // Sorting by creation date and name + // TODO - made it customizible using gSavedSettings + bool operator()(const LLViewerInventoryItem* const& a, const LLViewerInventoryItem* const& b) + { + time_t first_create = a->getCreationDate(); + time_t second_create = b->getCreationDate(); + if (first_create == second_create) + { + return (LLStringUtil::compareDict(a->getName(), b->getName()) < 0); + } + else + { + return (first_create > second_create); + } + } +}; + +class LLVisibilityTrackingMenuGL : public LLMenuGL +{ +protected: + LLVisibilityTrackingMenuGL(const LLMenuGL::Params&); + friend class LLUICtrlFactory; +public: + virtual void onVisibilityChange (BOOL curVisibilityIn); + void setChevronRect(const LLRect& rect) { mChevronRect = rect; } + + bool getClosedByChevronClick() { return mClosedByChevronClick; } + void resetClosedByChevronClick() { mClosedByChevronClick = false; } + +protected: + bool mClosedByChevronClick; + LLRect mChevronRect; +}; + +LLVisibilityTrackingMenuGL::LLVisibilityTrackingMenuGL(const LLMenuGL::Params& p) +: LLMenuGL(p), + mClosedByChevronClick(false) +{ +} + +//virtual +void LLVisibilityTrackingMenuGL::onVisibilityChange (BOOL curVisibilityIn) +{ + S32 x,y; + LLUI::getCursorPositionLocal(LLUI::getRootView(), &x, &y); + + if (!curVisibilityIn && mChevronRect.pointInRect(x, y)) + { + mClosedByChevronClick = true; + } +} + +LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) +: LLUICtrl(p), + mFont(p.font.isProvided() ? p.font() : LLFontGL::getFontSansSerifSmall()), + mPopupMenuHandle(), + mInventoryItemsPopupMenuHandle() +{ + // Register callback for menus with current registrar (will be parent panel's registrar) + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Favorites.DoToSelected", + boost::bind(&LLFavoritesBarCtrl::doToSelected, this, _2)); + + // Add this if we need to selectively enable items + //LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Favorites.EnableSelected", + // boost::bind(&LLFavoritesBarCtrl::enableSelected, this, _2)); + + gInventory.addObserver(this); +} + +LLFavoritesBarCtrl::~LLFavoritesBarCtrl() +{ + gInventory.removeObserver(this); + + LLView::deleteViewByHandle(mPopupMenuHandle); + LLView::deleteViewByHandle(mInventoryItemsPopupMenuHandle); +} + +BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + *accept = ACCEPT_NO; + + switch (cargo_type) + { + + case DAD_LANDMARK: + { + // Copy the item into the favorites folder (if it's not already there). + LLInventoryItem *item = (LLInventoryItem *)cargo_data; + LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + if (item->getParentUUID() == favorites_id) + { + llwarns << "Attemt to copy a favorite item into the same folder." << llendl; + break; + } + + *accept = ACCEPT_YES_COPY_SINGLE; + + if (drop) + { + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + favorites_id, + std::string(), + LLPointer(NULL)); + + llinfos << "Copied inventory item #" << item->getUUID() << " to favorites." << llendl; + } + + } + break; + default: + break; + } + + return TRUE; +} + +//virtual +void LLFavoritesBarCtrl::changed(U32 mask) +{ + if (mFavoriteFolderId.isNull()) + { + mFavoriteFolderId = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + + if (mFavoriteFolderId.notNull()) + { + gInventory.fetchDescendentsOf(mFavoriteFolderId); + } + } + else + { + updateButtons(getRect().getWidth()); + } +} + +//virtual +void LLFavoritesBarCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + updateButtons(width); + + LLUICtrl::reshape(width, height, called_from_parent); +} + +void LLFavoritesBarCtrl::updateButtons(U32 bar_width) +{ + LLInventoryModel::item_array_t items; + + if (!collectFavoriteItems(items)) + { + return; + } + + const S32 buttonHPad = LLUI::sSettingGroups["config"]->getS32("ButtonHPad"); + const S32 buttonHGap = 2; + const S32 buttonVGap = 2; + static LLButton::Params default_button_params(LLUICtrlFactory::getDefaultParams()); + std::string flat_icon = "transparent.j2c"; + std::string hover_icon = default_button_params.image_unselected.name; + std::string hover_icon_selected = default_button_params.image_selected.name; + + S32 curr_x = buttonHGap; + + S32 count = items.count(); + + const S32 chevron_button_width = mFont->getWidth(">>") + buttonHPad * 2; + + S32 buttons_space = bar_width - curr_x; + + S32 first_drop_down_item = count; + + // Calculating, how much buttons can fit in the bar + S32 buttons_width = 0; + for (S32 i = 0; i < count; ++i) + { + buttons_width += mFont->getWidth(items.get(i)->getName()) + buttonHPad * 2 + buttonHGap; + if (buttons_width > buttons_space) + { + // There is no space for all buttons. + // Calculating the number of buttons, that are fit with chevron button + buttons_space -= chevron_button_width + buttonHGap; + while (i >= 0 && buttons_width > buttons_space) + { + buttons_width -= mFont->getWidth(items.get(i)->getName()) + buttonHPad * 2 + buttonHGap; + i--; + } + first_drop_down_item = i + 1; // First item behind visible items + + break; + } + } + + // If inventory items are not changed up to mFirstDropDownItem, no need to recreate them + if (mFirstDropDownItem == first_drop_down_item && (mItemNamesCache.size() == count || mItemNamesCache.size() == mFirstDropDownItem)) + { + S32 i; + for (i = 0; i < mFirstDropDownItem; ++i) + { + if (mItemNamesCache.get(i) != items.get(i)->getName()) + { + break; + } + } + if (i == mFirstDropDownItem) + { + // Chevron button should stay right aligned + LLView *chevron_button = getChildView(std::string(">>"), FALSE, FALSE); + if (chevron_button) + { + LLRect rect; + rect.setOriginAndSize(bar_width - chevron_button_width - buttonHGap, buttonVGap, chevron_button_width, getRect().getHeight()-buttonVGap); + chevron_button->setRect(rect); + + S32 chevron_root_x, chevron_root_y; + localPointToOtherView(rect.mLeft, rect.mBottom, &chevron_root_x, &chevron_root_y, LLUI::getRootView()); + mChevronRect.setOriginAndSize(chevron_root_x, chevron_root_y, rect.getWidth(), rect.getHeight()); + } + return; + } + } + + mFirstDropDownItem = first_drop_down_item; + + mItemNamesCache.clear(); + for (S32 i = 0; i < mFirstDropDownItem; i++) + { + mItemNamesCache.put(items.get(i)->getName()); + } + + // Rebuild the buttons only + // child_list_t is a linked list, so safe to erase from the middle if we pre-incrament the iterator + for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ) + { + child_list_const_iter_t cur_it = child_it++; + LLView* viewp = *cur_it; + LLButton* button = dynamic_cast(viewp); + if (button) + { + removeChild(button); + delete button; + } + } + + // Adding buttons + for(S32 i = 0; i < mFirstDropDownItem; i++) + { + + LLInventoryItem* item = items.get(i); + + S32 buttonWidth = mFont->getWidth(item->getName()) + buttonHPad * 2; + + LLRect rect; + rect.setOriginAndSize(curr_x, buttonVGap, buttonWidth, getRect().getHeight()-buttonVGap); + + LLButton::Params bparams; + bparams.image_unselected.name(flat_icon); + bparams.image_disabled.name(flat_icon); + bparams.image_selected.name(hover_icon_selected); + bparams.image_hover_selected.name(hover_icon_selected); + bparams.image_disabled_selected.name(hover_icon_selected); + bparams.image_hover_unselected.name(hover_icon); + bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_BOTTOM); + bparams.rect (rect); + bparams.tab_stop(false); + bparams.font(mFont); + bparams.name(item->getName()); + bparams.tool_tip(item->getName()); + bparams.click_callback.function(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID())); + bparams.rightclick_callback.function(boost::bind(&LLFavoritesBarCtrl::onButtonRightClick, this, item->getUUID())); + + addChildInBack(LLUICtrlFactory::create (bparams)); + + curr_x += buttonWidth + buttonHGap; + } + + // Chevron button + if (mFirstDropDownItem != count) + { + LLButton::Params bparams; + + LLRect rect; + rect.setOriginAndSize(bar_width - chevron_button_width - buttonHGap, buttonVGap, chevron_button_width, getRect().getHeight()-buttonVGap); + + bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_BOTTOM); + bparams.image_unselected.name(flat_icon); + bparams.image_disabled.name(flat_icon); + bparams.image_selected.name(hover_icon_selected); + bparams.image_hover_selected.name(hover_icon_selected); + bparams.image_disabled_selected.name(hover_icon_selected); + bparams.image_hover_unselected.name(hover_icon); + bparams.rect (rect); + bparams.tab_stop(false); + bparams.font(mFont); + bparams.name(">>"); + bparams.click_callback.function(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); + + addChildInBack(LLUICtrlFactory::create (bparams)); + + S32 chevron_root_x, chevron_root_y; + localPointToOtherView(rect.mLeft, rect.mBottom, &chevron_root_x, &chevron_root_y, LLUI::getRootView()); + mChevronRect.setOriginAndSize(chevron_root_x, chevron_root_y, rect.getWidth(), rect.getHeight()); + } +} + +BOOL LLFavoritesBarCtrl::postBuild() +{ + // make the popup menu available + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_favorites.xml", gMenuHolder); + if (!menu) + { + menu = LLUICtrlFactory::createDummyWidget("inventory_menu"); + } + menu->setBackgroundColor(gSavedSkinSettings.getColor("MenuPopupBgColor")); + mInventoryItemsPopupMenuHandle = menu->getHandle(); + + return TRUE; +} + +BOOL LLFavoritesBarCtrl::collectFavoriteItems(LLInventoryModel::item_array_t &items) +{ + if (mFavoriteFolderId.isNull()) + return FALSE; + + LLInventoryModel::cat_array_t cats; + + LLIsType is_type(LLAssetType::AT_LANDMARK); + gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type); + + std::sort(items.begin(), items.end(), LLFavoritesSort()); + + return TRUE; +} + +void LLFavoritesBarCtrl::showDropDownMenu() +{ + if (mPopupMenuHandle.isDead()) + { + LLMenuGL::Params menu_p; + menu_p.name("favorites menu"); + menu_p.can_tear_off(false); + menu_p.visible(false); + menu_p.scrollable(true); + + LLVisibilityTrackingMenuGL* menu = LLUICtrlFactory::create(menu_p); + + mPopupMenuHandle = menu->getHandle(); + } + + LLVisibilityTrackingMenuGL* menu = (LLVisibilityTrackingMenuGL*)mPopupMenuHandle.get(); + + if(menu) + { + if (menu->getClosedByChevronClick()) + { + menu->resetClosedByChevronClick(); + return; + } + + if (menu->getVisible()) + { + menu->setVisible(FALSE); + menu->resetClosedByChevronClick(); + return; + } + + LLInventoryModel::item_array_t items; + + if (!collectFavoriteItems(items)) + { + return; + } + + S32 count = items.count(); + + // Check it there are changed items, since last call + if (mItemNamesCache.size() == count) + { + S32 i; + for (i = mFirstDropDownItem; i < count; i++) + { + if (mItemNamesCache.get(i) != items.get(i)->getName()) + { + break; + } + } + + // Check passed, just show the menu + if (i == count) + { + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + + menu->setChevronRect(mChevronRect); + + LLMenuGL::showPopup(this, menu, getRect().getWidth() - menu->getRect().getWidth(), 0); + return; + } + } + + // Add menu items to cache, if there is only names of buttons + if (mItemNamesCache.size() == mFirstDropDownItem) + { + for (S32 i = mFirstDropDownItem; i < count; i++) + { + mItemNamesCache.put(items.get(i)->getName()); + } + } + + menu->empty(); + + U32 max_width = 0; + + // Menu will not be wider, than bar + S32 bar_width = getRect().getWidth(); + + for(S32 i = mFirstDropDownItem; i < count; i++) + { + LLInventoryItem* item = items.get(i); + const std::string& item_name = item->getName(); + + LLMenuItemCallGL::Params item_params; + item_params.name(item_name); + item_params.label(item_name); + + item_params.on_click.function(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID())); + + LLMenuItemCallGL *menu_item = LLUICtrlFactory::create(item_params); + + // Check whether item name wider than menu + if ((S32) menu_item->getNominalWidth() > bar_width) + { + S32 chars_total = item_name.length(); + S32 chars_fitted = 1; + menu_item->setLabel(LLStringExplicit("")); + S32 label_space = bar_width - menu_item->getFont()->getWidth("...") - + menu_item->getNominalWidth(); // This returns width of menu item with empty label (pad pixels) + + while (chars_fitted < chars_total && menu_item->getFont()->getWidth(item_name, 0, chars_fitted) < label_space) + { + chars_fitted++; + } + chars_fitted--; // Rolling back one char, that doesn't fit + + menu_item->setLabel(item_name.substr(0, chars_fitted) + "..."); + } + + max_width = llmax(max_width, menu_item->getNominalWidth()); + + menu->addChild(menu_item); + } + + // Menu will not be wider, than bar + max_width = llmin((S32)max_width, bar_width); + + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + + menu->setChevronRect(mChevronRect); + + LLMenuGL::showPopup(this, menu, getRect().getWidth() - max_width, 0); + } +} + +void LLFavoritesBarCtrl::onButtonClick(LLUUID item_id) +{ + LLInventoryModel::item_array_t items; + + if (!collectFavoriteItems(items)) + { + return; + } + + // We only have one Inventory, gInventory. Some day this should be better abstracted. + LLInvFVBridgeAction::doAction(item_id,&gInventory); +} + +void LLFavoritesBarCtrl::onButtonRightClick(LLUUID item_id) +{ + mSelectedItemID = item_id; + + LLMenuGL* menu = (LLMenuGL*)mInventoryItemsPopupMenuHandle.get(); + if (!menu) + { + return; + } + + menu->updateParent(LLMenuGL::sMenuContainer); + + S32 x,y; + LLUI::getCursorPositionLocal(this, &x, &y); + LLMenuGL::showPopup(this, menu, x, y); +} + +void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) +{ + std::string action = userdata.asString(); + llinfos << "Action = " << action << " Item = " << mSelectedItemID.asString() << llendl; + + LLViewerInventoryItem* item = gInventory.getItem(mSelectedItemID); + if (!item) + return; + + if (action == "open") + { + teleport_via_landmark(item->getAssetUUID()); + } + else if (action == "about") + { + LLFloaterReg::showInstance("preview_landmark", LLSD(mSelectedItemID), TAKE_FOCUS_YES); + } + else if (action == "rename") + { + // Would need to re-implement this: + // folder->startRenamingSelectedItem(); + } + else if (action == "delete") + { + gInventory.removeItem(mSelectedItemID); + } +} diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h new file mode 100644 index 0000000000..646e98cabb --- /dev/null +++ b/indra/newview/llfavoritesbar.h @@ -0,0 +1,89 @@ +/** + * @file llfavoritesbar.h + * @brief LLFavoritesBarCtrl base class + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFAVORITESBARCTRL_H +#define LL_LLFAVORITESBARCTRL_H + +#include "lluictrl.h" +#include "lliconctrl.h" +#include "llinventorymodel.h" + +class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver +{ +public: + struct Params : public LLUICtrl::Params{}; +protected: + LLFavoritesBarCtrl(const Params&); + friend class LLUICtrlFactory; +public: + virtual ~LLFavoritesBarCtrl(); + + /*virtual*/ BOOL postBuild(); + + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + + // LLInventoryObserver observer trigger + virtual void changed(U32 mask); + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + +protected: + void updateButtons(U32 bar_width); + BOOL collectFavoriteItems(LLInventoryModel::item_array_t &items); + + void onButtonClick(LLUUID id); + void onButtonRightClick(LLUUID id); + + void doToSelected(const LLSD& userdata); + + void showDropDownMenu(); + + LLHandle mPopupMenuHandle; + LLHandle mInventoryItemsPopupMenuHandle; + + LLUUID mFavoriteFolderId; + const LLFontGL *mFont; + S32 mFirstDropDownItem; + + typedef LLDynamicArray item_names_array_t; + item_names_array_t mItemNamesCache; + + LLUUID mSelectedItemID; + LLRect mChevronRect; +}; + + +#endif // LL_LLFAVORITESBARCTRL_H + diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 8f5882615f..028e1cc098 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -39,6 +39,7 @@ #include "lldir.h" #include "llframetimer.h" #include "lltrans.h" +#include "llwindow.h" // beforeDialog() #if LL_SDL #include "llwindowsdl.h" // for some X/GTK utils to help with filepickers @@ -818,6 +819,13 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter) reset(); mNavOptions.optionFlags &= ~kNavAllowMultipleFiles; + + if(filter == FFLOAD_ALL) // allow application bundles etc. to be traversed; important for DEV-16869, but generally useful + { + // mNavOptions.optionFlags |= kNavAllowOpenPackages; + mNavOptions.optionFlags |= kNavSupportPackages; + } + // Modal, so pause agent send_agent_pause(); { diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 9ee24d6d83..352ca3c863 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -51,8 +51,6 @@ std::set LLFirstUse::sConfigVariables; // static void LLFirstUse::addConfigVariable(const std::string& var) { - //Don't add the warning, now that we're storing the default in the settings_default.xml file - //gSavedSettings.addWarning(var); sConfigVariables.insert(var); } @@ -63,7 +61,7 @@ void LLFirstUse::disableFirstUse() for (std::set::iterator iter = sConfigVariables.begin(); iter != sConfigVariables.end(); ++iter) { - gSavedSettings.setWarning(*iter, FALSE); + gWarningSettings.setBOOL(*iter, FALSE); } } @@ -74,7 +72,7 @@ void LLFirstUse::resetFirstUse() for (std::set::iterator iter = sConfigVariables.begin(); iter != sConfigVariables.end(); ++iter) { - gSavedSettings.setWarning(*iter, TRUE); + gWarningSettings.setBOOL(*iter, TRUE); } } @@ -82,9 +80,9 @@ void LLFirstUse::resetFirstUse() // Called whenever the viewer detects that your balance went up void LLFirstUse::useBalanceIncrease(S32 delta) { - if (gSavedSettings.getWarning("FirstBalanceIncrease")) + if (gWarningSettings.getBOOL("FirstBalanceIncrease")) { - gSavedSettings.setWarning("FirstBalanceIncrease", FALSE); + gWarningSettings.setBOOL("FirstBalanceIncrease", FALSE); LLSD args; args["AMOUNT"] = llformat("%d",delta); @@ -96,9 +94,9 @@ void LLFirstUse::useBalanceIncrease(S32 delta) // Called whenever the viewer detects your balance went down void LLFirstUse::useBalanceDecrease(S32 delta) { - if (gSavedSettings.getWarning("FirstBalanceDecrease")) + if (gWarningSettings.getBOOL("FirstBalanceDecrease")) { - gSavedSettings.setWarning("FirstBalanceDecrease", FALSE); + gWarningSettings.setBOOL("FirstBalanceDecrease", FALSE); LLSD args; args["AMOUNT"] = llformat("%d",-delta); @@ -112,9 +110,9 @@ void LLFirstUse::useSit() { // Our orientation island uses sitting to teach vehicle driving // so just never show this message. JC - //if (gSavedSettings.getWarning("FirstSit")) + //if (gWarningSettings.getBOOL("FirstSit")) //{ - // gSavedSettings.setWarning("FirstSit", FALSE); + // gWarningSettings.setBOOL("FirstSit", FALSE); // // LLNotifications::instance().add("FirstSit"); //} @@ -123,9 +121,9 @@ void LLFirstUse::useSit() // static void LLFirstUse::useMap() { - if (gSavedSettings.getWarning("FirstMap")) + if (gWarningSettings.getBOOL("FirstMap")) { - gSavedSettings.setWarning("FirstMap", FALSE); + gWarningSettings.setBOOL("FirstMap", FALSE); LLNotifications::instance().add("FirstMap"); } @@ -140,9 +138,9 @@ void LLFirstUse::useGoTo() // static void LLFirstUse::useBuild() { - if (gSavedSettings.getWarning("FirstBuild")) + if (gWarningSettings.getBOOL("FirstBuild")) { - gSavedSettings.setWarning("FirstBuild", FALSE); + gWarningSettings.setBOOL("FirstBuild", FALSE); LLNotifications::instance().add("FirstBuild"); } @@ -151,9 +149,9 @@ void LLFirstUse::useBuild() // static void LLFirstUse::useLeftClickNoHit() { - if (gSavedSettings.getWarning("FirstLeftClickNoHit")) + if (gWarningSettings.getBOOL("FirstLeftClickNoHit")) { - gSavedSettings.setWarning("FirstLeftClickNoHit", FALSE); + gWarningSettings.setBOOL("FirstLeftClickNoHit", FALSE); LLNotifications::instance().add("FirstLeftClickNoHit"); } @@ -162,12 +160,12 @@ void LLFirstUse::useLeftClickNoHit() // static void LLFirstUse::useTeleport() { - if (gSavedSettings.getWarning("FirstTeleport")) + if (gWarningSettings.getBOOL("FirstTeleport")) { LLVector3d teleportDestination = LLTracker::getTrackedPositionGlobal(); if(teleportDestination != LLVector3d::zero) { - gSavedSettings.setWarning("FirstTeleport", FALSE); + gWarningSettings.setBOOL("FirstTeleport", FALSE); LLNotifications::instance().add("FirstTeleport"); } @@ -181,9 +179,9 @@ void LLFirstUse::useOverrideKeys() // so don't show this message until you get off OI. JC if (!gAgent.inPrelude()) { - if (gSavedSettings.getWarning("FirstOverrideKeys")) + if (gWarningSettings.getBOOL("FirstOverrideKeys")) { - gSavedSettings.setWarning("FirstOverrideKeys", FALSE); + gWarningSettings.setBOOL("FirstOverrideKeys", FALSE); LLNotifications::instance().add("FirstOverrideKeys"); } @@ -199,9 +197,9 @@ void LLFirstUse::useAttach() // static void LLFirstUse::useAppearance() { - if (gSavedSettings.getWarning("FirstAppearance")) + if (gWarningSettings.getBOOL("FirstAppearance")) { - gSavedSettings.setWarning("FirstAppearance", FALSE); + gWarningSettings.setBOOL("FirstAppearance", FALSE); LLNotifications::instance().add("FirstAppearance"); } @@ -210,9 +208,9 @@ void LLFirstUse::useAppearance() // static void LLFirstUse::useInventory() { - if (gSavedSettings.getWarning("FirstInventory")) + if (gWarningSettings.getBOOL("FirstInventory")) { - gSavedSettings.setWarning("FirstInventory", FALSE); + gWarningSettings.setBOOL("FirstInventory", FALSE); LLNotifications::instance().add("FirstInventory"); } @@ -222,9 +220,9 @@ void LLFirstUse::useInventory() // static void LLFirstUse::useSandbox() { - if (gSavedSettings.getWarning("FirstSandbox")) + if (gWarningSettings.getBOOL("FirstSandbox")) { - gSavedSettings.setWarning("FirstSandbox", FALSE); + gWarningSettings.setBOOL("FirstSandbox", FALSE); LLSD args; args["HOURS"] = llformat("%d",SANDBOX_CLEAN_FREQ); @@ -236,9 +234,9 @@ void LLFirstUse::useSandbox() // static void LLFirstUse::useFlexible() { - if (gSavedSettings.getWarning("FirstFlexible")) + if (gWarningSettings.getBOOL("FirstFlexible")) { - gSavedSettings.setWarning("FirstFlexible", FALSE); + gWarningSettings.setBOOL("FirstFlexible", FALSE); LLNotifications::instance().add("FirstFlexible"); } @@ -247,9 +245,9 @@ void LLFirstUse::useFlexible() // static void LLFirstUse::useDebugMenus() { - if (gSavedSettings.getWarning("FirstDebugMenus")) + if (gWarningSettings.getBOOL("FirstDebugMenus")) { - gSavedSettings.setWarning("FirstDebugMenus", FALSE); + gWarningSettings.setBOOL("FirstDebugMenus", FALSE); LLNotifications::instance().add("FirstDebugMenus"); } @@ -258,9 +256,9 @@ void LLFirstUse::useDebugMenus() // static void LLFirstUse::useSculptedPrim() { - if (gSavedSettings.getWarning("FirstSculptedPrim")) + if (gWarningSettings.getBOOL("FirstSculptedPrim")) { - gSavedSettings.setWarning("FirstSculptedPrim", FALSE); + gWarningSettings.setBOOL("FirstSculptedPrim", FALSE); LLNotifications::instance().add("FirstSculptedPrim"); @@ -270,9 +268,9 @@ void LLFirstUse::useSculptedPrim() // static void LLFirstUse::useMedia() { - if (gSavedSettings.getWarning("FirstMedia")) + if (gWarningSettings.getBOOL("FirstMedia")) { - gSavedSettings.setWarning("FirstMedia", FALSE); + gWarningSettings.setBOOL("FirstMedia", FALSE); LLNotifications::instance().add("FirstMedia"); } diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index 895701da3a..811ae24df2 100644 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -43,7 +43,6 @@ #ifndef LL_LLFLEXIBLEOBJECT_H #define LL_LLFLEXIBLEOBJECT_H -#include "llmemory.h" #include "llprimitive.h" #include "llvovolume.h" #include "llwind.h" diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 810799d27c..9df0a96888 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -69,41 +69,35 @@ extern LLCPUInfo gSysCPU; extern LLMemoryInfo gSysMemory; extern U32 gPacketsIn; -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - -LLFloaterAbout* LLFloaterAbout::sInstance = NULL; - static std::string get_viewer_release_notes_url(); + ///---------------------------------------------------------------------------- /// Class LLFloaterAbout ///---------------------------------------------------------------------------- // Default constructor -LLFloaterAbout::LLFloaterAbout() -: LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null) +LLFloaterAbout::LLFloaterAbout(const LLSD& key) +: LLFloater() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml"); + +} - // Support for changing product name. - std::string title("About "); - title += LLAppViewer::instance()->getSecondLifeTitle(); - setTitle(title); +// Destroys the object +LLFloaterAbout::~LLFloaterAbout() +{ +} +BOOL LLFloaterAbout::postBuild() +{ + center(); LLViewerTextEditor *support_widget = getChild("support_editor", true); LLViewerTextEditor *credits_widget = getChild("credits_editor", true); - - if (!support_widget || !credits_widget) - { - return; - } - // For some reason, adding style doesn't work unless this is true. support_widget->setParseHTML(TRUE); @@ -112,15 +106,15 @@ LLFloaterAbout::LLFloaterAbout() viewer_link_style->setVisible(true); viewer_link_style->setFontName(LLStringUtil::null); viewer_link_style->setLinkHREF(get_viewer_release_notes_url()); - viewer_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + viewer_link_style->setColor(gSavedSkinSettings.getColor4("HTMLLinkColor")); // Version string - std::string version = LLAppViewer::instance()->getSecondLifeTitle() + std::string version = LLTrans::getString("SECOND_LIFE_VIEWER") + llformat(" %d.%d.%d (%d) %s %s (%s)\n", LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD, __DATE__, __TIME__, gSavedSettings.getString("VersionChannelName").c_str()); - support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); + support_widget->appendColoredText(version, FALSE, FALSE, LLUI::sSettingGroups["color"]->getColor("TextFgReadOnlyColor")); support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style); std::string support; @@ -142,7 +136,7 @@ LLFloaterAbout::LLFloaterAbout() server_link_style->setVisible(true); server_link_style->setFontName(LLStringUtil::null); server_link_style->setLinkHREF(region->getCapability("ServerReleaseNotes")); - server_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + server_link_style->setColor(gSavedSkinSettings.getColor4("HTMLLinkColor")); const LLVector3d &pos = gAgent.getPositionGlobal(); LLUIString pos_text = getString("you_are_at"); @@ -150,8 +144,8 @@ LLFloaterAbout::LLFloaterAbout() llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ])); support.append(pos_text); - std::string region_text = llformat("in %s located at ", - gAgent.getRegion()->getName().c_str()); + LLUIString region_text = getString ("in_region") + " "; + region_text.setArg("[REGION]", llformat ("%s", gAgent.getRegion()->getName().c_str())); support.append(region_text); std::string buffer; @@ -164,7 +158,7 @@ LLFloaterAbout::LLFloaterAbout() support.append(gLastVersionChannel); support.append("\n"); - support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); + support_widget->appendColoredText(support, FALSE, FALSE, LLUI::sSettingGroups["color"]->getColor("TextFgReadOnlyColor")); support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style); support = "\n\n"; @@ -175,25 +169,26 @@ LLFloaterAbout::LLFloaterAbout() // and this info sometimes gets sent to support // CPU - support.append("CPU: "); + support.append(getString("CPU") + " "); support.append( gSysCPU.getCPUString() ); support.append("\n"); U32 memory = gSysMemory.getPhysicalMemoryKB() / 1024; // Moved hack adjustment to Windows memory size into llsys.cpp - std::string mem_text = llformat("Memory: %u MB\n", memory ); - support.append(mem_text); + LLStringUtil::format_map_t args; + args["[MEM]"] = llformat ("%u", memory); + support.append(getString("Memory", args) + "\n"); - support.append("OS Version: "); + support.append(getString("OSVersion") + " "); support.append( LLAppViewer::instance()->getOSInfo().getOSString() ); support.append("\n"); - support.append("Graphics Card Vendor: "); + support.append(getString("GraphicsCardVendor") + " "); support.append( (const char*) glGetString(GL_VENDOR) ); support.append("\n"); - support.append("Graphics Card: "); + support.append(getString("GraphicsCard") + " "); support.append( (const char*) glGetString(GL_RENDERER) ); support.append("\n"); @@ -211,23 +206,23 @@ LLFloaterAbout::LLFloaterAbout() getWindow()->setCursor(UI_CURSOR_ARROW); #endif - support.append("OpenGL Version: "); + support.append(getString("OpenGLVersion") + " "); support.append( (const char*) glGetString(GL_VERSION) ); support.append("\n"); support.append("\n"); - support.append("libcurl Version: "); + support.append(getString("LibCurlVersion") + " "); support.append( LLCurl::getVersionString() ); support.append("\n"); - support.append("J2C Decoder Version: "); + support.append(getString("J2CDecoderVersion") + " "); support.append( LLImageJ2C::getEngineInfo() ); support.append("\n"); - support.append("Audio Driver Version: "); + support.append(getString("AudioDriverVersion") + " "); bool want_fullname = true; - support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : "(none)" ); + support.append( gAudiop ? gAudiop->getDriverName(want_fullname) : getString("none") ); support.append("\n"); LLMediaManager *mgr = LLMediaManager::getInstance(); @@ -236,7 +231,7 @@ LLFloaterAbout::LLFloaterAbout() LLMediaBase *media_source = mgr->createSourceFromMimeType("http", "text/html"); if (media_source) { - support.append("LLMozLib Version: "); + support.append(getString("LLMozLibVersion") + " "); support.append(media_source->getVersion()); support.append("\n"); mgr->destroySource(media_source); @@ -245,15 +240,13 @@ LLFloaterAbout::LLFloaterAbout() if (gPacketsIn > 0) { - std::string packet_loss = llformat("Packets Lost: %.0f/%.0f (%.1f%%)", - LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(), - F32(gPacketsIn), - 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); - support.append(packet_loss); - support.append("\n"); + args["[LOST]"] = llformat ("%.0f", LLViewerStats::getInstance()->mPacketsLostStat.getCurrent()); + args["[IN]"] = llformat ("%.0f", F32(gPacketsIn)); + args["[PCT]"] = llformat ("%.1f", 100.f*LLViewerStats::getInstance()->mPacketsLostStat.getCurrent() / F32(gPacketsIn) ); + support.append(getString ("PacketsLost", args) + "\n"); } - support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); + support_widget->appendColoredText(support, FALSE, FALSE, LLUI::sSettingGroups["color"]->getColor("TextFgReadOnlyColor")); // Fix views support_widget->setCursorPos(0); @@ -266,43 +259,24 @@ LLFloaterAbout::LLFloaterAbout() credits_widget->setTakesFocus(TRUE); credits_widget->setHandleEditKeysDirectly(TRUE); - center(); - - sInstance = this; -} - -// Destroys the object -LLFloaterAbout::~LLFloaterAbout() -{ - sInstance = NULL; -} - -// static -void LLFloaterAbout::show(void*) -{ - if (!sInstance) - { - sInstance = new LLFloaterAbout(); - } - - sInstance->open(); /*Flawfinder: ignore*/ + return TRUE; } -static std::string get_viewer_release_notes_url() -{ - std::ostringstream version; - version << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; + static std::string get_viewer_release_notes_url() + { + std::ostringstream version; + version << LL_VERSION_MAJOR << "." + << LL_VERSION_MINOR << "." + << LL_VERSION_PATCH << "." + << LL_VERSION_BUILD; - LLSD query; - query["channel"] = gSavedSettings.getString("VersionChannelName"); - query["version"] = version.str(); + LLSD query; + query["channel"] = gSavedSettings.getString("VersionChannelName"); + query["version"] = version.str(); - std::ostringstream url; - url << RELEASE_NOTES_BASE_URL << LLURI::mapToQueryString(query); + std::ostringstream url; + url << LLTrans::getString("RELEASE_NOTES_BASE_URL") << LLURI::mapToQueryString(query); - return url.str(); -} + return url.str(); + } diff --git a/indra/newview/llfloaterabout.h b/indra/newview/llfloaterabout.h index 7564b8e41c..1b0f3cddd3 100644 --- a/indra/newview/llfloaterabout.h +++ b/indra/newview/llfloaterabout.h @@ -36,16 +36,16 @@ #include "llfloater.h" class LLFloaterAbout -: public LLFloater + : public LLFloater, public LLFloaterSingleton { -public: - LLFloaterAbout(); + friend class LLUISingleton >; +public: + LLFloaterAbout(const LLSD& key); +protected: virtual ~LLFloaterAbout(); - static void show(void*); - -private: - static LLFloaterAbout* sInstance; +public: + /*virtual*/ BOOL postBuild(); }; diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 162456b8ce..12c4932293 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -42,6 +42,7 @@ #include "llstring.h" #include "llagent.h" +#include "llanimationstates.h" #include "llbbox.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -66,6 +67,7 @@ #include "llvoavatar.h" #include "pipeline.h" #include "lluictrlfactory.h" +#include "lltrans.h" S32 LLFloaterAnimPreview::sUploadAmount = 10; @@ -82,6 +84,40 @@ const F32 MAX_CAMERA_ZOOM = 10.f; const F32 BASE_ANIM_TIME_OFFSET = 5.f; +std::string STATUS[] = +{ + "E_ST_OK", + "E_ST_EOF", + "E_ST_NO_CONSTRAINT", + "E_ST_NO_FILE", +"E_ST_NO_HIER", +"E_ST_NO_JOINT", +"E_ST_NO_NAME", +"E_ST_NO_OFFSET", +"E_ST_NO_CHANNELS", +"E_ST_NO_ROTATION", +"E_ST_NO_AXIS", +"E_ST_NO_MOTION", +"E_ST_NO_FRAMES", +"E_ST_NO_FRAME_TIME", +"E_ST_NO_POS", +"E_ST_NO_ROT", +"E_ST_NO_XLT_FILE", +"E_ST_NO_XLT_HEADER", +"E_ST_NO_XLT_NAME", +"E_ST_NO_XLT_IGNORE", +"E_ST_NO_XLT_RELATIVE", +"E_ST_NO_XLT_OUTNAME", +"E_ST_NO_XLT_MATRIX", +"E_ST_NO_XLT_MERGECHILD", +"E_ST_NO_XLT_MERGEPARENT", +"E_ST_NO_XLT_PRIORITY", +"E_ST_NO_XLT_LOOP", +"E_ST_NO_XLT_EASEIN", +"E_ST_NO_XLT_EASEOUT", +"E_ST_NO_XLT_HAND", +"E_ST_NO_XLT_EMOTE", +}; //----------------------------------------------------------------------------- // LLFloaterAnimPreview() //----------------------------------------------------------------------------- @@ -131,9 +167,9 @@ void LLFloaterAnimPreview::setAnimCallbacks() childSetCommitCallback("priority", onCommitPriority, this); childSetCommitCallback("loop_check", onCommitLoop, this); childSetCommitCallback("loop_in_point", onCommitLoopIn, this); - childSetValidate("loop_in_point", validateLoopIn); + childSetValidate("loop_in_point", boost::bind(&LLFloaterAnimPreview::validateLoopIn, this, _1)); childSetCommitCallback("loop_out_point", onCommitLoopOut, this); - childSetValidate("loop_out_point", validateLoopOut); + childSetValidate("loop_out_point", boost::bind(&LLFloaterAnimPreview::validateLoopOut, this, _1)); childSetCommitCallback("hand_pose_combo", onCommitHandPose, this); @@ -141,9 +177,9 @@ void LLFloaterAnimPreview::setAnimCallbacks() childSetValue("emote_combo", "[None]"); childSetCommitCallback("ease_in_time", onCommitEaseIn, this); - childSetValidate("ease_in_time", validateEaseIn); + childSetValidate("ease_in_time", boost::bind(&LLFloaterAnimPreview::validateEaseIn, this, _1)); childSetCommitCallback("ease_out_time", onCommitEaseOut, this); - childSetValidate("ease_out_time", validateEaseOut); + childSetValidate("ease_out_time", boost::bind(&LLFloaterAnimPreview::validateEaseOut, this, _1)); } //----------------------------------------------------------------------------- @@ -151,7 +187,6 @@ void LLFloaterAnimPreview::setAnimCallbacks() //----------------------------------------------------------------------------- BOOL LLFloaterAnimPreview::postBuild() { - LLRect r; LLKeyframeMotion* motionp = NULL; LLBVHLoader* loaderp = NULL; @@ -172,63 +207,14 @@ BOOL LLFloaterAnimPreview::postBuild() PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); - S32 y = mPreviewRect.mTop + BTN_HEIGHT; - S32 btn_left = PREVIEW_HPAD; - - r.set( btn_left, y, btn_left + 32, y - BTN_HEIGHT ); mPlayButton = getChild( "play_btn"); - if (!mPlayButton) - { - mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0)); - } - mPlayButton->setClickedCallback(onBtnPlay); - mPlayButton->setCallbackUserData(this); - - mPlayButton->setImages(std::string("button_anim_play.tga"), - std::string("button_anim_play_selected.tga")); - mPlayButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null); - - mPlayButton->setScaleImage(TRUE); + mPlayButton->setClickedCallback(onBtnPlay, this); mStopButton = getChild( "stop_btn"); - if (!mStopButton) - { - mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0)); - } - mStopButton->setClickedCallback(onBtnStop); - mStopButton->setCallbackUserData(this); - - mStopButton->setImages(std::string("button_anim_stop.tga"), - std::string("button_anim_stop_selected.tga")); - mStopButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null); - - mStopButton->setScaleImage(TRUE); - - r.set(r.mRight + PREVIEW_HPAD, y, getRect().getWidth() - PREVIEW_HPAD, y - BTN_HEIGHT); - //childSetCommitCallback("playback_slider", onSliderMove, this); + mStopButton->setClickedCallback(onBtnStop, this); childHide("bad_animation_text"); - //childSetCommitCallback("preview_base_anim", onCommitBaseAnim, this); - //childSetValue("preview_base_anim", "Standing"); - - //childSetCommitCallback("priority", onCommitPriority, this); - //childSetCommitCallback("loop_check", onCommitLoop, this); - //childSetCommitCallback("loop_in_point", onCommitLoopIn, this); - //childSetValidate("loop_in_point", validateLoopIn); - //childSetCommitCallback("loop_out_point", onCommitLoopOut, this); - //childSetValidate("loop_out_point", validateLoopOut); - - //childSetCommitCallback("hand_pose_combo", onCommitHandPose, this); - - //childSetCommitCallback("emote_combo", onCommitEmote, this); - //childSetValue("emote_combo", "[None]"); - - //childSetCommitCallback("ease_in_time", onCommitEaseIn, this); - //childSetValidate("ease_in_time", validateEaseIn); - //childSetCommitCallback("ease_out_time", onCommitEaseOut, this); - //childSetValidate("ease_out_time", validateEaseOut); - std::string exten = gDirUtilp->getExtension(mFilename); if (exten == "bvh") { @@ -254,7 +240,19 @@ BOOL LLFloaterAnimPreview::postBuild() { file_buffer[file_size] = '\0'; llinfos << "Loading BVH file " << mFilename << llendl; - loaderp = new LLBVHLoader(file_buffer); + ELoadStatus load_status = E_ST_OK; + S32 line_number = 0; + loaderp = new LLBVHLoader(file_buffer, load_status, line_number); + std::string status = getString(STATUS[load_status]); + + if(load_status == E_ST_NO_XLT_FILE) + { + llwarns << "NOTE: No translation table found." << llendl; + } + else + { + llwarns << "ERROR: [line: " << line_number << "] " << status << llendl; + } } infile.close() ; @@ -347,7 +345,7 @@ BOOL LLFloaterAnimPreview::postBuild() else { LLUIString out_str = getString("failed_file_read"); - out_str.setArg("[STATUS]", loaderp->getStatus()); // *TODO:Translate + out_str.setArg("[STATUS]", getString(STATUS[loaderp->getStatus()])); childSetValue("bad_animation_text", out_str.getString()); } } @@ -813,57 +811,53 @@ void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) //----------------------------------------------------------------------------- // validateEaseIn() //----------------------------------------------------------------------------- -BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) +bool LLFloaterAnimPreview::validateEaseIn(const LLSD& data) { - LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; - LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (!motionp->getLoop()) { - F32 new_ease_in = llclamp((F32)previewp->childGetValue("ease_in_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration()); - previewp->childSetValue("ease_in_time", LLSD(new_ease_in)); + F32 new_ease_in = llclamp((F32)childGetValue("ease_in_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration()); + childSetValue("ease_in_time", LLSD(new_ease_in)); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // validateEaseOut() //----------------------------------------------------------------------------- -BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) +bool LLFloaterAnimPreview::validateEaseOut(const LLSD& data) { - LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; + if (!getEnabled()) + return false; - if (!previewp->getEnabled()) - return FALSE; - - LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (!motionp->getLoop()) { - F32 new_ease_out = llclamp((F32)previewp->childGetValue("ease_out_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration()); - previewp->childSetValue("ease_out_time", LLSD(new_ease_out)); + F32 new_ease_out = llclamp((F32)childGetValue("ease_out_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration()); + childSetValue("ease_out_time", LLSD(new_ease_out)); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // validateLoopIn() //----------------------------------------------------------------------------- -BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) +bool LLFloaterAnimPreview::validateLoopIn(const LLSD& data) { - LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; - F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); - F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); + F32 loop_in_value = (F32)childGetValue("loop_in_point").asReal(); + F32 loop_out_value = (F32)childGetValue("loop_out_point").asReal(); if (loop_in_value < 0.f) { @@ -878,21 +872,20 @@ BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) loop_in_value = loop_out_value; } - previewp->childSetValue("loop_in_point", LLSD(loop_in_value)); - return TRUE; + childSetValue("loop_in_point", LLSD(loop_in_value)); + return true; } //----------------------------------------------------------------------------- // validateLoopOut() //----------------------------------------------------------------------------- -BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) +bool LLFloaterAnimPreview::validateLoopOut(const LLSD& data) { - LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; - F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); - F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); + F32 loop_out_value = (F32)childGetValue("loop_out_point").asReal(); + F32 loop_in_value = (F32)childGetValue("loop_in_point").asReal(); if (loop_out_value < 0.f) { @@ -907,8 +900,8 @@ BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) loop_out_value = loop_in_value; } - previewp->childSetValue("loop_out_point", LLSD(loop_out_value)); - return TRUE; + childSetValue("loop_out_point", LLSD(loop_out_value)); + return true; } @@ -1018,7 +1011,7 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata) LLKeyframeDataCache::removeKeyframeData(floaterp->mMotionID); } - floaterp->close(false); + floaterp->closeFloater(false); } //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h index 639c9277cd..2f228c3ecd 100644 --- a/indra/newview/llfloateranimpreview.h +++ b/indra/newview/llfloateranimpreview.h @@ -92,16 +92,16 @@ public: static void onCommitLoop(LLUICtrl*, void*); static void onCommitLoopIn(LLUICtrl*, void*); static void onCommitLoopOut(LLUICtrl*, void*); - static BOOL validateLoopIn(LLUICtrl*, void*); - static BOOL validateLoopOut(LLUICtrl*, void*); + bool validateLoopIn(const LLSD& data); + bool validateLoopOut(const LLSD& data); static void onCommitName(LLUICtrl*, void*); static void onCommitHandPose(LLUICtrl*, void*); static void onCommitEmote(LLUICtrl*, void*); static void onCommitPriority(LLUICtrl*, void*); static void onCommitEaseIn(LLUICtrl*, void*); static void onCommitEaseOut(LLUICtrl*, void*); - static BOOL validateEaseIn(LLUICtrl*, void*); - static BOOL validateEaseOut(LLUICtrl*, void*); + bool validateEaseIn(const LLSD& data); + bool validateEaseOut(const LLSD& data); static void onBtnOK(void*); static void onSaveComplete(const LLUUID& asset_uuid, LLAssetType::EType type, diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index 747431fb19..e1974bba84 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -41,6 +41,7 @@ #include "llparcel.h" #include "llvfile.h" #include "llvfs.h" +#include "llwindow.h" #include "llagent.h" #include "llcombobox.h" @@ -69,41 +70,32 @@ void auction_tga_upload_done(const LLUUID& asset_id, /// Class llfloaterauction ///---------------------------------------------------------------------------- -LLFloaterAuction* LLFloaterAuction::sInstance = NULL; - // Default constructor -LLFloaterAuction::LLFloaterAuction() : - LLFloater(std::string("floater_auction")), +LLFloaterAuction::LLFloaterAuction(const LLSD& key) + : LLFloater(), mParcelID(-1) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_auction.xml"); - - childSetValue("fence_check", - LLSD( gSavedSettings.getBOOL("AuctionShowFence") ) ); - childSetCommitCallback("fence_check", - LLSavedSettingsGlue::setBOOL, (void*)"AuctionShowFence"); - - childSetAction("snapshot_btn", onClickSnapshot, this); - childSetAction("ok_btn", onClickOK, this); } // Destroys the object LLFloaterAuction::~LLFloaterAuction() { - sInstance = NULL; } -// static -void LLFloaterAuction::show() +BOOL LLFloaterAuction::postBuild() { - if(!sInstance) - { - sInstance = new LLFloaterAuction(); - sInstance->center(); - sInstance->setFocus(TRUE); - } - sInstance->initialize(); - sInstance->open(); /*Flawfinder: ignore*/ + childSetValue("fence_check", LLSD( gSavedSettings.getBOOL("AuctionShowFence") ) ); + getChild("fence_check")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "AuctionShowFence")); + + childSetAction("snapshot_btn", onClickSnapshot, this); + childSetAction("ok_btn", onClickOK, this); + return TRUE; +} + +void LLFloaterAuction::onOpen(const LLSD& key) +{ + initialize(); } void LLFloaterAuction::initialize() @@ -259,7 +251,7 @@ void LLFloaterAuction::onClickOK(void* data) self->mImage = NULL; self->mParcelID = -1; self->mParcelHost.invalidate(); - self->close(); + self->closeFloater(); } diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h index e13bce01e1..d71fd3c653 100644 --- a/indra/newview/llfloaterauction.h +++ b/indra/newview/llfloaterauction.h @@ -36,7 +36,7 @@ #include "llfloater.h" #include "lluuid.h" -#include "llmemory.h" +#include "llpointer.h" #include "llviewerimage.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -46,26 +46,24 @@ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLParcelSelection; -class LLFloaterAuction : public LLFloater +class LLFloaterAuction : public LLFloater, public LLFloaterSingleton { + friend class LLUISingleton >; public: // LLFloater interface /*virtual*/ void onClose(bool app_quitting) { setVisible(FALSE); } + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void draw(); - - // LLFloaterAuction interface - static void show(); private: - LLFloaterAuction(); + LLFloaterAuction(const LLSD& key); ~LLFloaterAuction(); void initialize(); static void onClickSnapshot(void* data); static void onClickOK(void* data); - static LLFloaterAuction* sInstance; - + /*virtual*/ BOOL postBuild(); private: LLTransactionID mTransactionID; LLAssetID mImageID; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index e382fefece..2c2dcda633 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -42,15 +42,13 @@ #include "llinventorymodel.h" #include "lllineeditor.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lltextbox.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" #include "llworld.h" - -const S32 MIN_WIDTH = 200; -const S32 MIN_HEIGHT = 340; -const LLRect FLOATER_RECT(0, 380, 240, 0); -const std::string FLOATER_TITLE = "Choose Resident"; +#include "lltabcontainer.h" // static LLFloaterAvatarPicker* LLFloaterAvatarPicker::sInstance = NULL; @@ -70,13 +68,13 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, sInstance->mCallbackUserdata = userdata; sInstance->mCloseOnSelect = FALSE; - sInstance->open(); /* Flawfinder: ignore */ + sInstance->openFloater(); sInstance->center(); sInstance->setAllowMultiple(allow_multiple); } else { - sInstance->open(); /*Flawfinder: ignore*/ + sInstance->openFloater(); sInstance->mCallback = callback; sInstance->mCallbackUserdata = userdata; sInstance->setAllowMultiple(allow_multiple); @@ -88,30 +86,33 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, } // Default constructor -LLFloaterAvatarPicker::LLFloaterAvatarPicker() : - LLFloater(std::string("avatarpicker"), FLOATER_RECT, FLOATER_TITLE, TRUE, MIN_WIDTH, MIN_HEIGHT), +LLFloaterAvatarPicker::LLFloaterAvatarPicker() + : LLFloater(), mResultsReturned(FALSE), mCallback(NULL), mCallbackUserdata(NULL) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml", NULL); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml"); } BOOL LLFloaterAvatarPicker::postBuild() { - childSetKeystrokeCallback("Edit", editKeystroke, this); + getChild("Edit")->setKeystrokeCallback(editKeystroke, this); childSetAction("Find", onBtnFind, this); childDisable("Find"); childSetAction("Refresh", onBtnRefresh, this); childSetCommitCallback("near_me_range", onRangeAdjust, this); - - childSetDoubleClickCallback("SearchResults", onBtnSelect); - childSetDoubleClickCallback("NearMe", onBtnSelect); + + LLScrollListCtrl* searchresults = getChild("SearchResults"); + searchresults->setDoubleClickCallback(onBtnSelect, this); childSetCommitCallback("SearchResults", onList, this); - childSetCommitCallback("NearMe", onList, this); childDisable("SearchResults"); - + + LLScrollListCtrl* nearme = getChild("NearMe"); + nearme->setDoubleClickCallback(onBtnSelect, this); + childSetCommitCallback("NearMe", onList, this); + childSetAction("Select", onBtnSelect, this); childDisable("Select"); @@ -126,33 +127,26 @@ BOOL LLFloaterAvatarPicker::postBuild() search_panel->setDefaultBtn("Find"); } - getChild("SearchResults")->addCommentText(getString("no_results")); + getChild("SearchResults")->setCommentText(getString("no_results")); LLInventoryPanel* inventory_panel = getChild("InventoryPanel"); inventory_panel->setFilterTypes(0x1 << LLInventoryType::IT_CALLINGCARD); inventory_panel->setFollowsAll(); inventory_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); inventory_panel->openDefaultFolderForType(LLAssetType::AT_CALLINGCARD); - inventory_panel->setSelectCallback(LLFloaterAvatarPicker::onCallingCardSelectionChange, this); - - childSetTabChangeCallback("ResidentChooserTabs", "SearchPanel", onTabChanged, this); - childSetTabChangeCallback("ResidentChooserTabs", "CallingCardsPanel", onTabChanged, this); - childSetTabChangeCallback("ResidentChooserTabs", "NearMePanel", onTabChanged, this); + inventory_panel->setSelectCallback(boost::bind(&LLFloaterAvatarPicker::doCallingCardSelectionChange, this, _1, _2)); + + getChild("ResidentChooserTabs")->setCommitCallback( + boost::bind(&LLFloaterAvatarPicker::onTabChanged, this)); setAllowMultiple(FALSE); return TRUE; } -void LLFloaterAvatarPicker::onTabChanged(void* userdata, bool from_click) +void LLFloaterAvatarPicker::onTabChanged() { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; - if (!self) - { - return; - } - - self->childSetEnabled("Select", self->visibleItemsSelected()); + childSetEnabled("Select", visibleItemsSelected()); } // Destroys the object @@ -216,7 +210,7 @@ void LLFloaterAvatarPicker::onBtnSelect(void* userdata) if(self->mCloseOnSelect) { self->mCloseOnSelect = FALSE; - self->close(); + self->closeFloater(); } } @@ -229,14 +223,14 @@ void LLFloaterAvatarPicker::onBtnRefresh(void* userdata) } self->getChild("NearMe")->deleteAllItems(); - self->getChild("NearMe")->addCommentText(self->getString("searching")); + self->getChild("NearMe")->setCommentText(self->getString("searching")); self->mNearMeListComplete = FALSE; } void LLFloaterAvatarPicker::onBtnClose(void* userdata) { LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; - if(self) self->close(); + if(self) self->closeFloater(); } void LLFloaterAvatarPicker::onRangeAdjust(LLUICtrl* source, void* data) @@ -253,18 +247,8 @@ void LLFloaterAvatarPicker::onList(LLUICtrl* ctrl, void* userdata) } } -// static callback for inventory picker (select from calling cards) -void LLFloaterAvatarPicker::onCallingCardSelectionChange(const std::deque &items, BOOL user_action, void* data) -{ - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)data; - if (self) - { - self->doCallingCardSelectionChange( items, user_action, data ); - } -} - // Callback for inventory picker (select from calling cards) -void LLFloaterAvatarPicker::doCallingCardSelectionChange(const std::deque &items, BOOL user_action, void* data) +void LLFloaterAvatarPicker::doCallingCardSelectionChange(const std::deque &items, BOOL user_action) { bool panel_active = (childGetVisibleTab("ResidentChooserTabs") == getChild("CallingCardsPanel")); @@ -330,7 +314,7 @@ void LLFloaterAvatarPicker::populateNearMe() { childDisable("NearMe"); childDisable("Select"); - near_me_scroller->addCommentText(getString("no_one_near")); + near_me_scroller->setCommentText(getString("no_one_near")); } else { @@ -394,7 +378,7 @@ void LLFloaterAvatarPicker::find() gAgent.sendReliableMessage(); getChild("SearchResults")->deleteAllItems(); - getChild("SearchResults")->addCommentText(getString("searching")); + getChild("SearchResults")->setCommentText(getString("searching")); childSetEnabled("Select", FALSE); mResultsReturned = FALSE; @@ -501,7 +485,7 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) } else if (key == KEY_ESCAPE && mask == MASK_NONE) { - close(); + closeFloater(); return TRUE; } diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 56bc387bce..0f47401f23 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -62,10 +62,9 @@ private: static void onRangeAdjust(LLUICtrl* source, void* data); static void onBtnClose(void* userdata); static void onList(class LLUICtrl* ctrl, void* userdata); - static void onTabChanged(void* userdata, bool from_click); + void onTabChanged(); - void doCallingCardSelectionChange(const std::deque &items, BOOL user_action, void* data); - static void onCallingCardSelectionChange(const std::deque &items, BOOL user_action, void* data); + void doCallingCardSelectionChange(const std::deque &items, BOOL user_action); void populateNearMe(); BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected. diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index e81b5d7fce..e2f13088eb 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -42,30 +42,29 @@ using namespace LLVOAvatarDefines; -LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) : - LLFloater(std::string("avatar_texture_debug")), +LLFloaterAvatarTextures* LLFloaterAvatarTextures::sInstance = NULL; +LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) + : LLFloater(), mID(id) { + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_textures.xml"); } LLFloaterAvatarTextures::~LLFloaterAvatarTextures() { + sInstance = NULL; } LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id) { - - LLFloaterAvatarTextures* floaterp = new LLFloaterAvatarTextures(id); - - // Builds and adds to gFloaterView - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_avatar_textures.xml"); - - gFloaterView->addChild(floaterp); - floaterp->open(); /*Flawfinder: ignore*/ - - gFloaterView->adjustToFitScreen(floaterp, FALSE); - - return floaterp; + if (!sInstance) + { + sInstance = new LLFloaterAvatarTextures(id); + gFloaterView->addChild(sInstance); + gFloaterView->adjustToFitScreen(sInstance, FALSE); + } + sInstance->openFloater(); + return sInstance; } BOOL LLFloaterAvatarTextures::postBuild() @@ -142,7 +141,7 @@ void LLFloaterAvatarTextures::refresh() } else { - setTitle(mTitle + ": INVALID AVATAR (" + mID.asString() + ")"); + setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")"); } } diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h index 4138edeb4d..3ec0e7cb03 100644 --- a/indra/newview/llfloateravatartextures.h +++ b/indra/newview/llfloateravatartextures.h @@ -60,6 +60,7 @@ private: LLUUID mID; std::string mTitle; LLTextureCtrl* mTextures[LLVOAvatarDefines::TEX_NUM_INDICES]; + static LLFloaterAvatarTextures* sInstance; }; #endif diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp index 5476b35dc8..052f334285 100644 --- a/indra/newview/llfloaterbeacons.cpp +++ b/indra/newview/llfloaterbeacons.cpp @@ -40,6 +40,7 @@ LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed) +: LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_beacons.xml"); @@ -71,14 +72,13 @@ BOOL LLFloaterBeacons::postBuild() // Needed to make the floater visibility toggle the beacons. // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. -void LLFloaterBeacons::open() +void LLFloaterBeacons::onOpen(const LLSD& key) { - LLFloater::open(); gSavedSettings.setBOOL( "BeaconAlwaysOn", TRUE); } -void LLFloaterBeacons::close(bool app_quitting) +void LLFloaterBeacons::onClose(bool app_quitting) { - LLFloater::close(app_quitting); + destroy(); if(!app_quitting) { gSavedSettings.setBOOL( "BeaconAlwaysOn", FALSE); diff --git a/indra/newview/llfloaterbeacons.h b/indra/newview/llfloaterbeacons.h index c12bdd7261..8156e82ac3 100644 --- a/indra/newview/llfloaterbeacons.h +++ b/indra/newview/llfloaterbeacons.h @@ -45,8 +45,8 @@ public: // Needed to make the floater visibility toggle the beacons. // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. - /*virtual*/ void open(); - /*virtual*/ void close(bool app_quitting); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); private: LLFloaterBeacons(const LLSD& seed); diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp index 3cd35db19c..2507a72caa 100644 --- a/indra/newview/llfloaterbuildoptions.cpp +++ b/indra/newview/llfloaterbuildoptions.cpp @@ -40,58 +40,16 @@ #include "llfloaterbuildoptions.h" #include "lluictrlfactory.h" -// library includes -#include "llfontgl.h" -#include "llcheckboxctrl.h" -#include "llspinctrl.h" -#include "llsliderctrl.h" - -// newview includes -#include "llresmgr.h" -#include "llviewercontrol.h" - -// -// Globals -// -LLFloaterBuildOptions *LLFloaterBuildOptions::sInstance = NULL; - // // Methods // -LLFloaterBuildOptions::LLFloaterBuildOptions( ) -: LLFloater(std::string("build options floater")) +LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key) + : LLFloater() { - sInstance = this; + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_build_options.xml"); } LLFloaterBuildOptions::~LLFloaterBuildOptions() { - sInstance = NULL; -} - -// static -void LLFloaterBuildOptions::show(void*) -{ - if (sInstance) - { - sInstance->open(); /*Flawfinder: ignore*/ - } - else - { - LLFloaterBuildOptions* floater = new LLFloaterBuildOptions(); - - LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_build_options.xml"); - floater->open(); /*Flawfinder: ignore*/ - } } -LLFloaterBuildOptions* LLFloaterBuildOptions::getInstance() -{ - return sInstance; -} - -// static -BOOL LLFloaterBuildOptions::visible(void*) -{ - return (sInstance != NULL); -} diff --git a/indra/newview/llfloaterbuildoptions.h b/indra/newview/llfloaterbuildoptions.h index e030b063d9..da72520486 100644 --- a/indra/newview/llfloaterbuildoptions.h +++ b/indra/newview/llfloaterbuildoptions.h @@ -42,19 +42,12 @@ class LLFloaterBuildOptions -: public LLFloater + : public LLFloater, public LLFloaterSingleton { + friend class LLUISingleton >; protected: - LLFloaterBuildOptions(); + LLFloaterBuildOptions(const LLSD& key); ~LLFloaterBuildOptions(); - -public: - static void show(void*); - static LLFloaterBuildOptions* getInstance(); - static BOOL visible(void*); - -protected: - static LLFloaterBuildOptions* sInstance; }; #endif diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index d4e1e98125..65dc3cd9f0 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -52,14 +52,21 @@ #include "llviewerstats.h" #include "lluictrlfactory.h" #include "llselectmgr.h" +#include "llcheckboxctrl.h" #include "roles_constants.h" // for GP_OBJECT_MANIPULATE -LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed) : mDone(FALSE) +LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed) +: LLFloater(), + mDone(FALSE) { mID.generate(); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_bulk_perms.xml"); +} + +BOOL LLFloaterBulkPermission::postBuild() +{ childSetEnabled("next_owner_transfer", gSavedSettings.getBOOL("BulkChangeNextOwnerCopy")); childSetAction("help", onHelpBtn, this); childSetAction("apply", onApplyBtn, this); @@ -67,6 +74,7 @@ LLFloaterBulkPermission::LLFloaterBulkPermission(const LLSD& seed) : mDone(FALSE childSetAction("check_all", onCheckAll, this); childSetAction("check_none", onUncheckAll, this); childSetCommitCallback("next_owner_copy", &onCommitCopy, this); + return TRUE; } void LLFloaterBulkPermission::doApply() @@ -93,7 +101,7 @@ void LLFloaterBulkPermission::doApply() LLSelectMgr::getInstance()->getSelection()->applyToNodes(&gatherer); if(mObjectIDs.empty()) { - list->addCommentText(getString("nothing_to_modify_text")); + list->setCommentText(getString("nothing_to_modify_text")); } else { @@ -178,7 +186,7 @@ void LLFloaterBulkPermission::onCommitCopy(LLUICtrl* ctrl, void* data) BOOL LLFloaterBulkPermission::start() { // note: number of top-level objects to modify is mObjectIDs.count(). - getChild("queue output")->addCommentText(getString("start_text")); + getChild("queue output")->setCommentText(getString("start_text")); return nextObject(); } @@ -201,7 +209,7 @@ BOOL LLFloaterBulkPermission::nextObject() if(isDone() && !mDone) { - getChild("queue output")->addCommentText(getString("done_text")); + getChild("queue output")->setCommentText(getString("done_text")); mDone = TRUE; } return successful_start; @@ -268,6 +276,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, Invent ( asstype == LLAssetType::AT_CLOTHING && gSavedSettings.getBOOL("BulkChangeIncludeClothing" )) || ( asstype == LLAssetType::AT_GESTURE && gSavedSettings.getBOOL("BulkChangeIncludeGestures" )) || ( asstype == LLAssetType::AT_LANDMARK && gSavedSettings.getBOOL("BulkChangeIncludeLandmarks" )) || + ( asstype == LLAssetType::AT_FAVORITE && gSavedSettings.getBOOL("BulkChangeIncludeFavourite" )) || ( asstype == LLAssetType::AT_NOTECARD && gSavedSettings.getBOOL("BulkChangeIncludeNotecards" )) || ( asstype == LLAssetType::AT_OBJECT && gSavedSettings.getBOOL("BulkChangeIncludeObjects" )) || ( asstype == LLAssetType::AT_LSL_TEXT && gSavedSettings.getBOOL("BulkChangeIncludeScripts" )) || @@ -317,7 +326,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, Invent status_text.setArg("[STATUS]", ""); } - list->addCommentText(status_text.getString()); + list->setCommentText(status_text.getString()); //TODO if we are an object inside an object we should check a recuse flag and if set //open the inventory of the object and recurse - Michelle2 Zenovka diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h index a26b5b4f79..2ea12fbe69 100644 --- a/indra/newview/llfloaterbulkpermission.h +++ b/indra/newview/llfloaterbulkpermission.h @@ -51,6 +51,7 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener, public: LLFloaterBulkPermission(const LLSD& seed); + BOOL postBuild(); private: virtual ~LLFloaterBulkPermission() {} diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index 96e51c2fa2..5cf4d90ece 100644 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -37,25 +37,19 @@ #include "llscrolllistctrl.h" +#include "llsd.h" #include "lluictrlfactory.h" #include "llviewermessage.h" #include "llappviewer.h" // gPacificDaylightTime -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- -LLFloaterBump* LLFloaterBump::sInstance = NULL; - ///---------------------------------------------------------------------------- /// Class LLFloaterBump ///---------------------------------------------------------------------------- // Default constructor -LLFloaterBump::LLFloaterBump() +LLFloaterBump::LLFloaterBump(const LLSD& key) : LLFloater() { - sInstance = this; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_bumps.xml"); } @@ -63,29 +57,19 @@ LLFloaterBump::LLFloaterBump() // Destroys the object LLFloaterBump::~LLFloaterBump() { - sInstance = NULL; } -// static -void LLFloaterBump::show(void *contents) +// virtual +void LLFloaterBump::onOpen(const LLSD& key) { - if (gNoRender) - { + LLScrollListCtrl* list = getChild("bump_list"); + if (!list) return; - } - - if (!sInstance) - { - sInstance = new LLFloaterBump(); - } - - LLScrollListCtrl* list = sInstance->getChild("bump_list"); - if (!list) return; list->deleteAllItems(); if (gMeanCollisionList.empty()) { - std::string none_detected = sInstance->getString("none_detected"); + std::string none_detected = getString("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; @@ -97,33 +81,23 @@ void LLFloaterBump::show(void *contents) iter != gMeanCollisionList.end(); ++iter) { LLMeanCollisionData *mcd = *iter; - LLFloaterBump::add(list, mcd); + add(list, mcd); } } - - sInstance->open(); /*Flawfinder: ignore*/ } void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) { - if (!sInstance) - { - new LLFloaterBump(); - } - if (mcd->mFirstName.empty() || list->getItemCount() >= 20) { return; } - // There's only one internal tm buffer. - struct tm* timep; - - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); - - std::string time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); + std::string timeStr = getString ("timeStr"); + LLSD substitution; + + substitution["datetime"] = (S32) mcd->mTime; + LLStringUtil::format (timeStr, substitution); std::string action; switch(mcd->mType) @@ -150,8 +124,8 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) } // All above action strings are in XML file - LLUIString text = sInstance->getString(action); - text.setArg("[TIME]", time); + LLUIString text = getString(action); + text.setArg("[TIME]", timeStr); text.setArg("[FIRST]", mcd->mFirstName); text.setArg("[LAST]", mcd->mLastName); diff --git a/indra/newview/llfloaterbump.h b/indra/newview/llfloaterbump.h index eb15671d41..f55a9e6bc5 100644 --- a/indra/newview/llfloaterbump.h +++ b/indra/newview/llfloaterbump.h @@ -40,18 +40,17 @@ class LLMeanCollisionData; class LLScrollListCtrl; class LLFloaterBump -: public LLFloater +: public LLFloater, public LLFloaterSingleton { -public: - static void show(void *); - -private: - LLFloaterBump(); + friend class LLUISingleton >; +protected: + LLFloaterBump(const LLSD& key); virtual ~LLFloaterBump(); - static void add(LLScrollListCtrl* list, LLMeanCollisionData *mcd); -private: - static LLFloaterBump* sInstance; + void add(LLScrollListCtrl* list, LLMeanCollisionData *mcd); + +public: + /*virtual*/ void onOpen(const LLSD& key); }; #endif diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index a33cabc749..9c523522fd 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -49,14 +49,19 @@ #include "llviewerobject.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" +#include "lltrans.h" LLFloaterBuy* LLFloaterBuy::sInstance = NULL; LLFloaterBuy::LLFloaterBuy() -: LLFloater(std::string("floater_buy_object"), std::string("FloaterBuyRect"), LLStringUtil::null) +: LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml"); +} + +BOOL LLFloaterBuy::postBuild() +{ childDisable("object_list"); childDisable("item_list"); @@ -64,6 +69,7 @@ LLFloaterBuy::LLFloaterBuy() childSetAction("buy_btn", onClickBuy, this); setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130) + return TRUE; } LLFloaterBuy::~LLFloaterBuy() @@ -102,7 +108,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) sInstance = new LLFloaterBuy(); } - sInstance->open(); /*Flawfinder: ignore*/ + sInstance->openFloater(); sInstance->setFocus(TRUE); sInstance->mSaleInfo = sale_info; sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); @@ -270,15 +276,15 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, std::string text = obj->getName(); if (!(next_owner_mask & PERM_COPY)) { - text.append(" (no copy)"); + text.append(getString("no_copy")); } if (!(next_owner_mask & PERM_MODIFY)) { - text.append(" (no modify)"); + text.append(LLTrans::getString("no_modify")); } if (!(next_owner_mask & PERM_TRANSFER)) { - text.append(" (no transfer)"); + text.append(LLTrans::getString("no_transfer")); } row["columns"][1]["column"] = "text"; @@ -290,7 +296,6 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, removeVOInventoryListener(); } - // static void LLFloaterBuy::onClickBuy(void*) { @@ -309,7 +314,7 @@ void LLFloaterBuy::onClickBuy(void*) // it doesn't match region info then sale is canceled. LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo ); - sInstance->close(); + sInstance->closeFloater(); } @@ -318,7 +323,7 @@ void LLFloaterBuy::onClickCancel(void*) { if (sInstance) { - sInstance->close(); + sInstance->closeFloater(); } } @@ -326,5 +331,5 @@ void LLFloaterBuy::onClose(bool app_quitting) { // drop reference to current selection so selection goes away mObjectSelection = NULL; - LLFloater::onClose(app_quitting); + destroy(); } diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h index 7473e6c855..ffd3fa30c8 100644 --- a/indra/newview/llfloaterbuy.h +++ b/indra/newview/llfloaterbuy.h @@ -57,7 +57,7 @@ public: protected: LLFloaterBuy(); ~LLFloaterBuy(); - + /*virtual*/ BOOL postBuild(); /*virtual*/ void onClose(bool app_quitting); void reset(); diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index 95a8caac53..7a90275201 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -57,10 +57,14 @@ LLFloaterBuyContents* LLFloaterBuyContents::sInstance = NULL; LLFloaterBuyContents::LLFloaterBuyContents() -: LLFloater(std::string("floater_buy_contents"), std::string("FloaterBuyContentsRect"), LLStringUtil::null) +: LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml"); +} +BOOL LLFloaterBuyContents::postBuild() +{ + childSetAction("cancel_btn", onClickCancel, this); childSetAction("buy_btn", onClickBuy, this); @@ -69,6 +73,7 @@ LLFloaterBuyContents::LLFloaterBuyContents() childDisable("wear_check"); setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130) + return TRUE; } LLFloaterBuyContents::~LLFloaterBuyContents() @@ -99,7 +104,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) sInstance = new LLFloaterBuyContents(); } - sInstance->open(); /*Flawfinder: ignore*/ + sInstance->openFloater(); sInstance->setFocus(TRUE); sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); @@ -275,7 +280,7 @@ void LLFloaterBuyContents::onClickBuy(void*) if(!sInstance->childIsEnabled("buy_btn")) { // We shouldn't be enabled. Just close. - sInstance->close(); + sInstance->closeFloater(); return; } @@ -294,12 +299,12 @@ void LLFloaterBuyContents::onClickBuy(void*) // it doesn't match region info then sale is canceled. LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo); - sInstance->close(); + sInstance->closeFloater(); } // static void LLFloaterBuyContents::onClickCancel(void*) { - sInstance->close(); + sInstance->closeFloater(); } diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h index 908ff134e6..52114811bf 100644 --- a/indra/newview/llfloaterbuycontents.h +++ b/indra/newview/llfloaterbuycontents.h @@ -55,7 +55,7 @@ public: protected: LLFloaterBuyContents(); ~LLFloaterBuyContents(); - + /*virtual*/ BOOL postBuild(); void requestObjectInventories(); /*virtual*/ void inventoryChanged(LLViewerObject* obj, InventoryObjectList* inv, diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index cfbc5da761..4274650f2c 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -80,7 +80,6 @@ public: virtual void draw(); virtual BOOL canClose(); - virtual void onClose(bool app_quitting); static void onClickBuy(void* data); static void onClickCancel(void* data); @@ -114,7 +113,7 @@ LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded #pragma warning(disable : 4355) #endif LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI() -: LLFloater(std::string("Buy Currency")), +: LLFloater(), mChildren(*this), mManager(*this) { @@ -162,7 +161,6 @@ BOOL LLFloaterBuyCurrencyUI::postBuild() childSetAction("error_web", onClickErrorWeb, this); updateUI(); - return TRUE; } @@ -172,7 +170,7 @@ void LLFloaterBuyCurrencyUI::draw() { if (mManager.bought()) { - close(); + closeFloater(); return; } @@ -187,12 +185,6 @@ BOOL LLFloaterBuyCurrencyUI::canClose() return mManager.canCancel(); } -void LLFloaterBuyCurrencyUI::onClose(bool app_quitting) -{ - LLFloater::onClose(app_quitting); - destroy(); -} - void LLFloaterBuyCurrencyUI::updateUI() { bool hasError = mManager.hasError(); @@ -341,7 +333,7 @@ void LLFloaterBuyCurrencyUI::onClickCancel(void* data) LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false); if (self) { - self->close(); + self->closeFloater(); } } @@ -352,7 +344,7 @@ void LLFloaterBuyCurrencyUI::onClickErrorWeb(void* data) if (self) { LLWeb::loadURLExternal(self->mManager.errorURI()); - self->close(); + self->closeFloater(); } } @@ -362,7 +354,7 @@ void LLFloaterBuyCurrency::buyCurrency() LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true); ui->noTarget(); ui->updateUI(); - ui->open(); + ui->openFloater(); } void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) @@ -370,7 +362,7 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true); ui->target(name, price); ui->updateUI(); - ui->open(); + ui->openFloater(); } diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 29506e21d5..3fbee83c7b 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -187,7 +187,6 @@ public: virtual void draw(); virtual BOOL canClose(); - virtual void onClose(bool app_quitting); /*virtual*/ void setMinimized(BOOL b); private: @@ -199,7 +198,7 @@ private: }; static void cacheNameUpdateRefreshesBuyLand(const LLUUID&, - const std::string&, const std::string&, BOOL, void* data) + const std::string&, const std::string&, BOOL) { LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false); if (ui) @@ -221,7 +220,7 @@ void LLFloaterBuyLand::buyLand( LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(true); ui->setForGroup(is_for_group); ui->setParcel(region, parcel); - ui->open(); /*Flawfinder: ignore*/ + ui->openFloater(); } // static @@ -298,7 +297,7 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) static bool observingCacheName = false; if (!observingCacheName) { - gCacheName->addObserver(cacheNameUpdateRefreshesBuyLand); + gCacheName->addObserver(&cacheNameUpdateRefreshesBuyLand); observingCacheName = true; } @@ -322,7 +321,7 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) #pragma warning(disable : 4355) #endif LLFloaterBuyLandUI::LLFloaterBuyLandUI() -: LLFloater(std::string("Buy Land")), +: LLFloater(), mParcel(0), mBought(false), mParcelValid(false), mSiteValid(false), @@ -350,7 +349,7 @@ void LLFloaterBuyLandUI::SelectionObserver::changed() { if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - ui->close(); + ui->closeFloater(); } else { ui->setParcel( @@ -566,8 +565,7 @@ void LLFloaterBuyLandUI::updateCovenantInfo() { check->set(false); check->setEnabled(true); - check->setCallbackUserData(this); - check->setCommitCallback(onChangeAgreeCovenant); + check->setCommitCallback(onChangeAgreeCovenant, this); } LLTextBox* box = getChild("covenant_text"); @@ -963,7 +961,7 @@ void LLFloaterBuyLandUI::draw() if (mBought) { - close(); + closeFloater(); } else if (needsUpdate) { @@ -999,13 +997,6 @@ void LLFloaterBuyLandUI::setMinimized(BOOL minimize) } } -void LLFloaterBuyLandUI::onClose(bool app_quitting) -{ - LLFloater::onClose(app_quitting); - destroy(); -} - - void LLFloaterBuyLandUI::refreshUI() { // section zero: title area @@ -1155,7 +1146,7 @@ void LLFloaterBuyLandUI::refreshUI() if (mIsForGroup) { LLStringUtil::format_map_t string_args; - string_args["[GROUP]"] = std::string(gAgent.mGroupName); + string_args["[GROUP]"] = std::string(gAgent.getGroupName()); message += getString("insufficient_land_credits", string_args); @@ -1169,7 +1160,7 @@ void LLFloaterBuyLandUI::refreshUI() if (!mParcelValid) { - message += "(no parcel selected)"; + message += getString("no_parcel_selected"); } else if (mParcelBillableArea == mParcelActualArea) { @@ -1225,12 +1216,10 @@ void LLFloaterBuyLandUI::refreshUI() ? LLViewChildren::BADGE_NOTE : LLViewChildren::BADGE_OK); - childSetText("purchase_action", - llformat( - "Pay L$ %d to %s for this land", - mParcelPrice, - mParcelSellerName.c_str() - )); + LLStringUtil::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", mParcelPrice); + string_args["[SELLER]"] = mParcelSellerName; + childSetText("purchase_action", getString("pay_to_for_land", string_args)); childSetVisible("purchase_action", mParcelValid); std::string reasonString; @@ -1368,7 +1357,7 @@ void LLFloaterBuyLandUI::onClickBuy(void* data) void LLFloaterBuyLandUI::onClickCancel(void* data) { LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data; - self->close(); + self->closeFloater(); } // static @@ -1376,7 +1365,7 @@ void LLFloaterBuyLandUI::onClickErrorWeb(void* data) { LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data; LLWeb::loadURLExternal(self->mCannotBuyURI); - self->close(); + self->closeFloater(); } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 7a4e5147fe..6ca8944a19 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -48,71 +48,31 @@ const F32 CAMERA_BUTTON_DELAY = 0.0f; // Member functions // + LLFloaterCamera::LLFloaterCamera(const LLSD& val) -: LLFloater("camera floater") // uses "FloaterCameraRect3" +: LLFloater() { setIsChrome(TRUE); // For now, only used for size and tooltip strings const BOOL DONT_OPEN = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_camera.xml", NULL, DONT_OPEN); - - S32 top = getRect().getHeight(); - S32 bottom = 0; - S32 left = 16; - - const S32 ROTATE_WIDTH = 64; - mRotate = new LLJoystickCameraRotate(std::string("cam rotate stick"), - LLRect( left, top, left + ROTATE_WIDTH, bottom ), - std::string("cam_rotate_out.tga"), - std::string("cam_rotate_in.tga") ); - mRotate->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - mRotate->setHeldDownDelay(CAMERA_BUTTON_DELAY); - mRotate->setToolTip( getString("rotate_tooltip") ); - mRotate->setSoundFlags(MOUSE_DOWN | MOUSE_UP); - addChild(mRotate); - - left += ROTATE_WIDTH; + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_camera.xml", DONT_OPEN); - const S32 ZOOM_WIDTH = 16; - mZoom = new LLJoystickCameraZoom( - std::string("zoom"), - LLRect( left, top, left + ZOOM_WIDTH, bottom ), - std::string("cam_zoom_out.tga"), - std::string("cam_zoom_plus_in.tga"), - std::string("cam_zoom_minus_in.tga")); - mZoom->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - mZoom->setHeldDownDelay(CAMERA_BUTTON_DELAY); - mZoom->setToolTip( getString("zoom_tooltip") ); - mZoom->setSoundFlags(MOUSE_DOWN | MOUSE_UP); - addChild(mZoom); - - left += ZOOM_WIDTH; - - const S32 TRACK_WIDTH = 64; - mTrack = new LLJoystickCameraTrack(std::string("cam track stick"), - LLRect( left, top, left + TRACK_WIDTH, bottom ), - std::string("cam_tracking_out.tga"), - std::string("cam_tracking_in.tga")); - mTrack->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); - mTrack->setHeldDownDelay(CAMERA_BUTTON_DELAY); - mTrack->setToolTip( getString("move_tooltip") ); - mTrack->setSoundFlags(MOUSE_DOWN | MOUSE_UP); - addChild(mTrack); + mRotate = getChild("cam_rotate_stick"); + mZoom = getChild("zoom"); + mTrack = getChild("cam_track_stick"); } // virtual -void LLFloaterCamera::onOpen() +void LLFloaterCamera::onOpen(const LLSD& key) { - LLFloater::onOpen(); - gSavedSettings.setBOOL("ShowCameraControls", TRUE); } // virtual void LLFloaterCamera::onClose(bool app_quitting) { - LLFloater::onClose(app_quitting); + destroy(); if (!app_quitting) { diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 6862db7068..871e5c8ed1 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -49,7 +49,7 @@ private: LLFloaterCamera(const LLSD& val); ~LLFloaterCamera() {}; - /*virtual*/ void onOpen(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); public: diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index ea529d1883..61ef3abda6 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -38,15 +38,6 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterchat.h" -#include "llfloateractivespeakers.h" -#include "llfloaterscriptdebug.h" - -#include "llchat.h" -#include "llfontgl.h" -#include "llrect.h" -#include "llerror.h" -#include "llstring.h" -#include "message.h" // project include #include "llagent.h" @@ -54,13 +45,17 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llconsole.h" +#include "llfloateractivespeakers.h" #include "llfloaterchatterbox.h" #include "llfloatermute.h" +#include "llfloaterreg.h" +#include "llfloaterscriptdebug.h" #include "llkeyboard.h" //#include "lllineeditor.h" #include "llmutelist.h" //#include "llresizehandle.h" #include "llchatbar.h" +#include "llrecentpeople.h" #include "llstatusbar.h" #include "llviewertexteditor.h" #include "llviewergesture.h" // for triggering gestures @@ -76,16 +71,21 @@ #include "llweb.h" #include "llstylemap.h" -// Used for LCD display -extern void AddNewIMToLCD(const std::string &newLine); -extern void AddNewChatToLCD(const std::string &newLine); +// linden library includes +#include "audioengine.h" +#include "llchat.h" +#include "llfontgl.h" +#include "llrect.h" +#include "llerror.h" +#include "llstring.h" +#include "llwindow.h" +#include "message.h" + // // Constants // const F32 INSTANT_MSG_SIZE = 8.0f; const F32 CHAT_MSG_SIZE = 8.0f; -const LLColor4 MUTED_MSG_COLOR(0.5f, 0.5f, 0.5f, 1.f); -const S32 MAX_CHATTER_COUNT = 16; // // Global statics @@ -96,20 +96,13 @@ LLColor4 get_text_color(const LLChat& chat); // Member Functions // LLFloaterChat::LLFloaterChat(const LLSD& seed) -: LLFloater(std::string("chat floater"), std::string("FloaterChatRect"), LLStringUtil::null, - RESIZE_YES, 440, 100, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), - mPanel(NULL) + : LLFloater(), + mPanel(NULL) { mFactoryMap["chat_panel"] = LLCallbackMap(createChatPanel, NULL); mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL); - // do not automatically open singleton floaters (as result of getInstance()) - BOOL no_open = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml",&getFactoryMap(),no_open); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml"); - childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes - childSetVisible("Chat History Editor with mute",FALSE); - childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); - setDefaultBtn("Chat"); } LLFloaterChat::~LLFloaterChat() @@ -120,8 +113,6 @@ LLFloaterChat::~LLFloaterChat() void LLFloaterChat::setVisible(BOOL visible) { LLFloater::setVisible( visible ); - - gSavedSettings.setBOOL("ShowChatHistory", visible); } void LLFloaterChat::draw() @@ -130,7 +121,7 @@ void LLFloaterChat::draw() childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); - LLChatBar* chat_barp = getChild("chat_panel", TRUE); + LLChatBar* chat_barp = findChild("chat_panel", TRUE); if (chat_barp) { chat_barp->refresh(); @@ -144,22 +135,30 @@ BOOL LLFloaterChat::postBuild() { mPanel = (LLPanelActiveSpeakers*)getChild("active_speakers_panel"); - LLChatBar* chat_barp = getChild("chat_panel", TRUE); + LLChatBar* chat_barp = findChild("chat_panel", TRUE); if (chat_barp) { chat_barp->setGestureCombo(getChild( "Gesture")); } + + childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes + childSetVisible("Chat History Editor with mute",FALSE); + childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); + return TRUE; } // public virtual void LLFloaterChat::onClose(bool app_quitting) { - if (!app_quitting) + if (getHost()) + { + getHost()->setVisible(FALSE); + } + else { - gSavedSettings.setBOOL("ShowChatHistory", FALSE); + setVisible(FALSE); } - setVisible(FALSE); } void LLFloaterChat::onVisibilityChange(BOOL new_visibility) @@ -167,12 +166,6 @@ void LLFloaterChat::onVisibilityChange(BOOL new_visibility) // Hide the chat overlay when our history is visible. updateConsoleVisibility(); - // stop chat history tab from flashing when it appears - if (new_visibility) - { - LLFloaterChatterBox::getInstance()->setFloaterFlashing(this, FALSE); - } - LLFloater::onVisibilityChange(new_visibility); } @@ -257,7 +250,7 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) } // could flash the chat button in the status bar here. JC - LLFloaterChat* chat_floater = LLFloaterChat::getInstance(LLSD()); + LLFloaterChat* chat_floater = LLFloaterChat::getInstance(); LLViewerTextEditor* history_editor = chat_floater->getChild("Chat History Editor"); LLViewerTextEditor* history_editor_with_mute = chat_floater->getChild("Chat History Editor with mute"); @@ -295,8 +288,8 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) // static void LLFloaterChat::setHistoryCursorAndScrollToEnd() { - LLViewerTextEditor* history_editor = LLFloaterChat::getInstance(LLSD())->getChild("Chat History Editor"); - LLViewerTextEditor* history_editor_with_mute = LLFloaterChat::getInstance(LLSD())->getChild("Chat History Editor with mute"); + LLViewerTextEditor* history_editor = LLFloaterChat::getInstance()->getChild("Chat History Editor"); + LLViewerTextEditor* history_editor_with_mute = LLFloaterChat::getInstance()->getChild("Chat History Editor with mute"); if (history_editor) { @@ -324,8 +317,7 @@ void LLFloaterChat::onClickMute(void *data) LLMute mute(id); mute.setFromDisplayName(name); LLMuteList::getInstance()->add(mute); - - LLFloaterMute::showInstance(); + LLFloaterReg::showInstance("mute"); } //static @@ -368,20 +360,6 @@ void LLFloaterChat::addChat(const LLChat& chat, chat.mChatType == CHAT_TYPE_DEBUG_MSG && !gSavedSettings.getBOOL("ScriptErrorsAsChat"); -#if LL_LCD_COMPILE - // add into LCD displays - if (!invisible_script_debug_chat) - { - if (!from_instant_message) - { - AddNewChatToLCD(chat.mText); - } - else - { - AddNewIMToLCD(chat.mText); - } - } -#endif if (!invisible_script_debug_chat && !chat.mMuted && gConsole @@ -390,11 +368,11 @@ void LLFloaterChat::addChat(const LLChat& chat, F32 size = CHAT_MSG_SIZE; if (chat.mSourceType == CHAT_SOURCE_SYSTEM) { - text_color = gSavedSettings.getColor("SystemChatColor"); + text_color = gSavedSkinSettings.getColor("SystemChatColor"); } else if(from_instant_message) { - text_color = gSavedSettings.getColor("IMChatColor"); + text_color = gSavedSkinSettings.getColor("IMChatColor"); size = INSTANT_MSG_SIZE; } // We display anything if it's not an IM. If it's an IM, check pref... @@ -406,14 +384,62 @@ void LLFloaterChat::addChat(const LLChat& chat, if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) log_chat_text(chat); + + if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) + addChatHistory(chat,false); + + triggerAlerts(chat.mText); - LLTextParser* highlight = LLTextParser::getInstance(); - highlight->triggerAlerts(gAgent.getID(), gAgent.getPositionGlobal(), chat.mText, gViewerWindow->getWindow()); + // Add the sender to the list of people with which we've recently interacted. + if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull()) + LLRecentPeople::instance().add(chat.mFromID); if(!from_instant_message) addChatHistory(chat); } +// Moved from lltextparser.cpp to break llui/llaudio library dependency. +//static +void LLFloaterChat::triggerAlerts(const std::string& text) +{ + LLTextParser* parser = LLTextParser::getInstance(); +// bool spoken=FALSE; + for (S32 i=0;imHighlights.size();i++) + { + LLSD& highlight = parser->mHighlights[i]; + if (parser->findPattern(text,highlight) >= 0 ) + { + if(gAudiop) + { + if ((std::string)highlight["sound_lluuid"] != LLUUID::null.asString()) + { + gAudiop->triggerSound(highlight["sound_lluuid"].asUUID(), + gAgent.getID(), + 1.f, + LLAudioEngine::AUDIO_TYPE_UI, + gAgent.getPositionGlobal() ); + } +/* + if (!spoken) + { + LLTextToSpeech* text_to_speech = NULL; + text_to_speech = LLTextToSpeech::getInstance(); + spoken = text_to_speech->speak((LLString)highlight["voice"],text); + } + */ + } + if (highlight["flash"]) + { + LLWindow* viewer_window = gViewerWindow->getWindow(); + if (viewer_window && viewer_window->getMinimized()) + { + viewer_window->flashIcon(5.f); + } + } + } + } +} + LLColor4 get_text_color(const LLChat& chat) { LLColor4 text_color; @@ -427,37 +453,37 @@ LLColor4 get_text_color(const LLChat& chat) switch(chat.mSourceType) { case CHAT_SOURCE_SYSTEM: - text_color = gSavedSettings.getColor4("SystemChatColor"); + text_color = gSavedSkinSettings.getColor4("SystemChatColor"); break; case CHAT_SOURCE_AGENT: if (chat.mFromID.isNull()) { - text_color = gSavedSettings.getColor4("SystemChatColor"); + text_color = gSavedSkinSettings.getColor4("SystemChatColor"); } else { if(gAgent.getID() == chat.mFromID) { - text_color = gSavedSettings.getColor4("UserChatColor"); + text_color = gSavedSkinSettings.getColor4("UserChatColor"); } else { - text_color = gSavedSettings.getColor4("AgentChatColor"); + text_color = gSavedSkinSettings.getColor4("AgentChatColor"); } } break; case CHAT_SOURCE_OBJECT: if (chat.mChatType == CHAT_TYPE_DEBUG_MSG) { - text_color = gSavedSettings.getColor4("ScriptErrorColor"); + text_color = gSavedSkinSettings.getColor4("ScriptErrorColor"); } else if ( chat.mChatType == CHAT_TYPE_OWNER ) { - text_color = gSavedSettings.getColor4("llOwnerSayChatColor"); + text_color = gSavedSkinSettings.getColor4("llOwnerSayChatColor"); } else { - text_color = gSavedSettings.getColor4("ObjectChatColor"); + text_color = gSavedSkinSettings.getColor4("ObjectChatColor"); } break; default: @@ -482,7 +508,7 @@ LLColor4 get_text_color(const LLChat& chat) //static void LLFloaterChat::loadHistory() { - LLLogChat::loadHistory(std::string("chat"), &chatFromLogFile, (void *)LLFloaterChat::getInstance(LLSD())); + LLLogChat::loadHistory(std::string("chat"), &chatFromLogFile, (void *)LLFloaterChat::getInstance()); } //static @@ -498,6 +524,7 @@ void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , std::string l { LLChat chat; chat.mText = line; + get_text_color(chat); addChatHistory(chat, FALSE); } break; @@ -528,27 +555,9 @@ void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata) self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); } -//static -bool LLFloaterChat::visible(LLFloater* instance, const LLSD& key) -{ - return VisibilityPolicy::visible(instance, key); -} - -//static -void LLFloaterChat::show(LLFloater* instance, const LLSD& key) -{ - VisibilityPolicy::show(instance, key); -} - -//static -void LLFloaterChat::hide(LLFloater* instance, const LLSD& key) -{ - if(instance->getHost()) - { - LLFloaterChatterBox::hideInstance(); - } - else - { - VisibilityPolicy::hide(instance, key); - } -} +//static + LLFloaterChat* LLFloaterChat::getInstance() + { + LLFloater* inst = LLFloaterReg::getInstance("chat", LLSD()) ; + return dynamic_cast(inst); + } diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h index b5393866b8..2bae4ea0c2 100644 --- a/indra/newview/llfloaterchat.h +++ b/indra/newview/llfloaterchat.h @@ -40,19 +40,18 @@ #include "llfloater.h" #include "lllogchat.h" -class LLButton; + class LLChat; -class LLComboBox; -class LLLineEditor; class LLViewerTextEditor; class LLMessageSystem; class LLUUID; class LLCheckBoxCtrl; class LLPanelActiveSpeakers; class LLLogChat; +class LLVector3d; +class LLWindow; -class LLFloaterChat - : public LLFloater, public LLUISingleton +class LLFloaterChat : public LLFloater { public: LLFloaterChat(const LLSD& seed); @@ -67,14 +66,16 @@ public: void updateConsoleVisibility(); static void setHistoryCursorAndScrollToEnd(); - + + // *TODO:Skinning - move these to LLChat (or LLViewerChat?) // Add chat to console and history list. // Color based on source, type, distance. static void addChat(const LLChat& chat, BOOL from_im = FALSE, BOOL local_agent = FALSE); - // Add chat to history alone. static void addChatHistory(const LLChat& chat, bool log_to_file = true); + static void triggerAlerts(const std::string& text); + static void onClickMute(void *data); static void onClickToggleShowMute(LLUICtrl* caller, void *data); static void onClickToggleActiveSpeakers(void* userdata); @@ -82,12 +83,9 @@ public: static void loadHistory(); static void* createSpeakersPanel(void* data); static void* createChatPanel(void* data); - - // visibility policy for LLUISingleton - static bool visible(LLFloater* instance, const LLSD& key); - static void show(LLFloater* instance, const LLSD& key); - static void hide(LLFloater* instance, const LLSD& key); - + + static LLFloaterChat* getInstance(); // *TODO:Skinning Deprecate + LLPanelActiveSpeakers* mPanel; BOOL mScrolledToEnd; }; diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp index 0fa1aa15e6..a283b445f5 100644 --- a/indra/newview/llfloaterchatterbox.cpp +++ b/indra/newview/llfloaterchatterbox.cpp @@ -35,6 +35,7 @@ #include "llviewerprecompiledheaders.h" +#include "llfloaterreg.h" #include "llfloaterchatterbox.h" #include "lluictrlfactory.h" #include "llfloaterchat.h" @@ -49,12 +50,11 @@ // LLFloaterMyFriends::LLFloaterMyFriends(const LLSD& seed) + : LLFloater() { mFactoryMap["friends_panel"] = LLCallbackMap(LLFloaterMyFriends::createFriendsPanel, NULL); mFactoryMap["groups_panel"] = LLCallbackMap(LLFloaterMyFriends::createGroupsPanel, NULL); - // do not automatically open singleton floaters (as result of getInstance()) - BOOL no_open = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_my_friends.xml", &getFactoryMap(), no_open); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_my_friends.xml"); } LLFloaterMyFriends::~LLFloaterMyFriends() @@ -63,11 +63,20 @@ LLFloaterMyFriends::~LLFloaterMyFriends() BOOL LLFloaterMyFriends::postBuild() { - mTabs = getChild("friends_and_groups"); - return TRUE; } +void LLFloaterMyFriends::onOpen(const LLSD& key) +{ + if (key.asString() == "friends") + { + childShowTab("friends_and_groups", "friends_panel"); + } + else if (key.asString() == "groups") + { + childShowTab("friends_and_groups", "groups_panel"); + } +} void LLFloaterMyFriends::onClose(bool app_quitting) { @@ -86,18 +95,34 @@ void* LLFloaterMyFriends::createGroupsPanel(void* data) return new LLPanelGroups(); } +//static +LLFloaterMyFriends* LLFloaterMyFriends::getInstance() +{ + LLFloater* inst = LLFloaterReg::getInstance("contacts", "friends") ; + return dynamic_cast(inst); +} + // // LLFloaterChatterBox // -LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : - mActiveVoiceFloater(NULL) +LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) + : LLMultiFloater(), + mActiveVoiceFloater(NULL) { mAutoResize = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_chatterbox.xml", NULL, FALSE); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_chatterbox.xml", FALSE); +} + +LLFloaterChatterBox::~LLFloaterChatterBox() +{ +} + +BOOL LLFloaterChatterBox::postBuild() +{ if (gSavedSettings.getBOOL("ContactsTornOff")) { - LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance(0); + LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance(); // add then remove to set up relationship for re-attach addFloater(floater_contacts, FALSE); removeFloater(floater_contacts); @@ -106,7 +131,7 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : } else { - addFloater(LLFloaterMyFriends::getInstance(0), TRUE); + addFloater(LLFloaterMyFriends::getInstance(), TRUE); } if (gSavedSettings.getBOOL("ChatHistoryTornOff")) @@ -120,13 +145,10 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : } else { - addFloater(LLFloaterChat::getInstance(LLSD()), FALSE); + addFloater(LLFloaterChat::getInstance(), FALSE); } mTabContainer->lockTabs(); -} - -LLFloaterChatterBox::~LLFloaterChatterBox() -{ + return TRUE; } BOOL LLFloaterChatterBox::handleKeyHere(KEY key, MASK mask) @@ -139,13 +161,13 @@ BOOL LLFloaterChatterBox::handleKeyHere(KEY key, MASK mask) { if (floater->isCloseable()) { - floater->close(); + floater->closeFloater(); } else { // close chatterbox window if frontmost tab is reserved, non-closeable tab // such as contacts or near me - close(); + closeFloater(); } } return TRUE; @@ -200,15 +222,27 @@ void LLFloaterChatterBox::draw() LLMultiFloater::draw(); } -void LLFloaterChatterBox::onOpen() +void LLFloaterChatterBox::onOpen(const LLSD& key) { - gSavedSettings.setBOOL("ShowCommunicate", TRUE); + //*TODO:Skinning show the session id associated with key + if (key.asString() == "local") + { + LLFloaterChat* chat = LLFloaterReg::findTypedInstance("chat"); + chat->openFloater(); + } + else if (key.isDefined()) + { + LLFloaterIMPanel* impanel = gIMMgr->findFloaterBySession(key.asUUID()); + if (impanel) + { + impanel->openFloater(); + } + } } void LLFloaterChatterBox::onClose(bool app_quitting) { setVisible(FALSE); - gSavedSettings.setBOOL("ShowCommunicate", FALSE); } void LLFloaterChatterBox::setMinimized(BOOL minimized) @@ -244,7 +278,11 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, S32 num_locked_tabs = mTabContainer->getNumLockedTabs(); // already here - if (floaterp->getHost() == this) return; + if (floaterp->getHost() == this) + { + openFloater(floaterp->getKey()); + return; + } // make sure my friends and chat history both locked when re-attaching chat history if (floaterp->getName() == "chat floater") @@ -281,6 +319,7 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, else { LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); + openFloater(floaterp->getKey()); } // make sure active voice icon shows up for new tab @@ -290,6 +329,13 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, } } +//static +LLFloaterChatterBox* LLFloaterChatterBox::getInstance() +{ + LLFloater* inst = LLFloaterReg::getInstance("communicate", LLSD()) ; + return dynamic_cast(inst); +} + //static LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater() { @@ -300,11 +346,11 @@ LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater() if (LLVoiceChannelProximal::getInstance() == LLVoiceChannel::getCurrentVoiceChannel()) { // show near me tab if in proximal channel - return LLFloaterChat::getInstance(LLSD()); + return LLFloaterChat::getInstance(); } else { - LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance(LLSD()); + LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance(); // iterator over all IM tabs (skip friends and near me) for (S32 i = 0; i < floater->getFloaterCount(); i++) { diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h index 3adbd14370..e6a2e30ba6 100644 --- a/indra/newview/llfloaterchatterbox.h +++ b/indra/newview/llfloaterchatterbox.h @@ -42,15 +42,16 @@ class LLTabContainer; -class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton +class LLFloaterChatterBox : public LLMultiFloater { public: LLFloaterChatterBox(const LLSD& seed); virtual ~LLFloaterChatterBox(); - + + /*virtual*/ BOOL postBuild(); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void draw(); - /*virtual*/ void onOpen(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void setMinimized(BOOL minimized); @@ -59,108 +60,28 @@ public: BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); + static LLFloaterChatterBox* getInstance(); // *TODO:Skinning Deprecate static LLFloater* getCurrentVoiceFloater(); - // visibility policy for LLUISingleton - static bool visible(LLFloater* instance, const LLSD& key) - { - LLFloater* floater_to_check = ((LLFloaterChatterBox*)instance)->getFloater(key); - - if (floater_to_check) - { - return floater_to_check->isInVisibleChain(); - } - - // otherwise use default visibility rule for chatterbox - return VisibilityPolicy::visible(instance, key); - } - - static void show(LLFloater* instance, const LLSD& key) - { - LLFloater* floater_to_show = ((LLFloaterChatterBox*)instance)->getFloater(key); - VisibilityPolicy::show(instance, key); - - if (floater_to_show) - { - floater_to_show->open(); - } - } - - static void hide(LLFloater* instance, const LLSD& key) - { - VisibilityPolicy::hide(instance, key); - } - -private: - LLFloater* getFloater(const LLSD& key) - { - LLFloater* floater = NULL; - - //try to show requested session - LLUUID session_id = key.asUUID(); - if (session_id.notNull()) - { - floater = LLIMMgr::getInstance()->findFloaterBySession(session_id); - } - - // if TRUE, show tab for active voice channel, otherwise, just show last tab - if (key.asBoolean()) - { - floater = getCurrentVoiceFloater(); - } - - return floater; - } - protected: LLFloater* mActiveVoiceFloater; }; -class LLFloaterMyFriends : public LLFloater, public LLUISingleton +class LLFloaterMyFriends : public LLFloater { public: LLFloaterMyFriends(const LLSD& seed); virtual ~LLFloaterMyFriends(); - virtual BOOL postBuild(); - - void onClose(bool app_quitting); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); + static LLFloaterMyFriends* getInstance(); // *TODO:Skinning Deprecate + static void* createFriendsPanel(void* data); static void* createGroupsPanel(void* data); - - // visibility policy for LLUISingleton - static bool visible(LLFloater* instance, const LLSD& key) - { - LLFloaterMyFriends* floaterp = (LLFloaterMyFriends*)instance; - return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == key.asInteger(); - } - - static void show(LLFloater* instance, const LLSD& key) - { - VisibilityPolicy::show(instance, key); - // garbage values in id will be interpreted as 0, or the friends tab - ((LLFloaterMyFriends*)instance)->mTabs->selectTab(key); - } - - static void hide(LLFloater* instance, const LLSD& key) - { - if (visible(instance, key)) - { - if(instance->getHost()) - { - LLFloaterChatterBox::hideInstance(); - } - else - { - VisibilityPolicy::hide(instance, key); - } - } - } - -protected: - LLTabContainer* mTabs; }; #endif // LL_LLFLOATERCHATTERBOX_H diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index f82d692dd3..4964f04556 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -32,11 +32,15 @@ #include "llviewerprecompiledheaders.h" -#include -#include - #include "llfloatercolorpicker.h" +// Viewer project includes +#include "lltoolmgr.h" +#include "lltoolpipette.h" +#include "llviewercontrol.h" +#include "llworld.h" + +// Linden library includes #include "llfontgl.h" #include "llsys.h" #include "llgl.h" @@ -47,23 +51,23 @@ #include "lllineeditor.h" #include "v4coloru.h" #include "llbutton.h" -#include "llviewercontrol.h" #include "lluictrlfactory.h" -#include "llviewerwindow.h" #include "llgl.h" -#include "llmemory.h" +#include "llpointer.h" #include "llimage.h" #include "llmousehandler.h" #include "llimagegl.h" #include "llglheaders.h" #include "llcheckboxctrl.h" -#include "llworld.h" #include "lltextbox.h" #include "lluiconstants.h" #include "llfocusmgr.h" -#include "lltoolmgr.h" -#include "lltoolpipette.h" #include "lldraghandle.h" +#include "llwindow.h" + +// System includes +#include +#include const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; @@ -75,11 +79,8 @@ const F32 CONTEXT_FADE_TIME = 0.08f; // ////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -// default ctor -LLFloaterColorPicker:: -LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) - : LLFloater (std::string("Color Picker Floater")), +LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) + : LLFloater(), mComponents ( 3 ), mMouseDownInLumRegion ( FALSE ), mMouseDownInHueRegion ( FALSE ), @@ -123,10 +124,7 @@ LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) } } -////////////////////////////////////////////////////////////////////////////// -// dtor -LLFloaterColorPicker:: -~LLFloaterColorPicker() +LLFloaterColorPicker::~LLFloaterColorPicker() { // destroy the UI we created destroyUI (); @@ -134,9 +132,7 @@ LLFloaterColorPicker:: ////////////////////////////////////////////////////////////////////////////// // -void -LLFloaterColorPicker:: -createUI () +void LLFloaterColorPicker::createUI () { // build the majority of the gui using the factory builder LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" ); @@ -177,19 +173,17 @@ createUI () // argh! const std::string s ( codec.str () ); - mPalette.push_back ( new LLColor4 ( gSavedSettings.getColor4 ( s ) ) ); + mPalette.push_back ( new LLColor4 ( gSavedSkinSettings.getColor4 ( s ) ) ); } } ////////////////////////////////////////////////////////////////////////////// // -void -LLFloaterColorPicker:: -showUI () +void LLFloaterColorPicker::showUI () { setVisible ( TRUE ); setFocus ( TRUE ); - open(); /*Flawfinder: ignore*/ + openFloater(getKey()); // HACK: if system color picker is required - close the SL one we made and use default system dialog if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) ) @@ -203,7 +197,7 @@ showUI () { LLColor4 curCol = swatch->get (); send_agent_pause(); - gViewerWindow->getWindow ()->dialog_color_picker ( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] ); + getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] ); send_agent_resume(); setOrigRgb ( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] ); @@ -212,36 +206,30 @@ showUI () LLColorSwatchCtrl::onColorChanged ( swatch, LLColorSwatchCtrl::COLOR_CHANGE ); } - close(); + closeFloater(); } } ////////////////////////////////////////////////////////////////////////////// // called after the dialog is rendered -BOOL -LLFloaterColorPicker:: -postBuild() +BOOL LLFloaterColorPicker::postBuild() { mCancelBtn = getChild( "cancel_btn" ); - mCancelBtn->setClickedCallback ( onClickCancel ); - mCancelBtn->setCallbackUserData ( this ); + mCancelBtn->setClickedCallback ( onClickCancel, this ); mSelectBtn = getChild( "select_btn"); - mSelectBtn->setClickedCallback ( onClickSelect ); - mSelectBtn->setCallbackUserData ( this ); + mSelectBtn->setClickedCallback ( onClickSelect, this ); mSelectBtn->setFocus ( TRUE ); mPipetteBtn = getChild("color_pipette" ); mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga")); - mPipetteBtn->setClickedCallback( onClickPipette ); - mPipetteBtn->setCallbackUserData ( this ); + mPipetteBtn->setCommitCallback( boost::bind(&LLFloaterColorPicker::onClickPipette, this )); mApplyImmediateCheck = getChild("apply_immediate"); mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately")); - mApplyImmediateCheck->setCommitCallback(onImmediateCheck); - mApplyImmediateCheck->setCallbackUserData(this); + mApplyImmediateCheck->setCommitCallback(onImmediateCheck, this); childSetCommitCallback("rspin", onTextCommit, (void*)this ); childSetCommitCallback("gspin", onTextCommit, (void*)this ); @@ -250,18 +238,15 @@ postBuild() childSetCommitCallback("sspin", onTextCommit, (void*)this ); childSetCommitCallback("lspin", onTextCommit, (void*)this ); + LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterColorPicker::onColorSelect, this, _1)); + return TRUE; } ////////////////////////////////////////////////////////////////////////////// // -void -LLFloaterColorPicker:: -initUI ( F32 rValIn, F32 gValIn, F32 bValIn ) +void LLFloaterColorPicker::initUI ( F32 rValIn, F32 gValIn, F32 bValIn ) { - // start catching lose-focus events from entry widgets - enableTextCallbacks ( TRUE ); - // under some circumstances, we get rogue values that can be calmed by clamping... rValIn = llclamp ( rValIn, 0.0f, 1.0f ); gValIn = llclamp ( gValIn, 0.0f, 1.0f ); @@ -279,9 +264,7 @@ initUI ( F32 rValIn, F32 gValIn, F32 bValIn ) ////////////////////////////////////////////////////////////////////////////// // -void -LLFloaterColorPicker:: -destroyUI () +void LLFloaterColorPicker::destroyUI () { // shut down pipette tool if active stopUsingPipette(); @@ -305,9 +288,7 @@ destroyUI () ////////////////////////////////////////////////////////////////////////////// // -F32 -LLFloaterColorPicker:: -hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn ) +F32 LLFloaterColorPicker::hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn ) { if ( valHUeIn < 0.0f ) valHUeIn += 1.0f; if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f; @@ -319,9 +300,7 @@ hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn ) ////////////////////////////////////////////////////////////////////////////// // -void -LLFloaterColorPicker:: -hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut ) +void LLFloaterColorPicker::hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& bValOut ) { if ( sValIn < 0.00001f ) { @@ -349,9 +328,7 @@ hslToRgb ( F32 hValIn, F32 sValIn, F32 lValIn, F32& rValOut, F32& gValOut, F32& ////////////////////////////////////////////////////////////////////////////// // mutator for original RGB value -void -LLFloaterColorPicker:: -setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn ) +void LLFloaterColorPicker::setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn ) { origR = origRIn; origG = origGIn; @@ -360,9 +337,7 @@ setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn ) ////////////////////////////////////////////////////////////////////////////// // accessor for original RGB value -void -LLFloaterColorPicker:: -getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut ) +void LLFloaterColorPicker::getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut ) { origROut = origR; origGOut = origG; @@ -371,9 +346,7 @@ getOrigRgb ( F32& origROut, F32& origGOut, F32& origBOut ) ////////////////////////////////////////////////////////////////////////////// // mutator for current RGB value -void -LLFloaterColorPicker:: -setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn ) +void LLFloaterColorPicker::setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn ) { // save current RGB curR = curRIn; @@ -383,19 +356,13 @@ setCurRgb ( F32 curRIn, F32 curGIn, F32 curBIn ) // update corresponding HSL values and LLColor3(curRIn, curGIn, curBIn).calcHSL(&curH, &curS, &curL); - // color changed so update text fields (fixes SL-16968) - // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion - // CP: this was required when I first wrote the code but this may not be necessary anymore - leaving it there just in case - enableTextCallbacks( FALSE ); + // color changed so update text fields updateTextEntry(); - enableTextCallbacks( TRUE ); } ////////////////////////////////////////////////////////////////////////////// // accessor for current RGB value -void -LLFloaterColorPicker:: -getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut ) +void LLFloaterColorPicker::getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut ) { curROut = curR; curGOut = curG; @@ -404,9 +371,7 @@ getCurRgb ( F32& curROut, F32& curGOut, F32& curBOut ) ////////////////////////////////////////////////////////////////////////////// // mutator for current HSL value -void -LLFloaterColorPicker:: -setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn ) +void LLFloaterColorPicker::setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn ) { // save current HSL curH = curHIn; @@ -419,9 +384,7 @@ setCurHsl ( F32 curHIn, F32 curSIn, F32 curLIn ) ////////////////////////////////////////////////////////////////////////////// // accessor for current HSL value -void -LLFloaterColorPicker:: -getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut ) +void LLFloaterColorPicker::getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut ) { curHOut = curH; curSOut = curS; @@ -430,9 +393,7 @@ getCurHsl ( F32& curHOut, F32& curSOut, F32& curLOut ) ////////////////////////////////////////////////////////////////////////////// // called when 'cancel' clicked -void -LLFloaterColorPicker:: -onClickCancel ( void* data ) +void LLFloaterColorPicker::onClickCancel ( void* data ) { if (data) { @@ -441,16 +402,14 @@ onClickCancel ( void* data ) if ( self ) { self->cancelSelection (); - self->close(); + self->closeFloater(); } } } ////////////////////////////////////////////////////////////////////////////// // called when 'select' clicked -void -LLFloaterColorPicker:: -onClickSelect ( void* data ) +void LLFloaterColorPicker::onClickSelect ( void* data ) { if (data) { @@ -460,36 +419,28 @@ onClickSelect ( void* data ) { // apply to selection LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_SELECT ); - self->close(); + self->closeFloater(); } } } -void LLFloaterColorPicker::onClickPipette( void* data ) +void LLFloaterColorPicker::onClickPipette( ) { - LLFloaterColorPicker* self = ( LLFloaterColorPicker* )data; - - if ( self) + BOOL pipette_active = mPipetteBtn->getToggleState(); + pipette_active = !pipette_active; + if (pipette_active) { - BOOL pipette_active = self->mPipetteBtn->getToggleState(); - pipette_active = !pipette_active; - if (pipette_active) - { - LLToolPipette::getInstance()->setSelectCallback(onColorSelect, self); - LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); - } - else - { - LLToolMgr::getInstance()->clearTransientTool(); - } + LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); + } + else + { + LLToolMgr::getInstance()->clearTransientTool(); } } ////////////////////////////////////////////////////////////////////////////// // called when 'text is committed' - i,e. focus moves from a text field -void -LLFloaterColorPicker:: -onTextCommit ( LLUICtrl* ctrl, void* data ) +void LLFloaterColorPicker::onTextCommit ( LLUICtrl* ctrl, void* data ) { if ( data ) { @@ -515,16 +466,12 @@ void LLFloaterColorPicker::onImmediateCheck( LLUICtrl* ctrl, void* data) } } -void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te, void *data ) +void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te ) { - LLFloaterColorPicker* self = (LLFloaterColorPicker*)data; - if (self) + setCurRgb(te.getColor().mV[VRED], te.getColor().mV[VGREEN], te.getColor().mV[VBLUE]); + if (mApplyImmediateCheck->get()) { - self->setCurRgb(te.getColor().mV[VRED], te.getColor().mV[VGREEN], te.getColor().mV[VBLUE]); - if (self->mApplyImmediateCheck->get()) - { - LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); - } + LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); } } @@ -673,9 +620,7 @@ void LLFloaterColorPicker::draw() ////////////////////////////////////////////////////////////////////////////// // find a complimentary color to the one passed in that can be used to highlight -const LLColor4& -LLFloaterColorPicker:: -getComplimentaryColor ( const LLColor4& backgroundColor ) +const LLColor4& LLFloaterColorPicker::getComplimentaryColor ( const LLColor4& backgroundColor ) { // going to base calculation on luminance F32 hVal, sVal, lVal; @@ -695,9 +640,7 @@ getComplimentaryColor ( const LLColor4& backgroundColor ) ////////////////////////////////////////////////////////////////////////////// // draw color palette -void -LLFloaterColorPicker:: -drawPalette () +void LLFloaterColorPicker::drawPalette () { S32 curEntry = 0; @@ -748,9 +691,7 @@ drawPalette () ////////////////////////////////////////////////////////////////////////////// // update text entry values for RGB/HSL (can't be done in ::draw () since this overwrites input -void -LLFloaterColorPicker:: -updateTextEntry () +void LLFloaterColorPicker::updateTextEntry () { // set values in spinners childSetValue("rspin", ( getCurR () * 255.0f ) ); @@ -761,38 +702,9 @@ updateTextEntry () childSetValue("lspin", ( getCurL () * 100.0f ) ); } -////////////////////////////////////////////////////////////////////////////// -// turns on or off text entry commit call backs -void -LLFloaterColorPicker:: -enableTextCallbacks ( BOOL stateIn ) -{ - if ( stateIn ) - { - childSetCommitCallback("rspin", onTextCommit, (void*)this ); - childSetCommitCallback("gspin", onTextCommit, (void*)this ); - childSetCommitCallback("bspin", onTextCommit, (void*)this ); - childSetCommitCallback("hspin", onTextCommit, (void*)this ); - childSetCommitCallback("sspin", onTextCommit, (void*)this ); - childSetCommitCallback("lspin", onTextCommit, (void*)this ); - } - else - { - childSetCommitCallback("rspin", 0, (void*)this ); - childSetCommitCallback("gspin", 0, (void*)this ); - childSetCommitCallback("bspin", 0, (void*)this ); - childSetCommitCallback("hspin", 0, (void*)this ); - childSetCommitCallback("sspin", 0, (void*)this ); - childSetCommitCallback("lspin", 0, (void*)this ); - } -} - - ////////////////////////////////////////////////////////////////////////////// // -void -LLFloaterColorPicker:: -onTextEntryChanged ( LLUICtrl* ctrl ) +void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl ) { // value in RGB boxes changed std::string name = ctrl->getName(); @@ -821,10 +733,7 @@ onTextEntryChanged ( LLUICtrl* ctrl ) // update current RGB (and implicitly HSL) setCurRgb ( rVal, gVal, bVal ); - // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion - enableTextCallbacks ( FALSE ); updateTextEntry (); - enableTextCallbacks ( TRUE ); } else // value in HSL boxes changed @@ -847,10 +756,7 @@ onTextEntryChanged ( LLUICtrl* ctrl ) // update current HSL (and implicitly RGB) setCurHsl ( hVal, sVal, lVal ); - // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion - enableTextCallbacks ( FALSE ); updateTextEntry (); - enableTextCallbacks ( TRUE ); } if (mApplyImmediateCheck->get()) @@ -861,9 +767,7 @@ onTextEntryChanged ( LLUICtrl* ctrl ) ////////////////////////////////////////////////////////////////////////////// // -BOOL -LLFloaterColorPicker:: -updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) +BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) { if ( xPosIn >= mRGBViewerImageLeft && xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth && @@ -899,9 +803,7 @@ updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn ) ////////////////////////////////////////////////////////////////////////////// // -BOOL -LLFloaterColorPicker:: -handleMouseDown ( S32 x, S32 y, MASK mask ) +BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask ) { // make it the frontmost gFloaterView->bringToFront(this); @@ -987,10 +889,7 @@ handleMouseDown ( S32 x, S32 y, MASK mask ) LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); } - // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion - enableTextCallbacks ( FALSE ); updateTextEntry (); - enableTextCallbacks ( TRUE ); } return TRUE; @@ -1003,9 +902,7 @@ handleMouseDown ( S32 x, S32 y, MASK mask ) ////////////////////////////////////////////////////////////////////////////// // -BOOL -LLFloaterColorPicker:: -handleHover ( S32 x, S32 y, MASK mask ) +BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask ) { // if we're the front most window if ( isFrontmost () ) @@ -1071,19 +968,9 @@ handleHover ( S32 x, S32 y, MASK mask ) return LLFloater::handleHover ( x, y, mask ); } -void LLFloaterColorPicker::onClose(bool app_quitting) -{ - //RN: this is consistent with texture picker in that closing the window leaves the current selection - // to change this to "close to cancel", uncomment the following line - //cancelSelection(); - LLFloater::onClose(app_quitting); -} - ////////////////////////////////////////////////////////////////////////////// // reverts state once mouse button is released -BOOL -LLFloaterColorPicker:: -handleMouseUp ( S32 x, S32 y, MASK mask ) +BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask ) { getWindow()->setCursor ( UI_CURSOR_ARROW ); @@ -1130,7 +1017,7 @@ handleMouseUp ( S32 x, S32 y, MASK mask ) std::ostringstream codec; codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << curEntry + 1; const std::string s ( codec.str () ); - gSavedSettings.setColor4( s, *mPalette [ curEntry ] ); + gSavedSkinSettings.setColor4( s, *mPalette [ curEntry ] ); } } @@ -1158,16 +1045,11 @@ handleMouseUp ( S32 x, S32 y, MASK mask ) ////////////////////////////////////////////////////////////////////////////// // cancel current color selection, revert to original and close picker -void -LLFloaterColorPicker:: -cancelSelection () +void LLFloaterColorPicker::cancelSelection () { // restore the previous color selection setCurRgb ( getOrigR (), getOrigG (), getOrigB () ); - // we're going away and when we do and the entry widgets lose focus, they do bad things so turn them off - enableTextCallbacks ( FALSE ); - // update in world item with original color via current swatch LLColorSwatchCtrl::onColorChanged( getSwatch(), LLColorSwatchCtrl::COLOR_CANCEL ); diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index 7c8d36a7c7..16f456b5bf 100644 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -36,7 +36,7 @@ #include #include "llfloater.h" -#include "llmemory.h" +#include "llpointer.h" #include "llcolorswatch.h" #include "llspinctrl.h" #include "lltextureentry.h" @@ -61,7 +61,6 @@ class LLFloaterColorPicker virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask ); virtual BOOL handleHover ( S32 x, S32 y, MASK mask ); virtual void onMouseCaptureLost(); - virtual void onClose(bool app_quitting); // implicit methods void createUI (); @@ -123,14 +122,11 @@ class LLFloaterColorPicker // callbacks static void onClickCancel ( void* data ); static void onClickSelect ( void* data ); - static void onClickPipette ( void* data ); + void onClickPipette ( ); static void onTextCommit ( LLUICtrl* ctrl, void* data ); static void onImmediateCheck ( LLUICtrl* ctrl, void* data ); - static void onColorSelect( const LLTextureEntry& te, void *data ); + void onColorSelect( const LLTextureEntry& te ); private: - // turns on or off text entry commit call backs - void enableTextCallbacks ( BOOL stateIn ); - // draws color selection palette void drawPalette (); diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 58876a8dec..a448df792e 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -63,15 +63,20 @@ LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; std::map LLFloaterDayCycle::sSliderToKey; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; -LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater")) +LLFloaterDayCycle::LLFloaterDayCycle() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml"); - +} + +BOOL LLFloaterDayCycle::postBuild() +{ // add the combo boxes LLComboBox* keyCombo = getChild("WLKeyPresets"); if(keyCombo != NULL) { + keyCombo->removeall(); std::map::iterator mIt = LLWLParamManager::instance()->mParamList.begin(); for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++) @@ -90,6 +95,7 @@ LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floate // load it up initCallbacks(); + return TRUE; } LLFloaterDayCycle::~LLFloaterDayCycle() @@ -231,7 +237,7 @@ LLFloaterDayCycle* LLFloaterDayCycle::instance() if (!sDayCycle) { sDayCycle = new LLFloaterDayCycle(); - sDayCycle->open(); + sDayCycle->openFloater(); sDayCycle->setFocus(TRUE); } return sDayCycle; @@ -256,7 +262,7 @@ void LLFloaterDayCycle::show() //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); //dayCycle->initCallbacks(); - dayCycle->open(); + dayCycle->openFloater(); } // virtual diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h index d230035545..a03a7f749a 100644 --- a/indra/newview/llfloaterdaycycle.h +++ b/indra/newview/llfloaterdaycycle.h @@ -58,7 +58,7 @@ public: LLFloaterDayCycle(); virtual ~LLFloaterDayCycle(); - + /*virtual*/ BOOL postBuild(); /// help button stuff static void onClickHelp(void* data); void initHelpBtn(const std::string& name, const std::string& xml_alert); diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index 661c3988c0..cfdf49373e 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -54,18 +54,22 @@ LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; -LLFloaterEnvSettings::LLFloaterEnvSettings() : LLFloater(std::string("Environment Settings Floater")) +LLFloaterEnvSettings::LLFloaterEnvSettings() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml"); - - // load it up - initCallbacks(); } - +// virtual LLFloaterEnvSettings::~LLFloaterEnvSettings() { } - +// virtual +BOOL LLFloaterEnvSettings::postBuild() +{ + // load it up + initCallbacks(); + return TRUE; +} void LLFloaterEnvSettings::onClickHelp(void* data) { LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data; @@ -174,7 +178,7 @@ LLFloaterEnvSettings* LLFloaterEnvSettings::instance() if (!sEnvSettings) { sEnvSettings = new LLFloaterEnvSettings(); - sEnvSettings->open(); + sEnvSettings->openFloater(); sEnvSettings->setFocus(TRUE); } return sEnvSettings; @@ -188,7 +192,7 @@ void LLFloaterEnvSettings::show() //LLUICtrlFactory::getInstance()->buildFloater(envSettings, "floater_env_settings.xml"); //envSettings->initCallbacks(); - envSettings->open(); + envSettings->openFloater(); } bool LLFloaterEnvSettings::isOpen() @@ -303,7 +307,6 @@ std::string LLFloaterEnvSettings::timeToString(F32 curTime) { S32 hours; S32 min; - bool isPM = false; // get hours and minutes hours = (S32) (24.0 * curTime); @@ -317,46 +320,19 @@ std::string LLFloaterEnvSettings::timeToString(F32 curTime) min = 0; } - // set for PM - if(hours >= 12 && hours < 24) - { - isPM = true; - } + std::string newTime = getString("timeStr"); + struct tm * timeT; + time_t secT = time(0); + timeT = gmtime (&secT); - // convert to non-military notation - if(hours >= 24) - { - hours = 12; - } - else if(hours > 12) - { - hours -= 12; - } - else if(hours == 0) - { - hours = 12; - } + timeT->tm_hour = hours; + timeT->tm_min = min; + secT = mktime (timeT); + secT -= LLStringOps::getLocalTimeOffset (); - // make the string - std::stringstream newTime; - newTime << hours << ":"; - - // double 0 - if(min < 10) - { - newTime << 0; - } - - // finish it - newTime << min << " "; - if(isPM) - { - newTime << "PM"; - } - else - { - newTime << "AM"; - } + LLSD substitution; + substitution["datetime"] = (S32) secT; - return newTime.str(); + LLStringUtil::format (newTime, substitution); + return newTime; } diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h index 4cdf6036c6..725fb9ed45 100644 --- a/indra/newview/llfloaterenvsettings.h +++ b/indra/newview/llfloaterenvsettings.h @@ -46,8 +46,8 @@ class LLFloaterEnvSettings : public LLFloater public: LLFloaterEnvSettings(); - virtual ~LLFloaterEnvSettings(); - + /*virtual*/ ~LLFloaterEnvSettings(); + /*virtual*/ BOOL postBuild(); /// initialize all the callbacks for the menu void initCallbacks(void); diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp index 485c13c7b6..6f84807564 100644 --- a/indra/newview/llfloaterevent.cpp +++ b/indra/newview/llfloaterevent.cpp @@ -75,13 +75,13 @@ public: }; LLEventHandler gEventHandler; -LLFloaterEventInfo::LLFloaterEventInfo(const std::string& name, const U32 event_id) -: LLFloater(name), +LLFloaterEventInfo::LLFloaterEventInfo(const U32 event_id) +: LLFloater(), mEventID( event_id ) { mFactoryMap["event_details_panel"] = LLCallbackMap(LLFloaterEventInfo::createEventDetail, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_event.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_event.xml"); gEventInfoInstances.addData(event_id, this); } @@ -115,14 +115,14 @@ LLFloaterEventInfo* LLFloaterEventInfo::show(const U32 event_id) { // ...bring that window to front floater = gEventInfoInstances.getData(event_id); - floater->open(); /*Flawfinder: ignore*/ + floater->openFloater(); floater->setFrontmost(true); } else { - floater = new LLFloaterEventInfo("eventinfo", event_id ); + floater = new LLFloaterEventInfo( event_id ); floater->center(); - floater->open(); /*Flawfinder: ignore*/ + floater->openFloater(); floater->displayEventInfo(event_id); floater->setFrontmost(true); } diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h index 8f448b5fa2..563ecc49da 100644 --- a/indra/newview/llfloaterevent.h +++ b/indra/newview/llfloaterevent.h @@ -42,7 +42,7 @@ class LLPanelEvent; class LLFloaterEventInfo : public LLFloater { public: - LLFloaterEventInfo(const std::string& name, const U32 event_id ); + LLFloaterEventInfo( const U32 event_id ); /*virtual*/ ~LLFloaterEventInfo(); void displayEventInfo(const U32 event_id); diff --git a/indra/newview/llfloaterfonttest.cpp b/indra/newview/llfloaterfonttest.cpp index 4bb1d9605d..02791b711e 100644 --- a/indra/newview/llfloaterfonttest.cpp +++ b/indra/newview/llfloaterfonttest.cpp @@ -5,7 +5,7 @@ * * $LicenseInfo:firstyear=2008&license=viewergpl$ * - * Copyright (c) 2008 Linden Research, Inc. + * Copyright (c) 2008-2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -13,12 +13,13 @@ * ("GPL"), unless you have obtained a separate licensing agreement * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -44,7 +45,7 @@ LLFloaterFontTest* LLFloaterFontTest::sInstance = NULL; LLFloaterFontTest::LLFloaterFontTest() - : LLFloater(std::string("floater_font_test"), LLRect(0,500,700,0), std::string("Font Test")) + : LLFloater("floater_font_test") { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_font_test.xml"); } @@ -60,6 +61,6 @@ void LLFloaterFontTest::show(void *unused) if (!sInstance) sInstance = new LLFloaterFontTest(); - sInstance->open(); /*Flawfinder: ignore*/ + sInstance->openFloater(); sInstance->setFocus(TRUE); } diff --git a/indra/newview/llfloaterfonttest.h b/indra/newview/llfloaterfonttest.h index 45ff890423..eb2d410387 100644 --- a/indra/newview/llfloaterfonttest.h +++ b/indra/newview/llfloaterfonttest.h @@ -5,7 +5,7 @@ * * $LicenseInfo:firstyear=2008&license=viewergpl$ * - * Copyright (c) 2008, Linden Research, Inc. + * Copyright (c) 2008-2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -13,12 +13,13 @@ * ("GPL"), unless you have obtained a separate licensing agreement * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 014a631a53..1e8129c7d3 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -46,12 +46,14 @@ #include "llfloateravatarpicker.h" #include "llviewerwindow.h" #include "llbutton.h" -#include "llfloateravatarinfo.h" +#include "llfriendactions.h" #include "llinventorymodel.h" #include "llnamelistctrl.h" #include "llnotify.h" #include "llresmgr.h" -#include "llimview.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lluictrlfactory.h" #include "llmenucommands.h" #include "llviewercontrol.h" @@ -60,6 +62,8 @@ #include "lltextbox.h" #include "llvoiceclient.h" +// *TODO: Move more common stuff to LLFriendActions? + //Maximum number of people you can select to do an operation on at once. #define MAX_FRIEND_SELECT 20 #define DEFAULT_PERIOD 5.0 @@ -148,7 +152,7 @@ void LLPanelFriends::updateFriends(U32 changed_mask) // if the maximum amount of friends are selected mShowMaxSelectWarning = false; - LLDynamicArray selected_friends = getSelectedIDs(); + std::vector selected_friends = getSelectedIDs(); if(changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) { refreshNames(changed_mask); @@ -173,7 +177,7 @@ void LLPanelFriends::updateFriends(U32 changed_mask) // but we don't really care here, because refreshUI() will // clean up the interface. friends_list->setCurrentByID(selected_id); - for(LLDynamicArray::iterator itr = selected_friends.begin(); itr != selected_friends.end(); ++itr) + for(std::vector::iterator itr = selected_friends.begin(); itr != selected_friends.end(); ++itr) { friends_list->setSelectedByValue(*itr, true); } @@ -188,10 +192,10 @@ BOOL LLPanelFriends::postBuild() { mFriendsList = getChild("friend_list"); mFriendsList->setMaxSelectable(MAX_FRIEND_SELECT); - mFriendsList->setMaximumSelectCallback(onMaximumSelect); + mFriendsList->setMaximumSelectCallback(boost::bind(&LLPanelFriends::onMaximumSelect)); mFriendsList->setCommitOnSelectionChange(TRUE); childSetCommitCallback("friend_list", onSelectName, this); - childSetDoubleClickCallback("friend_list", onClickIM); + getChild("friend_list")->setDoubleClickCallback(onClickIM, this); U32 changed_mask = LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE; refreshNames(changed_mask); @@ -233,7 +237,7 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) friend_column["column"] = "friend_name"; friend_column["value"] = fullname; friend_column["font"] = "SANSSERIF"; - friend_column["font-style"] = "NORMAL"; + friend_column["font"]["style"] = "NORMAL"; LLSD& online_status_column = element["columns"][LIST_ONLINE_STATUS]; online_status_column["column"] = "icon_online_status"; @@ -241,12 +245,12 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) if (isOnline) { - friend_column["font-style"] = "BOLD"; + friend_column["font"]["style"] = "BOLD"; online_status_column["value"] = "icon_avatar_online.tga"; } else if(isOnlineSIP) { - friend_column["font-style"] = "BOLD"; + friend_column["font"]["style"] = "BOLD"; online_status_column["value"] = ONLINE_SIP_ICON_NAME; } @@ -325,31 +329,14 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh void LLPanelFriends::refreshRightsChangeList() { - LLDynamicArray friends = getSelectedIDs(); + std::vector friends = getSelectedIDs(); S32 num_selected = friends.size(); bool can_offer_teleport = num_selected >= 1; bool selected_friends_online = true; - LLTextBox* processing_label = getChild("process_rights_label"); - - if(!mAllowRightsChange) - { - if(processing_label) - { - processing_label->setVisible(true); - // ignore selection for now - friends.clear(); - num_selected = 0; - } - } - else if(processing_label) - { - processing_label->setVisible(false); - } - const LLRelationship* friend_status = NULL; - for(LLDynamicArray::iterator itr = friends.begin(); itr != friends.end(); ++itr) + for(std::vector::iterator itr = friends.begin(); itr != friends.end(); ++itr) { friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr); if (friend_status) @@ -391,7 +378,7 @@ struct SortFriendsByID void LLPanelFriends::refreshNames(U32 changed_mask) { - LLDynamicArray selected_ids = getSelectedIDs(); + std::vector selected_ids = getSelectedIDs(); S32 pos = mFriendsList->getScrollPos(); // get all buddies we know about @@ -499,17 +486,8 @@ void LLPanelFriends::refreshUI() single_selected = TRUE; if(num_selected > 1) { - childSetText("friend_name_label", getString("Multiple")); multiple_selected = TRUE; } - else - { - childSetText("friend_name_label", mFriendsList->getFirstSelected()->getColumn(LIST_FRIEND_NAME)->getValue().asString() + "..."); - } - } - else - { - childSetText("friend_name_label", LLStringUtil::null); } @@ -521,15 +499,15 @@ void LLPanelFriends::refreshUI() //(single_selected will always be true in this situations) childSetEnabled("remove_btn", single_selected); childSetEnabled("im_btn", single_selected); - childSetEnabled("friend_rights", single_selected); +// childSetEnabled("friend_rights", single_selected); refreshRightsChangeList(); } -LLDynamicArray LLPanelFriends::getSelectedIDs() +std::vector LLPanelFriends::getSelectedIDs() { LLUUID selected_id; - LLDynamicArray friend_ids; + std::vector friend_ids; std::vector selected = mFriendsList->getAllSelected(); for(std::vector::iterator itr = selected.begin(); itr != selected.end(); ++itr) { @@ -552,7 +530,7 @@ void LLPanelFriends::onSelectName(LLUICtrl* ctrl, void* user_data) } //static -void LLPanelFriends::onMaximumSelect(void* user_data) +void LLPanelFriends::onMaximumSelect() { LLSD args; args["MAX_SELECT"] = llformat("%d", MAX_FRIEND_SELECT); @@ -564,14 +542,11 @@ void LLPanelFriends::onClickProfile(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; - //llinfos << "LLPanelFriends::onClickProfile()" << llendl; - LLDynamicArray ids = panelp->getSelectedIDs(); + std::vector ids = panelp->getSelectedIDs(); if(ids.size() > 0) { LLUUID agent_id = ids[0]; - BOOL online; - online = LLAvatarTracker::instance().isBuddyOnline(agent_id); - LLFloaterAvatarInfo::showFromFriend(agent_id, online); + LLFriendActions::showProfile(agent_id); } } @@ -580,70 +555,18 @@ void LLPanelFriends::onClickIM(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; - //llinfos << "LLPanelFriends::onClickIM()" << llendl; - LLDynamicArray ids = panelp->getSelectedIDs(); + std::vector ids = panelp->getSelectedIDs(); if(ids.size() > 0) { if(ids.size() == 1) { - LLUUID agent_id = ids[0]; - const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id); - std::string fullname; - if(info && gCacheName->getFullName(agent_id, fullname)) - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); - } + LLFriendActions::startIM(ids[0]); } else { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); + LLFriendActions::startConference(ids); } - make_ui_sound("UISndStartIM"); - } -} - -// static -void LLPanelFriends::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) -{ - LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); - send_improved_im(target_id, - target_name, - message, - IM_ONLINE, - IM_FRIENDSHIP_OFFERED, - calling_card_folder_id); -} - -// static -bool LLPanelFriends::callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) - { - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - response["message"].asString()); } - return false; -} - -bool LLPanelFriends::callbackAddFriend(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) - { - // Servers older than 1.25 require the text of the message to be the - // calling card folder ID for the offering user. JC - LLUUID calling_card_folder_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); - std::string message = calling_card_folder_id.asString(); - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - message); - } - return false; } // static @@ -653,35 +576,7 @@ void LLPanelFriends::onPickAvatar(const std::vector& names, { if (names.empty()) return; if (ids.empty()) return; - requestFriendshipDialog(ids[0], names[0]); -} - -// static -void LLPanelFriends::requestFriendshipDialog(const LLUUID& id, - const std::string& name) -{ - if(id == gAgentID) - { - LLNotifications::instance().add("AddSelfFriend"); - return; - } - - LLSD args; - args["NAME"] = name; - LLSD payload; - payload["id"] = id; - payload["name"] = name; - // Look for server versions like: Second Life Server 1.24.4.95600 - if (gLastVersionChannel.find(" 1.24.") != std::string::npos) - { - // Old and busted server version, doesn't support friend - // requests with messages. - LLNotifications::instance().add("AddFriend", args, payload, &callbackAddFriend); - } - else - { - LLNotifications::instance().add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); - } + LLFriendActions::requestFriendshipDialog(ids[0], names[0]); } // static @@ -700,53 +595,14 @@ void LLPanelFriends::onClickAddFriend(void* user_data) void LLPanelFriends::onClickRemove(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; - - //llinfos << "LLPanelFriends::onClickRemove()" << llendl; - LLDynamicArray ids = panelp->getSelectedIDs(); - LLSD args; - if(ids.size() > 0) - { - std::string msgType = "RemoveFromFriends"; - if(ids.size() == 1) - { - LLUUID agent_id = ids[0]; - std::string first, last; - if(gCacheName->getName(agent_id, first, last)) - { - args["FIRST_NAME"] = first; - args["LAST_NAME"] = last; - } - } - else - { - msgType = "RemoveMultipleFromFriends"; - } - LLSD payload; - - for (LLDynamicArray::iterator it = ids.begin(); - it != ids.end(); - ++it) - { - payload["ids"].append(*it); - } - - LLNotifications::instance().add(msgType, - args, - payload, - &handleRemove); - } + LLFriendActions::removeFriendsDialog(panelp->getSelectedIDs()); } // static void LLPanelFriends::onClickOfferTeleport(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; - - LLDynamicArray ids = panelp->getSelectedIDs(); - if(ids.size() > 0) - { - handle_lure(ids); - } + LLFriendActions::offerTeleport(panelp->getSelectedIDs()); } // static @@ -754,7 +610,7 @@ void LLPanelFriends::onClickPay(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; - LLDynamicArray ids = panelp->getSelectedIDs(); + std::vector ids = panelp->getSelectedIDs(); if(ids.size() == 1) { handle_pay_by_id(ids[0]); @@ -955,42 +811,3 @@ void LLPanelFriends::sendRightsGrant(rights_map_t& ids) mNumRightsChanged = ids.size(); gAgent.sendReliableMessage(); } - - - -// static -bool LLPanelFriends::handleRemove(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - const LLSD& ids = notification["payload"]["ids"]; - for(LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr) - { - LLUUID id = itr->asUUID(); - const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id); - if(ip) - { - switch(option) - { - case 0: // YES - if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)) - { - LLAvatarTracker::instance().empower(id, FALSE); - LLAvatarTracker::instance().notifyObservers(); - } - LLAvatarTracker::instance().terminateBuddy(id); - LLAvatarTracker::instance().notifyObservers(); - gInventory.addChangedMask(LLInventoryObserver::LABEL | LLInventoryObserver::CALLING_CARD, LLUUID::null); - gInventory.notifyObservers(); - break; - - case 1: // NO - default: - llinfos << "No removal performed." << llendl; - break; - } - } - - } - return false; -} diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index a5c94ee485..9242f00c91 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -74,15 +74,6 @@ public: virtual BOOL postBuild(); - // Show a dialog explaining what friendship entails, then request - // friendship. JC - static void requestFriendshipDialog(const LLUUID& target_id, - const std::string& target_name); - - // Just request friendship, no dialog. - static void requestFriendship(const LLUUID& target_id, - const std::string& target_name, const std::string& message); - private: enum FRIENDS_COLUMN_ORDER @@ -115,15 +106,15 @@ private: void confirmModifyRights(rights_map_t& ids, EGrantRevoke command); void sendRightsGrant(rights_map_t& ids); - // return LLUUID::null if nothing is selected - LLDynamicArray getSelectedIDs(); + // return empty vector if nothing is selected + std::vector getSelectedIDs(); // callback methods static void onSelectName(LLUICtrl* ctrl, void* user_data); static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static void onPickAvatar(const std::vector& names, const std::vector& ids, void* user_data); - static void onMaximumSelect(void* user_data); + static void onMaximumSelect(); static void onClickIM(void* user_data); static void onClickProfile(void* user_data); @@ -135,7 +126,6 @@ private: static void onClickModifyStatus(LLUICtrl* ctrl, void* user_data); - static bool handleRemove(const LLSD& notification, const LLSD& response); bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights); private: diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 6d39d75663..c3448d52c9 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -53,6 +53,7 @@ #include "llscrollcontainer.h" #include "llscrolllistctrl.h" #include "lltextbox.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llviewergesture.h" #include "llviewerimagelist.h" @@ -81,10 +82,8 @@ public: // LLFloaterGesture //--------------------------------------------------------------------------- LLFloaterGesture::LLFloaterGesture() -: LLFloater(std::string("Gesture Floater")) +: LLFloater() { - sInstance = this; - sObserver = new LLFloaterGestureObserver; gGestureManager.addObserver(sObserver); } @@ -97,10 +96,6 @@ LLFloaterGesture::~LLFloaterGesture() sObserver = NULL; sInstance = NULL; - - // Custom saving rectangle, since load must be done - // after postBuild. - gSavedSettings.setRect("FloaterGestureRect2", getRect()); } // virtual @@ -108,13 +103,12 @@ BOOL LLFloaterGesture::postBuild() { std::string label; - // Translate title label = getTitle(); setTitle(label); childSetCommitCallback("gesture_list", onCommitList, this); - childSetDoubleClickCallback("gesture_list", onClickPlay); + getChild("gesture_list")->setDoubleClickCallback(onClickPlay, this); childSetAction("inventory_btn", onClickInventory, this); @@ -138,25 +132,20 @@ void LLFloaterGesture::show() { if (sInstance) { - sInstance->open(); /*Flawfinder: ignore*/ + sInstance->openFloater(); return; } - LLFloaterGesture *self = new LLFloaterGesture(); + sInstance = new LLFloaterGesture(); // Builds and adds to gFloaterView - LLUICtrlFactory::getInstance()->buildFloater(self, "floater_gesture.xml"); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_gesture.xml"); - // Fix up rectangle - LLRect rect = gSavedSettings.getRect("FloaterGestureRect2"); - self->reshape(rect.getWidth(), rect.getHeight()); - self->setRect(rect); + sInstance->buildGestureList(); - self->buildGestureList(); + sInstance->childSetFocus("gesture_list"); - self->childSetFocus("gesture_list"); - - LLCtrlListInterface *list = self->childGetListInterface("gesture_list"); + LLCtrlListInterface *list = sInstance->childGetListInterface("gesture_list"); if (list) { const BOOL ascending = TRUE; @@ -164,11 +153,11 @@ void LLFloaterGesture::show() list->selectFirstItem(); } - self->mSelectedID = LLUUID::null; + sInstance->mSelectedID = LLUUID::null; // Update button labels - onCommitList(NULL, self); - self->open(); /*Flawfinder: ignore*/ + onCommitList(NULL, sInstance); + sInstance->openFloater(); } // static @@ -176,7 +165,7 @@ void LLFloaterGesture::toggleVisibility() { if(sInstance && sInstance->getVisible()) { - sInstance->close(); + sInstance->closeFloater(); } else { @@ -231,7 +220,7 @@ void LLFloaterGesture::buildGestureList() LLMultiGesture* gesture = (*it).second; // Note: Can have NULL item if inventory hasn't arrived yet. - std::string item_name = "Loading..."; + std::string item_name = getString("loading"); LLInventoryItem* item = gInventory.getItem(item_id); if (item) { @@ -254,7 +243,7 @@ void LLFloaterGesture::buildGestureList() element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = gesture->mTrigger; element["columns"][0]["font"] = "SANSSERIF"; - element["columns"][0]["font-style"] = font_style; + element["columns"][0]["font"]["style"] = font_style; std::string key_string = LLKeyboard::stringFromKey(gesture->mKey); std::string buffer; @@ -281,42 +270,42 @@ void LLFloaterGesture::buildGestureList() element["columns"][1]["column"] = "shortcut"; element["columns"][1]["value"] = buffer; element["columns"][1]["font"] = "SANSSERIF"; - element["columns"][1]["font-style"] = font_style; + element["columns"][1]["font"]["style"] = font_style; // hidden column for sorting element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = key_string; element["columns"][2]["font"] = "SANSSERIF"; - element["columns"][2]["font-style"] = font_style; + element["columns"][2]["font"]["style"] = font_style; // Only add "playing" if we've got the name, less confusing. JC if (item && gesture->mPlaying) { - item_name += " (Playing)"; + item_name += " " + getString("playing"); } element["columns"][3]["column"] = "name"; element["columns"][3]["value"] = item_name; element["columns"][3]["font"] = "SANSSERIF"; - element["columns"][3]["font-style"] = font_style; + element["columns"][3]["font"]["style"] = font_style; } else { element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = ""; element["columns"][0]["font"] = "SANSSERIF"; - element["columns"][0]["font-style"] = font_style; + element["columns"][0]["font"]["style"] = font_style; element["columns"][0]["column"] = "trigger"; element["columns"][0]["value"] = "---"; element["columns"][0]["font"] = "SANSSERIF"; - element["columns"][0]["font-style"] = font_style; + element["columns"][0]["font"]["style"] = font_style; element["columns"][2]["column"] = "key"; element["columns"][2]["value"] = "~~~"; element["columns"][2]["font"] = "SANSSERIF"; - element["columns"][2]["font-style"] = font_style; + element["columns"][2]["font"]["style"] = font_style; element["columns"][3]["column"] = "name"; element["columns"][3]["value"] = item_name; element["columns"][3]["font"] = "SANSSERIF"; - element["columns"][3]["font-style"] = font_style; + element["columns"][3]["font"]["style"] = font_style; } list->addElement(element, ADD_BOTTOM); } @@ -360,24 +349,16 @@ void LLFloaterGesture::onClickPlay(void* data) class GestureShowCallback : public LLInventoryCallback { public: - GestureShowCallback(std::string &title) - { - mTitle = title; - } void fire(const LLUUID &inv_item) { - LLPreviewGesture::show(mTitle, inv_item, LLUUID::null); + LLPreviewGesture::show(inv_item, LLUUID::null); } -private: - std::string mTitle; }; // static void LLFloaterGesture::onClickNew(void* data) { - std::string title("Gesture: "); - title.append("New Gesture"); - LLPointer cb = new GestureShowCallback(title); + LLPointer cb = new GestureShowCallback(); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), LLUUID::null, LLTransactionID::tnull, "New Gesture", "", LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, cb); @@ -396,10 +377,7 @@ void LLFloaterGesture::onClickEdit(void* data) LLInventoryItem* item = gInventory.getItem(item_id); if (!item) return; - std::string title("Gesture: "); - title.append(item->getName()); - - LLPreviewGesture* previewp = LLPreviewGesture::show(title, item_id, LLUUID::null); + LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null); if (!previewp->getHost()) { previewp->setRect(gFloaterView->findNeighboringPosition(self, previewp)); diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h index 4e11a10e61..f7c4e558ac 100644 --- a/indra/newview/llfloatergesture.h +++ b/indra/newview/llfloatergesture.h @@ -41,7 +41,7 @@ #include "lldarray.h" -class LLScrollableContainerView; +class LLScrollContainer; class LLView; class LLButton; class LLLineEditor; diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 4959a2913e..58cbe02d6d 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -73,36 +73,39 @@ #include "llsurface.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" +#include "lltrans.h" #include "lltransfertargetfile.h" #include "lltransfersourcefile.h" const F32 SECONDS_BETWEEN_UPDATE_REQUESTS = 5.0f; -static LLFloaterGodTools* sGodTools = NULL; - //***************************************************************************** // LLFloaterGodTools //***************************************************************************** -// static -LLFloaterGodTools* LLFloaterGodTools::instance() +void LLFloaterGodTools::onOpen(const LLSD& key) { - if (!sGodTools) + center(); + setFocus(TRUE); +// LLPanel *panel = childGetVisibleTab("GodTools Tabs"); +// if (panel) +// panel->setFocus(TRUE); + if (mPanelObjectTools) + mPanelObjectTools->setTargetAvatar(LLUUID::null); + + if (gAgent.getRegionHost() != mCurrentHost) { - sGodTools = new LLFloaterGodTools(); - sGodTools->open(); /*Flawfinder: ignore*/ - sGodTools->center(); - sGodTools->setFocus(TRUE); + // we're in a new region + sendRegionInfoRequest(); } - return sGodTools; } // static void LLFloaterGodTools::refreshAll() { - LLFloaterGodTools* god_tools = instance(); + LLFloaterGodTools* god_tools = getInstance(); if (god_tools) { if (gAgent.getRegionHost() != god_tools->mCurrentHost) @@ -115,22 +118,16 @@ void LLFloaterGodTools::refreshAll() -LLFloaterGodTools::LLFloaterGodTools() -: LLFloater(std::string("godtools floater")), +LLFloaterGodTools::LLFloaterGodTools(const LLSD& key) +: LLFloater(), mCurrentHost(LLHost::invalid), mUpdateTimer() { - LLCallbackMap::map_t factory_map; - factory_map["grid"] = LLCallbackMap(createPanelGrid, this); - factory_map["region"] = LLCallbackMap(createPanelRegion, this); - factory_map["objects"] = LLCallbackMap(createPanelObjects, this); - factory_map["request"] = LLCallbackMap(createPanelRequest, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_god_tools.xml", &factory_map); - - childSetTabChangeCallback("GodTools Tabs", "grid", onTabChanged, this); - childSetTabChangeCallback("GodTools Tabs", "region", onTabChanged, this); - childSetTabChangeCallback("GodTools Tabs", "objects", onTabChanged, this); - childSetTabChangeCallback("GodTools Tabs", "request", onTabChanged, this); + mFactoryMap["grid"] = LLCallbackMap(createPanelGrid, this); + mFactoryMap["region"] = LLCallbackMap(createPanelRegion, this); + mFactoryMap["objects"] = LLCallbackMap(createPanelObjects, this); + mFactoryMap["request"] = LLCallbackMap(createPanelRequest, this); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_god_tools.xml"); sendRegionInfoRequest(); @@ -140,14 +137,14 @@ LLFloaterGodTools::LLFloaterGodTools() // static void* LLFloaterGodTools::createPanelGrid(void *userdata) { - return new LLPanelGridTools("grid"); + return new LLPanelGridTools(); } // static void* LLFloaterGodTools::createPanelRegion(void *userdata) { LLFloaterGodTools* self = (LLFloaterGodTools*)userdata; - self->mPanelRegionTools = new LLPanelRegionTools("region"); + self->mPanelRegionTools = new LLPanelRegionTools(); return self->mPanelRegionTools; } @@ -155,20 +152,24 @@ void* LLFloaterGodTools::createPanelRegion(void *userdata) void* LLFloaterGodTools::createPanelObjects(void *userdata) { LLFloaterGodTools* self = (LLFloaterGodTools*)userdata; - self->mPanelObjectTools = new LLPanelObjectTools("objects"); + self->mPanelObjectTools = new LLPanelObjectTools(); return self->mPanelObjectTools; } // static void* LLFloaterGodTools::createPanelRequest(void *userdata) { - return new LLPanelRequestTools("region"); + return new LLPanelRequestTools(); } LLFloaterGodTools::~LLFloaterGodTools() { // children automatically deleted } +BOOL LLFloaterGodTools::postBuild() +{ + return TRUE; +} U32 LLFloaterGodTools::computeRegionFlags() const { @@ -186,9 +187,9 @@ void LLFloaterGodTools::updatePopup(LLCoordGL center, MASK mask) // virtual void LLFloaterGodTools::onClose(bool app_quitting) { - if (sGodTools) + if (getInstance()) { - sGodTools->setVisible(FALSE); + getInstance()->setVisible(FALSE); } } @@ -209,42 +210,15 @@ void LLFloaterGodTools::draw() LLFloater::draw(); } -// static -void LLFloaterGodTools::show(void *) -{ - LLFloaterGodTools* god_tools = instance(); - god_tools->open(); - LLPanel *panel = god_tools->childGetVisibleTab("GodTools Tabs"); - if (panel) panel->setFocus(TRUE); - if (god_tools->mPanelObjectTools) god_tools->mPanelObjectTools->setTargetAvatar(LLUUID::null); - - if (gAgent.getRegionHost() != god_tools->mCurrentHost) - { - // we're in a new region - god_tools->sendRegionInfoRequest(); - } -} - void LLFloaterGodTools::showPanel(const std::string& panel_name) { childShowTab("GodTools Tabs", panel_name); - open(); /*Flawfinder: ignore*/ + openFloater(); LLPanel *panel = childGetVisibleTab("GodTools Tabs"); - if (panel) panel->setFocus(TRUE); -} - - -// static -void LLFloaterGodTools::onTabChanged(void* data, bool from_click) -{ - LLPanel* panel = (LLPanel*)data; if (panel) - { panel->setFocus(TRUE); - } } - // static void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) { @@ -299,14 +273,14 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) } // push values to god tools, if available - if (sGodTools - && sGodTools->mPanelRegionTools - && sGodTools->mPanelObjectTools - && msg - && gAgent.isGodlike()) + if ( gAgent.isGodlike() + && instanceVisible() + && getInstance()->mPanelRegionTools + && getInstance()->mPanelObjectTools + && msg ) { - LLPanelRegionTools* rtool = sGodTools->mPanelRegionTools; - sGodTools->mCurrentHost = host; + LLPanelRegionTools* rtool = getInstance()->mPanelRegionTools; + getInstance()->mCurrentHost = host; // store locally rtool->setSimName(sim_name); @@ -319,7 +293,7 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) rtool->setRedirectGridY(redirect_grid_y); rtool->enableAllWidgets(); - LLPanelObjectTools *otool = sGodTools->mPanelObjectTools; + LLPanelObjectTools *otool = getInstance()->mPanelObjectTools; otool->setCheckFlags(region_flags); otool->enableAllWidgets(); @@ -364,12 +338,12 @@ void LLFloaterGodTools::sendGodUpdateRegionInfo() { LLViewerRegion *regionp = gAgent.getRegion(); if (gAgent.isGodlike() - && sGodTools->mPanelRegionTools + && getInstance()->mPanelRegionTools && regionp && gAgent.getRegionHost() == mCurrentHost) { LLMessageSystem *msg = gMessageSystem; - LLPanelRegionTools *rtool = sGodTools->mPanelRegionTools; + LLPanelRegionTools *rtool = getInstance()->mPanelRegionTools; msg->newMessage("GodUpdateRegionInfo"); msg->nextBlockFast(_PREHASH_AgentData); @@ -426,15 +400,15 @@ const F32 PRICE_PER_METER_MIN = 0.f; const F32 PRICE_PER_METER_MAX = 100.f; -LLPanelRegionTools::LLPanelRegionTools(const std::string& title) -: LLPanel(title) +LLPanelRegionTools::LLPanelRegionTools() +: LLPanel() { } BOOL LLPanelRegionTools::postBuild() { childSetCommitCallback("region name", onChangeAnything, this); - childSetKeystrokeCallback("region name", onChangeSimName, this); + getChild("region name")->setKeystrokeCallback(onChangeSimName, this); childSetPrevalidate("region name", &LLLineEditor::prevalidatePrintableNotPipe); childSetCommitCallback("check prelude", onChangePrelude, this); @@ -768,9 +742,7 @@ void LLPanelRegionTools::setPricePerMeter(S32 price) // static void LLPanelRegionTools::onChangeAnything(LLUICtrl* ctrl, void* userdata) { - if (sGodTools - && userdata - && gAgent.isGodlike()) + if (userdata && gAgent.isGodlike()) { LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata; region_tools->childEnable("Apply"); @@ -794,9 +766,7 @@ void LLPanelRegionTools::onChangePrelude(LLUICtrl* ctrl, void* data) // static void LLPanelRegionTools::onChangeSimName(LLLineEditor* caller, void* userdata ) { - if (sGodTools - && userdata - && gAgent.isGodlike()) + if (userdata && gAgent.isGodlike()) { LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata; region_tools->childEnable("Apply"); @@ -807,11 +777,9 @@ void LLPanelRegionTools::onChangeSimName(LLLineEditor* caller, void* userdata ) void LLPanelRegionTools::onRefresh(void* userdata) { LLViewerRegion *region = gAgent.getRegion(); - if (region - && sGodTools - && gAgent.isGodlike()) + if (region && gAgent.isGodlike()) { - sGodTools->sendRegionInfoRequest(); + LLFloaterGodTools::getInstance()->sendRegionInfoRequest(); } } @@ -819,15 +787,12 @@ void LLPanelRegionTools::onRefresh(void* userdata) void LLPanelRegionTools::onApplyChanges(void* userdata) { LLViewerRegion *region = gAgent.getRegion(); - if (region - && sGodTools - && userdata - && gAgent.isGodlike()) + if (region && userdata && gAgent.isGodlike()) { LLPanelRegionTools* region_tools = (LLPanelRegionTools*) userdata; region_tools->childDisable("Apply"); - sGodTools->sendGodUpdateRegionInfo(); + LLFloaterGodTools::getInstance()->sendGodUpdateRegionInfo(); } } @@ -890,11 +855,10 @@ void LLPanelRegionTools::onSelectRegion(void* userdata) // LEFT R2 RIGHT const F32 HOURS_TO_RADIANS = (2.f*F_PI)/24.f; -const char FLOATER_GRID_ADMIN_TITLE[] = "Grid Administration"; -LLPanelGridTools::LLPanelGridTools(const std::string& name) : - LLPanel(name) +LLPanelGridTools::LLPanelGridTools() : + LLPanel() { } @@ -919,10 +883,6 @@ void LLPanelGridTools::refresh() // static void LLPanelGridTools::onClickKickAll(void* userdata) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect(left, top, left+400, top-300); - LLNotifications::instance().add("KickAllUsers", LLSD(), LLSD(), LLPanelGridTools::confirmKick); } @@ -1017,8 +977,9 @@ bool LLPanelGridTools::flushMapVisibilityCachesConfirm(const LLSD& notification, // LEFT RIGHT // Default constructor -LLPanelObjectTools::LLPanelObjectTools(const std::string& title) -: LLPanel(title), mTargetAvatar() +LLPanelObjectTools::LLPanelObjectTools() + : LLPanel(), + mTargetAvatar() { } @@ -1054,7 +1015,7 @@ void LLPanelObjectTools::setTargetAvatar(const LLUUID &target_id) mTargetAvatar = target_id; if (target_id.isNull()) { - childSetValue("target_avatar_name", "(no target)"); + childSetValue("target_avatar_name", getString("no_target")); } } @@ -1137,8 +1098,7 @@ void LLPanelObjectTools::enableAllWidgets() // static void LLPanelObjectTools::onGetTopColliders(void* userdata) { - if (sGodTools - && gAgent.isGodlike()) + if (gAgent.isGodlike()) { LLFloaterTopObjects::show(); LLFloaterTopObjects::setMode(STAT_REPORT_TOP_COLLIDERS); @@ -1149,8 +1109,7 @@ void LLPanelObjectTools::onGetTopColliders(void* userdata) // static void LLPanelObjectTools::onGetTopScripts(void* userdata) { - if (sGodTools - && gAgent.isGodlike()) + if (gAgent.isGodlike()) { LLFloaterTopObjects::show(); LLFloaterTopObjects::setMode(STAT_REPORT_TOP_SCRIPTS); @@ -1161,8 +1120,7 @@ void LLPanelObjectTools::onGetTopScripts(void* userdata) // static void LLPanelObjectTools::onGetScriptDigest(void* userdata) { - if (sGodTools - && gAgent.isGodlike()) + if (gAgent.isGodlike()) { // get the list of scripts and number of occurences of each // (useful for finding self-replicating objects) @@ -1272,7 +1230,10 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); panelp->mTargetAvatar = owner_id; - std::string name = "Object " + node->mName + " owned by " + owner_name; + LLStringUtil::format_map_t args; + args["[OBJECT]"] = node->mName; + args["[OWNER]"] = owner_name; + std::string name = LLTrans::getString("GodToolsObjectOwnedBy", args); panelp->childSetValue("target_avatar_name", name); } @@ -1290,9 +1251,7 @@ void LLPanelObjectTools::callbackAvatarID(const std::vector& names, // static void LLPanelObjectTools::onChangeAnything(LLUICtrl* ctrl, void* userdata) { - if (sGodTools - && userdata - && gAgent.isGodlike()) + if (userdata && gAgent.isGodlike()) { LLPanelObjectTools* object_tools = (LLPanelObjectTools*) userdata; object_tools->childEnable("Apply"); @@ -1303,16 +1262,13 @@ void LLPanelObjectTools::onChangeAnything(LLUICtrl* ctrl, void* userdata) void LLPanelObjectTools::onApplyChanges(void* userdata) { LLViewerRegion *region = gAgent.getRegion(); - if (region - && sGodTools - && userdata - && gAgent.isGodlike()) + if (region && gAgent.isGodlike()) { LLPanelObjectTools* object_tools = (LLPanelObjectTools*) userdata; // TODO -- implement this object_tools->childDisable("Apply"); - sGodTools->sendGodUpdateRegionInfo(); + LLFloaterGodTools::getInstance()->sendGodUpdateRegionInfo(); } } @@ -1324,8 +1280,8 @@ void LLPanelObjectTools::onApplyChanges(void* userdata) const std::string SELECTION = "Selection"; const std::string AGENT_REGION = "Agent Region"; -LLPanelRequestTools::LLPanelRequestTools(const std::string& name): - LLPanel(name) +LLPanelRequestTools::LLPanelRequestTools(): + LLPanel() { } @@ -1348,9 +1304,13 @@ void LLPanelRequestTools::refresh() LLCtrlListInterface *list = childGetListInterface("destination"); if (!list) return; - list->operateOnAll(LLCtrlListInterface::OP_DELETE); - list->addSimpleElement(SELECTION); - list->addSimpleElement(AGENT_REGION); + S32 last_item = list->getItemCount(); + + if (last_item >=3) + { + list->selectItemRange(2,last_item); + list->operateOnSelection(LLCtrlListInterface::OP_DELETE); + } for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { @@ -1367,7 +1327,7 @@ void LLPanelRequestTools::refresh() } else { - list->selectByValue(SELECTION); + list->operateOnSelection(LLCtrlListInterface::OP_DESELECT); } } diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index 75813ca886..6c4b438808 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -57,12 +57,11 @@ class LLTextBox; class LLMessageSystem; class LLFloaterGodTools -: public LLFloater + : public LLFloater, public LLFloaterSingleton { + friend class LLUISingleton >; public: - static LLFloaterGodTools* instance(); - enum EGodPanel { PANEL_GRID, @@ -72,9 +71,6 @@ public: PANEL_COUNT }; - static void show(void *); - static void hide(void *); - static void* createPanelGrid(void *userdata); static void* createPanelRegion(void *userdata); static void* createPanelObjects(void *userdata); @@ -84,6 +80,7 @@ public: void showPanel(const std::string& panel_name); + virtual void onOpen(const LLSD& key); virtual void onClose(bool app_quitting); virtual void draw(); @@ -101,21 +98,17 @@ public: // Send possibly changed values to simulator. void sendGodUpdateRegionInfo(); - static void onTabChanged(void *data, bool from_click); - protected: U32 computeRegionFlags() const; protected: - LLFloaterGodTools(); + LLFloaterGodTools(const LLSD& key); ~LLFloaterGodTools(); - + /*virtual*/ BOOL postBuild(); // When the floater is going away, reset any options that need to be // cleared. void resetToolState(); - static LLFloaterGodTools* sInstance; - public: LLPanelRegionTools *mPanelRegionTools; LLPanelObjectTools *mPanelObjectTools; @@ -133,7 +126,7 @@ class LLPanelRegionTools : public LLPanel { public: - LLPanelRegionTools(const std::string& name); + LLPanelRegionTools(); /*virtual*/ ~LLPanelRegionTools(); BOOL postBuild(); @@ -194,7 +187,7 @@ class LLPanelGridTools : public LLPanel { public: - LLPanelGridTools(const std::string& name); + LLPanelGridTools(); virtual ~LLPanelGridTools(); BOOL postBuild(); @@ -221,7 +214,7 @@ class LLPanelObjectTools : public LLPanel { public: - LLPanelObjectTools(const std::string& name); + LLPanelObjectTools(); /*virtual*/ ~LLPanelObjectTools(); BOOL postBuild(); @@ -262,7 +255,7 @@ protected: class LLPanelRequestTools : public LLPanel { public: - LLPanelRequestTools(const std::string& name); + LLPanelRequestTools(); /*virtual*/ ~LLPanelRequestTools(); BOOL postBuild(); diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp index 08a6269a04..92db0b0926 100644 --- a/indra/newview/llfloatergroupinvite.cpp +++ b/indra/newview/llfloatergroupinvite.cpp @@ -34,9 +34,8 @@ #include "llfloatergroupinvite.h" #include "llpanelgroupinvite.h" - -const char FLOATER_TITLE[] = "Group Invitation"; -const LLRect FGI_RECT(0, 380, 210, 0); +#include "lltrans.h" +#include "lldraghandle.h" class LLFloaterGroupInvite::impl { @@ -73,25 +72,26 @@ void LLFloaterGroupInvite::impl::closeFloater(void* data) { LLFloaterGroupInvite* floaterp = (LLFloaterGroupInvite*) data; - if ( floaterp ) floaterp->close(); + if ( floaterp ) floaterp->closeFloater(); } //----------------------------------------------------------------------------- // Implementation //----------------------------------------------------------------------------- -LLFloaterGroupInvite::LLFloaterGroupInvite(const std::string& name, - const LLRect &rect, - const std::string& title, - const LLUUID& group_id) -: LLFloater(name, rect, title) +LLFloaterGroupInvite::LLFloaterGroupInvite(const LLUUID& group_id) +: LLFloater() { - LLRect contents(getRect()); - contents.mTop -= LLFLOATER_HEADER_SIZE; + static LLUICachedControl floater_header_size ("UIFloaterHeaderSize", 0); + LLRect contents; mImpl = new impl(group_id); - mImpl->mInvitePanelp = new LLPanelGroupInvite("Group Invite Panel", - group_id); + mImpl->mInvitePanelp = new LLPanelGroupInvite(group_id); + + contents = mImpl->mInvitePanelp->getRect(); + contents.mTop -= floater_header_size; + + setTitle (mImpl->mInvitePanelp->getString("GroupInvitation")); mImpl->mInvitePanelp->setCloseCallback(impl::closeFloater, this); @@ -114,6 +114,9 @@ LLFloaterGroupInvite::~LLFloaterGroupInvite() // static void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, std::vector *agent_ids) { + static LLUICachedControl floater_header_size ("UIFloaterHeaderSize", 0); + LLRect contents; + // Make sure group_id isn't null if (group_id.isNull()) { @@ -127,10 +130,12 @@ void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, std::vectormImpl->mInvitePanelp->getRect(); + contents.mTop += floater_header_size; + fgi->setRect(contents); + fgi->getDragHandle()->setRect(contents); + fgi->getDragHandle()->setTitle(fgi->mImpl->mInvitePanelp->getString("GroupInvitation")); impl::sInstances[group_id] = fgi; @@ -143,6 +148,6 @@ void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, std::vectorcenter(); - fgi->open(); /*Flawfinder: ignore*/ + fgi->openFloater(); fgi->mImpl->mInvitePanelp->update(); } diff --git a/indra/newview/llfloatergroupinvite.h b/indra/newview/llfloatergroupinvite.h index d1485ead91..b3f5d75ac1 100644 --- a/indra/newview/llfloatergroupinvite.h +++ b/indra/newview/llfloatergroupinvite.h @@ -46,10 +46,7 @@ public: static void showForGroup(const LLUUID &group_id, std::vector *agent_ids = NULL); protected: - LLFloaterGroupInvite(const std::string& name, - const LLRect &rect, - const std::string& title, - const LLUUID& group_id = LLUUID::null); + LLFloaterGroupInvite(const LLUUID& group_id = LLUUID::null); class impl; impl* mImpl; diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 9e0b0d7230..a967a1833f 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -41,21 +41,15 @@ #include "llfloatergroups.h" -#include "message.h" #include "roles_constants.h" #include "llagent.h" #include "llbutton.h" -#include "llfloatergroupinfo.h" -#include "llfloaterdirectory.h" -#include "llfocusmgr.h" -#include "llalertdialog.h" -#include "llselectmgr.h" +#include "llgroupactions.h" #include "llscrolllistctrl.h" #include "lltextbox.h" #include "lluictrlfactory.h" -#include "llviewerwindow.h" -#include "llimview.h" +#include "lltrans.h" using namespace LLOldEvents; @@ -84,17 +78,16 @@ LLFloaterGroupPicker* LLFloaterGroupPicker::findInstance(const LLSD& seed) LLFloaterGroupPicker* LLFloaterGroupPicker::createInstance(const LLSD &seed) { LLFloaterGroupPicker* pickerp = new LLFloaterGroupPicker(seed); - LLUICtrlFactory::getInstance()->buildFloater(pickerp, "floater_choose_group.xml"); return pickerp; } -LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed) : - mSelectCallback(NULL), - mCallbackUserdata(NULL), +LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed) +: LLFloater(), mPowersMask(GP_ALL_POWERS) { mID = seed.asUUID(); sInstances.insert(std::make_pair(mID, this)); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml"); } LLFloaterGroupPicker::~LLFloaterGroupPicker() @@ -102,13 +95,6 @@ LLFloaterGroupPicker::~LLFloaterGroupPicker() sInstances.erase(mID); } -void LLFloaterGroupPicker::setSelectCallback(void (*callback)(LLUUID, void*), - void* userdata) -{ - mSelectCallback = callback; - mCallbackUserdata = userdata; -} - void LLFloaterGroupPicker::setPowersMask(U64 powers_mask) { mPowersMask = powers_mask; @@ -126,8 +112,7 @@ BOOL LLFloaterGroupPicker::postBuild() setDefaultBtn("OK"); - childSetDoubleClickCallback("group list", onBtnOK); - childSetUserData("group list", this); + getChild("group list")->setDoubleClickCallback(onBtnOK, this); childEnable("OK"); @@ -143,7 +128,7 @@ void LLFloaterGroupPicker::onBtnOK(void* userdata) void LLFloaterGroupPicker::onBtnCancel(void* userdata) { LLFloaterGroupPicker* self = (LLFloaterGroupPicker*)userdata; - if(self) self->close(); + if(self) self->closeFloater(); } @@ -155,12 +140,9 @@ void LLFloaterGroupPicker::ok() { group_id = group_list->getCurrentID(); } - if(mSelectCallback) - { - mSelectCallback(group_id, mCallbackUserdata); - } + mGroupSelectSignal(group_id); - close(); + closeFloater(); } ///---------------------------------------------------------------------------- @@ -229,8 +211,7 @@ BOOL LLPanelGroups::postBuild() setDefaultBtn("IM"); - childSetDoubleClickCallback("group list", onBtnIM); - childSetUserData("group list", this); + getChild("group list")->setDoubleClickCallback(onBtnIM, this); reset(); @@ -315,113 +296,54 @@ void LLPanelGroups::onBtnSearch(void* userdata) void LLPanelGroups::create() { - llinfos << "LLPanelGroups::create" << llendl; - LLFloaterGroupInfo::showCreateGroup(NULL); + LLGroupActions::create(); } void LLPanelGroups::activate() { - llinfos << "LLPanelGroups::activate" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list) { group_id = group_list->getCurrentID(); } - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); + LLGroupActions::activate(group_id); } void LLPanelGroups::info() { - llinfos << "LLPanelGroups::info" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list && (group_id = group_list->getCurrentID()).notNull()) { - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::info(group_id); } } void LLPanelGroups::startIM() { - //llinfos << "LLPanelFriends::onClickIM()" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list && (group_id = group_list->getCurrentID()).notNull()) { - LLGroupData group_data; - if (gAgent.getGroupData(group_id, group_data)) - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession( - group_data.mName, - IM_SESSION_GROUP_START, - group_id); - make_ui_sound("UISndStartIM"); - } - else - { - // this should never happen, as starting a group IM session - // relies on you belonging to the group and hence having the group data - make_ui_sound("UISndInvalidOp"); - } + LLGroupActions::startChat(group_id); } } void LLPanelGroups::leave() { - llinfos << "LLPanelGroups::leave" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; if (group_list && (group_id = group_list->getCurrentID()).notNull()) { - S32 count = gAgent.mGroups.count(); - S32 i; - for(i = 0; i < count; ++i) - { - if(gAgent.mGroups.get(i).mID == group_id) - break; - } - if(i < count) - { - LLSD args; - args["GROUP"] = gAgent.mGroups.get(i).mName; - LLSD payload; - payload["group_id"] = group_id; - LLNotifications::instance().add("GroupLeaveConfirmMember", args, payload, callbackLeaveGroup); - } + LLGroupActions::leave(group_id); } } void LLPanelGroups::search() { - LLFloaterDirectory::showGroups(); -} - -// static -bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - LLUUID group_id = notification["payload"]["group_id"].asUUID(); - if(option == 0) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_LeaveGroupRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_GroupData); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); - } - return false; + LLGroupActions::search(); } void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) @@ -456,7 +378,7 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow element["columns"][0]["column"] = "name"; element["columns"][0]["value"] = group_datap->mName; element["columns"][0]["font"] = "SANSSERIF"; - element["columns"][0]["font-style"] = style; + element["columns"][0]["font"]["style"] = style; group_list->addElement(element, ADD_SORTED); } @@ -472,9 +394,9 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow LLSD element; element["id"] = LLUUID::null; element["columns"][0]["column"] = "name"; - element["columns"][0]["value"] = "none"; // *TODO: Translate + element["columns"][0]["value"] = LLTrans::getString("GroupsNone"); element["columns"][0]["font"] = "SANSSERIF"; - element["columns"][0]["font-style"] = style; + element["columns"][0]["font"]["style"] = style; group_list->addElement(element, ADD_TOP); } diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index 3eb3e5af52..b49d38ccd0 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -47,6 +47,8 @@ #include "lluuid.h" #include "llfloater.h" #include +#include +#include class LLUICtrl; class LLTextBox; @@ -59,8 +61,10 @@ class LLFloaterGroupPicker : public LLFloater, public LLUIFactory; public: ~LLFloaterGroupPicker(); - void setSelectCallback( void (*callback)(LLUUID, void*), - void* userdata); + + // Note: Don't return connection; use boost::bind + boost::signal::trackable to disconnect slots + typedef boost::signal signal_t; + void setSelectGroupCallback(const signal_t::slot_type& cb) { mGroupSelectSignal.connect(cb); } void setPowersMask(U64 powers_mask); BOOL postBuild(); @@ -77,8 +81,7 @@ protected: protected: LLUUID mID; U64 mPowersMask; - void (*mSelectCallback)(LLUUID id, void* userdata); - void* mCallbackUserdata; + signal_t mGroupSelectSignal; typedef std::map instance_map_t; static instance_map_t sInstances; diff --git a/indra/newview/llfloaterhandler.cpp b/indra/newview/llfloaterhandler.cpp index f4c7e43a7d..f229d30488 100644 --- a/indra/newview/llfloaterhandler.cpp +++ b/indra/newview/llfloaterhandler.cpp @@ -70,7 +70,7 @@ bool LLFloaterHandler::handle(const LLSD ¶ms, const LLSD &query_map, LLWebBr { if (floater) { - floater->close(); + floater->closeFloater(); return true; } } diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 7886e394a3..38915ebff9 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -33,27 +33,28 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterhardwaresettings.h" + +// Viewer includes #include "llfloaterpreference.h" #include "llviewerwindow.h" #include "llviewercontrol.h" #include "llviewerimagelist.h" #include "llfeaturemanager.h" #include "llstartup.h" +#include "pipeline.h" +// Linden library includes #include "llradiogroup.h" #include "lluictrlfactory.h" - +#include "llwindow.h" #include "llimagegl.h" -#include "pipeline.h" LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; -LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater(std::string("Hardware Settings Floater")) +LLFloaterHardwareSettings::LLFloaterHardwareSettings() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); - - // load it up - initCallbacks(); } LLFloaterHardwareSettings::~LLFloaterHardwareSettings() @@ -114,7 +115,7 @@ LLFloaterHardwareSettings* LLFloaterHardwareSettings::instance() if (!sHardwareSettings) { sHardwareSettings = new LLFloaterHardwareSettings(); - sHardwareSettings->close(); + sHardwareSettings->closeFloater(); } return sHardwareSettings; } @@ -128,7 +129,7 @@ void LLFloaterHardwareSettings::show() //LLUICtrlFactory::getInstance()->buildFloater(hardSettings, "floater_hardware_settings.xml"); //hardSettings->initCallbacks(); - hardSettings->open(); + hardSettings->openFloater(); } bool LLFloaterHardwareSettings::isOpen() @@ -158,6 +159,8 @@ BOOL LLFloaterHardwareSettings::postBuild() refresh(); + // load it up + initCallbacks(); return TRUE; } @@ -203,7 +206,7 @@ void LLFloaterHardwareSettings::cancel() gSavedSettings.setF32("RenderFogRatio", mFogRatio); gSavedSettings.setBOOL("ProbeHardwareOnStartup", mProbeHardwareOnStartup ); - close(); + closeFloater(); } // static @@ -211,6 +214,6 @@ void LLFloaterHardwareSettings::onBtnOK( void* userdata ) { LLFloaterHardwareSettings *fp =(LLFloaterHardwareSettings *)userdata; fp->apply(); - fp->close(false); + fp->closeFloater(false); } diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h index 04a33f69dc..ec99638740 100644 --- a/indra/newview/llfloaterhardwaresettings.h +++ b/indra/newview/llfloaterhardwaresettings.h @@ -35,19 +35,17 @@ #include "llfloater.h" -class LLSliderCtrl; - /// Menuing system for all of windlight's functionality class LLFloaterHardwareSettings : public LLFloater { - friend class LLPreferenceCore; + friend class LLFloaterPreference; public: LLFloaterHardwareSettings(); - virtual ~LLFloaterHardwareSettings(); + /*virtual*/ ~LLFloaterHardwareSettings(); - virtual BOOL postBuild(); + /*virtual*/ BOOL postBuild(); /// initialize all the callbacks for the menu void initCallbacks(void); @@ -85,8 +83,6 @@ public: void refreshEnabledState(); protected: - LLSliderCtrl* mCtrlVideoCardMem; - BOOL mUseVBO; BOOL mUseAniso; U32 mFSAASamples; diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index 9810bf1009..4379d25a66 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -52,7 +52,7 @@ LLFloaterHUD* LLFloaterHUD::sInstance = 0; // Default constructor LLFloaterHUD::LLFloaterHUD() -: LLFloater(std::string("floater_hud")), +: LLFloater(), mWebBrowser(0) { // Create floater from its XML definition @@ -69,11 +69,6 @@ LLFloaterHUD::LLFloaterHUD() // Opaque background since we never get the focus setBackgroundOpaque(TRUE); - // Position floater based on saved location - LLRect saved_position_rect = gSavedSettings.getRect("FloaterHUDRect2"); - reshape(saved_position_rect.getWidth(), saved_position_rect.getHeight(), FALSE); - setRect(saved_position_rect); - mWebBrowser = getChild("floater_hud_browser" ); if (mWebBrowser) { @@ -91,9 +86,6 @@ LLFloaterHUD::LLFloaterHUD() std::string url = base_url + language + "/"; mWebBrowser->navigateTo(url); } - - // Remember the one instance - sInstance = this; } // Get the instance @@ -101,7 +93,7 @@ LLFloaterHUD* LLFloaterHUD::getInstance() { if (!sInstance) { - new LLFloaterHUD(); + sInstance = new LLFloaterHUD(); } return sInstance; } @@ -109,9 +101,6 @@ LLFloaterHUD* LLFloaterHUD::getInstance() // Destructor LLFloaterHUD::~LLFloaterHUD() { - // Save floater position - gSavedSettings.setRect("FloaterHUDRect2", getRect() ); - // Clear out the one instance if it's ours if (sInstance == this) { @@ -131,7 +120,7 @@ void LLFloaterHUD::showHUD() // Create the instance if necessary LLFloaterHUD* hud = getInstance(); - hud->open(); + hud->openFloater(); hud->setFrontmost(FALSE); } diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index d39824ee05..faa4f0ec99 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -214,13 +214,16 @@ void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdata) //----------------------------------------------------------------------------- void LLFloaterImagePreview::clearAllPreviewTextures() { - mAvatarPreview->clearPreviewTexture("mHairMesh0"); - mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0"); - mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0"); - mAvatarPreview->clearPreviewTexture("mHeadMesh0"); - mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0"); - mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0"); - mAvatarPreview->clearPreviewTexture("mSkirtMesh0"); + if (mAvatarPreview) + { + mAvatarPreview->clearPreviewTexture("mHairMesh0"); + mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0"); + mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0"); + mAvatarPreview->clearPreviewTexture("mHeadMesh0"); + mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0"); + mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0"); + mAvatarPreview->clearPreviewTexture("mSkirtMesh0"); + } } //----------------------------------------------------------------------------- @@ -614,6 +617,7 @@ LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLDynamicTex mCameraZoom = 1.f; mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); + mDummyAvatar->initInstance(); mDummyAvatar->createDrawable(&gPipeline); mDummyAvatar->mIsDummy = TRUE; mDummyAvatar->mSpecialRenderMode = 2; @@ -671,11 +675,14 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const //----------------------------------------------------------------------------- void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name) { - LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name); - // clear out existing test mesh - if (mesh) + if (mDummyAvatar) { - mesh->setTestTexture(0); + LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name); + // clear out existing test mesh + if (mesh) + { + mesh->setTestTexture(0); + } } } @@ -796,27 +803,11 @@ LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLDynami F32 const HIGHEST_LOD = 4.0f; mVolume = new LLVolume(volume_params, HIGHEST_LOD); - - /* - mDummyAvatar = new LLVOAvatar(LLUUID::null, LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); - mDummyAvatar->createDrawable(&gPipeline); - mDummyAvatar->mIsDummy = TRUE; - mDummyAvatar->mSpecialRenderMode = 2; - mDummyAvatar->setPositionAgent(LLVector3::zero); - mDummyAvatar->slamPosition(); - mDummyAvatar->updateJointLODs(); - mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); - gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); - mTextureName = 0; - */ } LLImagePreviewSculpted::~LLImagePreviewSculpted() { - /* - mDummyAvatar->markDead(); - */ } diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index de8a094fa9..4b29a304ac 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -31,11 +31,15 @@ */ #include "llviewerprecompiledheaders.h" -#include "llfloateravatarinfo.h" + #include "llfloaterinspect.h" + +#include "llfloaterreg.h" #include "llfloatertools.h" +#include "llfriendactions.h" #include "llcachename.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" #include "llselectmgr.h" #include "lltoolcomp.h" #include "lltoolmgr.h" @@ -45,17 +49,16 @@ LLFloaterInspect* LLFloaterInspect::sInstance = NULL; -LLFloaterInspect::LLFloaterInspect(void) : - LLFloater(std::string("Inspect Object")), +LLFloaterInspect::LLFloaterInspect(void) + : LLFloater(), mDirty(FALSE) { - sInstance = this; LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inspect.xml"); } LLFloaterInspect::~LLFloaterInspect(void) { - if(!gFloaterTools->getVisible()) + if(!LLFloaterReg::instanceVisible("build")) { if(LLToolMgr::getInstance()->getBaseTool() == LLToolCompInspect::getInstance()) { @@ -66,7 +69,7 @@ LLFloaterInspect::~LLFloaterInspect(void) } else { - gFloaterTools->setFocus(TRUE); + LLFloaterReg::showInstance("build", LLSD(), TRUE); } sInstance = NULL; } @@ -88,7 +91,7 @@ void LLFloaterInspect::show(void* ignored) sInstance = new LLFloaterInspect; } - sInstance->open(); + sInstance->openFloater(); LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value @@ -119,7 +122,7 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl) LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func); if(node) { - LLFloaterAvatarInfo::showFromDirectory(node->mPermissions->getCreator()); + LLFriendActions::showProfile(node->mPermissions->getCreator()); } } } @@ -146,7 +149,7 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl) if(node) { const LLUUID& owner_id = node->mPermissions->getOwner(); - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLFriendActions::showProfile(owner_id); } } } @@ -156,7 +159,7 @@ BOOL LLFloaterInspect::postBuild() mObjectList = getChild("object_list"); childSetAction("button owner",onClickOwnerProfile, this); childSetAction("button creator",onClickCreatorProfile, this); - childSetCommitCallback("object_list", onSelectObject); + childSetCommitCallback("object_list", onSelectObject, NULL); return TRUE; } @@ -212,7 +215,6 @@ void LLFloaterInspect::refresh() { LLSelectNode* obj = *iter; LLSD row; - char time[MAX_STRING]; std::string owner_name, creator_name; if (obj->mCreationDate == 0) @@ -221,8 +223,11 @@ void LLFloaterInspect::refresh() } time_t timestamp = (time_t) (obj->mCreationDate/1000000); - LLStringUtil::copy(time, ctime(×tamp), MAX_STRING); - time[24] = '\0'; + std::string timeStr = getString("timeStamp"); + LLSD substitution; + substitution["datetime"] = (S32) timestamp; + LLStringUtil::format (timeStr, substitution); + gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name); gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name); row["id"] = obj->getObject()->getID(); @@ -246,7 +251,7 @@ void LLFloaterInspect::refresh() row["columns"][2]["value"] = creator_name; row["columns"][3]["column"] = "creation_date"; row["columns"][3]["type"] = "text"; - row["columns"][3]["value"] = time; + row["columns"][3]["value"] = timeStr; mObjectList->addElement(row, ADD_TOP); } if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index e5811671ed..c73218cd0f 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -48,10 +48,10 @@ #include "llcheckboxctrl.h" LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) - : LLFloater("floater_joystick") + : LLFloater() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_joystick.xml"); - center(); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_joystick.xml"); + } void LLFloaterJoystick::draw() @@ -68,14 +68,15 @@ void LLFloaterJoystick::draw() { F32 value = joystick->getJoystickAxis(i); mAxisStats[i]->addValue(value * gFrameIntervalSeconds); - - if (mAxisStatsBar[i]->mMinBar > value) - { - mAxisStatsBar[i]->mMinBar = value; - } - if (mAxisStatsBar[i]->mMaxBar < value) + if (mAxisStatsBar[i]) { - mAxisStatsBar[i]->mMaxBar = value; + F32 minbar, maxbar; + mAxisStatsBar[i]->getRange(minbar, maxbar); + if (llabs(value) > maxbar) + { + F32 range = llabs(value); + mAxisStatsBar[i]->setRange(-range, range, range * 0.25f, range * 0.5f); + } } } @@ -84,37 +85,20 @@ void LLFloaterJoystick::draw() BOOL LLFloaterJoystick::postBuild() { - F32 range = gSavedSettings.getBOOL("Cursor3D") ? 1024.f : 2.f; - LLUIString axis = getString("Axis"); - LLUIString joystick = getString("JoystickMonitor"); - - // use this child to get relative positioning info; we'll place the - // joystick monitor on its right, vertically aligned to it. - LLView* child = getChild("FlycamAxisScale1"); - LLRect rect; - - if (child) - { - LLRect r = child->getRect(); - LLRect f = getRect(); - rect = LLRect(350, r.mTop, r.mRight + 200, 0); - } - - mAxisStatsView = new LLStatView("axis values", joystick, "", rect); - mAxisStatsView->setDisplayChildren(TRUE); + center(); + F32 range = gSavedSettings.getBOOL("Cursor3D") ? 128.f : 2.f; for (U32 i = 0; i < 6; i++) { - axis.setArg("[NUM]", llformat("%d", i)); mAxisStats[i] = new LLStat(4); - mAxisStatsBar[i] = mAxisStatsView->addStat(axis, mAxisStats[i]); - mAxisStatsBar[i]->mMinBar = -range; - mAxisStatsBar[i]->mMaxBar = range; - mAxisStatsBar[i]->mLabelSpacing = range * 0.5f; - mAxisStatsBar[i]->mTickSpacing = range * 0.25f; + std::string axisname = llformat("axis%d", i); + mAxisStatsBar[i] = getChild(axisname); + if (mAxisStatsBar[i]) + { + mAxisStatsBar[i]->setStat(mAxisStats[i]); + mAxisStatsBar[i]->setRange(-range, range, range * 0.25f, range * 0.5f); + } } - - addChild(mAxisStatsView); mCheckJoystickEnabled = getChild("enable_joystick"); childSetCommitCallback("enable_joystick",onCommitJoystickEnabled,this); @@ -310,7 +294,7 @@ void LLFloaterJoystick::onClickCancel(void *joy_panel) if (self) { self->cancel(); - self->close(); + self->closeFloater(); } } } @@ -323,7 +307,7 @@ void LLFloaterJoystick::onClickOK(void *joy_panel) if (self) { - self->close(); + self->closeFloater(); } } } diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index 3ce647e5bb..9c66b3a895 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -84,9 +84,8 @@ private: LLCheckBoxCtrl *mCheckFlycamEnabled; // stats view - LLStatView* mAxisStatsView; - LLStat* mAxisStats[6]; - LLStatBar* mAxisStatsBar[6]; + LLStat* mAxisStats[6]; + LLStatBar* mAxisStatsBar[6]; }; #endif diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 91471ca2d0..a97b270c44 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -51,7 +51,7 @@ const std::string LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) - : LLFloater(std::string("floater_lagmeter")) + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml"); @@ -59,6 +59,15 @@ LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) // lose arrow-key driving when testing lag. setIsChrome(TRUE); + // were we shrunk last time? + if (gSavedSettings.getBOOL("LagMeterShrunk")) + { + onClickShrink(this); + } +} + +BOOL LLFloaterLagMeter::postBuild() +{ mClientButton = getChild("client_lagmeter"); mClientText = getChild("client_text"); mClientCause = getChild("client_lag_cause"); @@ -113,13 +122,8 @@ LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) childSetAction("minimize", onClickShrink, this); - // were we shrunk last time? - if (gSavedSettings.getBOOL("LagMeterShrunk")) - { - onClickShrink(this); - } + return TRUE; } - LLFloaterLagMeter::~LLFloaterLagMeter() { // save shrunk status for next time @@ -180,7 +184,7 @@ void LLFloaterLagMeter::determineClient() { mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); } - else if((LLViewerImage::sBoundTextureMemory >> 20) > LLViewerImage::sMaxBoundTextureMem) + else if((BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes)) > LLViewerImage::sMaxBoundTextureMemInMegaBytes) { mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); } diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h index d9cea18305..e8af68ac7a 100644 --- a/indra/newview/llfloaterlagmeter.h +++ b/indra/newview/llfloaterlagmeter.h @@ -35,13 +35,15 @@ #include "llfloater.h" +class LLTextBox; + class LLFloaterLagMeter : public LLFloater, public LLFloaterSingleton { friend class LLUISingleton >; public: /*virtual*/ void draw(); - + /*virtual*/ BOOL postBuild(); private: LLFloaterLagMeter(const LLSD& key); /*virtual*/ ~LLFloaterLagMeter(); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 94a834502f..6f5bd5f27b 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -50,15 +50,17 @@ #include "llradiogroup.h" #include "llcombobox.h" #include "llfloaterauction.h" -#include "llfloateravatarinfo.h" #include "llfloatergroups.h" #include "llfloatergroupinfo.h" +#include "llfriendactions.h" #include "lllineeditor.h" #include "llnamelistctrl.h" #include "llnotify.h" #include "llpanellandmedia.h" #include "llradiogroup.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "llselectmgr.h" #include "llspinctrl.h" #include "lltabcontainer.h" @@ -75,6 +77,7 @@ #include "llviewerwindow.h" #include "llviewercontrol.h" #include "roles_constants.h" +#include "lltrans.h" static std::string OWNER_ONLINE = "0"; static std::string OWNER_OFFLINE = "1"; @@ -161,7 +164,7 @@ void LLFloaterLand::refreshAll() LLFloaterLand::getInstance()->refresh(); } -void LLFloaterLand::onOpen() +void LLFloaterLand::onOpen(const LLSD& key) { // Done automatically when the selected parcel's properties arrive // (and hence we have the local id). @@ -193,19 +196,16 @@ void LLFloaterLand::onClose(bool app_quitting) LLFloaterLand::LLFloaterLand(const LLSD& seed) -: LLFloater(std::string("floaterland"), std::string("FloaterLandRect5"), std::string("About Land")) +: LLFloater() { - LLCallbackMap::map_t factory_map; - factory_map["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); + mFactoryMap["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); + mFactoryMap["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); + mFactoryMap["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this); + mFactoryMap["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); + mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); + mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - - factory_map["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); - factory_map["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this); - factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); - factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); - factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about_land.xml", &factory_map, false); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about_land.xml", false); sObserver = new LLParcelSelectionObserver(); LLViewerParcelMgr::getInstance()->addObserver( sObserver ); @@ -297,7 +297,7 @@ void* LLFloaterLand::createPanelLandAccess(void* data) LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_general_panel")), +: LLPanel(), mUncheckedSell(FALSE), mParcel(parcel) { @@ -306,15 +306,13 @@ LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel) BOOL LLPanelLandGeneral::postBuild() { mEditName = getChild("Name"); - mEditName->setCommitCallback(onCommitAny); + mEditName->setCommitCallback(onCommitAny, this); childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe); - childSetUserData("Name", this); mEditDesc = getChild("Description"); mEditDesc->setCommitOnFocusLost(TRUE); - mEditDesc->setCommitCallback(onCommitAny); + mEditDesc->setCommitCallback(onCommitAny, this); childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe); - childSetUserData("Description", this); mTextSalePending = getChild("SalePending"); @@ -333,7 +331,7 @@ BOOL LLPanelLandGeneral::postBuild() mBtnSetGroup = getChild("Set..."); - mBtnSetGroup->setClickedCallback(onClickSetGroup, this); + mBtnSetGroup->setCommitCallback(boost::bind(&LLPanelLandGeneral::onClickSetGroup, this)); mCheckDeedToGroup = getChild( "check deed"); @@ -396,7 +394,7 @@ BOOL LLPanelLandGeneral::postBuild() mBtnReclaimLand->setClickedCallback(onClickReclaim, NULL); mBtnStartAuction = getChild("Linden Sale..."); - mBtnStartAuction->setClickedCallback(onClickStartAuction, NULL); + mBtnStartAuction->setClickedCallback(onClickStartAuction, this); return TRUE; } @@ -754,16 +752,14 @@ void LLPanelLandGeneral::draw() LLPanel::draw(); } -// static -void LLPanelLandGeneral::onClickSetGroup(void* userdata) +void LLPanelLandGeneral::onClickSetGroup() { - LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)userdata; LLFloaterGroupPicker* fg; - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - fg->setSelectCallback( cbGroupID, userdata ); + fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 )); if (parent_floater) { @@ -788,17 +784,10 @@ void LLPanelLandGeneral::onClickProfile(void* data) else { const LLUUID& avatar_id = parcel->getOwnerID(); - LLFloaterAvatarInfo::showFromObject(avatar_id); + LLFriendActions::showProfile(avatar_id); } } -// static -void LLPanelLandGeneral::cbGroupID(LLUUID group_id, void* userdata) -{ - LLPanelLandGeneral* self = (LLPanelLandGeneral*)userdata; - self->setGroup(group_id); -} - // public void LLPanelLandGeneral::setGroup(const LLUUID& group_id) { @@ -900,7 +889,7 @@ void LLPanelLandGeneral::onClickStartAuction(void* data) } else { - LLFloaterAuction::show(); + LLFloaterAuction::showInstance(); } } } @@ -974,7 +963,8 @@ void LLPanelLandGeneral::onClickStopSellLand(void* data) // LLPanelLandObjects //--------------------------------------------------------------------------- LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_objects_panel")), mParcel(parcel) + : LLPanel(), + mParcel(parcel) { } @@ -1014,10 +1004,8 @@ BOOL LLPanelLandObjects::postBuild() mCleanOtherObjectsTime = getChild("clean other time"); mCleanOtherObjectsTime->setFocusLostCallback(onLostFocus, this); - mCleanOtherObjectsTime->setCommitCallback(onCommitClean); - + mCleanOtherObjectsTime->setCommitCallback(onCommitClean, this); childSetPrevalidate("clean other time", LLLineEditor::prevalidateNonNegativeS32); - childSetUserData("clean other time", this); mBtnRefresh = getChild("Refresh List"); mBtnRefresh->setClickedCallback(onClickRefresh, this); @@ -1032,7 +1020,7 @@ BOOL LLPanelLandObjects::postBuild() mOwnerList = getChild("owner list"); mOwnerList->sortByColumnIndex(3, FALSE); childSetCommitCallback("owner list", onCommitList, this); - mOwnerList->setDoubleClickCallback(onDoubleClickOwner); + mOwnerList->setDoubleClickCallback(onDoubleClickOwner, this); return TRUE; } @@ -1068,7 +1056,7 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata) } else { - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLFriendActions::showProfile(owner_id); } } } @@ -1406,7 +1394,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata) // ready the list for results self->mOwnerList->deleteAllItems(); - self->mOwnerList->addCommentText(std::string("Searching...")); // *TODO: Translate + self->mOwnerList->setCommentText(LLTrans::getString("Searching")); self->mOwnerList->setEnabled(FALSE); self->mFirstReply = TRUE; @@ -1468,39 +1456,34 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo continue; } - LLScrollListItem *row = new LLScrollListItem( TRUE, NULL, owner_id); + LLNameListCtrl::NameItem item_params; + item_params.value = owner_id; + item_params.target = is_group_owned ? LLNameListCtrl::GROUP : LLNameListCtrl::INDIVIDUAL; + if (is_group_owned) { - row->addColumn(self->mIconGroup); - row->addColumn(OWNER_GROUP, FONT); + item_params.cells.add().type("icon").value(self->mIconGroup->getName()).column("type"); + item_params.cells.add().value(OWNER_GROUP).font(FONT).column("online_status"); } else if (is_online) { - row->addColumn(self->mIconAvatarOnline); - row->addColumn(OWNER_ONLINE, FONT); + item_params.cells.add().type("icon").value(self->mIconAvatarOnline->getName()).column("type"); + item_params.cells.add().value(OWNER_ONLINE).font(FONT).column("online_status"); } else // offline { - row->addColumn(self->mIconAvatarOffline); - row->addColumn(OWNER_OFFLINE, FONT); + item_params.cells.add().type("icon").value(self->mIconAvatarOffline->getName()).column("type"); + item_params.cells.add().value(OWNER_OFFLINE).font(FONT).column("online_status"); } + // Placeholder for name. - row->addColumn(LLStringUtil::null, FONT); + item_params.cells.add().font(FONT).column("name"); object_count_str = llformat("%d", object_count); - row->addColumn(object_count_str, FONT); - - row->addColumn(formatted_time((time_t)most_recent_time), FONT); + item_params.cells.add().value(object_count_str).font(FONT).column("count"); + item_params.cells.add().value(formatted_time((time_t)most_recent_time)).font(FONT).column("mostrecent"); - - if (is_group_owned) - { - self->mOwnerList->addGroupNameItem(row, ADD_BOTTOM); - } - else - { - self->mOwnerList->addNameItem(row, ADD_BOTTOM); - } + self->mOwnerList->addRow(item_params); lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") << ") owns " << object_count << " objects." << llendl; @@ -1508,7 +1491,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo // check for no results if (0 == self->mOwnerList->getItemCount()) { - self->mOwnerList->addCommentText(std::string("None found.")); // *TODO: Translate + self->mOwnerList->setCommentText(LLTrans::getString("NoneFound")); } else { @@ -1699,7 +1682,7 @@ void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data) //--------------------------------------------------------------------------- LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_options_panel")), +: LLPanel(), mCheckEditObjects(NULL), mCheckEditGroupObjects(NULL), mCheckAllObjectEntry(NULL), @@ -1808,8 +1791,7 @@ BOOL LLPanelLandOptions::postBuild() mSnapshotCtrl = getChild("snapshot_ctrl"); if (mSnapshotCtrl) { - mSnapshotCtrl->setCommitCallback( onCommitAny ); - mSnapshotCtrl->setCallbackUserData( this ); + mSnapshotCtrl->setCommitCallback( onCommitAny, this ); mSnapshotCtrl->setAllowNoTexture ( TRUE ); mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); @@ -2262,7 +2244,8 @@ void LLPanelLandOptions::onClickPublishHelp(void*) //--------------------------------------------------------------------------- LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_access_panel")), mParcel(parcel) + : LLPanel(), + mParcel(parcel) { } @@ -2301,6 +2284,8 @@ LLPanelLandAccess::~LLPanelLandAccess() void LLPanelLandAccess::refresh() { + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + if (mListAccess) mListAccess->deleteAllItems(); if (mListBanned) @@ -2328,7 +2313,6 @@ void LLPanelLandAccess::refresh() childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count)); childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - // *TODO: Translate for (access_map_const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) { @@ -2336,25 +2320,28 @@ void LLPanelLandAccess::refresh() std::string suffix; if (entry.mTime != 0) { + LLStringUtil::format_map_t args; S32 now = time(NULL); S32 seconds = entry.mTime - now; if (seconds < 0) seconds = 0; suffix.assign(" ("); if (seconds >= 120) { - std::string buf = llformat("%d minutes", (seconds/60)); + args["[MINUTES]"] = llformat("%d", (seconds/60)); + std::string buf = parent_floater->getString ("Minutes", args); suffix.append(buf); } else if (seconds >= 60) { - suffix.append("1 minute"); + suffix.append("1 " + parent_floater->getString("Minute")); } else { - std::string buf = llformat("%d seconds", seconds); + args["[SECONDS]"] = llformat("%d", seconds); + std::string buf = parent_floater->getString ("Seconds", args); suffix.append(buf); } - suffix.append(" remaining)"); + suffix.append(" " + parent_floater->getString("Remaining") + ")"); } if (mListAccess) mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); @@ -2375,25 +2362,28 @@ void LLPanelLandAccess::refresh() std::string suffix; if (entry.mTime != 0) { + LLStringUtil::format_map_t args; S32 now = time(NULL); S32 seconds = entry.mTime - now; if (seconds < 0) seconds = 0; suffix.assign(" ("); if (seconds >= 120) { - std::string buf = llformat("%d minutes", (seconds/60)); + args["[MINUTES]"] = llformat("%d", (seconds/60)); + std::string buf = parent_floater->getString ("Minutes", args); suffix.append(buf); } else if (seconds >= 60) { - suffix.append("1 minute"); + suffix.append("1 " + parent_floater->getString("Minute")); } else { - std::string buf = llformat("%d seconds", seconds); + args["[SECONDS]"] = llformat("%d", seconds); + std::string buf = parent_floater->getString ("Seconds", args); suffix.append(buf); } - suffix.append(" remaining)"); + suffix.append(" " + parent_floater->getString("Remaining") + ")"); } mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); } @@ -2758,7 +2748,8 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) // LLPanelLandCovenant //--------------------------------------------------------------------------- LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_covenant_panel")), mParcel(parcel) + : LLPanel(), + mParcel(parcel) { } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 4c3de65d71..74c1205e1f 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -38,8 +38,8 @@ #include #include "llfloater.h" -//#include "llviewerimagelist.h" -#include "llmemory.h" // LLPointer<> +#include "llpointer.h" // LLPointer<> +#include "llsafehandle.h" typedef std::set uuid_list_t; const F32 CACHE_REFRESH_TIME = 2.5f; @@ -82,7 +82,7 @@ public: // Destroys itself on close. virtual void onClose(bool app_quitting); - virtual void onOpen(); + virtual void onOpen(const LLSD& key); virtual BOOL postBuild(); protected: @@ -138,8 +138,7 @@ public: void setGroup(const LLUUID& group_id); static void onClickProfile(void*); - static void onClickSetGroup(void*); - static void cbGroupID(LLUUID group_id, void* userdata); + void onClickSetGroup(); static BOOL enableDeedToGroup(void*); static void onClickDeed(void*); static void onClickBuyLand(void* data); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index bd1186b151..223cca50b2 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -41,13 +41,16 @@ #include "message.h" #include "llagent.h" -#include "llbutton.h" +#include "llfloaterreg.h" #include "llfloatergroupinfo.h" #include "llfloaterworldmap.h" #include "llproductinforequest.h" #include "llscrolllistctrl.h" #include "llstatusbar.h" #include "lltextbox.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lltrans.h" #include "lluiconstants.h" #include "llviewermessage.h" @@ -78,13 +81,13 @@ void LLFloaterLandHoldings::show(void*) ""); // TODO: request updated L$ balance? - floater->open(); /* Flawfinder: ignore */ + floater->openFloater(); } // protected LLFloaterLandHoldings::LLFloaterLandHoldings() -: LLFloater(std::string("land holdings floater")), +: LLFloater(), mActualArea(0), mBillableArea(0), mFirstPacketReceived(FALSE), @@ -101,8 +104,7 @@ BOOL LLFloaterLandHoldings::postBuild() childSetAction("Show on Map", onClickMap, this); // Grant list - childSetDoubleClickCallback("grant list", onGrantList); - childSetUserData("grant list", this); + getChild("grant list")->setDoubleClickCallback(onGrantList, this); LLCtrlListInterface *list = childGetListInterface("grant list"); if (!list) return TRUE; @@ -295,11 +297,11 @@ void LLFloaterLandHoldings::buttonCore(S32 which) { case 0: gAgent.teleportViaLocation(pos_global); - gFloaterWorldMap->trackLocation(pos_global); + LLFloaterWorldMap::getInstance()->trackLocation(pos_global); break; case 1: - gFloaterWorldMap->trackLocation(pos_global); - LLFloaterWorldMap::show(NULL, TRUE); + LLFloaterWorldMap::getInstance()->trackLocation(pos_global); + LLFloaterReg::showInstance("world_map", "center"); break; default: break; @@ -311,7 +313,7 @@ void LLFloaterLandHoldings::onClickTeleport(void* data) { LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data; self->buttonCore(0); - self->close(); + self->closeFloater(); } diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 3b1e4c7ac7..6660650c56 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -30,96 +30,188 @@ * $/LicenseInfo$ */ +#include #include "llviewerprecompiledheaders.h" +// self include #include "llfloatermap.h" +// Library includes +#include "llfloaterreg.h" +#include "llfontgl.h" +#include "llglheaders.h" + +// Viewer includes #include "llagent.h" -#include "llcolorscheme.h" #include "llviewercontrol.h" -#include "lldraghandle.h" #include "llnetmap.h" -#include "llregionhandle.h" -#include "llresizebar.h" -#include "lluictrlfactory.h" - -LLFloaterMap::LLFloaterMap(const LLSD& key) - : - LLFloater(std::string("minimap")), - mPanelMap(NULL) +#include "lltracker.h" +#include "llviewercamera.h" +#include "lldraghandle.h" +#include "lltextbox.h" +#include "llviewermenu.h" + +// +// Constants +// +const F32 MAP_SCALE_MIN = 64; +const F32 MAP_SCALE_MID = 172; +const F32 MAP_SCALE_MAX = 512; + +// +// Member functions +// + +LLFloaterMap::LLFloaterMap(const LLSD& key) + : LLFloater(key) { - LLCallbackMap::map_t factory_map; - factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_map.xml", FALSE); } - -// static -void* LLFloaterMap::createPanelMiniMap(void* data) +LLFloaterMap::~LLFloaterMap() { - LLFloaterMap* self = (LLFloaterMap*)data; - self->mPanelMap = new LLNetMap("Mapview"); - return self->mPanelMap; } BOOL LLFloaterMap::postBuild() { - // Send the drag handle to the back, but make sure close stays on top + mMap = getChild("Net Map"); + mMap->setScale(gSavedSettings.getF32("MiniMapScale")); + mMap->setRotateMap(gSavedSettings.getBOOL( "MiniMapRotate" )); + mMap->setToolTipMsg(getString("ToolTipMsg")); + sendChildToBack(mMap); + + mTextBoxNorth = getChild ("floater_map_north"); + mTextBoxEast = getChild ("floater_map_east"); + mTextBoxWest = getChild ("floater_map_west"); + mTextBoxSouth = getChild ("floater_map_south"); + mTextBoxSouthEast = getChild ("floater_map_southeast"); + mTextBoxNorthEast = getChild ("floater_map_northeast"); + mTextBoxSouthWest = getChild ("floater_map_southwest"); + mTextBoxNorthWest = getChild ("floater_map_northwest"); + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + + registrar.add("Minimap.Zoom", boost::bind(&LLFloaterMap::handleZoom, this, _2)); + registrar.add("Minimap.Tracker", boost::bind(&LLFloaterMap::handleStopTracking, this, _2)); + + mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_minimap.xml", gMenuHolder); + if (mPopupMenu && !LLTracker::isTracking(0)) + { + mPopupMenu->setItemEnabled ("Stop Tracking", false); + } + + // Get the drag handle all the way in back sendChildToBack(getDragHandle()); - sendChildToFront(getChild("llfloater_close_btn")); + setIsChrome(TRUE); + + // keep onscreen + gFloaterView->adjustToFitScreen(this, FALSE); + return TRUE; } - -LLFloaterMap::~LLFloaterMap() +BOOL LLFloaterMap::handleDoubleClick( S32 x, S32 y, MASK mask ) { + LLFloaterReg::showInstance("world_map"); + return TRUE; } +BOOL LLFloaterMap::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + if (mPopupMenu) + { + mPopupMenu->buildDrawLabels(); + mPopupMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mPopupMenu, x, y); + } + return TRUE; +} -// virtual -void LLFloaterMap::onOpen() +void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) { - gFloaterView->adjustToFitScreen(this, FALSE); + // Rotation is in radians. + // Rotation of 0 means x = 1, y = 0 on the unit circle. - gSavedSettings.setBOOL("ShowMiniMap", TRUE); -} + F32 map_half_height = (F32)(getRect().getHeight() / 2); + F32 map_half_width = (F32)(getRect().getWidth() / 2); + F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2); + F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2); + F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width ); + // Inset by a little to account for position display. + radius -= 8.f; + + text_box->setOrigin( + llround(map_half_width - text_half_width + radius * cos( rotation )), + llround(map_half_height - text_half_height + radius * sin( rotation )) ); +} // virtual -void LLFloaterMap::onClose(bool app_quitting) +void LLFloaterMap::draw() { - LLFloater::setVisible(FALSE); + F32 rotation = 0; - if (!app_quitting) + if( mMap->getRotateMap() ) { - gSavedSettings.setBOOL("ShowMiniMap", FALSE); + // rotate subsequent draws to agent rotation + rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); } -} -BOOL LLFloaterMap::canClose() -{ - return !LLApp::isExiting(); -} + setDirectionPos( mTextBoxEast, rotation ); + setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO ); + setDirectionPos( mTextBoxWest, rotation + F_PI ); + setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO ); + setDirectionPos( mTextBoxNorthEast, rotation + F_PI_BY_TWO / 2); + setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2); + setDirectionPos( mTextBoxSouthWest, rotation + F_PI + F_PI_BY_TWO / 2); + setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); -// virtual -void LLFloaterMap::draw() -{ // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. if( gAgent.cameraMouselook()) { setMouseOpaque(FALSE); getDragHandle()->setMouseOpaque(FALSE); - - drawChild(mPanelMap); } else { setMouseOpaque(TRUE); getDragHandle()->setMouseOpaque(TRUE); + } + + if (LLTracker::isTracking(0)) + { + mPopupMenu->setItemEnabled ("Stop Tracking", true); + } + + LLFloater::draw(); +} + +void LLFloaterMap::handleZoom(const LLSD& userdata) +{ + std::string level = userdata.asString(); + + F32 scale = 0.0f; + if (level == std::string("close")) + scale = MAP_SCALE_MAX; + else if (level == std::string("medium")) + scale = MAP_SCALE_MID; + else if (level == std::string("far")) + scale = MAP_SCALE_MIN; + if (scale != 0.0f) + { + gSavedSettings.setF32("MiniMapScale", scale ); + mMap->setScale(scale); + } +} - LLFloater::draw(); +void LLFloaterMap::handleStopTracking (const LLSD& userdata) +{ + if (mPopupMenu) + { + mPopupMenu->setItemEnabled ("Stop Tracking", false); + LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL)); } } diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index ec2db27f7a..501777ed07 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -35,28 +35,42 @@ #include "llfloater.h" +class LLMenuGL; class LLNetMap; +class LLTextBox; -class LLFloaterMap : - public LLFloater, - public LLFloaterSingleton +// +// Classes +// +class LLFloaterMap : public LLFloater { - friend class LLUISingleton >; public: + LLFloaterMap(const LLSD& key); virtual ~LLFloaterMap(); - - static void* createPanelMiniMap(void* data); - - BOOL postBuild(); - + + /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ void draw(); - /*virtual*/ void onOpen(); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ BOOL canClose(); - + private: - LLFloaterMap(const LLSD& key = LLSD()); - LLNetMap* mPanelMap; + void handleZoom(const LLSD& userdata); + void handleStopTracking (const LLSD& userdata); + void setDirectionPos( LLTextBox* text_box, F32 rotation ); + + LLMenuGL* mPopupMenu; + + LLTextBox* mTextBoxEast; + LLTextBox* mTextBoxNorth; + LLTextBox* mTextBoxWest; + LLTextBox* mTextBoxSouth; + + LLTextBox* mTextBoxSouthEast; + LLTextBox* mTextBoxNorthEast; + LLTextBox* mTextBoxNorthWest; + LLTextBox* mTextBoxSouthWest; + + LLNetMap* mMap; }; #endif // LL_LLFLOATERMAP_H diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp index df51918e35..3f2fcc26db 100644 --- a/indra/newview/llfloatermemleak.cpp +++ b/indra/newview/llfloatermemleak.cpp @@ -49,8 +49,10 @@ U32 LLFloaterMemLeak::sTotalLeaked = 0 ; S32 LLFloaterMemLeak::sStatus = LLFloaterMemLeak::STOP ; BOOL LLFloaterMemLeak::sbAllocationFailed = FALSE ; -LLFloaterMemLeak::LLFloaterMemLeak() : LLFloater("Memory Leaking Simulation Floater") +LLFloaterMemLeak::LLFloaterMemLeak() + : LLFloater() { + setTitle("Memory Leaking Simulation Floater"); } LLFloaterMemLeak::~LLFloaterMemLeak() @@ -224,7 +226,7 @@ LLFloaterMemLeak* LLFloaterMemLeak::instance() if (!sInstance) { sInstance = new LLFloaterMemLeak(); - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_mem_leaking.xml", NULL, FALSE); + LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_mem_leaking.xml", FALSE); if(sInstance) { @@ -256,7 +258,7 @@ LLFloaterMemLeak* LLFloaterMemLeak::instance() void LLFloaterMemLeak::show(void*) { - instance()->open(); + instance()->openFloater(); } LLFloaterMemLeak* LLFloaterMemLeak::getInstance() diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index acfcfab445..6ef72d4c1a 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -41,6 +41,7 @@ #include "llbutton.h" #include "llviewerwindow.h" #include "llfocusmgr.h" +#include "llrootview.h" #include "llradiogroup.h" #include "lldbstrings.h" #include "lldir.h" @@ -69,8 +70,9 @@ const S32 PREF_BUTTON_HEIGHT = 16; // LLFloaterNameDesc() //----------------------------------------------------------------------------- LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) - : LLFloater(std::string("Name/Description Floater")) + : LLFloater() { + setTitle("Name/Description Floater"); mFilenameAndPath = filename; mFilename = gDirUtilp->getBaseFileName(filename, false); // SL-5521 Maintain capitalization of filename when making the inventory item. JC @@ -190,7 +192,7 @@ void LLFloaterNameDesc::onBtnOK( void* userdata ) 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), display_name, callback, expected_upload_cost, nruserdata); - fp->close(false); + fp->closeFloater(false); } // static @@ -200,5 +202,5 @@ void LLFloaterNameDesc::onBtnOK( void* userdata ) void LLFloaterNameDesc::onBtnCancel( void* userdata ) { LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; - fp->close(false); + fp->closeFloater(false); } diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index e6250063f7..11842b8b0e 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -36,6 +36,7 @@ #include "lluictrlfactory.h" #include "llbutton.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" #include "llpanel.h" #include "llcombobox.h" #include "llviewertexteditor.h" @@ -59,11 +60,12 @@ private: }; LLNotificationChannelPanel::LLNotificationChannelPanel(const std::string& channel_name) - : LLPanel(channel_name) + : LLPanel() { mChannelPtr = LLNotifications::instance().getChannel(channel_name); mChannelRejectsPtr = LLNotificationChannelPtr( - LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(), !boost::bind(mChannelPtr->getFilter(), _1))); + LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(), + !boost::bind(mChannelPtr->getFilter(), _1))); LLUICtrlFactory::instance().buildPanel(this, "panel_notifications_channel.xml"); } @@ -77,13 +79,11 @@ BOOL LLNotificationChannelPanel::postBuild() mChannelRejectsPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1, false)); LLScrollListCtrl* scroll = getChild("notifications_list"); - scroll->setDoubleClickCallback(onClickNotification); - scroll->setCallbackUserData(this); - + scroll->setDoubleClickCallback(onClickNotification, this); + scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); scroll = getChild("notification_rejects_list"); - scroll->setDoubleClickCallback(onClickNotificationReject); - scroll->setCallbackUserData(this); - + scroll->setDoubleClickCallback(onClickNotificationReject, this); + scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); return TRUE; } @@ -161,6 +161,7 @@ bool LLNotificationChannelPanel::update(const LLSD& payload, bool passed_filter) // LLFloaterNotificationConsole // LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key) +: LLFloater() { LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml"); } @@ -229,8 +230,10 @@ void LLFloaterNotificationConsole::removeChannel(const std::string& name) //static void LLFloaterNotificationConsole::updateResizeLimits() { + static LLUICachedControl floater_header_size ("UIFloaterHeaderSize", 0); + LLLayoutStack& stack = getChildRef("notification_channels"); - setResizeLimits(getMinWidth(), LLFLOATER_HEADER_SIZE + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); + setResizeLimits(getMinWidth(), floater_header_size + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); } void LLFloaterNotificationConsole::onClickAdd(void* user_data) @@ -247,7 +250,9 @@ void LLFloaterNotificationConsole::onClickAdd(void* user_data) //=============== LLFloaterNotification ================ -LLFloaterNotification::LLFloaterNotification(LLNotification* note) : mNote(note) +LLFloaterNotification::LLFloaterNotification(LLNotification* note) +: LLFloater(), + mNote(note) { LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml"); } @@ -265,8 +270,7 @@ BOOL LLFloaterNotification::postBuild() return TRUE; } - responses_combo->setCommitCallback(onCommitResponse); - responses_combo->setCallbackUserData(this); + responses_combo->setCommitCallback(onCommitResponse, this); LLSD form_sd = form->asLLSD(); diff --git a/indra/newview/llfloaternotificationsconsole.h b/indra/newview/llfloaternotificationsconsole.h index 1a436b8bfe..0372553182 100644 --- a/indra/newview/llfloaternotificationsconsole.h +++ b/indra/newview/llfloaternotificationsconsole.h @@ -34,6 +34,7 @@ #define LL_LLFLOATER_NOTIFICATIONS_CONSOLE_H #include "llfloater.h" +#include "lllayoutstack.h" #include "llnotifications.h" class LLFloaterNotificationConsole : diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index f4984df6d9..4d782a1814 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -45,6 +45,7 @@ #include "llagent.h" // for agent id #include "llalertdialog.h" +#include "llinventorybridge.h" #include "llinventoryview.h" #include "llinventorymodel.h" #include "llpanelinventory.h" @@ -58,24 +59,26 @@ LLFloaterOpenObject* LLFloaterOpenObject::sInstance = NULL; LLFloaterOpenObject::LLFloaterOpenObject() -: LLFloater(std::string("object_contents")), +: LLFloater(), mPanelInventory(NULL), mDirty(TRUE) { - LLCallbackMap::map_t factory_map; - factory_map["object_contents"] = LLCallbackMap(createPanelInventory, this); - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml",&factory_map); - - childSetAction("copy_to_inventory_button", onClickMoveToInventory, this); - childSetAction("copy_and_wear_button", onClickMoveAndWear, this); - childSetTextArg("object_name", "[DESC]", std::string("Object") ); // *Note: probably do not want to translate this + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml"); } LLFloaterOpenObject::~LLFloaterOpenObject() { sInstance = NULL; } - +// virtual +BOOL LLFloaterOpenObject::postBuild() +{ + childSetAction("copy_to_inventory_button", onClickMoveToInventory, this); + childSetAction("copy_and_wear_button", onClickMoveAndWear, this); + childSetTextArg("object_name", "[DESC]", std::string("Object") ); // *Note: probably do not want to translate this + mPanelInventory = getChild("object_contents"); + return TRUE; +} void LLFloaterOpenObject::refresh() { mPanelInventory->refresh(); @@ -135,7 +138,7 @@ void LLFloaterOpenObject::show() sInstance->center(); } - sInstance->open(); /* Flawfinder: ignore */ + sInstance->openFloater(); sInstance->setFocus(TRUE); sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); @@ -215,7 +218,7 @@ void LLFloaterOpenObject::onClickMoveToInventory(void* data) { LLFloaterOpenObject* self = (LLFloaterOpenObject*)data; self->moveToInventory(false); - self->close(); + self->closeFloater(); } // static @@ -223,13 +226,6 @@ void LLFloaterOpenObject::onClickMoveAndWear(void* data) { LLFloaterOpenObject* self = (LLFloaterOpenObject*)data; self->moveToInventory(true); - self->close(); + self->closeFloater(); } -//static -void* LLFloaterOpenObject::createPanelInventory(void* data) -{ - LLFloaterOpenObject* floater = (LLFloaterOpenObject*)data; - floater->mPanelInventory = new LLPanelInventory(std::string("Object Contents"), LLRect()); - return floater->mPanelInventory; -} diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h index 27653a5c99..0097a85690 100644 --- a/indra/newview/llfloateropenobject.h +++ b/indra/newview/llfloateropenobject.h @@ -59,7 +59,7 @@ public: protected: LLFloaterOpenObject(); ~LLFloaterOpenObject(); - + /*virtual*/ BOOL postBuild(); void refresh(); void draw(); @@ -68,7 +68,6 @@ protected: static void onClickMoveToInventory(void* data); static void onClickMoveAndWear(void* data); static void callbackMoveInventory(S32 result, void* data); - static void* createPanelInventory(void* data); protected: static LLFloaterOpenObject* sInstance; diff --git a/indra/newview/llfloaterparcel.cpp b/indra/newview/llfloaterparcel.cpp index 4213150553..fa7403874e 100644 --- a/indra/newview/llfloaterparcel.cpp +++ b/indra/newview/llfloaterparcel.cpp @@ -93,12 +93,12 @@ void* LLFloaterParcelInfo::createPanelPlace(void* data) //---------------------------------------------------------------------------- -LLFloaterParcelInfo::LLFloaterParcelInfo(const std::string& name, const LLUUID &parcel_id) -: LLFloater(name), +LLFloaterParcelInfo::LLFloaterParcelInfo(const LLUUID &parcel_id) +: LLFloater(), mParcelID( parcel_id ) { mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterParcelInfo::createPanelPlace, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml"); gPlaceInfoInstances.addData(parcel_id, this); } @@ -128,14 +128,14 @@ LLFloaterParcelInfo* LLFloaterParcelInfo::show(const LLUUID &parcel_id) { // ...bring that window to front floater = gPlaceInfoInstances.getData(parcel_id); - floater->open(); /*Flawfinder: ignore*/ + floater->openFloater(); floater->setFrontmost(true); } else { - floater = new LLFloaterParcelInfo("parcelinfo", parcel_id ); + floater = new LLFloaterParcelInfo( parcel_id ); floater->center(); - floater->open(); /*Flawfinder: ignore*/ + floater->openFloater(); floater->displayParcelInfo(parcel_id); floater->setFrontmost(true); } diff --git a/indra/newview/llfloaterparcel.h b/indra/newview/llfloaterparcel.h index 4d698d64ae..c2d5987d8e 100644 --- a/indra/newview/llfloaterparcel.h +++ b/indra/newview/llfloaterparcel.h @@ -43,7 +43,7 @@ class LLFloaterParcelInfo public: static void* createPanelPlace(void* data); - LLFloaterParcelInfo(const std::string& name, const LLUUID &parcel_id ); + LLFloaterParcelInfo( const LLUUID &parcel_id ); /*virtual*/ ~LLFloaterParcelInfo(); void displayParcelInfo(const LLUUID& parcel_id); diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 52fba0aa20..1ef71a9d53 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -42,6 +42,7 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) +: LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_perm_prefs.xml"); } @@ -64,7 +65,7 @@ void LLFloaterPerms::onClickOK(void* data) { LLFloaterPerms* self = static_cast(data); self->ok(); - self->close(); + self->closeFloater(); } //static @@ -72,7 +73,7 @@ void LLFloaterPerms::onClickCancel(void* data) { LLFloaterPerms* self = static_cast(data); self->cancel(); - self->close(); + self->closeFloater(); } //static @@ -117,7 +118,7 @@ void LLFloaterPerms::onClose(bool app_quitting) // Cancel any unsaved changes before closing. // Note: when closed due to the OK button this amounts to a no-op. cancel(); - LLFloater::onClose(app_quitting); + destroy(); } //static diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index b0ab0f9625..4a68e3092e 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -78,30 +78,21 @@ LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances; ///---------------------------------------------------------------------------- LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global) -: LLFloater(std::string("Postcard Floater")), +: LLFloater(), mJPEGImage(jpeg), mViewerImage(img), mImageScale(img_scale), mPosTakenGlobal(pos_taken_global), mHasFirstMsgFocus(false) { - init(); -} + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_postcard.xml"); -void LLFloaterPostcard::init() -{ + sInstances.insert(this); + // pick up the user's up-to-date email address - if(!gAgent.getID().isNull()) - { - // we're logged in, so we can get this info. - gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gAgent.sendReliableMessage(); - } + gAgent.sendAgentUserInfoRequest(); - sInstances.insert(this); + openFloater(); } // Destroys the object @@ -145,14 +136,6 @@ LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLImag // It's now our job to clean them up LLFloaterPostcard *instance = new LLFloaterPostcard(jpeg, img, image_scale, pos_taken_global); - LLUICtrlFactory::getInstance()->buildFloater(instance, "floater_postcard.xml"); - - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - instance->setOrigin(left, top - instance->getRect().getHeight()); - - instance->open(); /*Flawfinder: ignore*/ - return instance; } @@ -215,7 +198,7 @@ void LLFloaterPostcard::onClickCancel(void* data) { LLFloaterPostcard *self = (LLFloaterPostcard *)data; - self->close(false); + self->closeFloater(false); } } @@ -313,7 +296,7 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, gAgent.sendReliableMessage(); } - self->close(); + self->closeFloater(); } // static diff --git a/indra/newview/llfloaterpostcard.h b/indra/newview/llfloaterpostcard.h index 087649f159..5abb97e15f 100644 --- a/indra/newview/llfloaterpostcard.h +++ b/indra/newview/llfloaterpostcard.h @@ -36,12 +36,13 @@ #include "llfloater.h" #include "llcheckboxctrl.h" -#include "llmemory.h" -#include "llimagegl.h" +#include "llpointer.h" class LLTextEditor; class LLLineEditor; class LLButton; +class LLImageGL; +class LLImageJPEG; class LLFloaterPostcard : public LLFloater @@ -50,7 +51,6 @@ public: LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global); virtual ~LLFloaterPostcard(); - virtual void init(); virtual BOOL postBuild(); virtual void draw(); diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index de9b598b1e..a1015918d4 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -47,10 +47,20 @@ LLFloaterPostProcess* LLFloaterPostProcess::sPostProcess = NULL; -LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Process Floater")) +LLFloaterPostProcess::LLFloaterPostProcess() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); +} + +LLFloaterPostProcess::~LLFloaterPostProcess() +{ + + +} +BOOL LLFloaterPostProcess::postBuild() +{ /// Color Filter Callbacks childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma())); @@ -78,19 +88,13 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce // Effect loading and saving. LLComboBox* comboBox = getChild("PPEffectsCombo"); childSetAction("PPLoadEffect", &LLFloaterPostProcess::onLoadEffect, comboBox); - comboBox->setCommitCallback(onChangeEffectName); + comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1)); LLLineEditor* editBox = getChild("PPEffectNameEditor"); childSetAction("PPSaveEffect", &LLFloaterPostProcess::onSaveEffect, editBox); syncMenu(); - -} - -LLFloaterPostProcess::~LLFloaterPostProcess() -{ - - + return TRUE; } LLFloaterPostProcess* LLFloaterPostProcess::instance() @@ -99,7 +103,7 @@ LLFloaterPostProcess* LLFloaterPostProcess::instance() if (!sPostProcess) { sPostProcess = new LLFloaterPostProcess(); - sPostProcess->open(); + sPostProcess->openFloater(); sPostProcess->setFocus(TRUE); } return sPostProcess; @@ -185,14 +189,13 @@ void LLFloaterPostProcess::onSaveEffect(void* userData) } } -void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl, void * userData) +void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl) { // get the combo box and name - LLComboBox * comboBox = static_cast(ctrl); - LLLineEditor* editBox = sPostProcess->getChild("PPEffectNameEditor"); + LLLineEditor* editBox = getChild("PPEffectNameEditor"); // set the parameter's new name - editBox->setValue(comboBox->getSelectedValue()); + editBox->setValue(ctrl->getValue()); } bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLSD& response) @@ -215,7 +218,7 @@ void LLFloaterPostProcess::show() // and open the menu LLFloaterPostProcess* postProcess = instance(); postProcess->syncMenu(); - postProcess->open(); + postProcess->openFloater(); } // virtual diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h index 08a3618c2b..68e6d1e244 100644 --- a/indra/newview/llfloaterpostprocess.h +++ b/indra/newview/llfloaterpostprocess.h @@ -53,7 +53,7 @@ public: LLFloaterPostProcess(); virtual ~LLFloaterPostProcess(); - + /*virtual*/ BOOL postBuild(); /// one and one instance only static LLFloaterPostProcess* instance(); @@ -66,7 +66,7 @@ public: static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); static void onLoadEffect(void* userData); static void onSaveEffect(void* userData); - static void onChangeEffectName(LLUICtrl* ctrl, void * userData); + void onChangeEffectName(LLUICtrl* ctrl); /// prompts a user when overwriting an effect static bool saveAlertCallback(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 17a59ccb77..d0df2617b3 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -40,477 +40,953 @@ #include "llfloaterpreference.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "lldir.h" -#include "llfocusmgr.h" -#include "llscrollbar.h" -#include "llspinctrl.h" #include "message.h" +#include "llagent.h" +#include "llavatarconstants.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" #include "llcommandhandler.h" +#include "lldirpicker.h" +#include "llfeaturemanager.h" +#include "llfocusmgr.h" +#include "llfirstuse.h" +#include "llfloaterreg.h" #include "llfloaterabout.h" -#include "llfloaterpreference.h" -#include "llpanelnetwork.h" -#include "llpanelaudioprefs.h" +#include "llfloaterhardwaresettings.h" +#include "llfloatervoicedevicesettings.h" +#include "llkeyboard.h" +#include "llmodaldialog.h" #include "llpaneldisplay.h" -#include "llpaneldebug.h" -#include "llpanelgeneral.h" -#include "llpanelinput.h" #include "llpanellogin.h" -#include "llpanelLCD.h" -#include "llpanelmsgs.h" -#include "llpanelweb.h" -#include "llpanelskins.h" -#include "llprefschat.h" -#include "llprefsvoice.h" -#include "llprefsim.h" -#include "llresizehandle.h" -#include "llresmgr.h" -#include "llassetstorage.h" -#include "llagent.h" +#include "llradiogroup.h" +#include "llstylemap.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llsliderctrl.h" +#include "lltabcontainer.h" +#include "lltexteditor.h" #include "llviewercontrol.h" -#include "llviewernetwork.h" -#include "lluictrlfactory.h" +#include "llviewercamera.h" #include "llviewerwindow.h" -#include "llkeyboard.h" -#include "llscrollcontainer.h" -#include "llfloaterhardwaresettings.h" -const S32 PREF_BORDER = 4; -const S32 PREF_PAD = 5; -const S32 PREF_BUTTON_WIDTH = 70; -const S32 PREF_CATEGORY_WIDTH = 150; - -const S32 PREF_FLOATER_MIN_HEIGHT = 2 * SCROLLBAR_SIZE + 2 * LLPANEL_BORDER_WIDTH + 96; - -LLFloaterPreference* LLFloaterPreference::sInstance = NULL; - - -class LLPreferencesHandler : public LLCommandHandler -{ -public: - // requires trusted browser - LLPreferencesHandler() : LLCommandHandler("preferences", true) { } - bool handle(const LLSD& tokens, const LLSD& query_map, - LLWebBrowserCtrl* web) +class LLVoiceSetKeyDialog : public LLModalDialog { - LLFloaterPreference::show(NULL); - return true; - } -}; - -LLPreferencesHandler gPreferencesHandler; - + public: + LLVoiceSetKeyDialog(LLFloaterPreference* parent); + ~LLVoiceSetKeyDialog(); + + BOOL handleKeyHere(KEY key, MASK mask); + static void onCancel(void* user_data); + + private: + LLFloaterPreference* mParent; + }; -// Must be done at run time, not compile time. JC -S32 pref_min_width() +LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLFloaterPreference* parent) +: LLModalDialog(LLStringUtil::null, 240, 100), mParent(parent) { - return - 2 * PREF_BORDER + - 2 * PREF_BUTTON_WIDTH + - PREF_PAD + RESIZE_HANDLE_WIDTH + - PREF_CATEGORY_WIDTH + - PREF_PAD; + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml"); + childSetAction("Cancel", onCancel, this); + childSetFocus("Cancel"); + + gFocusMgr.setKeystrokesOnly(TRUE); } -S32 pref_min_height() +LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog() { - return - 2 * PREF_BORDER + - 3*(BTN_HEIGHT + PREF_PAD) + - PREF_FLOATER_MIN_HEIGHT; } - -LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * default_btn) : - mTabContainer(tab_container), - mGeneralPanel(NULL), - mInputPanel(NULL), - mNetworkPanel(NULL), - mDisplayPanel(NULL), - mAudioPanel(NULL), - mMsgPanel(NULL), - mSkinsPanel(NULL), - mLCDPanel(NULL) +BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { - mGeneralPanel = new LLPanelGeneral(); - mTabContainer->addTabPanel(mGeneralPanel, mGeneralPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mGeneralPanel->setDefaultBtn(default_btn); + BOOL result = TRUE; + + if(key == 'Q' && mask == MASK_CONTROL) + { + result = FALSE; + } + else + { + mParent->setKey(key); + } + + closeFloater(); + return result; +} - mInputPanel = new LLPanelInput(); - mTabContainer->addTabPanel(mInputPanel, mInputPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mInputPanel->setDefaultBtn(default_btn); +//static +void LLVoiceSetKeyDialog::onCancel(void* user_data) +{ + LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; + self->closeFloater(); +} - mNetworkPanel = new LLPanelNetwork(); - mTabContainer->addTabPanel(mNetworkPanel, mNetworkPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mNetworkPanel->setDefaultBtn(default_btn); - mWebPanel = new LLPanelWeb(); - mTabContainer->addTabPanel(mWebPanel, mWebPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mWebPanel->setDefaultBtn(default_btn); +// global functions - mDisplayPanel = new LLPanelDisplay(); - mTabContainer->addTabPanel(mDisplayPanel, mDisplayPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mDisplayPanel->setDefaultBtn(default_btn); +// helper functions for getting/freeing the web browser media +// if creating/destroying these is too slow, we'll need to create +// a static member and update all our static callbacks - mAudioPanel = new LLPanelAudioPrefs(); - mTabContainer->addTabPanel(mAudioPanel, mAudioPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mAudioPanel->setDefaultBtn(default_btn); +void free_web_media(LLMediaBase *media_source); +void handleHTMLLinkColorChanged(const LLSD& newvalue); +LLMediaBase *get_web_media(); +bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); - mPrefsChat = new LLPrefsChat(); - mTabContainer->addTabPanel(mPrefsChat->getPanel(), mPrefsChat->getPanel()->getLabel(), FALSE, onTabChanged, mTabContainer); - mPrefsChat->getPanel()->setDefaultBtn(default_btn); +bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); +bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); - mPrefsVoice = new LLPrefsVoice(); - mTabContainer->addTabPanel(mPrefsVoice, mPrefsVoice->getLabel(), FALSE, onTabChanged, mTabContainer); - mPrefsVoice->setDefaultBtn(default_btn); +LLMediaBase *get_web_media() +{ + LLMediaBase *media_source; + LLMediaManager *mgr = LLMediaManager::getInstance(); + + if (!mgr) + { + llwarns << "cannot get media manager" << llendl; + return NULL; + } + + media_source = mgr->createSourceFromMimeType("http", "text/html" ); + if ( !media_source ) + { + llwarns << "media source create failed " << llendl; + return NULL; + } + + return media_source; +} - mPrefsIM = new LLPrefsIM(); - mTabContainer->addTabPanel(mPrefsIM->getPanel(), mPrefsIM->getPanel()->getLabel(), FALSE, onTabChanged, mTabContainer); - mPrefsIM->getPanel()->setDefaultBtn(default_btn); +void free_web_media(LLMediaBase *media_source) +{ + if (!media_source) + return; + + LLMediaManager *mgr = LLMediaManager::getInstance(); + if (!mgr) + { + llwarns << "cannot get media manager" << llendl; + return; + } + + mgr->destroySource(media_source); +} -#if LL_LCD_COMPILE - // only add this option if we actually have a logitech keyboard / speaker set - if (gLcdScreen->Enabled()) +bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + if ( option == 0 ) // YES { - mLCDPanel = new LLPanelLCD(); - mTabContainer->addTabPanel(mLCDPanel, mLCDPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mLCDPanel->setDefaultBtn(default_btn); + LLMediaBase *media_source = get_web_media(); + if (media_source) + media_source->clearCache(); + free_web_media(media_source); } + return false; +} -#else - mLCDPanel = NULL; -#endif - - mMsgPanel = new LLPanelMsgs(); - mTabContainer->addTabPanel(mMsgPanel, mMsgPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mMsgPanel->setDefaultBtn(default_btn); +void handleHTMLLinkColorChanged(const LLSD& newvalue) +{ + LLTextEditor::setLinkColor(LLColor4(newvalue)); + LLStyleMap::instance().update(); - mSkinsPanel = new LLPanelSkins(); - mTabContainer->addTabPanel(mSkinsPanel, mSkinsPanel->getLabel(), FALSE, onTabChanged, mTabContainer); - mSkinsPanel->setDefaultBtn(default_btn); +} - if (!mTabContainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) +bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + if (0 == option && floater ) { - mTabContainer->selectFirstTab(); + if ( floater ) + { + floater->setAllIgnored(); + LLFirstUse::disableFirstUse(); + LLFloaterPreference::buildLists(floater); + } } + return false; } -LLPreferenceCore::~LLPreferenceCore() +bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { - if (mGeneralPanel) + S32 option = LLNotification::getSelectedOption(notification, response); + if ( 0 == option && floater ) { - delete mGeneralPanel; - mGeneralPanel = NULL; + if ( floater ) + { + floater->resetAllIgnored(); + LLFirstUse::resetFirstUse(); + LLFloaterPreference::buildLists(floater); + } } - if (mInputPanel) + return false; +} + +// static +std::string LLFloaterPreference::sSkin = ""; +////////////////////////////////////////////// +// LLFloaterPreference + +LLFloaterPreference::LLFloaterPreference(const LLSD& key) + : LLFloater(key), + mGotPersonalInfo(false), + mOriginalIMViaEmail(false) +{ + //Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + mFactoryMap["display"] = LLCallbackMap((LLCallbackMap::callback_t)LLCallbackMap::buildPanel); /// done fixing the callbacks + + + mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this)); + mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this)); + mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this)); + + mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, (void*)NULL)); + mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, (void*)NULL)); + mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this)); + mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); + mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2)); + mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); + mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); + mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs", boost::bind(&LLFloaterPreference::onClickSkipDialogs, this)); + mCommitCallbackRegistrar.add("Pref.ClickResetDialogs", boost::bind(&LLFloaterPreference::onClickResetDialogs, this)); + mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); + mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); + mCommitCallbackRegistrar.add("Pref.Logging", boost::bind(&LLFloaterPreference::onCommitLogging, this)); + mCommitCallbackRegistrar.add("Pref.OpenHelp", boost::bind(&LLFloaterPreference::onOpenHelp, this)); + mCommitCallbackRegistrar.add("Pref.ChangeCustom", boost::bind(&LLFloaterPreference::onChangeCustom, this)); + mCommitCallbackRegistrar.add("Pref.UpdateMeterText", boost::bind(&LLFloaterPreference::updateMeterText, this, _1)); + mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this)); + mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); + mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); + gSavedSkinSettings.getControl("HTMLLinkColor")->getCommitSignal()->connect(boost::bind(&handleHTMLLinkColorChanged, _2)); + //gSavedSettings.getControl("UseExternalBrowser")->getCommitSignal()->connect(boost::bind(&LLPanelPreference::handleUseExternalBrowserChanged, this)); + +} + +BOOL LLFloaterPreference::postBuild() +{ + LLTabContainer* tabcontainer = getChild("pref core"); + if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) + tabcontainer->selectFirstTab(); + + + return TRUE; +} + +LLFloaterPreference::~LLFloaterPreference() +{ +} +void LLFloaterPreference::draw() +{ + BOOL has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); + gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + + + LLFloater::draw(); +} + +void LLFloaterPreference::apply() +{ + LLTabContainer* tabcontainer = getChild("pref core"); + if (sSkin != gSavedSettings.getString("SkinCurrent")) { - delete mInputPanel; - mInputPanel = NULL; + LLNotifications::instance().add("ChangeSkin"); + refreshSkin(this); } - if (mNetworkPanel) + // Call apply() on all panels that derive from LLPanelPreference + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) { - delete mNetworkPanel; - mNetworkPanel = NULL; + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->apply(); } - if (mDisplayPanel) + // hardware menu apply + LLFloaterHardwareSettings::instance()->apply(); + + LLFloaterVoiceDeviceSettings* voice_device_settings = LLFloaterReg::findTypedInstance("pref_voicedevicesettings"); + if(voice_device_settings) { - delete mDisplayPanel; - mDisplayPanel = NULL; + voice_device_settings->apply(); } + + gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor - if (mAudioPanel) + LLSliderCtrl* fov_slider = getChild("camera_fov"); + fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); + fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); + + std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); + childSetText("cache_location", cache_location); + + LLMediaBase *media_source = get_web_media(); + if (media_source) { - delete mAudioPanel; - mAudioPanel = NULL; + media_source->enableCookies(childGetValue("cookies_enabled")); + if(hasChild("web_proxy_enabled") &&hasChild("web_proxy_editor") && hasChild("web_proxy_port")) + { + bool proxy_enable = childGetValue("web_proxy_enabled"); + std::string proxy_address = childGetValue("web_proxy_editor"); + + int proxy_port = childGetValue("web_proxy_port"); + media_source->enableProxy(proxy_enable, proxy_address, proxy_port); + } } - if (mPrefsChat) + free_web_media(media_source); + + LLTextEditor* busy = getChild("busy_response"); + LLWString busy_response; + if (busy) busy_response = busy->getWText(); + LLWStringUtil::replaceTabsWithSpaces(busy_response, 4); + + if(mGotPersonalInfo) + { + gSavedPerAccountSettings.setString("BusyModeResponse2", std::string(wstring_to_utf8str(busy_response))); + bool new_im_via_email = childGetValue("send_im_to_email").asBoolean(); + bool new_hide_online = childGetValue("online_visibility").asBoolean(); + + if((new_im_via_email != mOriginalIMViaEmail) + ||(new_hide_online != mOriginalHideOnlineStatus)) + { + // This hack is because we are representing several different + // possible strings with a single checkbox. Since most users + // can only select between 2 values, we represent it as a + // checkbox. This breaks down a little bit for liaisons, but + // works out in the end. + if(new_hide_online != mOriginalHideOnlineStatus) + { + if(new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN; + else mDirectoryVisibility = VISIBILITY_DEFAULT; + //Update showonline value, otherwise multiple applys won't work + mOriginalHideOnlineStatus = new_hide_online; + } + gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility); + } + } + +} + +void LLFloaterPreference::cancel() +{ + LLTabContainer* tabcontainer = getChild("pref core"); + // Call cancel() on all panels that derive from LLPanelPreference + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) { - delete mPrefsChat; - mPrefsChat = NULL; + LLView* view = *iter; + LLPanelPreference* panel = dynamic_cast(view); + if (panel) + panel->cancel(); } - if (mPrefsIM) + // hide joystick pref floater + LLFloaterReg::hideInstance("pref_joystick"); + + // cancel hardware menu + LLFloaterHardwareSettings::instance()->cancel(); // TODO: angela change the build of the floater to floater reg + + // reverts any changes to current skin + gSavedSettings.setString("SkinCurrent", sSkin); + + LLFloaterVoiceDeviceSettings* voice_device_settings = LLFloaterReg::findTypedInstance("pref_voicedevicesettings"); + if (voice_device_settings) { - delete mPrefsIM; - mPrefsIM = NULL; + voice_device_settings ->cancel(); } - if (mMsgPanel) + LLFloaterReg::hideInstance("pref_voicedevicesettings"); +} + +void LLFloaterPreference::onOpen(const LLSD& key) +{ + gAgent.sendAgentUserInfoRequest(); + LLPanelLogin::setAlwaysRefresh(true); +} + +void LLFloaterPreference::onVertexShaderEnable() +{ + refreshEnabledGraphics(); +} + +void LLFloaterPreference::setHardwareDefaults() +{ + LLFeatureManager::getInstance()->applyRecommendedSettings(); + refreshEnabledGraphics(); +} +void LLFloaterPreference::onClose(bool app_quitting) +{ + gSavedSettings.setS32("LastPrefTab", getChild("pref core")->getCurrentPanelIndex()); + LLPanelLogin::setAlwaysRefresh(false); + cancel(); // will be a no-op if OK or apply was performed just prior. + destroy(); +} +void LLFloaterPreference::onOpenHardwareSettings() +{ + LLFloaterHardwareSettings::show(); +} +// static +void LLFloaterPreference::onBtnOK() +{ + // commit any outstanding text entry + if (hasFocus()) { - delete mMsgPanel; - mMsgPanel = NULL; + LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); + if (cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } } - if (mWebPanel) + + if (canClose()) { - delete mWebPanel; - mWebPanel = NULL; + apply(); + closeFloater(false); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); + gSavedSkinSettings.saveToFile(gSavedSettings.getString("SkinningSettingsFile") , TRUE ); + std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); + // save all settings, even if equals defaults + gCrashSettings.saveToFile(crash_settings_filename, FALSE); } - if (mSkinsPanel) + else { - delete mSkinsPanel; - mSkinsPanel = NULL; + // Show beep, pop up dialog, etc. + llinfos << "Can't close preferences!" << llendl; } + LLPanelLogin::refreshLocation( false ); } +void LLFloaterPreference::onOpenHelp() +{ + const char* xml_alert = "GraphicsPreferencesHelp"; + LLNotifications::instance().add(this->contextualNotification(xml_alert)); +} -void LLPreferenceCore::apply() +// static +void LLFloaterPreference::onBtnApply( ) { - mGeneralPanel->apply(); - mInputPanel->apply(); - mNetworkPanel->apply(); - mDisplayPanel->apply(); - mAudioPanel->apply(); - mPrefsChat->apply(); - mPrefsVoice->apply(); - mPrefsIM->apply(); - mMsgPanel->apply(); - mSkinsPanel->apply(); + if (hasFocus()) + { + LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); + if (cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } + } + apply(); - // hardware menu apply - LLFloaterHardwareSettings::instance()->apply(); + LLPanelLogin::refreshLocation( false ); +} - mWebPanel->apply(); -#if LL_LCD_COMPILE - // only add this option if we actually have a logitech keyboard / speaker set - if (gLcdScreen->Enabled()) +// static +void LLFloaterPreference::onBtnCancel() +{ + if (hasFocus()) { - mLCDPanel->apply(); + LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); + if (cur_focus->acceptsTextInput()) + { + cur_focus->onCommit(); + } } -#endif -// mWebPanel->apply(); + closeFloater(); // side effect will also cancel any unsaved changes. } - -void LLPreferenceCore::cancel() +// static +void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email) { - mGeneralPanel->cancel(); - mInputPanel->cancel(); - mNetworkPanel->cancel(); - mDisplayPanel->cancel(); - mAudioPanel->cancel(); - mPrefsChat->cancel(); - mPrefsVoice->cancel(); - mPrefsIM->cancel(); - mMsgPanel->cancel(); - mSkinsPanel->cancel(); - - // cancel hardware menu - LLFloaterHardwareSettings::instance()->cancel(); - - mWebPanel->cancel(); -#if LL_LCD_COMPILE - // only add this option if we actually have a logitech keyboard / speaker set - if (gLcdScreen->Enabled()) + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if(instance) { - mLCDPanel->cancel(); + instance->setPersonalInfo(visibility, im_via_email, email); } -#endif -// mWebPanel->cancel(); } -// static -void LLPreferenceCore::onTabChanged(void* user_data, bool from_click) + +void LLFloaterPreference::onChangeCustom() { - LLTabContainer* self = (LLTabContainer*)user_data; + // if custom is turned off, reset everything to defaults + if (this && getChild("CustomSettings")->getValue()) + { + U32 set = (U32)getChild("QualityPerformanceSelection")->getValueF32(); + LLFeatureManager::getInstance()->setGraphicsLevel(set, true); + updateMeterText(getChild("DrawDistance")); + } - gSavedSettings.setS32("LastPrefTab", self->getCurrentPanelIndex()); + refreshEnabledGraphics(); +} +////////////////////////////////////////////////////////////////////////// +// static Note:(angela) NOT touching LLPanelDisplay for this milestone (skinning-11) +void LLFloaterPreference::refreshEnabledGraphics() +{ + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if(instance) + { + LLFloaterHardwareSettings::instance()->refreshEnabledState(); + + LLTabContainer* tabcontainer = instance->getChild("pref core"); + for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin(); + iter != tabcontainer->getChildList()->end(); ++iter) + { + LLView* view = *iter; + if(!view) + return; + if(view->getName()=="display") + { + LLPanelDisplay* display_panel = dynamic_cast(view); + if(!display_panel) + return; + display_panel->refreshEnabledState(); + } + } + } } +void LLFloaterPreference::updateMeterText(LLUICtrl* ctrl) +{ + // get our UI widgets + LLSliderCtrl* slider = (LLSliderCtrl*) ctrl; + LLTextBox* m1 = getChild("DrawDistanceMeterText1"); + LLTextBox* m2 = getChild("DrawDistanceMeterText2"); -void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email) -{ - mPrefsIM->setPersonalInfo(visibility, im_via_email, email); + // toggle the two text boxes based on whether we have 1 or two digits + F32 val = slider->getValueF32(); + bool two_digits = val < 100; + m1->setVisible(two_digits); + m2->setVisible(!two_digits); } -void LLPreferenceCore::refreshEnabledGraphics() +// static +void LLFloaterPreference::onClickClearCache(void*) { - LLFloaterHardwareSettings::instance()->refreshEnabledState(); - mDisplayPanel->refreshEnabledState(); + // flag client cache for clearing next time the client runs + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + LLNotifications::instance().add("CacheWillClear"); } -////////////////////////////////////////////// -// LLFloaterPreference - -LLFloaterPreference::LLFloaterPreference() +// static +void LLFloaterPreference::onClickBrowserClearCache(void*) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preferences.xml"); + LLNotifications::instance().add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); } -BOOL LLFloaterPreference::postBuild() +void LLFloaterPreference::onClickSetCache() { - requires("About..."); - requires("OK"); - requires("Cancel"); - requires("Apply"); - requires("pref core"); + std::string cur_name(gSavedSettings.getString("CacheLocation")); + std::string proposed_name(cur_name); - if (!checkRequirements()) + LLDirPicker& picker = LLDirPicker::instance(); + if (! picker.getDir(&proposed_name ) ) { - return FALSE; + return; //Canceled! } - mAboutBtn = getChild("About..."); - mAboutBtn->setClickedCallback(onClickAbout, this); - - mApplyBtn = getChild("Apply"); - mApplyBtn->setClickedCallback(onBtnApply, this); - - mCancelBtn = getChild("Cancel"); - mCancelBtn->setClickedCallback(onBtnCancel, this); - - mOKBtn = getChild("OK"); - mOKBtn->setClickedCallback(onBtnOK, this); - - mPreferenceCore = new LLPreferenceCore( - getChild("pref core"), - getChild("OK") - ); - - sInstance = this; - - return TRUE; + std::string dir_name = picker.getDirName(); + if (!dir_name.empty() && dir_name != cur_name) + { + childSetText("cache_location", dir_name); + LLNotifications::instance().add("CacheWillBeMoved"); + gSavedSettings.setString("NewCacheLocation", dir_name); + } + else + { + std::string cache_location = gDirUtilp->getCacheDir(); + childSetText("cache_location", cache_location); + } } - -LLFloaterPreference::~LLFloaterPreference() +void LLFloaterPreference::onClickResetCache() { - sInstance = NULL; - delete mPreferenceCore; + if (!gSavedSettings.getString("CacheLocation").empty()) + { + gSavedSettings.setString("NewCacheLocation", ""); + LLNotifications::instance().add("CacheWillBeMoved"); + } + std::string cache_location = gDirUtilp->getCacheDir(true); + childSetText("cache_location", cache_location); } -void LLFloaterPreference::apply() +void LLFloaterPreference::onClickSkin(LLUICtrl* ctrl, const LLSD& userdata) { - this->mPreferenceCore->apply(); + gSavedSettings.setString("SkinCurrent", userdata.asString()); + ctrl->setValue(userdata.asString()); } - -void LLFloaterPreference::cancel() +void LLFloaterPreference::onSelectSkin() { - this->mPreferenceCore->cancel(); + std::string skin_selection = getChild("skin_selection")->getValue().asString(); + gSavedSettings.setString("SkinCurrent", skin_selection); } +void LLFloaterPreference::refreshSkin(void* data) +{ + LLPanel*self = (LLPanel*)data; + sSkin = gSavedSettings.getString("SkinCurrent"); + self->getChild("skin_selection", true)->setValue(sSkin); +} // static -void LLFloaterPreference::show(void*) +void LLFloaterPreference::buildLists(void* data) { - if (!sInstance) + LLPanel*self = (LLPanel*)data; + LLScrollListCtrl& disabled_popups = self->getChildRef("disabled_popups"); + LLScrollListCtrl& enabled_popups = self->getChildRef("enabled_popups"); + + disabled_popups.deleteAllItems(); + enabled_popups.deleteAllItems(); + + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) { - new LLFloaterPreference(); - sInstance->center(); + LLNotificationTemplatePtr templatep = iter->second; + LLNotificationFormPtr formp = templatep->mForm; + + LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType(); + if (ignore == LLNotificationForm::IGNORE_NO) + continue; + + LLSD row; + row["columns"][0]["value"] = formp->getIgnoreMessage(); + row["columns"][0]["font"] = "SANSSERIF_SMALL"; + row["columns"][0]["width"] = 400; + + LLScrollListItem* item = NULL; + + bool show_popup = LLUI::sSettingGroups["ignores"]->getBOOL(templatep->mName); + if (!show_popup) + { + if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) + { + LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName); + if (!last_response.isUndefined()) + { + for (LLSD::map_const_iterator it = last_response.beginMap(); + it != last_response.endMap(); + ++it) + { + if (it->second.asBoolean()) + { + row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString(); + break; + } + } + } + row["columns"][1]["font"] = "SANSSERIF_SMALL"; + row["columns"][1]["width"] = 360; + } + item = disabled_popups.addElement(row, + ADD_SORTED); + } + else + { + item = enabled_popups.addElement(row, + ADD_SORTED); + } + + if (item) + { + item->setUserdata((void*)&iter->first); + } } +} - sInstance->open(); /* Flawfinder: ignore */ - - if(!gAgent.getID().isNull()) +// static +// DEV-24146 - needs to be removed at a later date. jan-2009 +void LLFloaterPreference::cleanupBadSetting() +{ + if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|") { - // we're logged in, so we can get this info. - gMessageSystem->newMessageFast(_PREHASH_UserInfoRequest); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gAgent.sendReliableMessage(); + llwarns << "cleaning old BusyModeResponse" << llendl; + gSavedPerAccountSettings.setString("BusyModeResponse2", gSavedPerAccountSettings.getText("BusyModeResponse")); } +} - LLPanelLogin::setAlwaysRefresh(true); +void LLFloaterPreference::onClickSetKey() +{ + LLVoiceSetKeyDialog* dialog = new LLVoiceSetKeyDialog(this); + dialog->startModal(); } +void LLFloaterPreference::setKey(KEY key) +{ + childSetValue("modifier_combo", LLKeyboard::stringFromKey(key)); +} -// static -void LLFloaterPreference::onClickAbout(void*) +void LLFloaterPreference::onClickSetMiddleMouse() { - LLFloaterAbout::show(NULL); + childSetValue("modifier_combo", "MiddleMouse"); } +void LLFloaterPreference::onClickSkipDialogs() +{ + LLNotifications::instance().add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); +} -// static -void LLFloaterPreference::onBtnOK( void* userdata ) +void LLFloaterPreference::onClickResetDialogs() { - LLFloaterPreference *fp =(LLFloaterPreference *)userdata; - // commit any outstanding text entry - if (fp->hasFocus()) + LLNotifications::instance().add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); +} + +void LLFloaterPreference::onClickEnablePopup() +{ + LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); + + std::vector items = disabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) { - LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); - if (cur_focus->acceptsTextInput()) + LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + //gSavedSettings.setWarning(templatep->mName, TRUE); + std::string notification_name = templatep->mName; + LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE); + } + + buildLists(this); +} + +void LLFloaterPreference::resetAllIgnored() +{ + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) { - cur_focus->onCommit(); + LLUI::sSettingGroups["ignores"]->setBOOL(iter->first, TRUE); + } + } +} + +void LLFloaterPreference::setAllIgnored() +{ + for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); + iter != LLNotifications::instance().templatesEnd(); + ++iter) + { + if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) + { + LLUI::sSettingGroups["ignores"]->setBOOL(iter->first, FALSE); } } +} - if (fp->canClose()) +void LLFloaterPreference::onClickLogPath() +{ + std::string proposed_name(childGetText("log_path_string")); + + LLDirPicker& picker = LLDirPicker::instance(); + if (!picker.getDir(&proposed_name ) ) { - fp->apply(); - fp->close(false); + return; //Canceled! + } + + childSetText("log_path_string", picker.getDirName()); +} - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); - - std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); - // save all settings, even if equals defaults - gCrashSettings.saveToFile(crash_settings_filename, FALSE); +void LLFloaterPreference::onCommitLogging() +{ + enableHistory(); +} +void LLFloaterPreference::enableHistory() +{ + + if (childGetValue("log_instant_messages").asBoolean() || childGetValue("log_chat").asBoolean()) + { + childEnable("log_show_history"); + childEnable("log_path_button"); } else { - // Show beep, pop up dialog, etc. - llinfos << "Can't close preferences!" << llendl; + childDisable("log_show_history"); + childDisable("log_path_button"); } - - LLPanelLogin::refreshLocation( false ); } - -// static -void LLFloaterPreference::onBtnApply( void* userdata ) +void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email) { - LLFloaterPreference *fp =(LLFloaterPreference *)userdata; - if (fp->hasFocus()) + mGotPersonalInfo = true; + mOriginalIMViaEmail = im_via_email; + mDirectoryVisibility = visibility; + + if(visibility == VISIBILITY_DEFAULT) { - LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); - if (cur_focus->acceptsTextInput()) - { - cur_focus->onCommit(); - } + mOriginalHideOnlineStatus = false; + childEnable("online_visibility"); + } + else if(visibility == VISIBILITY_HIDDEN) + { + mOriginalHideOnlineStatus = true; + childEnable("online_visibility"); } - fp->apply(); + else + { + mOriginalHideOnlineStatus = true; + } + + childEnable("include_im_in_chat_history"); + childEnable("show_timestamps_check_im"); + childEnable("friends_online_notify_checkbox"); + + childSetValue("online_visibility", mOriginalHideOnlineStatus); + childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility); + childEnable("send_im_to_email"); + childSetValue("send_im_to_email", im_via_email); + childEnable("log_instant_messages"); + childEnable("log_chat"); + childEnable("busy_response"); + childEnable("log_instant_messages_timestamp"); + childEnable("log_chat_timestamp"); + childEnable("log_chat_IM"); + childEnable("log_date_timestamp"); + + childSetText("busy_response", gSavedPerAccountSettings.getString("BusyModeResponse2")); + + enableHistory(); + std::string display_email(email); + childSetText("email_address",display_email); - LLPanelLogin::refreshLocation( false ); } -void LLFloaterPreference::onClose(bool app_quitting) +//---------------------------------------------------------------------------- +static LLRegisterPanelClassWrapper t_places("panel_preference"); +LLPanelPreference::LLPanelPreference() +: LLPanel() { - LLPanelLogin::setAlwaysRefresh(false); - cancel(); // will be a no-op if OK or apply was performed just prior. - LLFloater::onClose(app_quitting); + // + mCommitCallbackRegistrar.add("setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); + } +//virtual +BOOL LLPanelPreference::postBuild() +{ + if (hasChild("maturity_desired_combobox")) + { + /////////////////////////// From LLPanelGeneral ////////////////////////// + // if we have no agent, we can't let them choose anything + // if we have an agent, then we only let them choose if they have a choice + bool canChoose = gAgent.getID().notNull() && + (gAgent.isMature() || gAgent.isGodlike()); -// static -void LLFloaterPreference::onBtnCancel( void* userdata ) -{ - LLFloaterPreference *fp =(LLFloaterPreference *)userdata; - if (fp->hasFocus()) + if (canChoose) + { + + // if they're not adult or a god, they shouldn't see the adult selection, so delete it + if (!gAgent.isAdult() && !gAgent.isGodlike()) + { + LLComboBox* pMaturityCombo = getChild("maturity_desired_combobox"); + // we're going to remove the adult entry from the combo. This obviously depends + // on the order of items in the XML file, but there doesn't seem to be a reasonable + // way to depend on the field in XML called 'name'. + pMaturityCombo->remove(0); + } + childSetVisible("maturity_desired_combobox", true); + childSetVisible("maturity_desired_textbox", false); + } + else + { + childSetVisible("maturity_desired_combobox", false); + std::string selectedItemLabel = getChild("maturity_desired_combobox")->getSelectedItemLabel(); + childSetValue("maturity_desired_textbox", selectedItemLabel); + childSetVisible("maturity_desired_textbox", true); + } + } + ////////////////////// PanelVoice /////////////////// + if(hasChild("voice_unavailable")) { - LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); - if (cur_focus->acceptsTextInput()) + BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); + childSetVisible("voice_unavailable", voice_disabled); + childSetVisible("enable_voice_check", !voice_disabled); + } + + //////////////////////PanelSkins /////////////////// + + if (hasChild("skin_selection")) + { + LLFloaterPreference::refreshSkin(this); + + // if skin is set to a skin that no longer exists (silver) set back to default + if (getChild("skin_selection")->getSelectedIndex() < 0) { - cur_focus->onCommit(); + gSavedSettings.setString("SkinCurrent", "default"); + LLFloaterPreference::refreshSkin(this); } + } - fp->close(); // side effect will also cancel any unsaved changes. + ////////////////////////Panel Popups///////////////// + if(hasChild("disabled_popups") && hasChild("enabled_popups")) + { + LLFloaterPreference::buildLists(this); + } + ////// + if(hasChild("online_visibility") && hasChild("send_im_to_email")) + { + requires("online_visibility"); + requires("send_im_to_email"); + if (!checkRequirements()) + { + return FALSE; + } + childSetText("email_address",getString("log_in_to_change") ); + childSetText("busy_response", getString("log_in_to_change")); + + } + apply(); + return true; } +void LLPanelPreference::apply() +{ + // Save the value of all controls in the hierarchy + mSavedValues.clear(); + std::list view_stack; + view_stack.push_back(this); + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + mSavedValues[control] = control->getValue(); + } + } + + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } + +} -// static -void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email) +void LLPanelPreference::cancel() { - if(sInstance && sInstance->mPreferenceCore) + for (control_values_map_t::iterator iter = mSavedValues.begin(); + iter != mSavedValues.end(); ++iter) { - sInstance->mPreferenceCore->setPersonalInfo(visibility, im_via_email, email); + LLControlVariable* control = iter->first; + LLSD ctrl_value = iter->second; + control->set(ctrl_value); } } -void LLFloaterPreference::refreshEnabledGraphics() +void LLPanelPreference::setControlFalse(const LLSD& user_data) { - sInstance->mPreferenceCore->refreshEnabledGraphics(); + std::string control_name = user_data.asString(); + LLControlVariable* control = findControl(control_name); + + if (control) + control->set(LLSD(FALSE)); } + diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index f48696ffdb..000bff4dea 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -40,94 +40,99 @@ #define LL_LLFLOATERPREFERENCE_H #include "llfloater.h" -#include "lltabcontainervertical.h" -class LLPanelGeneral; -class LLPanelInput; +class LLPanelPreference; class LLPanelLCD; class LLPanelDisplay; -class LLPanelAudioPrefs; class LLPanelDebug; -class LLPanelNetwork; -class LLPanelWeb; class LLMessageSystem; -class LLPrefsChat; -class LLPrefsVoice; -class LLPrefsIM; -class LLPanelMsgs; -class LLPanelSkins; class LLScrollListCtrl; -class LLPreferenceCore -{ - -public: - LLPreferenceCore(LLTabContainer* tab_container, LLButton * default_btn); - ~LLPreferenceCore(); - - void apply(); - void cancel(); - - LLTabContainer* getTabContainer() { return mTabContainer; } - - void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); - - static void onTabChanged(void* user_data, bool from_click); - - // refresh all the graphics preferences menus - void refreshEnabledGraphics(); - -private: - LLTabContainer *mTabContainer; - LLPanelGeneral *mGeneralPanel; - LLPanelSkins *mSkinsPanel; - LLPanelInput *mInputPanel; - LLPanelNetwork *mNetworkPanel; - LLPanelDisplay *mDisplayPanel; - LLPanelAudioPrefs *mAudioPanel; -// LLPanelDebug *mDebugPanel; - LLPrefsChat *mPrefsChat; - LLPrefsVoice *mPrefsVoice; - LLPrefsIM *mPrefsIM; - LLPanelWeb *mWebPanel; - LLPanelMsgs *mMsgPanel; - LLPanelLCD *mLCDPanel; -}; +class LLSD; // Floater to control preferences (display, audio, bandwidth, general. class LLFloaterPreference : public LLFloater { public: - LLFloaterPreference(); + LLFloaterPreference(const LLSD& key); ~LLFloaterPreference(); void apply(); void cancel(); + /*virtual*/ void draw(); virtual BOOL postBuild(); - static void show(void*); + virtual void onOpen(const LLSD& key); + virtual void onClose(bool app_quitting); // static data update, called from message handler static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email); // refresh all the graphics preferences menus static void refreshEnabledGraphics(); - + protected: - LLPreferenceCore *mPreferenceCore; - - /*virtual*/ void onClose(bool app_quitting); + + void onBtnOK(); + void onBtnCancel(); + void onBtnApply(); + void onOpenHelp(); + + static void onClickClearCache(void*); + static void onClickBrowserClearCache(void*); + + // if the custom settings box is clicked + void onChangeCustom(); + void updateMeterText(LLUICtrl* ctrl); + void onOpenHardwareSettings(); + /// callback for defaults + void setHardwareDefaults(); + // callback for when client turns on shaders + void onVertexShaderEnable(); +public: - LLButton* mAboutBtn; - LLButton *mOKBtn; - LLButton *mCancelBtn; - LLButton *mApplyBtn; + void onClickSetCache(); + void onClickResetCache(); + void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata); + void onSelectSkin(); + void onClickSetKey(); + void setKey(KEY key); + void onClickSetMiddleMouse(); + void onClickSkipDialogs(); + void onClickResetDialogs(); + void onClickEnablePopup(); + void resetAllIgnored(); + void setAllIgnored(); + void onClickLogPath(); + void enableHistory(); + void onCommitLogging(); + void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email); + + static void buildLists(void* data); + static void refreshSkin(void* data); + static void cleanupBadSetting(); + +private: + static std::string sSkin; + bool mGotPersonalInfo; + bool mOriginalIMViaEmail; + + bool mOriginalHideOnlineStatus; + std::string mDirectoryVisibility; - static void onClickAbout(void*); - static void onBtnOK(void*); - static void onBtnCancel(void*); - static void onBtnApply(void*); +}; - static LLFloaterPreference* sInstance; +class LLPanelPreference : public LLPanel +{ +public: + LLPanelPreference(); + /*virtual*/ BOOL postBuild(); + + virtual void apply(); + virtual void cancel(); + void setControlFalse(const LLSD& user_data); +private: + typedef std::map control_values_map_t; + control_values_map_t mSavedValues; }; #endif // LL_LLPREFERENCEFLOATER_H diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 406d940cf0..5a8afc2277 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -37,13 +37,14 @@ #include #include "llcachename.h" #include "lldbstrings.h" +#include "llfloaterreg.h" #include "llinventory.h" #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" +#include "llfriendactions.h" #include "llinventorymodel.h" #include "lllineeditor.h" #include "llradiogroup.h" @@ -51,11 +52,13 @@ #include "roles_constants.h" #include "llselectmgr.h" #include "lltextbox.h" +#include "lltrans.h" #include "lluiconstants.h" #include "llviewerinventory.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewercontrol.h" +#include "llviewerwindow.h" #include "lluictrlfactory.h" @@ -135,7 +138,13 @@ LLFloaterProperties* LLFloaterProperties::show(const LLUUID& item_id, } instance->refresh(); - instance->open(); /* Flawfinder: ignore */ + instance->openFloater(); + } + else + { + LLFloaterProperties* floater = new LLFloaterProperties(item_id, object_id); + // keep onscreen + gFloaterView->adjustToFitScreen(floater, FALSE); } return instance; } @@ -151,14 +160,14 @@ void LLFloaterProperties::dirtyAll() } // Default constructor -LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id) : - LLFloater(name, rect, title), +LLFloaterProperties::LLFloaterProperties(const LLUUID& item_id, const LLUUID& object_id) + : LLFloater(), mItemID(item_id), mObjectID(object_id), mDirty(TRUE) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); - + if (!sPropertiesObserver) { sPropertiesObserver = new LLPropertiesObserver; @@ -168,6 +177,28 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& // add the object to the static structure LLUUID key = mItemID ^ mObjectID; sInstances.insert(instance_map::value_type(key, this)); + +} + +// Destroys the object +LLFloaterProperties::~LLFloaterProperties() +{ + // clean up the static data. + instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); + if(it != sInstances.end()) + { + sInstances.erase(it); + } + sPropertiesObserverCount--; + if (!sPropertiesObserverCount) + { + delete sPropertiesObserver; + sPropertiesObserver = NULL; + } +} +// virtual +BOOL LLFloaterProperties::postBuild() +{ // build the UI // item name & description childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); @@ -196,23 +227,8 @@ LLFloaterProperties::LLFloaterProperties(const std::string& name, const LLRect& childSetCommitCallback("EditPrice",&onCommitSaleInfo, this); // The UI has been built, now fill in all the values refresh(); -} -// Destroys the object -LLFloaterProperties::~LLFloaterProperties() -{ - // clean up the static data. - instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); - if(it != sInstances.end()) - { - sInstances.erase(it); - } - sPropertiesObserverCount--; - if (!sPropertiesObserverCount) - { - delete sPropertiesObserver; - sPropertiesObserver = NULL; - } + return TRUE; } void LLFloaterProperties::refresh() @@ -372,8 +388,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) ////////////////// // ACQUIRE DATE // ////////////////// - - // *TODO: Localize / translate this + time_t time_utc = item->getCreationDate(); if (0 == time_utc) { @@ -381,7 +396,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) } else { - childSetText("LabelAcquiredDate", std::string(ctime(&time_utc)) ); + std::string timeStr = getString("acquiredDate"); + LLSD substitution; + substitution["datetime"] = (S32) time_utc; + LLStringUtil::format (timeStr, substitution); + childSetText ("LabelAcquiredDate", timeStr); } /////////////////////// @@ -586,7 +605,7 @@ void LLFloaterProperties::onClickCreator(void* data) if(!item) return; if(!item->getCreatorUUID().isNull()) { - LLFloaterAvatarInfo::showFromObject(item->getCreatorUUID()); + LLFriendActions::showProfile(item->getCreatorUUID()); } } @@ -603,10 +622,7 @@ void LLFloaterProperties::onClickOwner(void* data) } else { - if(!item->getPermissions().getOwner().isNull()) - { - LLFloaterAvatarInfo::showFromObject(item->getPermissions().getOwner()); - } + LLFriendActions::showProfile(item->getPermissions().getOwner()); } } @@ -938,7 +954,7 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ if (floaterp) { - floaterp->close(); + floaterp->closeFloater(); } } @@ -946,8 +962,24 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ /// LLMultiProperties ///---------------------------------------------------------------------------- -LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect) +LLMultiProperties::LLMultiProperties() + : LLMultiFloater() { + // *TODO: There should be a .xml file for this + const LLRect& nextrect = LLFloaterReg::getFloaterRect("properties"); // place where the next properties should show up + if (nextrect.getWidth() > 0) + { + setRect(nextrect); + } + else + { + // start with a small rect in the top-left corner ; will get resized + LLRect rect; + rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 20, 20); + setRect(rect); + } + setTitle(LLTrans::getString("MultiPropertiesTitle")); + buildTabContainer(); } ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterproperties.h b/indra/newview/llfloaterproperties.h index 2f5d97d384..d0e5abefb8 100644 --- a/indra/newview/llfloaterproperties.h +++ b/indra/newview/llfloaterproperties.h @@ -34,7 +34,7 @@ #define LL_LLFLOATERPROPERTIES_H #include -#include "llfloater.h" +#include "llmultifloater.h" #include "lliconctrl.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -54,16 +54,16 @@ class LLFloaterProperties : public LLFloater { public: static LLFloaterProperties* find(const LLUUID& item_id, - const LLUUID& object_id); + const LLUUID& object_id = LLUUID::null); static LLFloaterProperties* show(const LLUUID& item_id, - const LLUUID& object_id); + const LLUUID& object_id = LLUUID::null); static void dirtyAll(); static void closeByID(const LLUUID& item_id, const LLUUID& object_id); - LLFloaterProperties(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id); + LLFloaterProperties(const LLUUID& item_id, const LLUUID& object_id); virtual ~LLFloaterProperties(); - + /*virtual*/ BOOL postBuild(); // do everything necessary void dirty() { mDirty = TRUE; } void refresh(); @@ -104,7 +104,7 @@ protected: class LLMultiProperties : public LLMultiFloater { public: - LLMultiProperties(const LLRect& rect); + LLMultiProperties(); }; #endif // LL_LLFLOATERPROPERTIES_H diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 06c1b2c12b..57a3bf9445 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -64,6 +64,7 @@ #include "lllineeditor.h" #include "llalertdialog.h" #include "llnamelistctrl.h" +#include "llscrolllistitem.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "lltabcontainer.h" @@ -73,6 +74,7 @@ #include "lltrans.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" +#include "llviewerinventory.h" #include "llviewerimage.h" #include "llviewerimagelist.h" #include "llviewerregion.h" @@ -80,6 +82,7 @@ #include "llviewertexteditor.h" #include "llviewerwindow.h" #include "llvlcomposition.h" +#include "lltrans.h" #define ELAR_ENABLED 0 // Enable when server support is implemented @@ -161,8 +164,9 @@ bool estate_dispatch_initialized = false; LLUUID LLFloaterRegionInfo::sRequestInvoice; LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) + : LLFloater() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", NULL, FALSE); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_region_info.xml", FALSE); } BOOL LLFloaterRegionInfo::postBuild() @@ -174,32 +178,32 @@ BOOL LLFloaterRegionInfo::postBuild() panel = new LLPanelRegionGeneralInfo; mInfoPanels.push_back(panel); LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_general.xml"); - mTab->addTabPanel(panel, panel->getLabel(), TRUE); + mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); panel = new LLPanelRegionDebugInfo; mInfoPanels.push_back(panel); LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_debug.xml"); - mTab->addTabPanel(panel, panel->getLabel(), FALSE); + mTab->addTabPanel(panel); panel = new LLPanelRegionTextureInfo; mInfoPanels.push_back(panel); LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); - mTab->addTabPanel(panel, panel->getLabel(), FALSE); + mTab->addTabPanel(panel); panel = new LLPanelRegionTerrainInfo; mInfoPanels.push_back(panel); LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); - mTab->addTabPanel(panel, panel->getLabel(), FALSE); + mTab->addTabPanel(panel); panel = new LLPanelEstateInfo; mInfoPanels.push_back(panel); LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_estate.xml"); - mTab->addTabPanel(panel, panel->getLabel(), FALSE); + mTab->addTabPanel(panel); panel = new LLPanelEstateCovenant; mInfoPanels.push_back(panel); LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_covenant.xml"); - mTab->addTabPanel(panel, panel->getLabel(), FALSE); + mTab->addTabPanel(panel); gMessageSystem->setHandlerFunc( "EstateOwnerMessage", @@ -212,22 +216,16 @@ LLFloaterRegionInfo::~LLFloaterRegionInfo() { } -void LLFloaterRegionInfo::onOpen() +void LLFloaterRegionInfo::onOpen(const LLSD& key) { - LLRect rect = gSavedSettings.getRect("FloaterRegionInfo"); - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - rect.translate(left,top); - refreshFromRegion(gAgent.getRegion()); requestRegionInfo(); - LLFloater::onOpen(); } // static void LLFloaterRegionInfo::requestRegionInfo() { - LLTabContainer* tab = findInstance()->getChild("region_panels"); + LLTabContainer* tab = getChild("region_panels"); tab->getChild("General")->setCtrlsEnabled(FALSE); tab->getChild("Debug")->setCtrlsEnabled(FALSE); @@ -436,6 +434,11 @@ void LLFloaterRegionInfo::refresh() // LLPanelRegionInfo // +LLPanelRegionInfo::LLPanelRegionInfo() + : LLPanel() +{ +} + // static void LLPanelRegionInfo::onBtnSet(void* user_data) { @@ -719,7 +722,7 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L // static void LLPanelRegionGeneralInfo::onClickManageTelehub(void* data) { - LLFloaterRegionInfo::getInstance()->close(); + LLFloaterRegionInfo::getInstance()->closeFloater(); LLFloaterTelehub::show(); } @@ -1074,7 +1077,7 @@ BOOL LLPanelRegionTextureInfo::postBuild() initCtrl(buffer); } -// LLButton* btn = new LLButton("dump", LLRect(0, 20, 100, 0), "", onClickDump, this); +// LLButton* btn = ("dump", LLRect(0, 20, 100, 0), "", onClickDump, this); // btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); // addChild(btn); @@ -1363,9 +1366,10 @@ void LLPanelRegionTerrainInfo::onClickUploadRaw(void* data) // static void LLPanelRegionTerrainInfo::onClickBakeTerrain(void* data) { - LLNotifications::instance().add( - LLNotification::Params("ConfirmBakeTerrain") - .functor(boost::bind(&LLPanelRegionTerrainInfo::callbackBakeTerrain, (LLPanelRegionTerrainInfo*)data, _1, _2))); + LLNotification::Params::Functor functor_params; + functor_params.function(boost::bind(&LLPanelRegionTerrainInfo::callbackBakeTerrain, (LLPanelRegionTerrainInfo*)data, _1, _2)); + + LLNotifications::instance().add(LLNotification::Params("ConfirmBakeTerrain").functor(functor_params)); } bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, const LLSD& response) @@ -1478,11 +1482,9 @@ void LLPanelEstateInfo::onClickRemoveAllowedAgent(void* user_data) accessRemoveCore(ESTATE_ACCESS_ALLOWED_AGENT_REMOVE, "EstateAllowedAgentRemove", "allowed_avatar_name_list"); } -// static -void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) +void LLPanelEstateInfo::onClickAddAllowedGroup() { - LLPanelEstateInfo* self = (LLPanelEstateInfo*)user_data; - LLCtrlListInterface *list = self->childGetListInterface("allowed_group_name_list"); + LLCtrlListInterface *list = childGetListInterface("allowed_group_name_list"); if (!list) return; if (list->getItemCount() >= ESTATE_MAX_ACCESS_IDS) { @@ -1493,7 +1495,7 @@ void LLPanelEstateInfo::onClickAddAllowedGroup(void* user_data) } LLNotification::Params params("ChangeLindenAccess"); - params.functor(boost::bind(&LLPanelEstateInfo::addAllowedGroup, self, _1, _2)); + params.functor.function(boost::bind(&LLPanelEstateInfo::addAllowedGroup, this, _1, _2)); if (isLindenEstate()) { LLNotifications::instance().add(params); @@ -1515,7 +1517,7 @@ bool LLPanelEstateInfo::addAllowedGroup(const LLSD& notification, const LLSD& re widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); if (widget) { - widget->setSelectCallback(addAllowedGroup2, NULL); + widget->setSelectGroupCallback(boost::bind(&LLPanelEstateInfo::addAllowedGroup2, this, _1)); if (parent_floater) { LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, widget); @@ -1656,26 +1658,29 @@ bool LLPanelEstateInfo::kickUserConfirm(const LLSD& notification, const LLSD& re std::string all_estates_text() { LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); - if (!panel) return "(error)"; + if (!panel) return "(" + LLTrans::getString("RegionInfoError") + ")"; + LLStringUtil::format_map_t args; std::string owner = panel->getOwnerName(); LLViewerRegion* region = gAgent.getRegion(); if (gAgent.isGodlike()) { - return llformat("all estates\nowned by %s", owner.c_str()); + args["[OWNER]"] = owner.c_str(); + return LLTrans::getString("RegionInfoAllEstatesOwnedBy", args); } else if (region && region->getOwner() == gAgent.getID()) { - return "all estates you own"; + return LLTrans::getString("AllEstatesYouOwn"); } else if (region && region->isEstateManager()) { - return llformat("all estates that\nyou manage for %s", owner.c_str()); + args["[OWNER]"] = owner.c_str(); + return LLTrans::getString("RegionInfoAllEstatesYouManage", args); } else { - return "(error)"; + return "(" + LLTrans::getString("RegionInfoError") + ")"; } } @@ -1725,8 +1730,7 @@ struct LLEstateAccessChangeInfo }; // Special case callback for groups, since it has different callback format than names -// static -void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) +void LLPanelEstateInfo::addAllowedGroup2(LLUUID id) { LLSD payload; payload["operation"] = (S32)ESTATE_ACCESS_ALLOWED_GROUP_ADD; @@ -1739,7 +1743,7 @@ void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) LLNotification::Params params("EstateAllowedGroupAdd"); params.payload(payload) .substitutions(args) - .functor(accessCoreConfirm); + .functor.function(accessCoreConfirm); if (isLindenEstate()) { LLNotifications::instance().forceResponse(params, 0); @@ -1760,7 +1764,7 @@ void LLPanelEstateInfo::accessAddCore(U32 operation_flag, const std::string& dia LLNotification::Params params("ChangeLindenAccess"); params.payload(payload) - .functor(accessAddCore2); + .functor.function(accessAddCore2); if (isLindenEstate()) { @@ -1848,7 +1852,7 @@ void LLPanelEstateInfo::accessAddCore3(const std::vector& names, co LLNotification::Params params(change_info->mDialogName); params.substitutions(args) .payload(change_info->asLLSD()) - .functor(accessCoreConfirm); + .functor.function(accessCoreConfirm); if (isLindenEstate()) { @@ -1888,7 +1892,7 @@ void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const std::string& LLNotification::Params params("ChangeLindenAccess"); params.payload(payload) - .functor(accessRemoveCore2); + .functor.function(accessRemoveCore2); if (isLindenEstate()) { @@ -2121,7 +2125,7 @@ BOOL LLPanelEstateInfo::postBuild() initCtrl("limit_age_verified"); initCtrl("voice_chat_check"); childSetCommitCallback("abuse_email_address", onChangeAnything, this); - childSetKeystrokeCallback("abuse_email_address", onChangeText, this); + getChild("abuse_email_address")->setKeystrokeCallback(onChangeText, this); initHelpBtn("estate_manager_help", "HelpEstateEstateManager"); initHelpBtn("use_global_time_help", "HelpEstateUseGlobalTime"); @@ -2161,7 +2165,7 @@ BOOL LLPanelEstateInfo::postBuild() group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS); } - childSetAction("add_allowed_group_btn", onClickAddAllowedGroup, this); + getChild("add_allowed_group_btn")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onClickAddAllowedGroup, this)); childSetAction("remove_allowed_group_btn", onClickRemoveAllowedGroup, this); childSetCommitCallback("banned_avatar_name_list", onChangeChildCtrl, this); @@ -2213,7 +2217,7 @@ BOOL LLPanelEstateInfo::sendUpdate() llinfos << "LLPanelEsateInfo::sendUpdate()" << llendl; LLNotification::Params params("ChangeLindenEstate"); - params.functor(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); + params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); if (getEstateID() <= ESTATE_LAST_LINDEN) { @@ -2556,8 +2560,7 @@ void LLPanelEstateInfo::callbackCacheName( const LLUUID& id, const std::string& first, const std::string& last, - BOOL is_group, - void*) + BOOL is_group) { LLPanelEstateInfo* self = LLFloaterRegionInfo::getPanelEstate(); if (!self) return; @@ -2852,7 +2855,7 @@ void LLPanelEstateCovenant::loadInvItem(LLInventoryItem *itemp) else { mAssetStatus = ASSET_LOADED; - setCovenantTextEditor("There is no Covenant provided for this Estate."); + setCovenantTextEditor(LLTrans::getString("RegionNoCovenant")); sendChangeCovenantID(LLUUID::null); } } @@ -3063,7 +3066,7 @@ bool LLDispatchEstateUpdateInfo::operator()( regionp->setOwner(owner_id); // Update estate owner name in UI const BOOL is_group = FALSE; - gCacheName->get(owner_id, is_group, LLPanelEstateInfo::callbackCacheName); + gCacheName->get(owner_id, is_group, &LLPanelEstateInfo::callbackCacheName); U32 estate_id = strtoul(strings[2].c_str(), NULL, 10); panel->setEstateID(estate_id); @@ -3162,9 +3165,10 @@ bool LLDispatchSetEstateAccess::operator()( totalAllowedAgents += allowed_agent_name_list->getItemCount(); } - std::string msg = llformat("Allowed residents: (%d, max %d)", - totalAllowedAgents, - ESTATE_MAX_ACCESS_IDS); + LLStringUtil::format_map_t args; + args["[ALLOWEDAGENTS]"] = llformat ("%d", totalAllowedAgents); + args["[MAXACCESS]"] = llformat ("%d", ESTATE_MAX_ACCESS_IDS); + std::string msg = LLTrans::getString("RegionInfoAllowedResidents", args); panel->childSetValue("allow_resident_label", LLSD(msg)); if (allowed_agent_name_list) @@ -3186,9 +3190,10 @@ bool LLDispatchSetEstateAccess::operator()( LLNameListCtrl* allowed_group_name_list; allowed_group_name_list = panel->getChild("allowed_group_name_list"); - std::string msg = llformat("Allowed groups: (%d, max %d)", - num_allowed_groups, - (S32) ESTATE_MAX_GROUP_IDS); + LLStringUtil::format_map_t args; + args["[ALLOWEDGROUPS]"] = llformat ("%d", num_allowed_groups); + args["[MAXACCESS]"] = llformat ("%d", ESTATE_MAX_GROUP_IDS); + std::string msg = LLTrans::getString("RegionInfoAllowedGroups", args); panel->childSetValue("allow_group_label", LLSD(msg)); if (allowed_group_name_list) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 806d1f57d6..b3a1fcb7ca 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -65,7 +65,7 @@ class LLFloaterRegionInfo : public LLFloater, public LLFloaterSingletonbuildFloater(this, "floater_report_bug.xml"); - } - else - { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); - } - - childSetText("abuse_location_edit", gAgent.getSLURL() ); - - LLButton* pick_btn = getChild("pick_btn"); - if (pick_btn) - { - // XUI: Why aren't these in viewerart.ini? - pick_btn->setImages( std::string("UIImgFaceUUID"), - std::string("UIImgFaceSelectedUUID") ); - childSetAction("pick_btn", onClickObjPicker, this); - } - if (report_type != BUG_REPORT) - { - // abuser name is selected from a list - LLLineEditor* le = getChild("abuser_name_edit"); - le->setEnabled( FALSE ); - } - - childSetAction("select_abuser", onClickSelectAbuser, this); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); + - childSetAction("send_btn", onClickSend, this); - childSetAction("cancel_btn", onClickCancel, this); + childSetText("abuse_location_edit", gAgent.getSLURL() ); enableControls(TRUE); @@ -182,18 +152,16 @@ LLFloaterReporter::LLFloaterReporter( gDialogVisible = TRUE; - // only request details for abuse reports (not BUG reports) - if (report_type != BUG_REPORT) - { - // send a message and ask for information about this region - - // result comes back in processRegionInfo(..) - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("RequestRegionInfo"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - gAgent.sendReliableMessage(); - }; + + // send a message and ask for information about this region - + // result comes back in processRegionInfo(..) + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("RequestRegionInfo"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + gAgent.sendReliableMessage(); + } // static @@ -213,7 +181,25 @@ void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg) LLNotifications::instance().add("HelpReportAbuseEmailLL"); }; } +// virtual +BOOL LLFloaterReporter::postBuild() +{ + // abuser name is selected from a list + LLLineEditor* le = getChild("abuser_name_edit"); + le->setEnabled( FALSE ); + setPosBox(mPosition.getValue()); + LLButton* pick_btn = getChild("pick_btn"); + pick_btn->setImages(std::string("tool_face.tga"), + std::string("tool_face_active.tga") ); + childSetAction("pick_btn", onClickObjPicker, this); + + childSetAction("select_abuser", onClickSelectAbuser, this); + + childSetAction("send_btn", onClickSend, this); + childSetAction("cancel_btn", onClickCancel, this); + return TRUE; +} // virtual LLFloaterReporter::~LLFloaterReporter() { @@ -241,7 +227,7 @@ void LLFloaterReporter::draw() // this is set by a static callback sometime after the dialog is created. // Only disable screenshot for abuse reports to estate owners - bug reports always // allow screenshots to be taken. - if ( gEmailToEstateOwner && ( mReportType != BUG_REPORT ) ) + if ( gEmailToEstateOwner ) { childSetValue("screen_check", FALSE ); childSetEnabled("screen_check", FALSE ); @@ -257,11 +243,7 @@ void LLFloaterReporter::draw() void LLFloaterReporter::enableControls(BOOL enable) { childSetEnabled("category_combo", enable); - // bug reports never include the chat history - if (mReportType != BUG_REPORT) - { - childSetEnabled("chat_check", enable); - } + childSetEnabled("chat_check", enable); childSetEnabled("screen_check", enable); childDisable("screenshot"); childSetEnabled("pick_btn", enable); @@ -332,7 +314,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) // we have to query the simulator for information // about this object LLMessageSystem* msg = gMessageSystem; - U32 request_flags = (mReportType == BUG_REPORT) ? BUG_REPORT_REQUEST : COMPLAINT_REPORT_REQUEST; + U32 request_flags = COMPLAINT_REPORT_REQUEST; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -363,15 +345,12 @@ void LLFloaterReporter::callbackAvatarID(const std::vector& names, if (ids.empty() || names.empty()) return; - // this should never be called in a bug report but here for safety. - if ( self->mReportType != BUG_REPORT ) - { - self->childSetText("abuser_name_edit", names[0] ); - - self->mAbuserID = ids[0]; + self->childSetText("abuser_name_edit", names[0] ); + + self->mAbuserID = ids[0]; + + self->refresh(); - self->refresh(); - }; } // static @@ -386,9 +365,7 @@ void LLFloaterReporter::onClickSend(void *userdata) if(self->validateReport()) { - // only show copyright alert for abuse reports - if ( self->mReportType != BUG_REPORT ) - { + const int IP_CONTENT_REMOVAL = 66; const int IP_PERMISSONS_EXPLOIT = 37; LLComboBox* combo = self->getChild( "category_combo"); @@ -418,7 +395,7 @@ void LLFloaterReporter::onClickSend(void *userdata) LLNotifications::instance().add("HelpReportAbuseContainsCopyright"); return; } - } + LLUploadDialog::modalUploadDialog("Uploading...\n\nReport"); // *TODO don't upload image if checkbox isn't checked @@ -427,7 +404,7 @@ void LLFloaterReporter::onClickSend(void *userdata) if(!url.empty() || !sshot_url.empty()) { self->sendReportViaCaps(url, sshot_url, self->gatherReport()); - self->close(); + self->closeFloater(); } else { @@ -442,7 +419,7 @@ void LLFloaterReporter::onClickSend(void *userdata) { self->sendReportViaLegacy(self->gatherReport()); LLUploadDialog::modalUploadFinished(); - self->close(); + self->closeFloater(); } } } @@ -461,7 +438,7 @@ void LLFloaterReporter::onClickCancel(void *userdata) { closePickTool(self); } - self->close(); + self->closeFloater(); } @@ -501,16 +478,13 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) { // ...bring that window to front LLFloaterReporter *f = gReporterInstances.getData(report_type); - f->open(); /* Flawfinder: ignore */ + f->openFloater(); } else { LLFloaterReporter *f; - if (BUG_REPORT == report_type) - { - f = LLFloaterReporter::createNewBugReporter(); - } - else if (COMPLAINT_REPORT == report_type) + + if (COMPLAINT_REPORT == report_type) { f = LLFloaterReporter::createNewAbuseReporter(); } @@ -557,7 +531,7 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id) // Need to deselect on close f->mDeselectOnClose = TRUE; - f->open(); /* Flawfinder: ignore */ + f->openFloater(); } @@ -575,21 +549,8 @@ LLFloaterReporter* LLFloaterReporter::getReporter(EReportType report_type) LLFloaterReporter* LLFloaterReporter::createNewAbuseReporter() { - return new LLFloaterReporter("complaint_reporter", - LLRect(), - "Report Abuse", - COMPLAINT_REPORT); -} - -//static -LLFloaterReporter* LLFloaterReporter::createNewBugReporter() -{ - return new LLFloaterReporter("bug_reporter", - LLRect(), - "Report Bug", - BUG_REPORT); + return new LLFloaterReporter(COMPLAINT_REPORT); } - void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id) @@ -619,21 +580,26 @@ bool LLFloaterReporter::validateReport() return false; } - if ( mReportType != BUG_REPORT ) + + if ( childGetText("abuser_name_edit").empty() ) + { + LLNotifications::instance().add("HelpReportAbuseAbuserNameEmpty"); + return false; + }; + + if ( childGetText("abuse_location_edit").empty() ) + { + LLNotifications::instance().add("HelpReportAbuseAbuserLocationEmpty"); + return false; + }; + + if ( childGetText("abuse_location_edit").empty() ) { - if ( childGetText("abuser_name_edit").empty() ) - { - LLNotifications::instance().add("HelpReportAbuseAbuserNameEmpty"); - return false; - }; - - if ( childGetText("abuse_location_edit").empty() ) - { - LLNotifications::instance().add("HelpReportAbuseAbuserLocationEmpty"); - return false; - }; + LLNotifications::instance().add("HelpReportAbuseAbuserLocationEmpty"); + return false; }; + if ( childGetText("summary_edit").empty() ) { if ( mReportType != BUG_REPORT ) @@ -685,50 +651,34 @@ LLSD LLFloaterReporter::gatherReport() #if LL_WINDOWS const char* platform = "Win"; - const char* short_platform = "O:W"; #elif LL_DARWIN const char* platform = "Mac"; - const char* short_platform = "O:M"; #elif LL_LINUX const char* platform = "Lnx"; - const char* short_platform = "O:L"; #elif LL_SOLARIS const char* platform = "Sol"; const char* short_platform = "O:S"; #else const char* platform = "???"; - const char* short_platform = "O:?"; #endif - if ( mReportType == BUG_REPORT) - { - summary << short_platform << " V" << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VIEWER_BUILD - << " (" << regionp->getName() << ")" - << "[" << category_name << "] " - << "\"" << childGetValue("summary_edit").asString() << "\""; - } - else - { - summary << "" - << " |" << regionp->getName() << "|" // region reporter is currently in. - << " (" << childGetText("abuse_location_edit") << ")" // region abuse occured in (freeform text - no LLRegionPicker tool) - << " [" << category_name << "] " // updated category - << " {" << childGetText("abuser_name_edit") << "} " // name of abuse entered in report (chosen using LLAvatarPicker) - << " \"" << childGetValue("summary_edit").asString() << "\""; // summary as entered - }; + + summary << "" + << " |" << regionp->getName() << "|" // region reporter is currently in. + << " (" << childGetText("abuse_location_edit") << ")" // region abuse occured in (freeform text - no LLRegionPicker tool) + << " [" << category_name << "] " // updated category + << " {" << childGetText("abuser_name_edit") << "} " // name of abuse entered in report (chosen using LLAvatarPicker) + << " \"" << childGetValue("summary_edit").asString() << "\""; // summary as entered + std::ostringstream details; - if (mReportType != BUG_REPORT) - { - details << "V" << LL_VERSION_MAJOR << "." // client version moved to body of email for abuse reports - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VIEWER_BUILD << std::endl << std::endl; - } + + details << "V" << LL_VERSION_MAJOR << "." // client version moved to body of email for abuse reports + << LL_VERSION_MINOR << "." + << LL_VERSION_PATCH << "." + << LL_VIEWER_BUILD << std::endl << std::endl; + std::string object_name = childGetText("object_name"); std::string owner_name = childGetText("owner_name"); if (!object_name.empty() && !owner_name.empty()) @@ -737,11 +687,9 @@ LLSD LLFloaterReporter::gatherReport() details << "Owner: " << owner_name << "\n"; } - if ( mReportType != BUG_REPORT ) - { - details << "Abuser name: " << childGetText("abuser_name_edit") << " \n"; - details << "Abuser location: " << childGetText("abuse_location_edit") << " \n"; - }; + + details << "Abuser name: " << childGetText("abuser_name_edit") << " \n"; + details << "Abuser location: " << childGetText("abuse_location_edit") << " \n"; details << childGetValue("details_edit").asString(); @@ -761,17 +709,11 @@ LLSD LLFloaterReporter::gatherReport() LLUUID screenshot_id = LLUUID::null; if (childGetValue("screen_check")) { - if ( mReportType != BUG_REPORT ) - { - if ( gEmailToEstateOwner == FALSE ) - { - screenshot_id = childGetValue("screenshot"); - } - } - else + + if ( gEmailToEstateOwner == FALSE ) { screenshot_id = childGetValue("screenshot"); - }; + } }; LLSD report = LLSD::emptyMap(); @@ -891,12 +833,8 @@ void LLFloaterReporter::takeScreenshot() mResourceDatap->mExpectedUploadCost = 0; // we expect that abuse screenshots are free mResourceDatap->mAssetInfo.mTransactionID.generate(); mResourceDatap->mAssetInfo.mUuid = mResourceDatap->mAssetInfo.mTransactionID.makeAssetID(gAgent.getSecureSessionID()); - if (BUG_REPORT == mReportType) - { - mResourceDatap->mAssetInfo.mType = LLAssetType::AT_TEXTURE; - mResourceDatap->mPreferredLocation = LLAssetType::EType(-1); - } - else if (COMPLAINT_REPORT == mReportType) + + if (COMPLAINT_REPORT == mReportType) { mResourceDatap->mAssetInfo.mType = LLAssetType::AT_TEXTURE; mResourceDatap->mPreferredLocation = LLAssetType::EType(-2); @@ -927,7 +865,7 @@ void LLFloaterReporter::takeScreenshot() { texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid); texture->setDefaultImageAssetID(mResourceDatap->mAssetInfo.mUuid); - texture->setCaption(std::string("Screenshot")); + texture->setCaption(getString("Screenshot")); } } @@ -967,11 +905,7 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, } EReportType report_type = UNKNOWN_REPORT; - if (data->mPreferredLocation == -1) - { - report_type = BUG_REPORT; - } - else if (data->mPreferredLocation == -2) + if (data->mPreferredLocation == -2) { report_type = COMPLAINT_REPORT; } @@ -986,7 +920,7 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, self->mScreenID = uuid; llinfos << "Got screen shot " << uuid << llendl; self->sendReportViaLegacy(self->gatherReport()); - self->close(); + self->closeFloater(); } } diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 86bc60559e..da1dda9c78 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -82,12 +82,9 @@ class LLFloaterReporter : public LLFloater { public: - LLFloaterReporter(const std::string& name, - const LLRect &rect, - const std::string& title, - EReportType = UNKNOWN_REPORT); + LLFloaterReporter(EReportType = UNKNOWN_REPORT); /*virtual*/ ~LLFloaterReporter(); - + /*virtual*/ BOOL postBuild(); virtual void draw(); // Enables all buttons @@ -107,7 +104,6 @@ public: // returns a pointer to reporter of report_type static LLFloaterReporter* getReporter(EReportType report_type); static LLFloaterReporter* createNewAbuseReporter(); - static LLFloaterReporter* createNewBugReporter(); // static static void processRegionInfo(LLMessageSystem* msg); diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index bc774e77ac..b2bb343681 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -52,12 +52,17 @@ // LLFloaterScriptDebug* LLFloaterScriptDebug::sInstance = NULL; +void* getOutputWindow(void* data); + // // Member Functions // -LLFloaterScriptDebug::LLFloaterScriptDebug() : - LLMultiFloater() +LLFloaterScriptDebug::LLFloaterScriptDebug(const std::string& filename) + : LLMultiFloater() { + mFactoryMap["all_scripts"] = LLCallbackMap(getOutputWindow, NULL); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_debug.xml"); + // avoid resizing of the window to match // the initial size of the tabbed-childs, whenever a tab is opened or closed mAutoResize = FALSE; @@ -73,8 +78,11 @@ void LLFloaterScriptDebug::show(const LLUUID& object_id) LLFloater* floaterp = addOutputWindow(object_id); if (sInstance) { - sInstance->open(); /* Flawfinder: ignore */ - sInstance->showFloater(floaterp); + sInstance->openFloater(object_id); + if (object_id.notNull()) + sInstance->showFloater(floaterp, LLTabContainer::END); +// else // Jump to [All scripts], but keep it on the left +// sInstance->showFloater(floaterp, LLTabContainer::START); } } @@ -95,25 +103,19 @@ BOOL LLFloaterScriptDebug::postBuild() void* getOutputWindow(void* data) { - return new LLFloaterScriptDebugOutput(); + return new LLFloaterScriptDebugOutput(LLUUID::null); } LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id) { if (!sInstance) { - sInstance = new LLFloaterScriptDebug(); - LLCallbackMap::map_t factory_map; - factory_map["all_scripts"] = LLCallbackMap(getOutputWindow, NULL); - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_script_debug.xml", &factory_map); + sInstance = new LLFloaterScriptDebug("floater_script_debug.xml"); sInstance->setVisible(FALSE); } - LLFloater* floaterp = NULL; LLFloater::setFloaterHost(sInstance); - { - floaterp = LLFloaterScriptDebugOutput::show(object_id); - } + LLFloater* floaterp = LLFloaterScriptDebugOutput::show(object_id); LLFloater::setFloaterHost(NULL); // Tabs sometimes overlap resize handle @@ -155,54 +157,19 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std: std::map LLFloaterScriptDebugOutput::sInstanceMap; -LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput() -: mObjectID(LLUUID::null) -{ - sInstanceMap[mObjectID] = this; -} - LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) -: LLFloater(std::string("script instance floater"), LLRect(0, 200, 200, 0), std::string("Script"), TRUE), mObjectID(object_id) + : LLFloater(), + mObjectID(object_id) { - S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; - S32 x = LLFLOATER_HPAD; - // History editor - // Give it a border on the top - LLRect history_editor_rect( - x, - y, - getRect().getWidth() - LLFLOATER_HPAD, - LLFLOATER_VPAD ); - mHistoryEditor = new LLViewerTextEditor( std::string("Chat History Editor"), - history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::getFontSansSerif()); - mHistoryEditor->setWordWrap( TRUE ); - mHistoryEditor->setFollowsAll(); - mHistoryEditor->setEnabled( FALSE ); - mHistoryEditor->setTabStop( TRUE ); // We want to be able to cut or copy from the history. - addChild(mHistoryEditor); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_debug_panel.xml"); + sInstanceMap[object_id] = this; } -void LLFloaterScriptDebugOutput::initFloater(const std::string& title, BOOL resizable, - S32 min_width, S32 min_height, BOOL drag_on_left, - BOOL minimizable, BOOL close_btn) +BOOL LLFloaterScriptDebugOutput::postBuild() { - LLFloater::initFloater(title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); - S32 y = getRect().getHeight() - LLFLOATER_HEADER_SIZE - LLFLOATER_VPAD; - S32 x = LLFLOATER_HPAD; - // History editor - // Give it a border on the top - LLRect history_editor_rect( - x, - y, - getRect().getWidth() - LLFLOATER_HPAD, - LLFLOATER_VPAD ); - mHistoryEditor = new LLViewerTextEditor( std::string("Chat History Editor"), - history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::getFontSansSerif()); - mHistoryEditor->setWordWrap( TRUE ); - mHistoryEditor->setFollowsAll(); - mHistoryEditor->setEnabled( FALSE ); - mHistoryEditor->setTabStop( TRUE ); // We want to be able to cut or copy from the history. - addChild(mHistoryEditor); + LLFloater::postBuild(); + mHistoryEditor = getChild("Chat History Editor"); + return TRUE; } LLFloaterScriptDebugOutput::~LLFloaterScriptDebugOutput() @@ -214,13 +181,13 @@ void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std: { if (mObjectID.isNull()) { - //setTitle("[All scripts]"); setCanTearOff(FALSE); setCanClose(FALSE); } else { setTitle(user_name); + setShortTitle(user_name); } mHistoryEditor->appendColoredText(utf8mesg, false, true, color); @@ -234,8 +201,7 @@ LLFloaterScriptDebugOutput* LLFloaterScriptDebugOutput::show(const LLUUID& objec if (found_it == sInstanceMap.end()) { floaterp = new LLFloaterScriptDebugOutput(object_id); - sInstanceMap[object_id] = floaterp; - floaterp->open(); /* Flawfinder: ignore*/ + floaterp->openFloater(); } else { diff --git a/indra/newview/llfloaterscriptdebug.h b/indra/newview/llfloaterscriptdebug.h index 59c0ba1c8b..5f2cf48125 100644 --- a/indra/newview/llfloaterscriptdebug.h +++ b/indra/newview/llfloaterscriptdebug.h @@ -33,7 +33,7 @@ #ifndef LL_LLFLOATERSCRIPTDEBUG_H #define LL_LLFLOATERSCRIPTDEBUG_H -#include "llfloater.h" +#include "llmultifloater.h" class LLTextEditor; class LLUUID; @@ -48,7 +48,7 @@ public: static void addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id); protected: - LLFloaterScriptDebug(); + LLFloaterScriptDebug(const std::string& filename); static LLFloater* addOutputWindow(const LLUUID& object_id); @@ -63,12 +63,10 @@ public: LLFloaterScriptDebugOutput(const LLUUID& object_id); ~LLFloaterScriptDebugOutput(); - virtual void initFloater(const std::string& title, BOOL resizable, - S32 min_width, S32 min_height, BOOL drag_on_left, - BOOL minimizable, BOOL close_btn); - void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color); + virtual BOOL postBuild(); + static LLFloaterScriptDebugOutput* show(const LLUUID& object_id); static LLFloaterScriptDebugOutput* getFloaterByID(const LLUUID& id); diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 92e070f766..6775e218cb 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -88,7 +88,6 @@ private: public: virtual BOOL postBuild(); - virtual void onClose(bool app_quitting); static LLFloaterSellLandUI* soleInstance(bool createIfNeeded); @@ -109,7 +108,7 @@ void LLFloaterSellLand::sellLand( LLFloaterSellLandUI* ui = LLFloaterSellLandUI::soleInstance(true); if (ui->setParcel(region, parcel)) { - ui->open(); /* Flawfinder: ignore */ + ui->openFloater(); } } @@ -139,7 +138,7 @@ LLFloaterSellLandUI* LLFloaterSellLandUI::soleInstance(bool createIfNeeded) } LLFloaterSellLandUI::LLFloaterSellLandUI() -: LLFloater(std::string("Sell Land")), +: LLFloater(), mRegion(0) { } @@ -159,7 +158,7 @@ void LLFloaterSellLandUI::SelectionObserver::changed() { if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - ui->close(); + ui->closeFloater(); } else { ui->setParcel( @@ -169,12 +168,6 @@ void LLFloaterSellLandUI::SelectionObserver::changed() } } -void LLFloaterSellLandUI::onClose(bool app_quitting) -{ - LLFloater::onClose(app_quitting); - destroy(); -} - BOOL LLFloaterSellLandUI::postBuild() { childSetCommitCallback("sell_to", onChangeValue, this); @@ -432,7 +425,7 @@ void LLFloaterSellLandUI::callbackAvatarPick(const std::vector& nam void LLFloaterSellLandUI::doCancel(void *userdata) { LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata; - self->close(); + self->closeFloater(); } // static @@ -490,7 +483,7 @@ void LLFloaterSellLandUI::doSellLand(void *userdata) LLNotification::Params params("ConfirmLandSaleChange"); params.substitutions(args) - .functor(boost::bind(&LLFloaterSellLandUI::onConfirmSale, self, _1, _2)); + .functor.function(boost::bind(&LLFloaterSellLandUI::onConfirmSale, self, _1, _2)); if (sell_to_anyone) { @@ -556,6 +549,6 @@ bool LLFloaterSellLandUI::onConfirmSale(const LLSD& notification, const LLSD& re // Send update to server LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); - close(); + closeFloater(); return false; } diff --git a/indra/newview/llfloatersellland.h b/indra/newview/llfloatersellland.h index 1b3a33ebb8..12b0ecbcef 100644 --- a/indra/newview/llfloatersellland.h +++ b/indra/newview/llfloatersellland.h @@ -31,7 +31,8 @@ #ifndef LL_LLFLOATERSELLLAND_H #define LL_LLFLOATERSELLLAND_H -#include "llmemory.h" + +#include "llsafehandle.h" class LLParcel; class LLViewerRegion; diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 2677467611..339b90a0f5 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -40,16 +40,15 @@ #include "llcolorswatch.h" #include "llviewercontrol.h" -LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL; -LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater(std::string("Configuration Editor")) +LLFloaterSettingsDebug::LLFloaterSettingsDebug(const LLSD& key) +: LLFloater(key) { + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_settings_debug.xml"); } LLFloaterSettingsDebug::~LLFloaterSettingsDebug() -{ - sInstance = NULL; -} +{} BOOL LLFloaterSettingsDebug::postBuild() { @@ -68,29 +67,31 @@ BOOL LLFloaterSettingsDebug::postBuild() } } func(settings_combo); - gSavedSettings.applyToAll(&func); - gSavedPerAccountSettings.applyToAll(&func); - gColors.applyToAll(&func); + std::string key = getKey().asString(); + if (key == "all" || key == "base") + { + gSavedSettings.applyToAll(&func); + } + if (key == "all" || key == "account") + { + gSavedPerAccountSettings.applyToAll(&func); + } + if (key == "all" || key == "skin") + { + gSavedSkinSettings.applyToAll(&func); + } settings_combo->sortByName(); - settings_combo->setCommitCallback(onSettingSelect); - settings_combo->setCallbackUserData(this); + settings_combo->setCommitCallback(onSettingSelect, this); settings_combo->updateSelection(); - childSetCommitCallback("val_spinner_1", onCommitSettings); - childSetUserData("val_spinner_1", this); - childSetCommitCallback("val_spinner_2", onCommitSettings); - childSetUserData("val_spinner_2", this); - childSetCommitCallback("val_spinner_3", onCommitSettings); - childSetUserData("val_spinner_3", this); - childSetCommitCallback("val_spinner_4", onCommitSettings); - childSetUserData("val_spinner_4", this); - childSetCommitCallback("val_text", onCommitSettings); - childSetUserData("val_text", this); - childSetCommitCallback("boolean_combo", onCommitSettings); - childSetUserData("boolean_combo", this); - childSetCommitCallback("color_swatch", onCommitSettings); - childSetUserData("color_swatch", this); + childSetCommitCallback("val_spinner_1", onCommitSettings, this); + childSetCommitCallback("val_spinner_2", onCommitSettings, this); + childSetCommitCallback("val_spinner_3", onCommitSettings, this); + childSetCommitCallback("val_spinner_4", onCommitSettings, this); + childSetCommitCallback("val_text", onCommitSettings, this); + childSetCommitCallback("boolean_combo", onCommitSettings, this); + childSetCommitCallback("color_swatch", onCommitSettings, this); childSetAction("default_btn", onClickDefault, this); mComment = getChild("comment_text"); return TRUE; @@ -105,19 +106,6 @@ void LLFloaterSettingsDebug::draw() LLFloater::draw(); } -//static -void LLFloaterSettingsDebug::show(void*) -{ - if (sInstance == NULL) - { - sInstance = new LLFloaterSettingsDebug(); - - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_settings_debug.xml"); - } - - sInstance->open(); /* Flawfinder: ignore */ -} - //static void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data) { @@ -192,12 +180,6 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) //col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); //controlp->set(col3.getValue()); break; - case TYPE_COL4U: - col3.setValue(floaterp->childGetValue("color_swatch")); - col4U.setVecScaleClamp(col3); - col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger(); - controlp->set(col4U.getValue()); - break; default: break; } @@ -464,29 +446,6 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) color_swatch->setValue(sd); break; } - case TYPE_COL4U: - { - LLColor4U clr; - clr.setValue(sd); - color_swatch->setVisible(TRUE); - if(LLColor4(clr) != LLColor4(color_swatch->getValue())) - { - color_swatch->set(LLColor4(clr), TRUE, FALSE); - } - spinner4->setVisible(TRUE); - spinner4->setLabel(std::string("Alpha")); - if(!spinner4->hasFocus()) - { - spinner4->setPrecision(0); - spinner4->setValue(clr.mV[VALPHA]); - } - - spinner4->setMinValue(0); - spinner4->setMaxValue(255); - spinner4->setIncrement(1.f); - - break; - } default: mComment->setText(std::string("unknown")); break; diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index e08e6b5d74..0a98021c79 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -37,10 +37,14 @@ #include "llfloater.h" #include "lltexteditor.h" -class LLFloaterSettingsDebug : public LLFloater +class LLFloaterSettingsDebug +: public LLFloater, + public LLFloaterSingleton { public: - LLFloaterSettingsDebug(); + // key - selects which settings to show, one of: + // "all", "base", "account", "skin" + LLFloaterSettingsDebug(const LLSD& key); virtual ~LLFloaterSettingsDebug(); virtual BOOL postBuild(); @@ -48,13 +52,11 @@ public: void updateControl(LLControlVariable* control); - static void show(void*); static void onSettingSelect(LLUICtrl* ctrl, void* user_data); static void onCommitSettings(LLUICtrl* ctrl, void* user_data); static void onClickDefault(void* user_data); protected: - static LLFloaterSettingsDebug* sInstance; LLTextEditor* mComment; }; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index e68d699d03..cb4f2a6711 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -34,15 +34,9 @@ #include "llfloatersnapshot.h" -#include "llfontgl.h" -#include "llsys.h" -#include "llgl.h" -#include "llrender.h" -#include "v3dmath.h" -#include "llmath.h" -#include "lldir.h" -#include "llsdserialize.h" +#include "llfloaterreg.h" +// Viewer includes #include "llagent.h" #include "llcallbacklist.h" #include "llcriticaldamp.h" @@ -67,14 +61,24 @@ #include "lltoolmgr.h" #include "llworld.h" +// Linden library includes +#include "llfontgl.h" +#include "llsys.h" +#include "llrender.h" +#include "v3dmath.h" +#include "llmath.h" +#include "lldir.h" +#include "llsdserialize.h" #include "llgl.h" #include "llglheaders.h" #include "llimagejpeg.h" #include "llimagepng.h" #include "llimagebmp.h" #include "llimagej2c.h" +#include "llresmgr.h" // LLLocale #include "llvfile.h" #include "llvfs.h" +#include "llwindow.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -85,8 +89,6 @@ S32 LLFloaterSnapshot::sUIWinWidth = 215 ; LLSnapshotFloaterView* gSnapshotFloaterView = NULL; -LLFloaterSnapshot* LLFloaterSnapshot::sInstance = NULL; - const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f; F32 SHINE_TIME = 0.5f; @@ -112,7 +114,17 @@ public: }; - LLSnapshotLivePreview(const LLRect& rect); + struct Params : public LLInitParam::Block + { + Params() + { + name = "snapshot_live_preview"; + mouse_opaque = false; + } + }; + + + LLSnapshotLivePreview(const LLSnapshotLivePreview::Params& p); ~LLSnapshotLivePreview(); /*virtual*/ void draw(); @@ -200,8 +212,9 @@ public: }; std::set LLSnapshotLivePreview::sList; -LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : - LLView(std::string("snapshot_live_preview"), rect, FALSE), + +LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Params& p) +: LLView(p), mColor(1.f, 0.f, 0.f, 0.5f), mCurImageIndex(0), mPreviewImage(NULL), @@ -472,10 +485,6 @@ void LLSnapshotLivePreview::draw() } else if (mShineAnimTimer.getStarted()) { - //LLDebugVarMessageBox::show("Shine time", &SHINE_TIME, 10.f, 0.1f); - //LLDebugVarMessageBox::show("Shine width", &SHINE_WIDTH, 2.f, 0.05f); - //LLDebugVarMessageBox::show("Shine opacity", &SHINE_OPACITY, 1.f, 0.05f); - F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME); // draw "shine" effect @@ -959,7 +968,7 @@ void LLSnapshotLivePreview::saveTexture() { LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE); std::string pos_string; - gAgent.buildLocationString(pos_string); + gAgent.buildLocationString(pos_string, LLAgent::LOCATION_FORMAT_FULL); std::string who_took_it; gAgent.buildFullname(who_took_it); LLAssetStorage::LLStoreAssetCallback callback = NULL; @@ -1053,9 +1062,6 @@ public: static void updateLayout(LLFloaterSnapshot* floater); static void updateResolutionTextEntry(LLFloaterSnapshot* floater); - static LLHandle sPreviewHandle; - static BOOL sAspectRatioCheckOff ; - private: static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); @@ -1068,18 +1074,14 @@ public: std::vector mAvatarPauseHandles; LLToolset* mLastToolset; + LLHandle mPreviewHandle; + BOOL mAspectRatioCheckOff ; }; -// static -LLHandle LLFloaterSnapshot::Impl::sPreviewHandle; - -//static -BOOL LLFloaterSnapshot::Impl::sAspectRatioCheckOff = FALSE ; - // static LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) { - LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)sPreviewHandle.get(); + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get(); return previewp; } @@ -1186,7 +1188,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) iter != LLCharacter::sInstances.end(); ++iter) { avatarp = *iter; - sInstance->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); + floaterp->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); } // freeze everything else @@ -1194,7 +1196,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) { - sInstance->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); + floaterp->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); } } @@ -1209,15 +1211,15 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) } //RN: thaw all avatars - sInstance->impl.mAvatarPauseHandles.clear(); + floaterp->impl.mAvatarPauseHandles.clear(); // thaw everything else gSavedSettings.setBOOL("FreezeTime", FALSE); // restore last tool (e.g. pie menu, etc) - if (sInstance->impl.mLastToolset) + if (floaterp->impl.mLastToolset) { - LLToolMgr::getInstance()->setCurrentToolset(sInstance->impl.mLastToolset); + LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl.mLastToolset); } } } @@ -1248,7 +1250,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); - floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !sAspectRatioCheckOff); + floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot"); @@ -1295,7 +1297,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->childSetColor("file_size_label", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLColor4::red : gColors.getColor( "LabelTextColor" )); + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLColor4::red : LLUI::sSettingGroups["color"]->getColor( "LabelTextColor" )); switch(shot_type) { @@ -1369,7 +1371,7 @@ void LLFloaterSnapshot::Impl::onClickDiscard(void* data) LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; if (view) { - view->close(); + view->closeFloater(); } } @@ -1415,7 +1417,7 @@ void LLFloaterSnapshot::Impl::onClickKeep(void* data) if (gSavedSettings.getBOOL("CloseSnapshotOnKeep")) { - view->close(); + view->closeFloater(); } else { @@ -1596,7 +1598,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde if(0 == index) //current window size { - sAspectRatioCheckOff = TRUE ; + view->impl.mAspectRatioCheckOff = TRUE ; view->childSetEnabled("keep_aspect_check", FALSE) ; if(previewp) @@ -1606,7 +1608,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde } else if(-1 == index) //custom { - sAspectRatioCheckOff = FALSE ; + view->impl.mAspectRatioCheckOff = FALSE ; //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) { view->childSetEnabled("keep_aspect_check", TRUE) ; @@ -1619,7 +1621,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde } else { - sAspectRatioCheckOff = TRUE ; + view->impl.mAspectRatioCheckOff = TRUE ; view->childSetEnabled("keep_aspect_check", FALSE) ; if(previewp) @@ -1955,21 +1957,17 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat ///---------------------------------------------------------------------------- // Default constructor -LLFloaterSnapshot::LLFloaterSnapshot() - : LLFloater(std::string("Snapshot Floater")), +LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key) + : LLFloater(key), impl (*(new Impl)) { + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE); } // Destroys the object LLFloaterSnapshot::~LLFloaterSnapshot() { - if (sInstance == this) - { - LLView::deleteViewByHandle(Impl::sPreviewHandle); - Impl::sPreviewHandle = LLHandle(); - sInstance = NULL; - } + LLView::deleteViewByHandle(impl.mPreviewHandle); //unfreeze everything else gSavedSettings.setBOOL("FreezeTime", FALSE); @@ -2034,16 +2032,22 @@ BOOL LLFloaterSnapshot::postBuild() childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); // create preview window - LLRect full_screen_rect = sInstance->getRootView()->getRect(); - LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(full_screen_rect); - sInstance->getRootView()->removeChild(gSnapshotFloaterView); + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + getRootView()->removeChild(gSnapshotFloaterView); // make sure preview is below snapshot floater - sInstance->getRootView()->addChild(previewp); - sInstance->getRootView()->addChild(gSnapshotFloaterView); - - Impl::sPreviewHandle = previewp->getHandle(); + getRootView()->addChild(previewp); + getRootView()->addChild(gSnapshotFloaterView); + + //move snapshot floater to special purpose snapshotfloaterview + gFloaterView->removeChild(this); + gSnapshotFloaterView->addChild(this); + impl.mPreviewHandle = previewp->getHandle(); impl.updateControls(this); + impl.updateLayout(this); return TRUE; } @@ -2077,54 +2081,34 @@ void LLFloaterSnapshot::draw() } } -void LLFloaterSnapshot::onClose(bool app_quitting) -{ - gSnapshotFloaterView->setEnabled(FALSE); - // Set invisible so it doesn't eat tooltips. JC - gSnapshotFloaterView->setVisible(FALSE); - destroy(); -} - -// static -void LLFloaterSnapshot::show(void*) +void LLFloaterSnapshot::onOpen(const LLSD& key) { - if (!sInstance) - { - sInstance = new LLFloaterSnapshot(); - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_snapshot.xml", NULL, FALSE); - //move snapshot floater to special purpose snapshotfloaterview - gFloaterView->removeChild(sInstance); - gSnapshotFloaterView->addChild(sInstance); - - sInstance->impl.updateLayout(sInstance); - } - else // just refresh the snapshot in the existing floater instance (DEV-12255) + LLSnapshotLivePreview* preview = LLFloaterSnapshot::Impl::getPreviewView(this); + if(preview) { - LLSnapshotLivePreview* preview = LLFloaterSnapshot::Impl::getPreviewView(sInstance); - if(preview) - { - preview->updateSnapshot(TRUE); - } + preview->updateSnapshot(TRUE); } - - sInstance->open(); /* Flawfinder: ignore */ - sInstance->focusFirstItem(FALSE); + focusFirstItem(FALSE); gSnapshotFloaterView->setEnabled(TRUE); gSnapshotFloaterView->setVisible(TRUE); - gSnapshotFloaterView->adjustToFitScreen(sInstance, FALSE); + gSnapshotFloaterView->adjustToFitScreen(this, FALSE); } -void LLFloaterSnapshot::hide(void*) +void LLFloaterSnapshot::onClose(bool app_quitting) { - if (sInstance && !sInstance->isDead()) - { - sInstance->close(); - } + gSnapshotFloaterView->setEnabled(FALSE); + // Set invisible so it doesn't eat tooltips. JC + gSnapshotFloaterView->setVisible(FALSE); + destroy(); } //static void LLFloaterSnapshot::update() { + LLFloaterSnapshot* inst = LLFloaterReg::findTypedInstance("snapshot"); + if (!inst) + return; + BOOL changed = FALSE; for (std::set::iterator iter = LLSnapshotLivePreview::sList.begin(); iter != LLSnapshotLivePreview::sList.end(); ++iter) @@ -2133,7 +2117,7 @@ void LLFloaterSnapshot::update() } if(changed) { - sInstance->impl.updateControls(sInstance); + inst->impl.updateControls(inst); } } @@ -2142,10 +2126,8 @@ void LLFloaterSnapshot::update() /// Class LLSnapshotFloaterView ///---------------------------------------------------------------------------- -LLSnapshotFloaterView::LLSnapshotFloaterView( const std::string& name, const LLRect& rect ) : LLFloaterView(name, rect) +LLSnapshotFloaterView::LLSnapshotFloaterView (const Params& p) : LLFloaterView (p) { - setMouseOpaque(TRUE); - setEnabled(FALSE); } LLSnapshotFloaterView::~LLSnapshotFloaterView() diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 14f1872cd1..1333497bd2 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -35,10 +35,6 @@ #include "llfloater.h" -#include "llmemory.h" -#include "llimagegl.h" -#include "llcharacter.h" - class LLFloaterSnapshot : public LLFloater { @@ -50,17 +46,16 @@ public: SNAPSHOT_FORMAT_BMP } ESnapshotFormat; - LLFloaterSnapshot(); + LLFloaterSnapshot(const LLSD& key); virtual ~LLFloaterSnapshot(); - + /*virtual*/ BOOL postBuild(); /*virtual*/ void draw(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); - - static void show(void*); - static void hide(void*); + static void update(); - + static S32 getUIWinHeightLong() {return sUIWinHeightLong ;} static S32 getUIWinHeightShort() {return sUIWinHeightShort ;} static S32 getUIWinWidth() {return sUIWinWidth ;} @@ -69,7 +64,6 @@ private: class Impl; Impl& impl; - static LLFloaterSnapshot* sInstance; static S32 sUIWinHeightLong ; static S32 sUIWinHeightShort ; static S32 sUIWinWidth ; @@ -78,7 +72,16 @@ private: class LLSnapshotFloaterView : public LLFloaterView { public: - LLSnapshotFloaterView( const std::string& name, const LLRect& rect ); + struct Params + : public LLInitParam::Block + { + }; + +protected: + LLSnapshotFloaterView (const Params& p); + friend class LLUICtrlFactory; + +public: virtual ~LLSnapshotFloaterView(); /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp index 530bb87983..1d2d3b98f2 100644 --- a/indra/newview/llfloatertelehub.cpp +++ b/indra/newview/llfloatertelehub.cpp @@ -81,7 +81,7 @@ void LLFloaterTelehub::show() } LLFloaterTelehub::LLFloaterTelehub() -: LLFloater(std::string("telehub")), +: LLFloater(), mTelehubObjectID(), mTelehubObjectName(), mTelehubPos(), @@ -94,6 +94,11 @@ LLFloaterTelehub::LLFloaterTelehub() LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_telehub.xml"); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); +} +BOOL LLFloaterTelehub::postBuild() +{ + childSetAction("connect_btn", onClickConnect, this); childSetAction("disconnect_btn", onClickDisconnect, this); childSetAction("add_spawn_point_btn", onClickAddSpawnPoint, this); @@ -106,9 +111,8 @@ LLFloaterTelehub::LLFloaterTelehub() list->setAllowKeyboardMovement(FALSE); } - mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + return TRUE; } - LLFloaterTelehub::~LLFloaterTelehub() { sInstance = NULL; diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h index 28c9d16573..b639338dfc 100644 --- a/indra/newview/llfloatertelehub.h +++ b/indra/newview/llfloatertelehub.h @@ -48,7 +48,7 @@ public: static void show(); virtual void draw(); - + /*virtual*/ BOOL postBuild(); static BOOL renderBeacons(); static void addBeacons(); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index a33b49563c..62a8c0d27e 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -54,6 +54,7 @@ #include "llpanelobject.h" #include "llpanelvolume.h" #include "llpanelpermissions.h" +#include "llradiogroup.h" #include "llresmgr.h" #include "llselectmgr.h" #include "llslider.h" @@ -95,25 +96,21 @@ const std::string PANEL_NAMES[LLFloaterTools::PANEL_COUNT] = }; // Local prototypes -void commit_select_tool(LLUICtrl *ctrl, void *data); void commit_select_component(LLUICtrl *ctrl, void *data); void click_show_more(void*); void click_popup_info(void*); void click_popup_done(void*); void click_popup_minimize(void*); -void click_popup_grab_drag(LLUICtrl *, void*); -void click_popup_grab_lift(LLUICtrl *, void*); -void click_popup_grab_spin(LLUICtrl *, void*); void click_popup_rotate_left(void*); void click_popup_rotate_reset(void*); void click_popup_rotate_right(void*); -void click_popup_dozer_mode(LLUICtrl *, void *user); void commit_slider_dozer_size(LLUICtrl *, void*); void commit_slider_dozer_force(LLUICtrl *, void*); void click_apply_to_selection(void*); -void commit_radio_zoom(LLUICtrl *, void*); -void commit_radio_orbit(LLUICtrl *, void*); -void commit_radio_pan(LLUICtrl *, void*); +void commit_radio_group_focus(LLUICtrl* ctrl, void* data); +void commit_radio_group_move(LLUICtrl* ctrl, void* data); +void commit_radio_group_edit(LLUICtrl* ctrl, void* data); +void commit_radio_group_land(LLUICtrl* ctrl, void* data); void commit_grid_mode(LLUICtrl *, void*); void commit_slider_zoom(LLUICtrl *, void*); @@ -122,14 +119,14 @@ void commit_slider_zoom(LLUICtrl *, void*); void* LLFloaterTools::createPanelPermissions(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelPermissions = new LLPanelPermissions("General"); + floater->mPanelPermissions = new LLPanelPermissions(); return floater->mPanelPermissions; } //static void* LLFloaterTools::createPanelObject(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelObject = new LLPanelObject("Object"); + floater->mPanelObject = new LLPanelObject(); return floater->mPanelObject; } @@ -137,7 +134,7 @@ void* LLFloaterTools::createPanelObject(void* data) void* LLFloaterTools::createPanelVolume(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelVolume = new LLPanelVolume("Features"); + floater->mPanelVolume = new LLPanelVolume(); return floater->mPanelVolume; } @@ -145,7 +142,7 @@ void* LLFloaterTools::createPanelVolume(void* data) void* LLFloaterTools::createPanelFace(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelFace = new LLPanelFace("Texture"); + floater->mPanelFace = new LLPanelFace(); return floater->mPanelFace; } @@ -153,26 +150,51 @@ void* LLFloaterTools::createPanelFace(void* data) void* LLFloaterTools::createPanelContents(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelContents = new LLPanelContents("Contents"); + floater->mPanelContents = new LLPanelContents(); return floater->mPanelContents; } -//static -void* LLFloaterTools::createPanelContentsInventory(void* data) -{ - LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelContents->mPanelInventory = new LLPanelInventory(std::string("ContentsInventory"), LLRect()); - return floater->mPanelContents->mPanelInventory; -} - //static void* LLFloaterTools::createPanelLandInfo(void* data) { LLFloaterTools* floater = (LLFloaterTools*)data; - floater->mPanelLandInfo = new LLPanelLandInfo(std::string("land info panel")); + floater->mPanelLandInfo = new LLPanelLandInfo(); return floater->mPanelLandInfo; } +static const std::string toolNames[]={ + "ToolCube", + "ToolPrism", + "ToolPyramid", + "ToolTetrahedron", + "ToolCylinder", + "ToolHemiCylinder", + "ToolCone", + "ToolHemiCone", + "ToolSphere", + "ToolHemiSphere", + "ToolTorus", + "ToolTube", + "ToolRing", + "ToolTree", + "ToolGrass"}; +LLPCode toolData[]={ + LL_PCODE_CUBE, + LL_PCODE_PRISM, + LL_PCODE_PYRAMID, + LL_PCODE_TETRAHEDRON, + LL_PCODE_CYLINDER, + LL_PCODE_CYLINDER_HEMI, + LL_PCODE_CONE, + LL_PCODE_CONE_HEMI, + LL_PCODE_SPHERE, + LL_PCODE_SPHERE_HEMI, + LL_PCODE_TORUS, + LLViewerObject::LL_VO_SQUARE_TORUS, + LLViewerObject::LL_VO_TRIANGLE_TORUS, + LL_PCODE_LEGACY_TREE, + LL_PCODE_LEGACY_GRASS}; + BOOL LLFloaterTools::postBuild() { @@ -200,27 +222,15 @@ BOOL LLFloaterTools::postBuild() childSetCommitCallback("slider zoom",commit_slider_zoom,this); - mRadioZoom = getChild("radio zoom"); - childSetCommitCallback("radio zoom",commit_radio_zoom,this); - mRadioOrbit = getChild("radio orbit"); - childSetCommitCallback("radio orbit",commit_radio_orbit,this); - mRadioPan = getChild("radio pan"); - childSetCommitCallback("radio pan",commit_radio_pan,this); - - mRadioMove = getChild("radio move"); - childSetCommitCallback("radio move",click_popup_grab_drag,this); - mRadioLift = getChild("radio lift"); - childSetCommitCallback("radio lift",click_popup_grab_lift,this); - mRadioSpin = getChild("radio spin"); - childSetCommitCallback("radio spin",click_popup_grab_spin,NULL); - mRadioPosition = getChild("radio position"); - childSetCommitCallback("radio position",commit_select_tool,LLToolCompTranslate::getInstance()); - mRadioRotate = getChild("radio rotate"); - childSetCommitCallback("radio rotate",commit_select_tool,LLToolCompRotate::getInstance()); - mRadioStretch = getChild("radio stretch"); - childSetCommitCallback("radio stretch",commit_select_tool,LLToolCompScale::getInstance()); - mRadioSelectFace = getChild("radio select face"); - childSetCommitCallback("radio select face",commit_select_tool,LLToolFace::getInstance()); + mRadioGroupFocus = getChild("focus_radio_group"); + childSetCommitCallback("focus_radio_group", commit_radio_group_focus, this); + + mRadioGroupMove = getChild("move_radio_group"); + childSetCommitCallback("move_radio_group", commit_radio_group_move, this); + + mRadioGroupEdit = getChild("edit_radio_group"); + childSetCommitCallback("edit_radio_group", commit_radio_group_edit, this); + mCheckSelectIndividual = getChild("checkbox edit linked parts"); childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts")); childSetCommitCallback("checkbox edit linked parts",commit_select_component,this); @@ -239,44 +249,12 @@ BOOL LLFloaterTools::postBuild() // Create Buttons // - static const std::string toolNames[]={ - "ToolCube", - "ToolPrism", - "ToolPyramid", - "ToolTetrahedron", - "ToolCylinder", - "ToolHemiCylinder", - "ToolCone", - "ToolHemiCone", - "ToolSphere", - "ToolHemiSphere", - "ToolTorus", - "ToolTube", - "ToolRing", - "ToolTree", - "ToolGrass"}; - void* toolData[]={ - &LLToolPlacerPanel::sCube, - &LLToolPlacerPanel::sPrism, - &LLToolPlacerPanel::sPyramid, - &LLToolPlacerPanel::sTetrahedron, - &LLToolPlacerPanel::sCylinder, - &LLToolPlacerPanel::sCylinderHemi, - &LLToolPlacerPanel::sCone, - &LLToolPlacerPanel::sConeHemi, - &LLToolPlacerPanel::sSphere, - &LLToolPlacerPanel::sSphereHemi, - &LLToolPlacerPanel::sTorus, - &LLToolPlacerPanel::sSquareTorus, - &LLToolPlacerPanel::sTriangleTorus, - &LLToolPlacerPanel::sTree, - &LLToolPlacerPanel::sGrass}; for(size_t t=0; t(toolNames[t]); if(found) { - found->setClickedCallback(setObjectType,toolData[t]); + found->setClickedCallback(boost::bind(&LLFloaterTools::setObjectType, toolData[t])); mButtons.push_back( found ); }else{ llwarns << "Tool button not found! DOA Pending." << llendl; @@ -290,20 +268,10 @@ BOOL LLFloaterTools::postBuild() childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters")); mCheckCopyRotates = getChild("checkbox copy rotates"); childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates")); - mRadioSelectLand = getChild("radio select land"); - childSetCommitCallback("radio select land",commit_select_tool, LLToolSelectLand::getInstance()); - mRadioDozerFlatten = getChild("radio flatten"); - childSetCommitCallback("radio flatten",click_popup_dozer_mode, (void*)0); - mRadioDozerRaise = getChild("radio raise"); - childSetCommitCallback("radio raise",click_popup_dozer_mode, (void*)1); - mRadioDozerLower = getChild("radio lower"); - childSetCommitCallback("radio lower",click_popup_dozer_mode, (void*)2); - mRadioDozerSmooth = getChild("radio smooth"); - childSetCommitCallback("radio smooth",click_popup_dozer_mode, (void*)3); - mRadioDozerNoise = getChild("radio noise"); - childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4); - mRadioDozerRevert = getChild("radio revert"); - childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5); + + mRadioGroupLand = getChild("land_radio_group"); + childSetCommitCallback("land_radio_group", commit_radio_group_land, this); + mBtnApplyToSelection = getChild("button apply to selection"); childSetAction("button apply to selection",click_apply_to_selection, (void*)0); @@ -338,8 +306,8 @@ BOOL LLFloaterTools::postBuild() // Create the popupview with a dummy center. It will be moved into place // during LLViewerWindow's per-frame hover processing. -LLFloaterTools::LLFloaterTools() -: LLFloater(std::string("toolbox floater")), +LLFloaterTools::LLFloaterTools(const LLSD& key) +: LLFloater(key), mBtnFocus(NULL), mBtnMove(NULL), mBtnEdit(NULL), @@ -347,18 +315,10 @@ LLFloaterTools::LLFloaterTools() mBtnLand(NULL), mTextStatus(NULL), - mRadioOrbit(NULL), - mRadioZoom(NULL), - mRadioPan(NULL), - - mRadioMove(NULL), - mRadioLift(NULL), - mRadioSpin(NULL), + mRadioGroupFocus(NULL), + mRadioGroupMove(NULL), + mRadioGroupEdit(NULL), - mRadioPosition(NULL), - mRadioRotate(NULL), - mRadioStretch(NULL), - mRadioSelectFace(NULL), mCheckSelectIndividual(NULL), mCheckSnapToGrid(NULL), @@ -380,13 +340,7 @@ LLFloaterTools::LLFloaterTools() mCheckCopySelection(NULL), mCheckCopyCenters(NULL), mCheckCopyRotates(NULL), - mRadioSelectLand(NULL), - mRadioDozerFlatten(NULL), - mRadioDozerRaise(NULL), - mRadioDozerLower(NULL), - mRadioDozerSmooth(NULL), - mRadioDozerNoise(NULL), - mRadioDozerRevert(NULL), + mRadioGroupLand(NULL), mSliderDozerSize(NULL), mSliderDozerForce(NULL), mBtnApplyToSelection(NULL), @@ -402,22 +356,23 @@ LLFloaterTools::LLFloaterTools() mTabLand(NULL), mDirty(TRUE) { + gFloaterTools = this; + setAutoFocus(FALSE); - LLCallbackMap::map_t factory_map; - factory_map["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions - factory_map["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject - factory_map["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume - factory_map["Texture"] = LLCallbackMap(createPanelFace, this);//LLPanelFace - factory_map["Contents"] = LLCallbackMap(createPanelContents, this);//LLPanelContents - factory_map["ContentsInventory"] = LLCallbackMap(createPanelContentsInventory, this);//LLPanelContents - factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo - - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_tools.xml",&factory_map,FALSE); + mFactoryMap["General"] = LLCallbackMap(createPanelPermissions, this);//LLPanelPermissions + mFactoryMap["Object"] = LLCallbackMap(createPanelObject, this);//LLPanelObject + mFactoryMap["Features"] = LLCallbackMap(createPanelVolume, this);//LLPanelVolume + mFactoryMap["Texture"] = LLCallbackMap(createPanelFace, this);//LLPanelFace + mFactoryMap["Contents"] = LLCallbackMap(createPanelContents, this);//LLPanelContents + mFactoryMap["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo + + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_tools.xml",FALSE); } LLFloaterTools::~LLFloaterTools() { // children automatically deleted + gFloaterTools = NULL; } void LLFloaterTools::setStatusText(const std::string& text) @@ -525,26 +480,31 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnFocus ->setToggleState( focus_visible ); - mRadioZoom ->setVisible( focus_visible ); - mRadioOrbit ->setVisible( focus_visible ); - mRadioPan ->setVisible( focus_visible ); + mRadioGroupFocus->setVisible( focus_visible ); childSetVisible("slider zoom", focus_visible); childSetEnabled("slider zoom", gCameraBtnZoom); - mRadioZoom ->set( !gCameraBtnOrbit && - !gCameraBtnPan && - !(mask == MASK_ORBIT) && - !(mask == (MASK_ORBIT | MASK_ALT)) && - !(mask == MASK_PAN) && - !(mask == (MASK_PAN | MASK_ALT)) ); - - mRadioOrbit ->set( gCameraBtnOrbit || - (mask == MASK_ORBIT) || - (mask == (MASK_ORBIT | MASK_ALT)) ); - - mRadioPan ->set( gCameraBtnPan || - (mask == MASK_PAN) || - (mask == (MASK_PAN | MASK_ALT)) ); + if (!gCameraBtnOrbit && + !gCameraBtnPan && + !(mask == MASK_ORBIT) && + !(mask == (MASK_ORBIT | MASK_ALT)) && + !(mask == MASK_PAN) && + !(mask == (MASK_PAN | MASK_ALT)) ) + { + mRadioGroupFocus->setValue("radio zoom"); + } + else if ( gCameraBtnOrbit || + (mask == MASK_ORBIT) || + (mask == (MASK_ORBIT | MASK_ALT)) ) + { + mRadioGroupFocus->setValue("radio orbit"); + } + else if ( gCameraBtnPan || + (mask == MASK_PAN) || + (mask == (MASK_PAN | MASK_ALT)) ) + { + mRadioGroupFocus->setValue("radio pan"); + } // multiply by correction factor because volume sliders go [0, 0.5] childSetValue( "slider zoom", gAgent.getCameraZoomFraction() * 0.5f); @@ -555,27 +515,23 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mBtnMove) mBtnMove ->setToggleState( move_visible ); // HACK - highlight buttons for next click - if (mRadioMove) + mRadioGroupMove->setVisible(move_visible); + if (!gGrabBtnSpin && + !gGrabBtnVertical && + !(mask == MASK_VERTICAL) && + !(mask == MASK_SPIN) ) { - mRadioMove ->setVisible( move_visible ); - mRadioMove ->set( !gGrabBtnSpin && - !gGrabBtnVertical && - !(mask == MASK_VERTICAL) && - !(mask == MASK_SPIN) ); + mRadioGroupMove->setValue("radio move"); } - - if (mRadioLift) + else if (gGrabBtnVertical || + (mask == MASK_VERTICAL) ) { - mRadioLift ->setVisible( move_visible ); - mRadioLift ->set( gGrabBtnVertical || - (mask == MASK_VERTICAL) ); + mRadioGroupMove->setValue("radio lift"); } - - if (mRadioSpin) + else if (gGrabBtnSpin || + (mask == MASK_SPIN) ) { - mRadioSpin ->setVisible( move_visible ); - mRadioSpin ->set( gGrabBtnSpin || - (mask == MASK_SPIN) ); + mRadioGroupMove->setValue("radio spin"); } // Edit buttons @@ -587,15 +543,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) tool == LLToolPipette::getInstance(); mBtnEdit ->setToggleState( edit_visible ); - - mRadioPosition ->setVisible( edit_visible ); - mRadioRotate ->setVisible( edit_visible ); - mRadioStretch ->setVisible( edit_visible ); - if (mRadioSelectFace) - { - mRadioSelectFace->setVisible( edit_visible ); - mRadioSelectFace->set( tool == LLToolFace::getInstance() ); - } + mRadioGroupEdit->setVisible( edit_visible ); if (mCheckSelectIndividual) { @@ -603,9 +551,22 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) //mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); } - mRadioPosition ->set( tool == LLToolCompTranslate::getInstance() ); - mRadioRotate ->set( tool == LLToolCompRotate::getInstance() ); - mRadioStretch ->set( tool == LLToolCompScale::getInstance() ); + if ( tool == LLToolCompTranslate::getInstance() ) + { + mRadioGroupEdit->setValue("radio position"); + } + else if ( tool == LLToolCompRotate::getInstance() ) + { + mRadioGroupEdit->setValue("radio rotate"); + } + else if ( tool == LLToolCompScale::getInstance() ) + { + mRadioGroupEdit->setValue("radio stretch"); + } + else if ( tool == LLToolFace::getInstance() ) + { + mRadioGroupEdit->setValue("radio select face"); + } if (mComboGridMode) { @@ -662,15 +623,13 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) else { // Highlight the correct placer button - for( std::vector::size_type i = 0; i < mButtons.size(); i++ ) + for( S32 t = 0; t < (S32)mButtons.size(); t++ ) { LLPCode pcode = LLToolPlacer::getObjectType(); - void *userdata = mButtons[i]->getCallbackUserData(); - LLPCode *cur = (LLPCode*) userdata; - - BOOL state = (pcode == *cur); - mButtons[i]->setToggleState( state ); - mButtons[i]->setVisible( create_visible ); + LLPCode button_pcode = toolData[t]; + BOOL state = (pcode == button_pcode); + mButtons[t]->setToggleState( state ); + mButtons[t]->setVisible( create_visible ); } } @@ -687,44 +646,39 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mBtnLand) mBtnLand ->setToggleState( land_visible ); - // mRadioEditLand ->set( tool == LLToolBrushLand::getInstance() ); - if (mRadioSelectLand) mRadioSelectLand->set( tool == LLToolSelectLand::getInstance() ); - - // mRadioEditLand ->setVisible( land_visible ); - if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible ); - - S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction"); - - if (mRadioDozerFlatten) + mRadioGroupLand->setVisible( land_visible ); + if ( tool == LLToolSelectLand::getInstance() ) { - mRadioDozerFlatten ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 0); - mRadioDozerFlatten ->setVisible( land_visible ); + mRadioGroupLand->setValue("radio select land"); } - if (mRadioDozerRaise) + else if ( tool == LLToolBrushLand::getInstance() ) { - mRadioDozerRaise ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 1); - mRadioDozerRaise ->setVisible( land_visible ); - } - if (mRadioDozerLower) - { - mRadioDozerLower ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 2); - mRadioDozerLower ->setVisible( land_visible ); - } - if (mRadioDozerSmooth) - { - mRadioDozerSmooth ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 3); - mRadioDozerSmooth ->setVisible( land_visible ); - } - if (mRadioDozerNoise) - { - mRadioDozerNoise ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 4); - mRadioDozerNoise ->setVisible( land_visible ); - } - if (mRadioDozerRevert) - { - mRadioDozerRevert ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 5); - mRadioDozerRevert ->setVisible( land_visible ); + S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction"); + switch(dozer_mode) + { + case 0: + mRadioGroupLand->setValue("radio flatten"); + break; + case 1: + mRadioGroupLand->setValue("radio raise"); + break; + case 2: + mRadioGroupLand->setValue("radio lower"); + break; + case 3: + mRadioGroupLand->setValue("radio smooth"); + break; + case 4: + mRadioGroupLand->setValue("radio noise"); + break; + case 5: + mRadioGroupLand->setValue("radio revert"); + break; + default: + break; + } } + if (mBtnApplyToSelection) { mBtnApplyToSelection->setVisible( land_visible ); @@ -757,13 +711,18 @@ BOOL LLFloaterTools::canClose() } // virtual -void LLFloaterTools::onOpen() +void LLFloaterTools::onOpen(const LLSD& key) { mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); - // gMenuBarView->setItemVisible(std::string("Tools"), TRUE); - // gMenuBarView->arrange(); + std::string panel = key.asString(); + if (!panel.empty()) + { + mTab->selectTabByName(panel); + } + + gMenuBarView->setItemVisible("BuildTools", TRUE); } // virtual @@ -796,19 +755,11 @@ void LLFloaterTools::onClose(bool app_quitting) // so manually reset tool to default (pie menu tool) LLToolMgr::getInstance()->getCurrentToolset()->selectFirstTool(); - // gMenuBarView->setItemVisible(std::string("Tools"), FALSE); - // gMenuBarView->arrange(); -} - -void LLFloaterTools::showPanel(EInfoPanel panel) -{ - llassert(panel >= 0 && panel < PANEL_COUNT); - mTab->selectTabByName(PANEL_NAMES[panel]); + gMenuBarView->setItemVisible("BuildTools", FALSE); } void click_popup_info(void*) { -// gBuildView->setPropertiesPanelOpen(TRUE); } void click_popup_done(void*) @@ -816,43 +767,49 @@ void click_popup_done(void*) handle_reset_view(); } -void click_popup_grab_drag(LLUICtrl*, void*) +void commit_radio_group_move(LLUICtrl* ctrl, void* data) { - gGrabBtnVertical = FALSE; - gGrabBtnSpin = FALSE; -} - -void click_popup_grab_lift(LLUICtrl*, void*) -{ - gGrabBtnVertical = TRUE; - gGrabBtnSpin = FALSE; -} - -void click_popup_grab_spin(LLUICtrl*, void*) -{ - gGrabBtnVertical = FALSE; - gGrabBtnSpin = TRUE; -} - -void commit_radio_zoom(LLUICtrl *, void*) -{ - gCameraBtnZoom = TRUE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = FALSE; -} - -void commit_radio_orbit(LLUICtrl *, void*) -{ - gCameraBtnZoom = FALSE; - gCameraBtnOrbit = TRUE; - gCameraBtnPan = FALSE; + LLRadioGroup* group = (LLRadioGroup*)ctrl; + std::string selected = group->getValue().asString(); + if (selected == "radio move") + { + gGrabBtnVertical = FALSE; + gGrabBtnSpin = FALSE; + } + else if (selected == "radio lift") + { + gGrabBtnVertical = TRUE; + gGrabBtnSpin = FALSE; + } + else if (selected == "radio spin") + { + gGrabBtnVertical = FALSE; + gGrabBtnSpin = TRUE; + } } -void commit_radio_pan(LLUICtrl *, void*) +void commit_radio_group_focus(LLUICtrl* ctrl, void* data) { - gCameraBtnZoom = FALSE; - gCameraBtnOrbit = FALSE; - gCameraBtnPan = TRUE; + LLRadioGroup* group = (LLRadioGroup*)ctrl; + std::string selected = group->getValue().asString(); + if (selected == "radio zoom") + { + gCameraBtnZoom = TRUE; + gCameraBtnOrbit = FALSE; + gCameraBtnPan = FALSE; + } + else if (selected == "radio orbit") + { + gCameraBtnZoom = FALSE; + gCameraBtnOrbit = TRUE; + gCameraBtnPan = FALSE; + } + else if (selected == "radio pan") + { + gCameraBtnZoom = FALSE; + gCameraBtnOrbit = FALSE; + gCameraBtnPan = TRUE; + } } void commit_slider_zoom(LLUICtrl *ctrl, void*) @@ -881,13 +838,6 @@ void click_popup_rotate_right(void*) } -void click_popup_dozer_mode(LLUICtrl *, void *user) -{ - S32 mode = (S32)(intptr_t) user; - gFloaterTools->setEditTool( LLToolBrushLand::getInstance() ); - gSavedSettings.setS32("RadioLandBrushAction", mode); -} - void commit_slider_dozer_size(LLUICtrl *ctrl, void*) { F32 size = (F32)ctrl->getValue().asReal(); @@ -901,21 +851,64 @@ void commit_slider_dozer_force(LLUICtrl *ctrl, void*) gSavedSettings.setF32("LandBrushForce", dozer_force); } - - - void click_apply_to_selection(void* user) { LLToolBrushLand::getInstance()->modifyLandInSelectionGlobal(); } -void commit_select_tool(LLUICtrl *ctrl, void *data) +void commit_radio_group_edit(LLUICtrl *ctrl, void *data) { S32 show_owners = gSavedSettings.getBOOL("ShowParcelOwners"); - gFloaterTools->setEditTool(data); + + LLRadioGroup* group = (LLRadioGroup*)ctrl; + std::string selected = group->getValue().asString(); + if (selected == "radio position") + { + LLFloaterTools::setEditTool( LLToolCompTranslate::getInstance() ); + } + else if (selected == "radio rotate") + { + LLFloaterTools::setEditTool( LLToolCompRotate::getInstance() ); + } + else if (selected == "radio stretch") + { + LLFloaterTools::setEditTool( LLToolCompScale::getInstance() ); + } + else if (selected == "radio select face") + { + LLFloaterTools::setEditTool( LLToolFace::getInstance() ); + } gSavedSettings.setBOOL("ShowParcelOwners", show_owners); } +void commit_radio_group_land(LLUICtrl* ctrl, void* data) +{ + LLRadioGroup* group = (LLRadioGroup*)ctrl; + std::string selected = group->getValue().asString(); + if (selected == "radio select land") + { + LLFloaterTools::setEditTool( LLToolSelectLand::getInstance() ); + } + else + { + LLFloaterTools::setEditTool( LLToolBrushLand::getInstance() ); + S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction"); + if (selected == "radio flatten") + dozer_mode = 0; + else if (selected == "radio raise") + dozer_mode = 1; + else if (selected == "radio lower") + dozer_mode = 2; + else if (selected == "radio smooth") + dozer_mode = 3; + else if (selected == "radio noise") + dozer_mode = 4; + else if (selected == "radio revert") + dozer_mode = 5; + gSavedSettings.setS32("RadioLandBrushAction", dozer_mode); + } +} + void commit_select_component(LLUICtrl *ctrl, void *data) { LLFloaterTools* floaterp = (LLFloaterTools*)data; @@ -948,9 +941,8 @@ void commit_grid_mode(LLUICtrl *ctrl, void *data) } // static -void LLFloaterTools::setObjectType( void* data ) +void LLFloaterTools::setObjectType( LLPCode pcode ) { - LLPCode pcode = *(LLPCode*) data; LLToolPlacer::setObjectType( pcode ); gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); gFocusMgr.setMouseCapture(NULL); @@ -960,14 +952,16 @@ void LLFloaterTools::setObjectType( void* data ) void LLFloaterTools::onClickGridOptions(void* data) { //LLFloaterTools* floaterp = (LLFloaterTools*)data; - LLFloaterBuildOptions::show(NULL); + LLFloaterBuildOptions::showInstance(); // RN: this makes grid options dependent on build tools window //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE); } +// static void LLFloaterTools::setEditTool(void* tool_pointer) { - select_tool(tool_pointer); + LLTool *tool = (LLTool *)tool_pointer; + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( tool ); } void LLFloaterTools::onFocusReceived() diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 833a8a7b73..7bb072232a 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -38,18 +38,20 @@ #include "llparcelselection.h" class LLButton; -class LLTextBox; -class LLTool; +class LLComboBox; class LLCheckBoxCtrl; -class LLTabContainer; class LLPanelPermissions; class LLPanelObject; class LLPanelVolume; class LLPanelContents; class LLPanelFace; class LLPanelLandInfo; -class LLComboBox; +class LLRadioCtrl; +class LLRadioGroup; class LLSlider; +class LLTabContainer; +class LLTextBox; +class LLTool; class LLParcelSelection; class LLObjectSelection; @@ -65,15 +67,16 @@ public: static void* createPanelVolume(void* vdata); static void* createPanelFace(void* vdata); static void* createPanelContents(void* vdata); - static void* createPanelContentsInventory(void* vdata); static void* createPanelLandInfo(void* vdata); - LLFloaterTools(); + LLFloaterTools(const LLSD& key); virtual ~LLFloaterTools(); - virtual void onOpen(); - virtual void onClose(bool app_quitting); - virtual BOOL canClose(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ BOOL canClose(); + /*virtual*/ void draw(); + /*virtual*/ void onFocusReceived(); // call this once per frame to handle visibility, rect location, // button highlights, etc. @@ -93,24 +96,20 @@ public: PANEL_COUNT }; - /*virtual*/ void draw(); - void dirty(); void showPanel(EInfoPanel panel); void setStatusText(const std::string& text); - virtual void onFocusReceived(); static void setEditTool(void* data); void saveLastTool(); private: - static void setObjectType( void* data ); + static void setObjectType( LLPCode pcode ); void refresh(); static void onClickGridOptions(void* data); public: - LLButton *mBtnFocus; LLButton *mBtnMove; LLButton *mBtnEdit; @@ -120,20 +119,13 @@ public: LLTextBox *mTextStatus; // Focus buttons - LLCheckBoxCtrl *mRadioOrbit; - LLCheckBoxCtrl *mRadioZoom; - LLCheckBoxCtrl *mRadioPan; + LLRadioGroup* mRadioGroupFocus; // Move buttons - LLCheckBoxCtrl *mRadioMove; - LLCheckBoxCtrl *mRadioLift; - LLCheckBoxCtrl *mRadioSpin; + LLRadioGroup* mRadioGroupMove; // Edit buttons - LLCheckBoxCtrl *mRadioPosition; - LLCheckBoxCtrl *mRadioRotate; - LLCheckBoxCtrl *mRadioStretch; - LLCheckBoxCtrl *mRadioSelectFace; + LLRadioGroup* mRadioGroupEdit; LLCheckBoxCtrl *mCheckSelectIndividual; @@ -159,15 +151,7 @@ public: LLCheckBoxCtrl *mCheckCopyRotates; // Land buttons -// LLCheckBoxCtrl *mRadioEditLand; - LLCheckBoxCtrl *mRadioSelectLand; - - LLCheckBoxCtrl *mRadioDozerFlatten; - LLCheckBoxCtrl *mRadioDozerRaise; - LLCheckBoxCtrl *mRadioDozerLower; - LLCheckBoxCtrl *mRadioDozerSmooth; - LLCheckBoxCtrl *mRadioDozerNoise; - LLCheckBoxCtrl *mRadioDozerRevert; + LLRadioGroup* mRadioGroupLand; LLSlider *mSliderDozerSize; LLSlider *mSliderDozerForce; diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index fa6ba162ec..29ac0c66f8 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -42,6 +42,8 @@ #include "llfloatergodtools.h" #include "llparcel.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lllineeditor.h" #include "lltextbox.h" #include "lltracker.h" @@ -71,7 +73,7 @@ void LLFloaterTopObjects::show() } LLFloaterTopObjects::LLFloaterTopObjects() -: LLFloater(std::string("top_objects")), +: LLFloater(), mInitialized(FALSE), mtotalScore(0.f) { @@ -86,14 +88,11 @@ LLFloaterTopObjects::~LLFloaterTopObjects() // virtual BOOL LLFloaterTopObjects::postBuild() { - childSetCommitCallback("objects_list", onCommitObjectsList, this); - childSetDoubleClickCallback("objects_list", onDoubleClickObjectsList); - childSetFocus("objects_list"); LLScrollListCtrl *objects_list = getChild("objects_list"); - if (objects_list) - { - objects_list->setCommitOnSelectionChange(TRUE); - } + childSetFocus("objects_list"); + childSetCommitCallback("objects_list", onCommitObjectsList, this); + objects_list->setDoubleClickCallback(onDoubleClickObjectsList, this); + objects_list->setCommitOnSelectionChange(TRUE); childSetAction("show_beacon_btn", onClickShowBeacon, this); setDefaultBtn("show_beacon_btn"); @@ -114,16 +113,14 @@ BOOL LLFloaterTopObjects::postBuild() if (line_editor) { line_editor->setCommitOnFocusLost(FALSE); - line_editor->setCommitCallback(onGetByOwnerName); - line_editor->setCallbackUserData(this); + line_editor->setCommitCallback(onGetByOwnerName, this); } line_editor = getChild("object_name_editor"); if (line_editor) { line_editor->setCommitOnFocusLost(FALSE); - line_editor->setCommitCallback(onGetByObjectName); - line_editor->setCallbackUserData(this); + line_editor->setCommitCallback(onGetByObjectName, this); }*/ mCurrentMode = STAT_REPORT_TOP_SCRIPTS; @@ -234,7 +231,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) if (total_count == 0 && list->getItemCount() == 0) { - list->addCommentText(getString("none_descriptor")); + list->setCommentText(getString("none_descriptor")); } else { diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 6a392e03fb..764a6a3498 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -254,7 +254,7 @@ void LLFloaterTOS::onContinue( void* userdata ) #endif LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); // Go back and finish authentication - self->close(); // destroys this object + self->closeFloater(); // destroys this object } // static @@ -265,7 +265,7 @@ void LLFloaterTOS::onCancel( void* userdata ) LLNotifications::instance().add("MustAgreeToLogIn", LLSD(), LLSD(), login_alert_done); LLStartUp::setStartupState( STATE_LOGIN_SHOW ); self->mLoadCompleteCount = 0; // reset counter for next time we come to TOS - self->close(); // destroys this object + self->closeFloater(); // destroys this object } //virtual diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp new file mode 100644 index 0000000000..34db895b52 --- /dev/null +++ b/indra/newview/llfloateruipreview.cpp @@ -0,0 +1,1550 @@ +/** + * @file llfloateruipreview.cpp + * @brief Tool for previewing and editing floaters, plus localization tool integration + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +// Tool for previewing floaters and panels for localization and UI design purposes. +// See: https://wiki.lindenlab.com/wiki/GUI_Preview_And_Localization_Tools +// See: https://jira.lindenlab.com/browse/DEV-16869 + +// *TODO: Translate error messgaes using notifications/alerts.xml + +#include "llviewerprecompiledheaders.h" // Precompiled headers + +#include "llfloateruipreview.h" // Own header + +// Internal utility +#include "llrender.h" +#include "llsdutil.h" +#include "llxmltree.h" +#include "llviewerwindow.h" +#include "lllivefile.h" + +// XUI +#include "lluictrlfactory.h" +#include "llcombobox.h" +#include "llresizebar.h" +#include "llscrolllistitem.h" +#include "llscrolllistctrl.h" +#include "llfilepicker.h" +#include "lldraghandle.h" +#include "lllayoutstack.h" +#include "llviewermenu.h" + +// Boost (for linux/unix command-line execv) +#include +#include + +// External utility +#include + +#if LL_DARWIN +#include +#endif + +// Static initialization +LLFloaterUIPreview* LLFloaterUIPreview::sInstance = NULL; // initialization of static instance pointer to NULL +std::string LLFloaterUIPreview::mSavedEditorPath = std::string(""); +std::string LLFloaterUIPreview::mSavedEditorArgs = std::string(""); +std::string LLFloaterUIPreview::mSavedDiffPath = std::string(""); +static const S32 PRIMARY_FLOATER = 1; +static const S32 SECONDARY_FLOATER = 2; + +static std::string get_xui_dir() +{ + std::string delim = gDirUtilp->getDirDelimiter(); + return gDirUtilp->getAppRODataDir() + delim + std::string("skins") + delim + "default" + delim + "xui" + delim; +} + +// Localization reset forcer -- ensures that when localization is temporarily changed for previewed floater, it is reset +// Changes are made here +LLLocalizationResetForcer::LLLocalizationResetForcer(S32 ID) +{ + mSavedLocalization = LLUI::sSettingGroups["config"]->getString("Language"); // save current localization setting + LLUI::sSettingGroups["config"]->setString("Language", LLFloaterUIPreview::getLocStr(ID));// hack language to be the one we want to preview floaters in + LLUI::setupPaths(); // forcibly reset XUI paths with this new language +} + +// Actually reset in destructor +// Changes are reversed here +LLLocalizationResetForcer::~LLLocalizationResetForcer() +{ + LLUI::sSettingGroups["config"]->setString("Language", mSavedLocalization); // reset language to what it was before we changed it + LLUI::setupPaths(); // forcibly reset XUI paths with this new language +} + +// Live file constructor +// Needs full path for LLLiveFile but needs just file name for this code, hence the reduntant arguments; easier than separating later +LLGUIPreviewLiveFile::LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent) + : mFileName(name), + mParent(parent), + mFirstFade(TRUE), + mFadeTimer(NULL), + LLLiveFile(path, 1.0) +{} + +LLGUIPreviewLiveFile::~LLGUIPreviewLiveFile() +{ + mParent->mLiveFile = NULL; + if(mFadeTimer) + { + mFadeTimer->mParent = NULL; + // deletes itself; see lltimer.cpp + } +} + +// Live file load +bool LLGUIPreviewLiveFile::loadFile() +{ + mParent->displayFloater(FALSE,1); // redisplay the floater + if(mFirstFade) // only fade if it wasn't just clicked on; can't use "clicked" BOOL below because of an oddity with setting LLLiveFile initial state + { + mFirstFade = FALSE; + } + else + { + if(mFadeTimer) + { + mFadeTimer->mParent = NULL; + } + mFadeTimer = new LLFadeEventTimer(0.05f,this); + } + return true; +} + +// Initialize fade event timer +LLFadeEventTimer::LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent) + : mParent(parent), + mFadingOut(TRUE), + LLEventTimer(refresh) +{ + mOriginalColor = mParent->mParent->mDisplayedFloater->getBackgroundColor(); +} + +// Single tick of fade event timer: increment the color +BOOL LLFadeEventTimer::tick() +{ + float diff = 0.04f; + if(TRUE == mFadingOut) // set fade for in/out color direction + { + diff = -diff; + } + + if(NULL == mParent) // no more need to tick, so suicide + { + delete this; + return FALSE; + } + + // Set up colors + LLColor4 bg_color = mParent->mParent->mDisplayedFloater->getBackgroundColor(); + LLSD colors = bg_color.getValue(); + LLSD colors_old = colors; + + // Tick colors + colors[0] = colors[0].asReal() - diff; if(colors[0].asReal() < mOriginalColor.getValue()[0].asReal()) { colors[0] = colors_old[0]; } + colors[1] = colors[1].asReal() - diff; if(colors[1].asReal() < mOriginalColor.getValue()[1].asReal()) { colors[1] = colors_old[1]; } + colors[2] = colors[2].asReal() + diff; if(colors[2].asReal() > mOriginalColor.getValue()[2].asReal()) { colors[2] = colors_old[2]; } + + // Clamp and set colors + bg_color.setValue(colors); + bg_color.clamp(); // make sure we didn't exceed [0,1] + mParent->mParent->mDisplayedFloater->setBackgroundColor(bg_color); + + if(bg_color[2] <= 0.0f) // end of fade out, start fading in + { + mFadingOut = FALSE; + } + + return FALSE; +} + +void* create_overlap_panel(void* data) +{ + return new LLOverlapPanel(); +} + +// Constructor +LLFloaterUIPreview::LLFloaterUIPreview(const LLSD& key) + : LLFloater(key), + mDisplayedFloater(NULL), + mDisplayedFloater_2(NULL), + mLiveFile(NULL), + // sHighlightingDiffs(FALSE), + mHighlightingOverlaps(FALSE), + mLastDisplayedX(0), + mLastDisplayedY(0) + +{ + sInstance = this; + mFactoryMap["overlap_panel"] = LLCallbackMap(create_overlap_panel, NULL); + // called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ui_preview.xml"); +} + +// Destructor +LLFloaterUIPreview::~LLFloaterUIPreview() +{ + // spawned floaters are deleted automatically, so we don't need to delete them here + + // save contents of textfields so it can be restored later if the floater is created again this session + LLFloaterUIPreview::mSavedEditorPath = mEditorPathTextBox->getText(); + LLFloaterUIPreview::mSavedEditorArgs = mEditorArgsTextBox->getText(); + LLFloaterUIPreview::mSavedDiffPath = mDiffPathTextBox->getText(); + + // delete live file if it exists + if(sInstance->mLiveFile) + { + delete sInstance->mLiveFile; + sInstance->mLiveFile = NULL; + } + + sInstance = NULL; // clear static pointer +} + +// Perform post-build setup (defined in superclass) +BOOL LLFloaterUIPreview::postBuild() +{ + LLPanel* main_panel_tmp = getChild("main_panel"); // get a pointer to the main panel in order to... + mFileList = main_panel_tmp->getChild("name_list"); // save pointer to file list + // Double-click opens the floater, for convenience + mFileList->setDoubleClickCallback(onClickDisplayFloater, (void*)&PRIMARY_FLOATER); + + // get pointers to buttons and link to callbacks + mLanguageSelection = main_panel_tmp->getChild("language_select_combo"); + mLanguageSelection->setSelectionCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection)); + mLanguageSelection_2 = main_panel_tmp->getChild("language_select_combo_2"); + mLanguageSelection_2->setSelectionCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection)); + LLPanel* editor_panel_tmp = main_panel_tmp->getChild("editor_panel"); + mDisplayFloaterBtn = main_panel_tmp->getChild("display_floater"); + mDisplayFloaterBtn->setClickedCallback(onClickDisplayFloater, (void*)&PRIMARY_FLOATER); + mDisplayFloaterBtn_2 = main_panel_tmp->getChild("display_floater_2"); + mDisplayFloaterBtn_2->setClickedCallback(onClickDisplayFloater, (void*)&SECONDARY_FLOATER); + mToggleOverlapButton = main_panel_tmp->getChild("toggle_overlap_panel"); + mToggleOverlapButton->setClickedCallback(onClickToggleOverlapping, this); + mCloseOtherButton = main_panel_tmp->getChild("close_displayed_floater"); + mCloseOtherButton->setClickedCallback(onClickCloseDisplayedFloater, (void*)&PRIMARY_FLOATER); + mCloseOtherButton_2 = main_panel_tmp->getChild("close_displayed_floater_2"); + mCloseOtherButton_2->setClickedCallback(onClickCloseDisplayedFloater, (void*)&SECONDARY_FLOATER); + mEditFloaterBtn = main_panel_tmp->getChild("edit_floater"); + mEditFloaterBtn->setClickedCallback(onClickEditFloater, this); + mExecutableBrowseButton = editor_panel_tmp->getChild("browse_for_executable"); + LLPanel* vlt_panel_tmp = main_panel_tmp->getChild("vlt_panel"); + mExecutableBrowseButton->setClickedCallback(onClickBrowseForEditor, this); + mDiffBrowseButton = vlt_panel_tmp->getChild("browse_for_vlt_diffs"); + mDiffBrowseButton->setClickedCallback(onClickBrowseForDiffs, NULL); + mToggleHighlightButton = vlt_panel_tmp->getChild("toggle_vlt_diff_highlight"); + mToggleHighlightButton->setClickedCallback(onClickToggleDiffHighlighting, NULL); + main_panel_tmp->getChild("save_floater")->setClickedCallback(onClickSaveFloater, (void*)&PRIMARY_FLOATER); + main_panel_tmp->getChild("save_all_floaters")->setClickedCallback(onClickSaveAll, (void*)&PRIMARY_FLOATER); + + // get pointers to text fields + mEditorPathTextBox = editor_panel_tmp->getChild("executable_path_field"); + mEditorArgsTextBox = editor_panel_tmp->getChild("executable_args_field"); + mDiffPathTextBox = vlt_panel_tmp->getChild("vlt_diff_path_field"); + + // *HACK: restored saved editor path and args to textfields + mEditorPathTextBox->setText(LLFloaterUIPreview::mSavedEditorPath); + mEditorArgsTextBox->setText(LLFloaterUIPreview::mSavedEditorArgs); + mDiffPathTextBox->setText(LLFloaterUIPreview::mSavedDiffPath); + + // Set up overlap panel + mOverlapPanel = getChild("overlap_panel"); + + sInstance->childSetVisible("overlap_scroll", mHighlightingOverlaps); + + mDelim = gDirUtilp->getDirDelimiter(); // initialize delimiter to dir sep slash + + // refresh list of available languages (EN will still be default) + BOOL found = TRUE; + BOOL found_en_us = FALSE; + std::string language_directory; + std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim + mLanguageSelection->removeall(); // clear out anything temporarily in list from XML + while(found) // for every directory + { + if((found = gDirUtilp->getNextFileInDir(xui_dir, "*", language_directory, FALSE))) // get next directory + { + std::string full_path = xui_dir + language_directory; + if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it + { + continue; + } + + if(strncmp("template",language_directory.c_str(),8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory + { + if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default + { + found_en_us = TRUE; + } + else + { + mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu + mLanguageSelection_2->add(std::string(language_directory)); + } + } + } + } + if(found_en_us) + { + mLanguageSelection->add(std::string("en"),ADD_TOP); // make en first item if we found it + mLanguageSelection_2->add(std::string("en"),ADD_TOP); + } + else + { + std::string warning = std::string("No EN localization found; check your XUI directories!"); + popupAndPrintWarning(warning); + } + mLanguageSelection->selectFirstItem(); // select the first item + mLanguageSelection_2->selectFirstItem(); + + refreshList(); // refresh the list of available floaters + + return TRUE; +} + +// Callback for language combo box selection: refresh current floater when you change languages +void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl) +{ + LLComboBox* caller = dynamic_cast(ctrl); + if (!caller) + return; + if(caller->getName() == std::string("language_select_combo")) + { + if(mDisplayedFloater) + { + onClickCloseDisplayedFloater((void*)&PRIMARY_FLOATER); + displayFloater(TRUE,1); + } + } + else + { + if(mDisplayedFloater_2) + { + onClickCloseDisplayedFloater((void*)&PRIMARY_FLOATER); + displayFloater(TRUE,2); // *TODO: make take an arg + } + } + +} + +// Close click handler -- delete my displayed floater if it exists +void LLFloaterUIPreview::onClose(bool app_quitting) +{ + if(!app_quitting && sInstance && sInstance->mDisplayedFloater) + { + onClickCloseDisplayedFloater((void*)&PRIMARY_FLOATER); + onClickCloseDisplayedFloater((void*)&SECONDARY_FLOATER); + delete sInstance->mDisplayedFloater; + sInstance->mDisplayedFloater = NULL; + } + destroy(); +} + +// Error handling (to avoid code repetition) +// *TODO: this is currently unlocalized. Add to alerts/notifications.xml, someday, maybe. +void LLFloaterUIPreview::popupAndPrintWarning(std::string& warning) +{ + llwarns << warning << llendl; + LLSD args; + args["MESSAGE"] = warning; + LLNotifications::instance().add("GenericAlert", args); +} + +// Get localization string from drop-down menu +std::string LLFloaterUIPreview::getLocStr(S32 ID) +{ + if(ID == 1) + { + return sInstance->mLanguageSelection->getSelectedItemLabel(0); + } + else + { + return sInstance->mLanguageSelection_2->getSelectedItemLabel(0); + } +} + +// Get localized directory (build path from data directory to XUI files, substituting localization string in for language) +std::string LLFloaterUIPreview::getLocalizedDirectory() +{ + return get_xui_dir() + (sInstance ? getLocStr(1) : "en") + mDelim; // e.g. "C:/Code/guipreview/indra/newview/skins/xui/en/"; +} + +// Refresh the list of floaters by doing a directory traverse for XML XUI floater files +// Could be used to grab any specific language's list of compatible floaters, but currently it's just used to get all of them +void LLFloaterUIPreview::refreshList() +{ + // Note: the mask doesn't seem to accept regular expressions, so there need to be two directory searches here + mFileList->clearRows(); // empty list + std::string name; + BOOL found = TRUE; + while(found) // for every floater file that matches the pattern + { + if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "floater_*.xml", name, FALSE))) // get next file matching pattern + { + addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) + } + } + found = TRUE; + while(found) // for every menu file that matches the pattern + { + if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "menu_*.xml", name, FALSE))) // get next file matching pattern + { + addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) + } + } + found = TRUE; + while(found) // for every panel file that matches the pattern + { + if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "panel_*.xml", name, FALSE))) // get next file matching pattern + { + addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path) + } + } + + if(!mFileList->isEmpty()) // if there were any matching files, just select the first one (so we don't have to worry about disabling buttons when no entry is selected) + { + mFileList->selectFirstItem(); + } +} + +// Add a single entry to the list of available floaters +// Note: no deduplification (shouldn't be necessary) +void LLFloaterUIPreview::addFloaterEntry(const std::string& path) +{ + LLUUID* entry_id = new LLUUID(); // create a new UUID + entry_id->generate(path); + const LLUUID& entry_id_ref = *entry_id; // get a reference to the UUID for the LLSD block + + // fill LLSD column entry: initialize row/col structure + LLSD row; + row["id"] = entry_id_ref; + LLSD& columns = row["columns"]; + + // Get name of floater: + LLXmlTree xml_tree; + std::string full_path = getLocalizedDirectory() + path; // get full path + BOOL success = xml_tree.parseFile(full_path.c_str(), TRUE); // parse xml + std::string entry_name; + std::string entry_title; + if(success) + { + // get root (or error handle) + LLXmlTreeNode* root_floater = xml_tree.getRoot(); + if (!root_floater) + { + std::string warning = std::string("No root node found in XUI file: ") + path; + popupAndPrintWarning(warning); + return; + } + + // get name + root_floater->getAttributeString("name",entry_name); + if(std::string("") == entry_name) + { + entry_name = "Error: unable to load " + std::string(path); // set to error state if load fails + } + + // get title + root_floater->getAttributeString("title",entry_title); // some don't have a title, and some have title = "(unknown)", so just leave it blank if it fails + } + else + { + std::string warning = std::string("Unable to parse XUI file: ") + path; // error handling + popupAndPrintWarning(warning); + if(mLiveFile) + { + delete mLiveFile; + mLiveFile = NULL; + } + return; + } + + // Fill floater title column + columns[0]["column"] = "title_column"; + columns[0]["type"] = "text"; + columns[0]["value"] = entry_title; + + // Fill floater path column + columns[1]["column"] = "file_column"; + columns[1]["type"] = "text"; + columns[1]["value"] = std::string(path); + + // Fill floater name column + columns[2]["column"] = "top_level_node_column"; + columns[2]["type"] = "text"; + columns[2]["value"] = entry_name; + + mFileList->addElement(row); // actually add to list +} + +// Respond to button click to display/refresh currently-selected floater +void LLFloaterUIPreview::onClickDisplayFloater(void* data) +{ + S32 caller_id = *((S32*)data); + displayFloater(TRUE, caller_id); + if(caller_id == 1) + { + sInstance->mDisplayedFloater->center(); // move displayed floater to the center of the screen + } +} + +// Saves the current floater/panel +void LLFloaterUIPreview::onClickSaveFloater(void* data) +{ + S32 caller_id = *((S32*)data); + displayFloater(TRUE, caller_id, true); + if(caller_id == 1) + { + sInstance->mDisplayedFloater->center(); // move displayed floater to the center of the screen + } +} + +// Saves all floater/panels +void LLFloaterUIPreview::onClickSaveAll(void* data) +{ + S32 caller_id = *((S32*)data); + int listSize = sInstance->mFileList->getItemCount(); + + for (int index = 0; index < listSize; index++) + { + sInstance->mFileList->selectNthItem(index); + displayFloater(TRUE, caller_id, true); + } +} + +// Given path to floater or panel XML file "filename.xml", +// returns "filename_new.xml" +static std::string append_new_to_xml_filename(const std::string& path) +{ + std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getLocalizedSkinPath(), path); + std::string::size_type extension_pos = full_filename.rfind(".xml"); + full_filename.resize(extension_pos); + full_filename += "_new.xml"; + return full_filename; +} + +// Actually display the floater +// Only set up a new live file if this came from a click (at which point there should be no existing live file), rather than from the live file's update itself; +// otherwise, we get an infinite loop as the live file keeps recreating itself. That means this function is generally called twice. +void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) +{ + // Convince UI that we're in a different language (the one selected on the drop-down menu) + LLLocalizationResetForcer reset_forcer(ID); // save old language in reset forcer object (to be reset upon destruction when it falls out of scope) + + LLPreviewedFloater** floaterp = (ID == 1 ? &(sInstance->mDisplayedFloater) : &(sInstance->mDisplayedFloater_2)); + if(ID == 1) + { + BOOL floater_already_open = sInstance->mDisplayedFloater != NULL; + if(floater_already_open) // if we are already displaying a floater + { + sInstance->mLastDisplayedX = sInstance->mDisplayedFloater->calcScreenRect().mLeft; // save floater's last known position to put the new one there + sInstance->mLastDisplayedY = sInstance->mDisplayedFloater->calcScreenRect().mBottom; + delete sInstance->mDisplayedFloater; // delete it (this closes it too) + sInstance->mDisplayedFloater = NULL; // and reset the pointer + } + } + else + { + if(sInstance->mDisplayedFloater_2 != NULL) + { + delete sInstance->mDisplayedFloater_2; + sInstance->mDisplayedFloater_2 = NULL; + } + } + + std::string path = sInstance->mFileList->getSelectedItemLabel(1); // get the path of the currently-selected floater + if(std::string("") == path) // if no item is selected + { + return; // ignore click (this can only happen with empty list; otherwise an item is always selected) + } + + *floaterp = new LLPreviewedFloater(); + + if(!strncmp(path.c_str(),"floater_",8)) // if it's a floater + { + if (save) + { + LLXMLNodePtr floater_write = new LLXMLNode(); + LLUICtrlFactory::getInstance()->buildFloater(*floaterp, path, FALSE, floater_write); // just build it + + if (!floater_write->isNull()) + { + std::string full_filename = append_new_to_xml_filename(path); + LLFILE* floater_temp = LLFile::fopen(full_filename.c_str(), "w"); + LLXMLNode::writeHeaderToFile(floater_temp); + floater_write->writeToFile(floater_temp); + fclose(floater_temp); + } + } + else + { + LLUICtrlFactory::getInstance()->buildFloater(*floaterp, path, TRUE); // just build it + } + + } + else if (!strncmp(path.c_str(),"menu_",5)) // if it's a menu + { + if (save) + { + LLXMLNodePtr menu_write = new LLXMLNode(); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile(path, gMenuHolder, menu_write); + + if (!menu_write->isNull()) + { + std::string full_filename = append_new_to_xml_filename(path); + LLFILE* menu_temp = LLFile::fopen(full_filename.c_str(), "w"); + LLXMLNode::writeHeaderToFile(menu_temp); + menu_write->writeToFile(menu_temp); + fclose(menu_temp); + } + + delete menu; + } + } + else // if it is a panel... + { + static LLUICachedControl floater_header_size ("UIFloaterHeaderSize", 0); + + LLPanel::Params panel_params; + LLPanel* panel = LLUICtrlFactory::create(panel_params); // create a new panel + + if (save) + { + LLXMLNodePtr panel_write = new LLXMLNode(); + LLUICtrlFactory::getInstance()->buildPanel(panel, path, panel_write); // build it + + if (!panel_write->isNull()) + { + std::string full_filename = append_new_to_xml_filename(path); + LLFILE* panel_temp = LLFile::fopen(full_filename.c_str(), "w"); + LLXMLNode::writeHeaderToFile(panel_temp); + panel_write->writeToFile(panel_temp); + fclose(panel_temp); + } + } + else + { + LLUICtrlFactory::getInstance()->buildPanel(panel, path); // build it + LLRect new_size = panel->getRect(); // get its rectangle + panel->setOrigin(0,0); // reset its origin point so it's not offset by -left or other XUI attributes + (*floaterp)->setTitle(path); // use the file name as its title, since panels have no guaranteed meaningful name attribute + panel->setUseBoundingRect(TRUE); // enable the use of its outer bounding rect (normally disabled because it's O(n) on the number of sub-elements) + panel->updateBoundingRect(); // update bounding rect + LLRect bounding_rect = panel->getBoundingRect(); // get the bounding rect + LLRect panel_rect = panel->getRect(); // get the panel's rect + LLRect new_rect = panel_rect.unionWith(bounding_rect); // union them to make sure we get the biggest one possible + (*floaterp)->reshape(new_rect.getWidth(), new_rect.getHeight() + floater_header_size); // reshape floater to match the union rect's dimensions + panel->reshape(new_rect.getWidth(), new_rect.getHeight()); // reshape panel to match the union rect's dimensions as well (both are needed) + (*floaterp)->addChild(panel); // add panel as child + (*floaterp)->openFloater(); // open floater (needed?) + } + } + + if(ID == 1) + { + (*floaterp)->setOrigin(sInstance->mLastDisplayedX, sInstance->mLastDisplayedY); + } + + // *HACK: Remove ability to close it; if you close it, its destructor gets called, but we don't know it's null and try to delete it again, + // resulting in a double free + (*floaterp)->setCanClose(FALSE); + + if(ID == 1) + { + sInstance->mCloseOtherButton->setEnabled(TRUE); // enable my floater's close button + } + else + { + sInstance->mCloseOtherButton_2->setEnabled(TRUE); + } + + // *TODO: Make the secondary floater pop up next to the primary one. Doesn't seem to always work if secondary was up first... + if((sInstance->mDisplayedFloater && ID == 2) || (sInstance->mDisplayedFloater_2 && ID == 1)) + { + sInstance->mDisplayedFloater_2->setSnapTarget(sInstance->mDisplayedFloater->getHandle()); + sInstance->mDisplayedFloater->addDependentFloater(sInstance->mDisplayedFloater_2); + } + + // Add localization to title so user knows whether it's localized or defaulted to en + std::string full_path = sInstance->getLocalizedDirectory() + path; + std::string floater_lang = "EN"; + llstat dummy; + if(!LLFile::stat(full_path.c_str(), &dummy)) // if the file does not exist + { + floater_lang = getLocStr(ID); + } + std::string new_title = (*floaterp)->getTitle() + std::string(" [") + floater_lang + + (ID == 1 ? " - Primary" : " - Secondary") + std::string("]"); + (*floaterp)->setTitle(new_title); + + if(click && ID == 1 && !save) + { + // set up live file to track it + if(sInstance->mLiveFile) + { + delete sInstance->mLiveFile; + sInstance->mLiveFile = NULL; + } + sInstance->mLiveFile = new LLGUIPreviewLiveFile(std::string(full_path.c_str()),std::string(path.c_str()),sInstance); + sInstance->mLiveFile->checkAndReload(); + sInstance->mLiveFile->addToEventTimer(); + } + + if(ID == 1) + { + sInstance->mToggleOverlapButton->setEnabled(TRUE); + } + + if(LLView::sHighlightingDiffs && click && ID == 1) + { + sInstance->highlightChangedElements(); + } + + if(ID == 1) + { + sInstance->mOverlapMap.clear(); + LLView::sPreviewClickedElement = NULL; // stop overlapping elements from drawing + sInstance->mOverlapPanel->mLastClickedElement = NULL; + sInstance->findOverlapsInChildren((LLView*)sInstance->mDisplayedFloater); + + // highlight and enable them + if(sInstance->mHighlightingOverlaps) + { + for(OverlapMap::iterator iter = sInstance->mOverlapMap.begin(); iter != sInstance->mOverlapMap.end(); ++iter) + { + LLView* viewp = iter->first; + LLView::sPreviewHighlightedElements.insert(viewp); + } + } + else if(LLView::sHighlightingDiffs) + { + sInstance->highlightChangedElements(); + } + } + + // NOTE: language is reset here automatically when the reset forcer object falls out of scope (see header for details) +} + +// Respond to button click to edit currently-selected floater +void LLFloaterUIPreview::onClickEditFloater(void*) +{ + std::string file_name = sInstance->mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater + if(std::string("") == file_name) // if no item is selected + { + return; // ignore click + } + std::string path = sInstance->getLocalizedDirectory() + file_name; + + // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file) + llstat dummy; + if(LLFile::stat(path.c_str(), &dummy)) // if the file does not exist + { + std::string warning = "No file for this floater exists in the selected localization. Opening the EN version instead."; + popupAndPrintWarning(warning); + + path = get_xui_dir() + sInstance->mDelim + "en" + sInstance->mDelim + file_name; // open the en version instead, by default + } + + // get executable path + const char* exe_path_char; + std::string path_in_textfield = sInstance->mEditorPathTextBox->getText(); + if(std::string("") != path_in_textfield) // if the text field is not emtpy, use its path + { + exe_path_char = path_in_textfield.c_str(); + } + else // otherwise use the path specified by the environment variable + { + exe_path_char = getenv("LL_XUI_EDITOR"); + } + + // error check executable path + if(NULL == exe_path_char) + { + std::string warning = "Select an editor by setting the environment variable LL_XUI_EDITOR or specifying its path in the \"Editor Path\" field."; + popupAndPrintWarning(warning); + return; + } + std::string exe_path = exe_path_char; // do this after error check, otherwise internal strlen call fails on bad char* + + // remove any quotes; they're added back in later where necessary + int found_at; + while((found_at = exe_path.find("\"")) != -1 || (found_at = exe_path.find("'")) != -1) + { + exe_path.erase(found_at,1); + } + + llstat s; + if(!LLFile::stat(exe_path.c_str(), &s)) // If the executable exists + { + // build paths and arguments + std::string args; + std::string custom_args = sInstance->mEditorArgsTextBox->getText(); + int position_of_file = custom_args.find(std::string("%FILE%"), 0); // prepare to replace %FILE% with actual file path + std::string first_part_of_args = ""; + std::string second_part_of_args = ""; + if(-1 == position_of_file) // default: Executable.exe File.xml + { + args = std::string("\"") + path + std::string("\""); // execute the command Program.exe "File.xml" + } + else // use advanced command-line arguments, e.g. "Program.exe -safe File.xml" -windowed for "-safe %FILE% -windowed" + { + first_part_of_args = custom_args.substr(0,position_of_file); // get part of args before file name + second_part_of_args = custom_args.substr(position_of_file+6,custom_args.length()); // get part of args after file name + custom_args = first_part_of_args + std::string("\"") + path + std::string("\"") + second_part_of_args; // replace %FILE% with "" and put back together + args = custom_args; // and save in the variable that is actually used + } + + // find directory in which executable resides by taking everything after last slash + int last_slash_position = exe_path.find_last_of(sInstance->mDelim); + if(-1 == last_slash_position) + { + std::string warning = std::string("Unable to find a valid path to the specified executable for XUI XML editing: ") + exe_path; + popupAndPrintWarning(warning); + return; + } + std::string exe_dir = exe_path.substr(0,last_slash_position); // strip executable off, e.g. get "C:\Program Files\TextPad 5" (with or without trailing slash) + +#if LL_WINDOWS + PROCESS_INFORMATION pinfo; + STARTUPINFOA sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + memset(&pinfo, 0, sizeof(pinfo)); + + std::string exe_name = exe_path.substr(last_slash_position+1); + args = exe_name + std::string(" ") + args; // and prepend the executable name, so we get 'Program.exe "Arg1"' + + char *args2 = new char[args.size() + 1]; // Windows requires that the second parameter to CreateProcessA be a writable (non-const) string... + strcpy(args2, args.c_str()); + + if(!CreateProcessA(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo)) + { + // DWORD dwErr = GetLastError(); + std::string warning = "Creating editor process failed!"; + popupAndPrintWarning(warning); + } + else + { + // foo = pinfo.dwProcessId; // get your pid here if you want to use it later on + // sGatewayHandle = pinfo.hProcess; + CloseHandle(pinfo.hThread); // stops leaks - nothing else + } + + delete[] args2; +#else // if !LL_WINDOWS + // This code was copied from the code to run SLVoice, with some modification; should work in UNIX (Mac/Darwin or Linux) + { + std::vector arglist; + arglist.push_back(exe_path.c_str()); + + // Split the argument string into separate strings for each argument + typedef boost::tokenizer< boost::char_separator > tokenizer; + boost::char_separator sep("","\" ", boost::drop_empty_tokens); + + tokenizer tokens(args, sep); + tokenizer::iterator token_iter; + BOOL inside_quotes = FALSE; + BOOL last_was_space = FALSE; + for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) + { + if(!strncmp("\"",(*token_iter).c_str(),2)) + { + inside_quotes = !inside_quotes; + } + else if(!strncmp(" ",(*token_iter).c_str(),2)) + { + if(inside_quotes) + { + arglist.back().append(std::string(" ")); + last_was_space = TRUE; + } + } + else + { + std::string to_push = *token_iter; + if(last_was_space) + { + arglist.back().append(to_push); + last_was_space = FALSE; + } + else + { + arglist.push_back(to_push); + } + } + } + + // create an argv vector for the child process + char **fakeargv = new char*[arglist.size() + 1]; + int i; + for(i=0; i < arglist.size(); i++) + fakeargv[i] = const_cast(arglist[i].c_str()); + + fakeargv[i] = NULL; + + fflush(NULL); // flush all buffers before the child inherits them + pid_t id = vfork(); + if(id == 0) + { + // child + execv(exe_path.c_str(), fakeargv); + + // If we reach this point, the exec failed. + // Use _exit() instead of exit() per the vfork man page. + std::string warning = "Creating editor process failed (vfork/execv)!"; + popupAndPrintWarning(warning); + _exit(0); + } + + // parent + delete[] fakeargv; + // sGatewayPID = id; + } +#endif // LL_WINDOWS + } + else + { + std::string warning = "Unable to find path to external XML editor for XUI preview tool"; + popupAndPrintWarning(warning); + } +} + +// Respond to button click to browse for an executable with which to edit XML files +void LLFloaterUIPreview::onClickBrowseForEditor(void*) +{ + // create load dialog box + LLFilePicker::ELoadFilter type = (LLFilePicker::ELoadFilter)((intptr_t)((void*)LLFilePicker::FFLOAD_ALL)); // nothing for *.exe so just use all + LLFilePicker& picker = LLFilePicker::instance(); + if (!picker.getOpenFile(type)) // user cancelled -- do nothing + { + return; + } + + // put the selected path into text field + const std::string chosen_path = picker.getFirstFile(); + std::string executable_path = chosen_path; +#if LL_DARWIN + // on Mac, if it's an application bundle, figure out the actual path from the Info.plist file + CFStringRef path_cfstr = CFStringCreateWithCString(kCFAllocatorDefault, chosen_path.c_str(), kCFStringEncodingMacRoman); // get path as a CFStringRef + CFURLRef path_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_cfstr, kCFURLPOSIXPathStyle, TRUE); // turn it into a CFURLRef + CFBundleRef chosen_bundle = CFBundleCreate(kCFAllocatorDefault, path_url); // get a handle for the bundle + if(NULL != chosen_bundle) + { + CFDictionaryRef bundleInfoDict = CFBundleGetInfoDictionary(chosen_bundle); // get the bundle's dictionary + if(NULL != bundleInfoDict) + { + CFStringRef executable_cfstr = (CFStringRef)CFDictionaryGetValue(bundleInfoDict, CFSTR("CFBundleExecutable")); // get the name of the actual executable (e.g. TextEdit or firefox-bin) + int max_file_length = 256; // (max file name length is 255 in OSX) + char executable_buf[max_file_length]; + if(CFStringGetCString(executable_cfstr, executable_buf, max_file_length, kCFStringEncodingMacRoman)) // convert CFStringRef to char* + { + executable_path += std::string("/Contents/MacOS/") + std::string(executable_buf); // append path to executable directory and then executable name to exec path + } + else + { + std::string warning = "Unable to get CString from CFString for executable path"; + popupAndPrintWarning(warning); + } + } + else + { + std::string warning = "Unable to get bundle info dictionary from application bundle"; + popupAndPrintWarning(warning); + } + } + else + { + if(-1 != executable_path.find(".app")) // only warn if this path actually had ".app" in it, i.e. it probably just wasn'nt an app bundle and that's okay + { + std::string warning = std::string("Unable to get bundle from path \"") + chosen_path + std::string("\""); + popupAndPrintWarning(warning); + } + } + +#endif + sInstance->mEditorPathTextBox->setText(std::string(executable_path)); // copy the path to the executable to the textfield for display and later fetching +} + +// Respond to button click to browse for a VLT-generated diffs file +void LLFloaterUIPreview::onClickBrowseForDiffs(void*) +{ + // create load dialog box + LLFilePicker::ELoadFilter type = (LLFilePicker::ELoadFilter)((intptr_t)((void*)LLFilePicker::FFLOAD_XML)); // nothing for *.exe so just use all + LLFilePicker& picker = LLFilePicker::instance(); + if (!picker.getOpenFile(type)) // user cancelled -- do nothing + { + return; + } + + // put the selected path into text field + const std::string chosen_path = picker.getFirstFile(); + sInstance->mDiffPathTextBox->setText(std::string(chosen_path)); // copy the path to the executable to the textfield for display and later fetching + if(LLView::sHighlightingDiffs) // if we're already highlighting, toggle off and then on so we get the data from the new file + { + onClickToggleDiffHighlighting(NULL); + onClickToggleDiffHighlighting(NULL); + } +} + +void LLFloaterUIPreview::onClickToggleDiffHighlighting(void*) +{ + if(sInstance->mHighlightingOverlaps) + { + onClickToggleOverlapping(NULL); + sInstance->mToggleOverlapButton->toggleState(); + } + + LLView::sPreviewHighlightedElements.clear(); // clear lists first + sInstance->mDiffsMap.clear(); + sInstance->mFileList->clearHighlightedItems(); + + if(LLView::sHighlightingDiffs) // Turning highlighting off + { + LLView::sHighlightingDiffs = !sInstance->sHighlightingDiffs; + return; + } + else // Turning highlighting on + { + // Get the file and make sure it exists + std::string path_in_textfield = sInstance->mDiffPathTextBox->getText(); // get file path + BOOL error = FALSE; + + if(std::string("") == path_in_textfield) // check for blank file + { + std::string warning = "Unable to highlight differences because no file was provided; fill in the relevant text field"; + popupAndPrintWarning(warning); + error = TRUE; + } + + llstat dummy; + if(LLFile::stat(path_in_textfield.c_str(), &dummy) && !error) // check if the file exists (empty check is reduntant but useful for the informative error message) + { + std::string warning = std::string("Unable to highlight differences because an invalid path to a difference file was provided:\"") + path_in_textfield + "\""; + popupAndPrintWarning(warning); + error = TRUE; + } + + // Build a list of changed elements as given by the XML + std::list changed_element_names; + LLXmlTree xml_tree; + BOOL success = xml_tree.parseFile(path_in_textfield.c_str(), TRUE); + + if(success && !error) + { + LLXmlTreeNode* root_floater = xml_tree.getRoot(); + if(!strncmp("XuiDelta",root_floater->getName().c_str(),9)) + { + for (LLXmlTreeNode* child = root_floater->getFirstChild(); // get the first child first, then below get the next one; otherwise the iterator is invalid (bug or feature in XML code?) + child != NULL; + child = root_floater->getNextChild()) // get child for next iteration + { + if(!strncmp("file",child->getName().c_str(),5)) + { + sInstance->scanDiffFile(child); + } + else if(!strncmp("error",child->getName().c_str(),6)) + { + std::string error_file, error_message; + child->getAttributeString("filename",error_file); + child->getAttributeString("message",error_message); + if(sInstance->mDiffsMap.find(error_file) != sInstance->mDiffsMap.end()) + { + sInstance->mDiffsMap.insert(std::make_pair(error_file,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList)))); + } + sInstance->mDiffsMap[error_file].second->push_back(error_message); + } + else + { + std::string warning = std::string("Child was neither a file or an error, but rather the following:\"") + std::string(child->getName()) + "\""; + popupAndPrintWarning(warning); + error = TRUE; + break; + } + } + } + else + { + std::string warning = std::string("Root node not named XuiDelta:\"") + path_in_textfield + "\""; + popupAndPrintWarning(warning); + error = TRUE; + } + } + else if(!error) + { + std::string warning = std::string("Unable to create tree from XML:\"") + path_in_textfield + "\""; + popupAndPrintWarning(warning); + error = TRUE; + } + + if(error) // if we encountered an error, reset the button to off + { + sInstance->mToggleHighlightButton->setToggleState(FALSE); + } + else // only toggle if we didn't encounter an error + { + LLView::sHighlightingDiffs = !sInstance->sHighlightingDiffs; + sInstance->highlightChangedElements(); // *TODO: this is extraneous, right? + sInstance->highlightChangedFiles(); // *TODO: this is extraneous, right? + } + } +} + +void LLFloaterUIPreview::scanDiffFile(LLXmlTreeNode* file_node) +{ + // Get file name + std::string file_name; + file_node->getAttributeString("name",file_name); + if(std::string("") == file_name) + { + std::string warning = std::string("Empty file name encountered in differences:\"") + file_name + "\""; + popupAndPrintWarning(warning); + return; + } + + // Get a list of changed elements + // Get the first child first, then below get the next one; otherwise the iterator is invalid (bug or feature in XML code?) + for (LLXmlTreeNode* child = file_node->getFirstChild(); child != NULL; child = file_node->getNextChild()) + { + if(!strncmp("delta",child->getName().c_str(),6)) + { + std::string id; + child->getAttributeString("id",id); + if(mDiffsMap.find(file_name) == mDiffsMap.end()) + { + mDiffsMap.insert(std::make_pair(file_name,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList)))); + } + mDiffsMap[file_name].first->push_back(std::string(id.c_str())); + } + else + { + std::string warning = std::string("Child of file was not a delta, but rather the following:\"") + std::string(child->getName()) + "\""; + popupAndPrintWarning(warning); + return; + } + } +} + +void LLFloaterUIPreview::highlightChangedElements() +{ + if(NULL == mLiveFile) + { + return; + } + + // Process differences first (we want their warnings to be shown underneath other warnings) + StringListPtr changed_element_paths; + DiffMap::iterator iterExists = mDiffsMap.find(mLiveFile->mFileName); + if(iterExists != mDiffsMap.end()) + { + changed_element_paths = mDiffsMap[mLiveFile->mFileName].first; // retrieve list of changed element paths from map + } + + for(std::list::iterator iter = changed_element_paths->begin(); iter != changed_element_paths->end(); ++iter) // for every changed element path + { + LLView* element = sInstance->mDisplayedFloater; + if(!strncmp(iter->c_str(),".",1)) // if it's the root floater itself + { + continue; + } + + // Split element hierarchy path on period (*HACK: it's possible that the element name will have a period in it, in which case this won't work. See https://wiki.lindenlab.com/wiki/Viewer_Localization_Tool_Documentation.) + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("."); + tokenizer tokens(*iter, sep); + tokenizer::iterator token_iter; + BOOL failed = FALSE; + for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) + { + element = element->getChild(*token_iter,FALSE,FALSE); // try to find element: don't recur, and don't create if missing + + // if we still didn't find it... + if(NULL == element) + { + llinfos << "Unable to find element in XuiDelta file named \"" << *iter << "\" in file \"" << mLiveFile->mFileName << + "\". The element may no longer exist, the path may be incorrect, or it may not be a non-displayable element (not an LLView) such as a \"string\" type." << llendl; + failed = TRUE; + break; + } + } + + if(!failed) + { + // Now that we have a pointer to the actual element, add it to the list of elements to be highlighted + std::set::iterator iter2 = std::find(LLView::sPreviewHighlightedElements.begin(), LLView::sPreviewHighlightedElements.end(), element); + if(iter2 == LLView::sPreviewHighlightedElements.end()) + { + LLView::sPreviewHighlightedElements.insert(element); + } + } + } + + // Process errors second, so their warnings show up on top of other warnings + StringListPtr error_list; + if(iterExists != mDiffsMap.end()) + { + error_list = mDiffsMap[mLiveFile->mFileName].second; + } + for(std::list::iterator iter = error_list->begin(); iter != error_list->end(); ++iter) // for every changed element path + { + std::string warning = std::string("Error listed among differences. Filename: \"") + mLiveFile->mFileName + "\". Message: \"" + *iter + "\""; + popupAndPrintWarning(warning); + } +} + +void LLFloaterUIPreview::highlightChangedFiles() +{ + for(DiffMap::iterator iter = mDiffsMap.begin(); iter != mDiffsMap.end(); ++iter) // for every file listed in diffs + { + LLScrollListItem* item = mFileList->getItemByLabel(std::string(iter->first), FALSE, 1); + if(item) + { + item->setHighlighted(TRUE); + } + } +} + +// Respond to button click to browse for an executable with which to edit XML files +void LLFloaterUIPreview::onClickCloseDisplayedFloater(void* data) +{ + S32 caller_id = *((S32*)data); + if(caller_id == 1) + { + sInstance->mCloseOtherButton->setEnabled(FALSE); + sInstance->mToggleOverlapButton->setEnabled(FALSE); + + if(sInstance->mDisplayedFloater) + { + sInstance->mLastDisplayedX = sInstance->mDisplayedFloater->calcScreenRect().mLeft; + sInstance->mLastDisplayedY = sInstance->mDisplayedFloater->calcScreenRect().mBottom; + delete sInstance->mDisplayedFloater; + sInstance->mDisplayedFloater = NULL; + } + + if(sInstance->mLiveFile) + { + delete sInstance->mLiveFile; + sInstance->mLiveFile = NULL; + } + + if(sInstance->mToggleOverlapButton->getToggleState()) + { + sInstance->mToggleOverlapButton->toggleState(); + onClickToggleOverlapping(NULL); + } + + LLView::sPreviewClickedElement = NULL; // stop overlapping elements panel from drawing + sInstance->mOverlapPanel->mLastClickedElement = NULL; + } + else + { + sInstance->mCloseOtherButton_2->setEnabled(FALSE); + delete sInstance->mDisplayedFloater_2; + sInstance->mDisplayedFloater_2 = NULL; + } + +} + +BOOL LLPreviewedFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + selectElement(this,x,y,0); + return TRUE; +} + +// *NOTE: In order to hide all of the overlapping elements of the selected element so as to see it in context, here is what you would need to do: +// -This selectElement call fills the overlap panel as normal. The element which is "selected" here is actually just an intermediate selection step; +// what you've really selected is a list of elements: the one you clicked on and everything that overlaps it. +// -The user then selects one of the elements from this list the overlap panel (click handling to the overlap panel would have to be added). +// This becomes the final selection (as opposed to the intermediate selection that was just made). +// -Everything else that is currently displayed on the overlap panel should be hidden from view in the previewed floater itself (setVisible(FALSE)). +// -Subsequent clicks on other elements in the overlap panel (they should still be there) should make other elements the final selection. +// -On close or on the click of a new button, everything should be shown again and all selection state should be cleared. +// ~Jacob, 8/08 +BOOL LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth) +{ + if(getVisible()) + { + BOOL handled = FALSE; + if(LLFloaterUIPreview::containerType(parent)) + { + for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it) + { + LLView* child = *child_it; + S32 local_x = x - child->getRect().mLeft; + S32 local_y = y - child->getRect().mBottom; + if (child->pointInView(local_x, local_y) && + child->getVisible() && + selectElement(child, x, y, ++depth)) + { + handled = TRUE; + break; + } + } + } + + if(!handled) + { + LLView::sPreviewClickedElement = parent; + } + return TRUE; + } + else + { + return FALSE; + } +} + +void LLPreviewedFloater::draw() +{ + if(NULL != LLFloaterUIPreview::sInstance) + { + // Set and unset sDrawPreviewHighlights flag so as to avoid using two flags + if(LLFloaterUIPreview::sInstance->mHighlightingOverlaps) + { + LLView::sDrawPreviewHighlights = TRUE; + } + LLFloater::draw(); + if(LLFloaterUIPreview::sInstance->mHighlightingOverlaps) + { + LLView::sDrawPreviewHighlights = FALSE; + } + } +} + +void LLFloaterUIPreview::onClickToggleOverlapping(void*) +{ + if(LLView::sHighlightingDiffs) + { + onClickToggleDiffHighlighting(NULL); + sInstance->mToggleHighlightButton->toggleState(); + } + LLView::sPreviewHighlightedElements.clear(); // clear lists first + + S32 width, height; + sInstance->getResizeLimits(&width, &height); // illegal call of non-static member function + if(sInstance->mHighlightingOverlaps) + { + sInstance->mHighlightingOverlaps = !sInstance->mHighlightingOverlaps; + // reset list of preview highlighted elements + sInstance->setRect(LLRect(sInstance->getRect().mLeft,sInstance->getRect().mTop,sInstance->getRect().mRight - sInstance->mOverlapPanel->getRect().getWidth(),sInstance->getRect().mBottom)); + sInstance->setResizeLimits(width - sInstance->mOverlapPanel->getRect().getWidth(), height); + } + else + { + sInstance->mHighlightingOverlaps = !sInstance->mHighlightingOverlaps; + displayFloater(FALSE,1); + sInstance->setRect(LLRect(sInstance->getRect().mLeft,sInstance->getRect().mTop,sInstance->getRect().mRight + sInstance->mOverlapPanel->getRect().getWidth(),sInstance->getRect().mBottom)); + sInstance->setResizeLimits(width + sInstance->mOverlapPanel->getRect().getWidth(), height); + } + sInstance->childSetVisible("overlap_scroll", sInstance->mHighlightingOverlaps); +} + +void LLFloaterUIPreview::findOverlapsInChildren(LLView* parent) +{ + if(parent->getChildCount() == 0 || !containerType(parent)) // if it has no children or isn't a container type, skip it + { + return; + } + + // for every child of the parent + for(child_list_const_iter_t child_it = parent->getChildList()->begin(); child_it != parent->getChildList()->end(); ++child_it) + { + LLView* child = *child_it; + if(overlapIgnorable(child)) + { + continue; + } + + // for every sibling + for(child_list_const_iter_t sibling_it = parent->getChildList()->begin(); sibling_it != parent->getChildList()->end(); ++sibling_it) // for each sibling + { + LLView* sibling = *sibling_it; + if(overlapIgnorable(sibling)) + { + continue; + } + + // if they overlap... (we don't care if they're visible or enabled -- we want to check those anyway, i.e. hidden tabs that can be later shown) + if(sibling != child && elementOverlap(child, sibling)) + { + mOverlapMap[child].push_back(sibling); // add to the map + } + } + findOverlapsInChildren(child); // recur + } +} + +// *HACK: don't overlap with the drag handle and various other elements +// This is using dynamic casts because there is no object-oriented way to tell which elements contain localizable text. These are a few that are ignorable. +// *NOTE: If a list of elements which have localizable content were created, this function should return false if viewp's class is in that list. +BOOL LLFloaterUIPreview::overlapIgnorable(LLView* viewp) +{ + return NULL != dynamic_cast(viewp) || + NULL != dynamic_cast(viewp) || + NULL != dynamic_cast(viewp); +} + +// *HACK: these are the only two container types as of 8/08, per Richard +// This is using dynamic casts because there is no object-oriented way to tell which elements are containers. +BOOL LLFloaterUIPreview::containerType(LLView* viewp) +{ + return NULL != dynamic_cast(viewp) || NULL != dynamic_cast(viewp); +} + +// Check if two llview's rectangles overlap, with some tolerance +BOOL LLFloaterUIPreview::elementOverlap(LLView* view1, LLView* view2) +{ + LLSD rec1 = view1->getRect().getValue(); + LLSD rec2 = view2->getRect().getValue(); + int tolerance = 2; + return (int)rec1[0] <= (int)rec2[2] - tolerance && + (int)rec2[0] <= (int)rec1[2] - tolerance && + (int)rec1[3] <= (int)rec2[1] - tolerance && + (int)rec2[3] <= (int)rec1[1] - tolerance; +} + +void LLOverlapPanel::draw() +{ + static const std::string current_selection_text("Current selection: "); + static const std::string overlapper_text("Overlapper: "); + LLColor4 text_color = LLColor4::grey; + gGL.color4fv(text_color.mV); + + if(!LLView::sPreviewClickedElement) + { + LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5 + LLView::sDrawPreviewHighlights = FALSE; + LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text, 0, 0, 0, text_color, + LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); + } + else + { + LLFloaterUIPreview::OverlapMap::iterator iterExists = LLFloaterUIPreview::sInstance->mOverlapMap.find(LLView::sPreviewClickedElement); + if(iterExists == LLFloaterUIPreview::sInstance->mOverlapMap.end()) + { + return; + } + + std::list overlappers = LLFloaterUIPreview::sInstance->mOverlapMap[LLView::sPreviewClickedElement]; + if(overlappers.size() == 0) + { + LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5 + LLView::sDrawPreviewHighlights = FALSE; + std::string current_selection = std::string(current_selection_text + LLView::sPreviewClickedElement->getName() + " (no elements overlap)"); + S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(current_selection) + 10; + LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection, 0, 0, 0, text_color, + LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); + // widen panel enough to fit this text + LLRect rect = getRect(); + setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop)); + return; + } + + // recalculate required with and height; otherwise use cached + BOOL need_to_recalculate_bounds = FALSE; + if(mLastClickedElement == NULL) + { + need_to_recalculate_bounds = TRUE; + } + + if(NULL == mLastClickedElement) + { + mLastClickedElement = LLView::sPreviewClickedElement; + } + + // recalculate bounds for scroll panel + if(need_to_recalculate_bounds || LLView::sPreviewClickedElement->getName() != mLastClickedElement->getName()) + { + // reset panel's rectangle to its default width and height (300x600) + LLRect panel_rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); + LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(panel_rect.mLeft,panel_rect.mTop,panel_rect.mLeft+LLFloaterUIPreview::sInstance->mOverlapPanel->getRect().getWidth(),panel_rect.mTop-LLFloaterUIPreview::sInstance->mOverlapPanel->getRect().getHeight())); + + LLRect rect; + + // change bounds for selected element + int height_sum = mLastClickedElement->getRect().getHeight() + mSpacing + 80; + rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); + LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > mLastClickedElement->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + mLastClickedElement->getRect().getWidth() + 5, rect.mBottom)); + + // and widen to accomodate text if that's wider + std::string display_text = current_selection_text + LLView::sPreviewClickedElement->getName(); + S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(display_text) + 10; + rect = getRect(); + setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop)); + + std::list overlappers = LLFloaterUIPreview::sInstance->mOverlapMap[LLView::sPreviewClickedElement]; + for(std::list::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it) + { + LLView* viewp = *overlap_it; + height_sum += viewp->getRect().getHeight() + mSpacing*3; + + // widen panel's rectangle to accommodate widest overlapping element of this floater + rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); + LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > viewp->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + viewp->getRect().getWidth() + 5, rect.mBottom)); + + // and widen to accomodate text if that's wider + std::string display_text = overlapper_text + viewp->getName(); + S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(display_text) + 10; + rect = getRect(); + setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop)); + } + // change panel's height to accommodate all element heights plus spacing between them + rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); + LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(rect.mLeft,rect.mTop,rect.mRight,rect.mTop-height_sum)); + } + + LLUI::translate(5,getRect().getHeight()-10); // translate to top left + LLView::sDrawPreviewHighlights = FALSE; + + // draw currently-selected element at top of overlappers + LLUI::translate(0,-mSpacing); + LLFontGL::getFontSansSerifSmall()->renderUTF8(current_selection_text + LLView::sPreviewClickedElement->getName(), 0, 0, 0, text_color, + LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); + LLUI::translate(0,-mSpacing-LLView::sPreviewClickedElement->getRect().getHeight()); // skip spacing distance + height + LLView::sPreviewClickedElement->draw(); + + for(std::list::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it) + { + LLView* viewp = *overlap_it; + + // draw separating line + LLUI::translate(0,-mSpacing); + gl_line_2d(0,0,getRect().getWidth()-10,0,LLColor4(192.0f/255.0f,192.0f/255.0f,192.0f/255.0f)); + + // draw name + LLUI::translate(0,-mSpacing); + LLFontGL::getFontSansSerifSmall()->renderUTF8(overlapper_text + viewp->getName(), 0, 0, 0, text_color, + LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); + + // draw element + LLUI::translate(0,-mSpacing-viewp->getRect().getHeight()); // skip spacing distance + height + viewp->draw(); + } + mLastClickedElement = LLView::sPreviewClickedElement; + } +} diff --git a/indra/newview/llfloateruipreview.h b/indra/newview/llfloateruipreview.h new file mode 100644 index 0000000000..b0af841e11 --- /dev/null +++ b/indra/newview/llfloateruipreview.h @@ -0,0 +1,216 @@ +/** + * @file llfloateruipreview.h + * @brief Tool for previewing and editing floaters + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +// Tool for previewing floaters and panels for localization and UI design purposes. +// See: https://wiki.lindenlab.com/wiki/GUI_Preview_And_Localization_Tools +// See: https://jira.lindenlab.com/browse/DEV-16869 + +#ifndef LL_LLUIPREVIEW_H +#define LL_LLUIPREVIEW_H + +#include "llfloater.h" // superclass +#include "llscrollcontainer.h" // scroll container for overlapping elements +#include "lllivefile.h" // live file poll/stat/reload +#include +#include + +// Forward declarations to avoid header dependencies +class LLEventTimer; +class LLColor; +class LLScrollListCtrl; +class LLComboBox; +class LLButton; +class LLXmlTreeNode; +class LLFloaterUIPreview; +class LLFadeEventTimer; + +// Reset object to ensure that when we change the current language setting for preview purposes, +// it automatically is reset. Constructed on the stack at the start of the method; the reset +// occurs as it falls out of scope at the end of the method. See llfloateruipreview.cpp for usage. +class LLLocalizationResetForcer +{ +public: + LLLocalizationResetForcer(S32 ID); + virtual ~LLLocalizationResetForcer(); + +private: + std::string mSavedLocalization; // the localization before we change it +}; + +// Implementation of live file +// When a floater is being previewed, any saved changes to its corresponding +// file cause the previewed floater to be reloaded +class LLGUIPreviewLiveFile : public LLLiveFile +{ +public: + LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent); + virtual ~LLGUIPreviewLiveFile(); + LLFloaterUIPreview* mParent; + LLFadeEventTimer* mFadeTimer; // timer for fade-to-yellow-and-back effect to warn that file has been reloaded + BOOL mFirstFade; // setting this avoids showing the fade reload warning on first load + std::string mFileName; +protected: + bool loadFile(); +}; + +// Implementation of graphical fade in/out (on timer) for when XUI files are updated +class LLFadeEventTimer : public LLEventTimer +{ +public: + LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent); + BOOL tick(); + LLGUIPreviewLiveFile* mParent; +private: + BOOL mFadingOut; // fades in then out; this is toggled in between + LLColor4 mOriginalColor; // original color; color is reset to this after fade is coimplete +}; + +// Implementation of previewed floater +// Used to override draw and mouse handler +class LLPreviewedFloater : public LLFloater +{ +public: + LLPreviewedFloater() : LLFloater() {} + virtual void draw(); + BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + BOOL selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers +}; + +// Implementation of custom overlapping element display panel +class LLOverlapPanel : public LLPanel +{ +public: + struct Params : public LLInitParam::Block + { + Params() {} + }; + LLOverlapPanel(Params p = Params()) : LLPanel(p), + mSpacing(10), + // mClickedElement(NULL), + mLastClickedElement(NULL) + { + mOriginalWidth = getRect().getWidth(); + mOriginalHeight = getRect().getHeight(); + } + virtual void draw(); + // LLView *mClickedElement; + LLView *mLastClickedElement; + int mOriginalWidth, mOriginalHeight, mSpacing; +}; + +class LLFloaterUIPreview : public LLFloater +{ +public: + // Setup + LLFloaterUIPreview(const LLSD& key); + virtual ~LLFloaterUIPreview(); + + static std::string getLocStr(S32 ID); // fetches the localization string based on what is selected in the drop-down menu + static void displayFloater(BOOL click, S32 ID, bool save = false); // needs to be public so live file can call it when it finds an update + static BOOL containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children + static LLFloaterUIPreview* sInstance; // static instance of this (for references in handlers) + + BOOL postBuild(); // post-build setup (called by superclass' constructor) + void refreshList(); // refresh list (empty it out and fill it up from scratch) + void addFloaterEntry(const std::string& path); // add a single file's entry to the list of floaters + + LLPreviewedFloater* mDisplayedFloater; // the floater which is currently being displayed + LLPreviewedFloater* mDisplayedFloater_2; // the floater which is currently being displayed + LLGUIPreviewLiveFile* mLiveFile; // live file for checking for updates to the currently-displayed XML file + LLOverlapPanel* mOverlapPanel; // custom overlapping elements panel + // BOOL mHighlightingDiffs; // bool for whether localization diffs are being highlighted or not + BOOL mHighlightingOverlaps; // bool for whether overlapping elements are being highlighted + + typedef std::map > OverlapMap; + OverlapMap mOverlapMap; // map, of XUI element to a list of XUI elements it overlaps + + // typedef std::map,std::list > > DiffMap; // this version copies the lists etc., and thus is bad memory-wise + typedef std::list StringList; + typedef boost::shared_ptr StringListPtr; + typedef std::map > DiffMap; + DiffMap mDiffsMap; // map, of filename to pair of list of changed element paths and list of errors + +protected: + virtual void onClose(bool app_quitting); + +private: + // XUI elements for this floater + LLScrollListCtrl* mFileList; // scroll list control for file list + LLLineEditor* mEditorPathTextBox; // text field for path to editor executable + LLLineEditor* mEditorArgsTextBox; // text field for arguments to editor executable + LLLineEditor* mDiffPathTextBox; // text field for path to diff file + LLButton* mDisplayFloaterBtn; // button to display primary floater + LLButton* mDisplayFloaterBtn_2; // button to display secondary floater + LLButton* mEditFloaterBtn; // button to edit floater + LLButton* mExecutableBrowseButton; // button to browse for executable + LLButton* mCloseOtherButton; // button to close primary displayed floater + LLButton* mCloseOtherButton_2; // button to close secondary displayed floater + LLButton* mDiffBrowseButton; // button to browse for diff file + LLButton* mToggleHighlightButton; // button to toggle highlight of files/elements with diffs + LLButton* mToggleOverlapButton; // button to togle overlap panel/highlighting + LLComboBox* mLanguageSelection; // combo box for primary language selection + LLComboBox* mLanguageSelection_2; // combo box for secondary language selection + LLScrollContainer* mOverlapScrollView; // overlapping elements scroll container + S32 mLastDisplayedX, mLastDisplayedY; // stored position of last floater so the new one opens up in the same place + std::string mDelim; // the OS-specific delimiter character (/ or \) (*TODO: this shouldn't be needed, right?) + + static std::string mSavedEditorPath; // stored editor path so closing this floater doesn't reset it + static std::string mSavedEditorArgs; // stored editor args so closing this floater doesn't reset it + static std::string mSavedDiffPath; // stored diff file path so closing this floater doesn't reset it + + // Internal functionality + static void popupAndPrintWarning(std::string& warning); // pop up a warning + std::string getLocalizedDirectory(); // build and return the path to the XUI directory for the currently-selected localization + void scanDiffFile(LLXmlTreeNode* file_node); // scan a given XML node for diff entries and highlight them in its associated file + void highlightChangedElements(); // look up the list of elements to highlight and highlight them in the current floater + void highlightChangedFiles(); // look up the list of changed files to highlight and highlight them in the scroll list + void findOverlapsInChildren(LLView* parent); // fill the map below with element overlap information + static BOOL overlapIgnorable(LLView* viewp); // check it the element can be ignored for overlap/localization purposes + + // check if two elements overlap using their rectangles + // used instead of llrect functions because by adding a few pixels of leeway I can cut down drastically on the number of overlaps + BOOL elementOverlap(LLView* view1, LLView* view2); + + // Button/drop-down action listeners (self explanatory) + static void onClickDisplayFloater(void*); + static void onClickSaveFloater(void*); + static void onClickSaveAll(void*); + static void onClickEditFloater(void*); + static void onClickBrowseForEditor(void*); + static void onClickBrowseForDiffs(void*); + static void onClickToggleDiffHighlighting(void*); + static void onClickToggleOverlapping(void*); + static void onClickCloseDisplayedFloater(void*); + void onLanguageComboSelect(LLUICtrl* ctrl); +}; +#endif // LL_LLUIPREVIEW_H + diff --git a/indra/newview/llfloaterurldisplay.cpp b/indra/newview/llfloaterurldisplay.cpp index c265c6169a..7f7d05e1d2 100644 --- a/indra/newview/llfloaterurldisplay.cpp +++ b/indra/newview/llfloaterurldisplay.cpp @@ -45,9 +45,10 @@ LLFloaterURLDisplay::LLFloaterURLDisplay(const LLSD& sd) + : LLFloater() { mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterURLDisplay::createPlaceDetail, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml"); this->setVisible(false); // If positioned at 0,0 the teleport button is behind the toolbar. diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 9d91aa9868..1f59812029 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -86,12 +86,22 @@ public: // LLFloaterURLEntry() //----------------------------------------------------------------------------- LLFloaterURLEntry::LLFloaterURLEntry(LLHandle parent) - : - LLFloater(), - mPanelLandMediaHandle(parent) + : LLFloater(), + mPanelLandMediaHandle(parent) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_url_entry.xml"); +} + +//----------------------------------------------------------------------------- +// ~LLFloaterURLEntry() +//----------------------------------------------------------------------------- +LLFloaterURLEntry::~LLFloaterURLEntry() +{ + sInstance = NULL; +} +BOOL LLFloaterURLEntry::postBuild() +{ mMediaURLEdit = getChild("media_entry"); // Cancel button @@ -99,7 +109,6 @@ LLFloaterURLEntry::LLFloaterURLEntry(LLHandle parent) // Cancel button childSetAction("clear_btn", onBtnClear, this); - // clear media list button LLSD parcel_history = LLURLHistory::getURLHistory("parcel"); bool enable_clear_button = parcel_history.size() > 0 ? true : false; @@ -111,17 +120,8 @@ LLFloaterURLEntry::LLFloaterURLEntry(LLHandle parent) setDefaultBtn("ok_btn"); buildURLHistory(); - sInstance = this; -} - -//----------------------------------------------------------------------------- -// ~LLFloaterURLEntry() -//----------------------------------------------------------------------------- -LLFloaterURLEntry::~LLFloaterURLEntry() -{ - sInstance = NULL; + return TRUE; } - void LLFloaterURLEntry::buildURLHistory() { LLCtrlListInterface* url_list = childGetListInterface("media_entry"); @@ -155,7 +155,7 @@ void LLFloaterURLEntry::headerFetchComplete(U32 status, const std::string& mime_ // Decrement the cursor getWindow()->decBusyCount(); childSetVisible("loading_label", false); - close(); + closeFloater(); } // static @@ -163,7 +163,7 @@ LLHandle LLFloaterURLEntry::show(LLHandle parent) { if (sInstance) { - sInstance->open(); + sInstance->openFloater(); } else { @@ -254,7 +254,7 @@ void LLFloaterURLEntry::onBtnOK( void* userdata ) void LLFloaterURLEntry::onBtnCancel( void* userdata ) { LLFloaterURLEntry *self =(LLFloaterURLEntry *)userdata; - self->close(); + self->closeFloater(); } // static diff --git a/indra/newview/llfloaterurlentry.h b/indra/newview/llfloaterurlentry.h index 6d04326cf8..0aeca823b8 100644 --- a/indra/newview/llfloaterurlentry.h +++ b/indra/newview/llfloaterurlentry.h @@ -1,6 +1,6 @@ /** - * @file llfloaternamedesc.h - * @brief LLFloaterNameDesc class definition + * @file llfloaterurlentry.h + * @brief LLFloaterURLEntry class definition * * $LicenseInfo:firstyear=2007&license=viewergpl$ * @@ -45,7 +45,7 @@ public: // Can only be shown by LLPanelLandMedia, and pushes data back into // that panel via the handle. static LLHandle show(LLHandle panel_land_media_handle); - + /*virtual*/ BOOL postBuild(); void updateFromLandMediaPanel(); void headerFetchComplete(U32 status, const std::string& mime_type); diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp index 2922628786..12d12f37f2 100644 --- a/indra/newview/llfloatervoicedevicesettings.cpp +++ b/indra/newview/llfloatervoicedevicesettings.cpp @@ -41,7 +41,6 @@ #include "llcombobox.h" #include "llfocusmgr.h" #include "lliconctrl.h" -#include "llprefsvoice.h" #include "llsliderctrl.h" #include "llviewercontrol.h" #include "llvoiceclient.h" @@ -52,6 +51,7 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings() + : LLPanel() { mCtrlInputDevices = NULL; mCtrlOutputDevices = NULL; @@ -113,7 +113,7 @@ void LLPanelVoiceDeviceSettings::draw() { if (power_bar_idx < discrete_power) { - LLColor4 color = (power_bar_idx >= 3) ? gSavedSettings.getColor4("OverdrivenColor") : gSavedSettings.getColor4("SpeakingColor"); + LLColor4 color = (power_bar_idx >= 3) ? gSavedSkinSettings.getColor4("OverdrivenColor") : gSavedSkinSettings.getColor4("SpeakingColor"); gl_rect_2d(bar_view->getRect(), color, TRUE); } gl_rect_2d(bar_view->getRect(), LLColor4::grey, FALSE); @@ -240,7 +240,7 @@ void LLPanelVoiceDeviceSettings::refresh() } } -void LLPanelVoiceDeviceSettings::onOpen() +void LLPanelVoiceDeviceSettings::initialize() { mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); @@ -255,7 +255,7 @@ void LLPanelVoiceDeviceSettings::onOpen() LLVoiceChannel::suspend(); } -void LLPanelVoiceDeviceSettings::onClose(bool app_quitting) +void LLPanelVoiceDeviceSettings::cleanup() { gVoiceClient->tuningStop(); LLVoiceChannel::resume(); @@ -284,31 +284,32 @@ void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user // LLFloaterVoiceDeviceSettings::LLFloaterVoiceDeviceSettings(const LLSD& seed) - : LLFloater(std::string("floater_device_settings")), + : LLFloater(), mDevicePanel(NULL) { mFactoryMap["device_settings"] = LLCallbackMap(createPanelVoiceDeviceSettings, this); // do not automatically open singleton floaters (as result of getInstance()) - BOOL no_open = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_device_settings.xml", &mFactoryMap, no_open); +// BOOL no_open = FALSE; +// Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_device_settings.xml", no_open); +} +BOOL LLFloaterVoiceDeviceSettings::postBuild() +{ center(); + return TRUE; } - -void LLFloaterVoiceDeviceSettings::onOpen() +void LLFloaterVoiceDeviceSettings::onOpen(const LLSD& key) { if(mDevicePanel) { - mDevicePanel->onOpen(); + mDevicePanel->initialize(); } - - LLFloater::onOpen(); } void LLFloaterVoiceDeviceSettings::onClose(bool app_quitting) { if(mDevicePanel) { - mDevicePanel->onClose(app_quitting); + mDevicePanel->cleanup(); } setVisible(FALSE); diff --git a/indra/newview/llfloatervoicedevicesettings.h b/indra/newview/llfloatervoicedevicesettings.h index d30a57f161..47f41d6d7e 100644 --- a/indra/newview/llfloatervoicedevicesettings.h +++ b/indra/newview/llfloatervoicedevicesettings.h @@ -36,8 +36,6 @@ #include "llfloater.h" -class LLPrefsVoiceLogic; - class LLPanelVoiceDeviceSettings : public LLPanel { public: @@ -49,8 +47,8 @@ public: void apply(); void cancel(); void refresh(); - void onOpen(); - void onClose(bool app_quitting); + void initialize(); + void cleanup(); protected: static void onCommitInputDevice(LLUICtrl* ctrl, void* user_data); @@ -68,7 +66,8 @@ class LLFloaterVoiceDeviceSettings : public LLFloater, public LLFloaterSingleton { public: LLFloaterVoiceDeviceSettings(const LLSD& seed); - /*virtual*/ void onOpen(); + virtual BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void draw(); void apply(); diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index 730c1393ca..5b551af836 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -66,25 +66,11 @@ LLFloaterWater* LLFloaterWater::sWaterMenu = NULL; std::set LLFloaterWater::sDefaultPresets; -LLFloaterWater::LLFloaterWater() : LLFloater(std::string("water floater")) +LLFloaterWater::LLFloaterWater() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml"); - // add the combo boxes - LLComboBox* comboBox = getChild("WaterPresetsCombo"); - - if(comboBox != NULL) { - - std::map::iterator mIt = - LLWaterParamManager::instance()->mParamList.begin(); - for(; mIt != LLWaterParamManager::instance()->mParamList.end(); mIt++) - { - comboBox->add(mIt->first); - } - - // set defaults on combo boxes - comboBox->selectByValue(LLSD("Default")); - } std::string def_water = getString("WLDefaultWaterNames"); @@ -97,14 +83,33 @@ LLFloaterWater::LLFloaterWater() : LLFloater(std::string("water floater")) sDefaultPresets.insert(tok); } - // load it up - initCallbacks(); + } LLFloaterWater::~LLFloaterWater() { } +BOOL LLFloaterWater::postBuild() +{ + // add the combo boxes + LLComboBox* comboBox = getChild("WaterPresetsCombo"); + + if(comboBox != NULL) { + + std::map::iterator mIt = + LLWaterParamManager::instance()->mParamList.begin(); + for(; mIt != LLWaterParamManager::instance()->mParamList.end(); mIt++) + { + comboBox->add(mIt->first); + } + // set defaults on combo boxes + comboBox->selectByValue(LLSD("Default")); + } + // load it up + initCallbacks(); + return TRUE; +} void LLFloaterWater::initCallbacks(void) { // help buttons @@ -165,7 +170,7 @@ void LLFloaterWater::initCallbacks(void) { childSetCommitCallback("WaterWave2DirX", onVector2ControlXMoved, ¶m_mgr->mWave2Dir); childSetCommitCallback("WaterWave2DirY", onVector2ControlYMoved, ¶m_mgr->mWave2Dir); - comboBox->setCommitCallback(onChangePresetName); + comboBox->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1)); LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); @@ -296,7 +301,7 @@ LLFloaterWater* LLFloaterWater::instance() if (!sWaterMenu) { sWaterMenu = new LLFloaterWater(); - sWaterMenu->open(); + sWaterMenu->openFloater(); sWaterMenu->setFocus(TRUE); } return sWaterMenu; @@ -310,7 +315,7 @@ void LLFloaterWater::show() //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml"); //water->initCallbacks(); - water->open(); + water->openFloater(); } bool LLFloaterWater::isOpen() @@ -712,17 +717,13 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r } -void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl, void * userData) +void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl) { - LLComboBox * combo_box = static_cast(ctrl); - - if(combo_box->getSimple() == "") + std::string data = ctrl->getValue().asString(); + if(!data.empty()) { - return; + LLWaterParamManager::instance()->loadPreset(data); + sWaterMenu->syncMenu(); } - - LLWaterParamManager::instance()->loadPreset( - combo_box->getSelectedValue().asString()); - sWaterMenu->syncMenu(); } diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h index 774d5c5a75..50fd7dd450 100644 --- a/indra/newview/llfloaterwater.h +++ b/indra/newview/llfloaterwater.h @@ -53,7 +53,7 @@ public: LLFloaterWater(); virtual ~LLFloaterWater(); - + /*virtual*/ BOOL postBuild(); /// initialize all void initCallbacks(void); @@ -107,7 +107,7 @@ public: static bool deleteAlertCallback(const LLSD& notification, const LLSD& response); /// what to do when you change the preset name - static void onChangePresetName(LLUICtrl* ctrl, void* userData); + void onChangePresetName(LLUICtrl* ctrl); //// menu management diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 98b315795a..2ba4002d94 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -67,15 +67,36 @@ std::set LLFloaterWindLight::sDefaultPresets; static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; -LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floater")) +LLFloaterWindLight::LLFloaterWindLight() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml"); + + + // add the list of presets + std::string def_days = getString("WLDefaultSkyNames"); + + // no editing or deleting of the blank string + sDefaultPresets.insert(""); + boost_tokenizer tokens(def_days, boost::char_separator(":")); + for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) + { + std::string tok(*token_iter); + sDefaultPresets.insert(tok); + } +} + +LLFloaterWindLight::~LLFloaterWindLight() +{ +} +BOOL LLFloaterWindLight::postBuild() +{ // add the combo boxes LLComboBox* comboBox = getChild("WLPresetsCombo"); if(comboBox != NULL) { - + std::map::iterator mIt = LLWLParamManager::instance()->mParamList.begin(); for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++) @@ -89,27 +110,10 @@ LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floa // set defaults on combo boxes comboBox->selectByValue(LLSD("Default")); } - - // add the list of presets - std::string def_days = getString("WLDefaultSkyNames"); - - // no editing or deleting of the blank string - sDefaultPresets.insert(""); - boost_tokenizer tokens(def_days, boost::char_separator(":")); - for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - std::string tok(*token_iter); - sDefaultPresets.insert(tok); - } - // load it up initCallbacks(); + return TRUE; } - -LLFloaterWindLight::~LLFloaterWindLight() -{ -} - void LLFloaterWindLight::initCallbacks(void) { // help buttons @@ -210,7 +214,7 @@ void LLFloaterWindLight::initCallbacks(void) { childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); - childSetCommitCallback("DrawClassicClouds", LLSavedSettingsGlue::setBOOL, (void*)"SkyUseClassicClouds"); + getChild("DrawClassicClouds")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "SkyUseClassicClouds")); // WL Top childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); @@ -222,7 +226,7 @@ void LLFloaterWindLight::initCallbacks(void) { childSetAction("WLSavePreset", onSavePreset, comboBox); childSetAction("WLDeletePreset", onDeletePreset, comboBox); - comboBox->setCommitCallback(onChangePresetName); + comboBox->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, this, _1)); // Dome @@ -444,7 +448,7 @@ LLFloaterWindLight* LLFloaterWindLight::instance() if (!sWindLight) { sWindLight = new LLFloaterWindLight(); - sWindLight->open(); + sWindLight->openFloater(); sWindLight->setFocus(TRUE); } return sWindLight; @@ -458,7 +462,7 @@ void LLFloaterWindLight::show() //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); //windLight->initCallbacks(); - windLight->open(); + windLight->openFloater(); } bool LLFloaterWindLight::isOpen() @@ -903,20 +907,16 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS } -void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl, void * userData) +void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) { deactivateAnimator(); - LLComboBox * combo_box = static_cast(ctrl); - - if(combo_box->getSimple() == "") + std::string data = ctrl->getValue().asString(); + if(!data.empty()) { - return; + LLWLParamManager::instance()->loadPreset( data); + sWindLight->syncMenu(); } - - LLWLParamManager::instance()->loadPreset( - combo_box->getSelectedValue().asString()); - sWindLight->syncMenu(); } void LLFloaterWindLight::onOpenDayCycle(void* userData) diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h index 3447caa923..e527a5637c 100644 --- a/indra/newview/llfloaterwindlight.h +++ b/indra/newview/llfloaterwindlight.h @@ -53,7 +53,7 @@ public: LLFloaterWindLight(); virtual ~LLFloaterWindLight(); - + /*virtual*/ BOOL postBuild(); /// initialize all void initCallbacks(void); @@ -104,7 +104,7 @@ public: bool deleteAlertCallback(const LLSD& notification, const LLSD& response); /// what to do when you change the preset name - static void onChangePresetName(LLUICtrl* ctrl, void* userData); + void onChangePresetName(LLUICtrl* ctrl); /// when user hits the save preset button static void onOpenDayCycle(void* userData); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 8326557cf8..251539088b 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -41,23 +41,22 @@ #include "llfloaterworldmap.h" #include "llagent.h" -#include "llviewerwindow.h" #include "llbutton.h" #include "llcallingcard.h" -#include "llcolorscheme.h" #include "llcombobox.h" #include "llviewercontrol.h" #include "lldraghandle.h" #include "llfirstuse.h" +#include "llfloaterreg.h" // getTypedInstance() #include "llfocusmgr.h" #include "lllandmarklist.h" #include "lllineeditor.h" #include "llpreviewlandmark.h" #include "llregionhandle.h" #include "llscrolllistctrl.h" +#include "llslurl.h" #include "lltextbox.h" #include "lltracker.h" -#include "llurldispatcher.h" #include "llviewermenu.h" #include "llviewerregion.h" #include "llviewerstats.h" @@ -69,6 +68,7 @@ #include "llweb.h" #include "llglheaders.h" +#include "llwindow.h" // copyTextToClipboard() //--------------------------------------------------------------------------- // Constants @@ -84,17 +84,10 @@ enum EPanDirection }; // Values in pixels per region -static const F32 ZOOM_MIN = -8.f; // initial value, updated by adjustZoomSlider -static const F32 ZOOM_MAX = 0.f; -static const F32 ZOOM_INC = 0.2f; +static const F32 ZOOM_MAX = 128.f; -static const F32 SIM_COORD_MIN = 0.f; -static const F32 SIM_COORD_MAX = 255.f; static const F32 SIM_COORD_DEFAULT = 128.f; -static const F64 MAX_FLY_DISTANCE = 363.f; // Diagonal size of one sim. -static const F64 MAX_FLY_DISTANCE_SQUARED = MAX_FLY_DISTANCE * MAX_FLY_DISTANCE; - //--------------------------------------------------------------------------- // Globals //--------------------------------------------------------------------------- @@ -148,8 +141,8 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001" //--------------------------------------------------------------------------- -LLFloaterWorldMap::LLFloaterWorldMap() -: LLFloater(std::string("worldmap")), +LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key) +: LLFloater(key), mInventory(NULL), mInventoryObserver(NULL), mFriendObserver(NULL), @@ -161,16 +154,18 @@ LLFloaterWorldMap::LLFloaterWorldMap() mTrackedLocation(0,0,0), mTrackedStatus(LLTracker::TRACKING_NOTHING) { - LLCallbackMap::map_t factory_map; - factory_map["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); - factory_map["terrain_mapview"] = LLCallbackMap(createWorldMapView, NULL); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &factory_map); + gFloaterWorldMap = this; + + mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); + mFactoryMap["terrain_mapview"] = LLCallbackMap(createWorldMapView, NULL); + + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", FALSE); } // static void* LLFloaterWorldMap::createWorldMapView(void* data) { - return new LLWorldMapView(std::string("mapview"), LLRect(0,300,400,0)); + return new LLWorldMapView(); } BOOL LLFloaterWorldMap::postBuild() @@ -178,27 +173,14 @@ BOOL LLFloaterWorldMap::postBuild() mTabs = getChild("maptab"); if (!mTabs) return FALSE; - LLPanel *panel; - - panel = mTabs->getChild("objects_mapview"); - if (panel) - { - mTabs->setTabChangeCallback(panel, onCommitBackground); - mTabs->setTabUserData(panel, this); - } - panel = mTabs->getChild("terrain_mapview"); - if (panel) - { - mTabs->setTabChangeCallback(panel, onCommitBackground); - mTabs->setTabUserData(panel, this); - } + mTabs->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCommitBackground, this)); // The following callback syncs the worlmap tabs with the images. // Commented out since it was crashing when LLWorldMap became a singleton. // We should be fine without it but override the onOpen method and put it // there if it turns out to be needed. -MG // - //onCommitBackground((void*)this, false); + //onCommitBackground(); childSetCommitCallback("friend combo", onAvatarComboCommit, this); @@ -206,22 +188,22 @@ BOOL LLFloaterWorldMap::postBuild() if (avatar_combo) { avatar_combo->selectFirstItem(); - avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); - avatar_combo->setTextEntryCallback( onComboTextEntry ); + avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) ); + avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); } childSetAction("DoSearch", onLocationCommit, this); - childSetFocusChangedCallback("location", onLocationFocusChanged, this); + getChild("location")->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); LLLineEditor *location_editor = getChild("location"); if (location_editor) { - location_editor->setKeystrokeCallback( onSearchTextEntry ); + location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this, _1), NULL ); } childSetCommitCallback("search_results", onCommitSearchResult, this); - childSetDoubleClickCallback("search_results", onClickTeleportBtn); + getChild("search_results")->setDoubleClickCallback(onClickTeleportBtn, this); childSetCommitCallback("spin x", onCommitLocation, this); childSetCommitCallback("spin y", onCommitLocation, this); childSetCommitCallback("spin z", onCommitLocation, this); @@ -232,8 +214,8 @@ BOOL LLFloaterWorldMap::postBuild() if (landmark_combo) { landmark_combo->selectFirstItem(); - landmark_combo->setPrearrangeCallback( onLandmarkComboPrearrange ); - landmark_combo->setTextEntryCallback( onComboTextEntry ); + landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) ); + landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); } childSetAction("Go Home", onGoHome, this); @@ -267,28 +249,44 @@ LLFloaterWorldMap::~LLFloaterWorldMap() // avatar tracker will delete this for us. mFriendObserver = NULL; + + gFloaterWorldMap = NULL; } +//static +LLFloaterWorldMap* LLFloaterWorldMap::getInstance() +{ + return LLFloaterReg::getTypedInstance("world_map"); +} // virtual void LLFloaterWorldMap::onClose(bool app_quitting) { + // While we're not visible, discard the overlay images we're using + LLWorldMap::getInstance()->clearImageRefs(); + +#if RELEASE_FOR_DOWNLOAD setVisible(FALSE); +#else + // Don't call destroy(), we need to delete this immediately + delete this; // sets gFloaterWorldMap = NULL; + // need to reconstruct gFloaterWorldMap so that code that assumes it exists doesn't crash + LLFloaterReg::getInstance("world_map"); // constructs a LLFloaterWorldMap and sets gFloaterWorldMap + gFloaterWorldMap->setVisible(FALSE); // hide it +#endif } -// static -void LLFloaterWorldMap::show(void*, BOOL center_on_target) +// virtual +void LLFloaterWorldMap::onOpen(const LLSD& key) { - BOOL was_visible = gFloaterWorldMap->getVisible(); + bool center_on_target = (key.asString() == "center"); - gFloaterWorldMap->mIsClosing = FALSE; - gFloaterWorldMap->open(); /* Flawfinder: ignore */ + mIsClosing = FALSE; LLWorldMapView* map_panel; - map_panel = (LLWorldMapView*)gFloaterWorldMap->mTabs->getCurrentPanel(); + map_panel = (LLWorldMapView*)mTabs->getCurrentPanel(); map_panel->clearLastClick(); - if (!was_visible) { // reset pan on show, so it centers on you again if (!center_on_target) @@ -303,13 +301,13 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) // Reload any maps that may have changed LLWorldMap::getInstance()->clearSimFlags(); - const S32 panel_num = gFloaterWorldMap->mTabs->getCurrentPanelIndex(); + const S32 panel_num = mTabs->getCurrentPanelIndex(); const bool request_from_sim = true; LLWorldMap::getInstance()->setCurrentLayer(panel_num, request_from_sim); // We may already have a bounding box for the regions of the world, // so use that to adjust the view. - gFloaterWorldMap->adjustZoomSliderBounds(); + adjustZoomSliderBounds(); // Could be first show LLFirstUse::useMap(); @@ -318,19 +316,19 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); gInventory.startBackgroundFetch(landmark_folder_id); - gFloaterWorldMap->childSetFocus("location", TRUE); + childSetFocus("location", TRUE); gFocusMgr.triggerFocusFlash(); - gFloaterWorldMap->buildAvatarIDList(); - gFloaterWorldMap->buildLandmarkIDLists(); + buildAvatarIDList(); + buildLandmarkIDLists(); // If nothing is being tracked, set flag so the user position will be found - gFloaterWorldMap->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); + mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); } if (center_on_target) { - gFloaterWorldMap->centerOnTarget(FALSE); + centerOnTarget(FALSE); } } @@ -345,46 +343,6 @@ void LLFloaterWorldMap::reloadIcons(void*) } -// static -void LLFloaterWorldMap::toggle(void*) -{ - BOOL visible = gFloaterWorldMap->getVisible(); - - if (!visible) - { - show(NULL, FALSE); - } - else - { - gFloaterWorldMap->mIsClosing = TRUE; - gFloaterWorldMap->close(); - } -} - - -// static -void LLFloaterWorldMap::hide(void*) -{ - gFloaterWorldMap->mIsClosing = TRUE; - gFloaterWorldMap->close(); -} - - -// virtual -void LLFloaterWorldMap::setVisible( BOOL visible ) -{ - LLFloater::setVisible( visible ); - - gSavedSettings.setBOOL( "ShowWorldMap", visible ); - - if( !visible ) - { - // While we're not visible, discard the overlay images we're using - LLWorldMap::getInstance()->clearImageRefs(); - } -} - - // virtual BOOL LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask) { @@ -428,6 +386,9 @@ void LLFloaterWorldMap::reshape( S32 width, S32 height, BOOL called_from_parent // virtual void LLFloaterWorldMap::draw() { + static LLCachedControl map_track_color(gSavedSkinSettings, "MapTrackColor", LLColor4::white); + static LLCachedControl map_track_disabled_color(gSavedSkinSettings, "MapTrackDisabledColor", LLColor4::white); + // Hide/Show Mature Events controls childSetVisible("events_mature_icon", gAgent.canAccessMature()); childSetVisible("events_mature_label", gAgent.canAccessMature()); @@ -456,25 +417,25 @@ void LLFloaterWorldMap::draw() LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if (LLTracker::TRACKING_AVATAR == tracking_status) { - childSetColor("avatar_icon", gTrackColor); + childSetColor("avatar_icon", map_track_color); } else { - childSetColor("avatar_icon", gDisabledTrackColor); + childSetColor("avatar_icon", map_track_disabled_color); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { - childSetColor("landmark_icon", gTrackColor); + childSetColor("landmark_icon", map_track_color); } else { - childSetColor("landmark_icon", gDisabledTrackColor); + childSetColor("landmark_icon", map_track_disabled_color); } if (LLTracker::TRACKING_LOCATION == tracking_status) { - childSetColor("location_icon", gTrackColor); + childSetColor("location_icon", map_track_color); } else { @@ -488,7 +449,7 @@ void LLFloaterWorldMap::draw() } else { - childSetColor("location_icon", gDisabledTrackColor); + childSetColor("location_icon", map_track_disabled_color); } } @@ -703,7 +664,7 @@ void LLFloaterWorldMap::updateLocation() childSetValue("spin z", LLSD(agent_z) ); // Set the current SLURL - mSLURL = LLURLDispatcher::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z); + mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z); } } @@ -740,7 +701,7 @@ void LLFloaterWorldMap::updateLocation() // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL if ( gotSimName ) { - mSLURL = LLURLDispatcher::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])); + mSLURL = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])); } else { // Empty SLURL will disable the "Copy SLURL to clipboard" button @@ -1024,7 +985,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds() // Make sure the zoom slider can be moved at least a little bit. // Likewise, less than the increment pixels per region is just silly. - pixels_per_region = llclamp(pixels_per_region, 1.f, (F32)(pow(2.f, ZOOM_MAX) * 128.f)); + pixels_per_region = llclamp(pixels_per_region, 1.f, ZOOM_MAX); F32 min_power = log(pixels_per_region/256.f)/log(2.f); childSetMinValue("zoom slider", min_power); @@ -1062,20 +1023,18 @@ void LLFloaterWorldMap::onPanBtn( void* userdata ) void LLFloaterWorldMap::onGoHome(void*) { gAgent.teleportHome(); - gFloaterWorldMap->close(); + gFloaterWorldMap->closeFloater(); } -// static -void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdata ) +void LLFloaterWorldMap::onLandmarkComboPrearrange( ) { - LLFloaterWorldMap* self = gFloaterWorldMap; - if( !self || self->mIsClosing ) + if( mIsClosing ) { return; } - LLCtrlListInterface *list = self->childGetListInterface("landmark combo"); + LLCtrlListInterface *list = childGetListInterface("landmark combo"); if (!list) return; LLUUID current_choice = list->getCurrentID(); @@ -1089,7 +1048,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdat } -void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata ) +void LLFloaterWorldMap::onComboTextEntry() { // Reset the tracking whenever we start typing into any of the search fields, // so that hitting does an auto-complete versus teleporting us to the @@ -1097,11 +1056,10 @@ void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata ) LLTracker::clearFocus(); } -// static -void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl, void* userdata ) +void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl ) { - onComboTextEntry(ctrl, userdata); - updateSearchEnabled(ctrl, userdata); + onComboTextEntry(); + updateSearchEnabled(); } // static @@ -1154,15 +1112,14 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) } // static -void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata ) +void LLFloaterWorldMap::onAvatarComboPrearrange( ) { - LLFloaterWorldMap* self = gFloaterWorldMap; - if( !self || self->mIsClosing ) + if( mIsClosing ) { return; } - LLCtrlListInterface *list = self->childGetListInterface("friend combo"); + LLCtrlListInterface *list = childGetListInterface("friend combo"); if (!list) return; LLUUID current_choice; @@ -1172,7 +1129,7 @@ void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata current_choice = LLAvatarTracker::instance().getAvatarID(); } - self->buildAvatarIDList(); + buildAvatarIDList(); if( !list->setCurrentByID( current_choice ) || current_choice.isNull() ) { @@ -1208,24 +1165,21 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) } } -//static -void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus, void* userdata ) +void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus ) { - updateSearchEnabled((LLUICtrl*)focus, userdata); + updateSearchEnabled(); } -// static -void LLFloaterWorldMap::updateSearchEnabled( LLUICtrl* ctrl, void* userdata ) +void LLFloaterWorldMap::updateSearchEnabled() { - LLFloaterWorldMap *self = gFloaterWorldMap; - if (self->childHasKeyboardFocus("location") && - self->childGetValue("location").asString().length() > 0) + if (childHasKeyboardFocus("location") && + childGetValue("location").asString().length() > 0) { - self->setDefaultBtn("DoSearch"); + setDefaultBtn("DoSearch"); } else { - self->setDefaultBtn(NULL); + setDefaultBtn(NULL); } } @@ -1312,7 +1266,7 @@ void LLFloaterWorldMap::onClickTeleportBtn(void* data) void LLFloaterWorldMap::onCopySLURL(void* data) { LLFloaterWorldMap* self = (LLFloaterWorldMap*)data; - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(self->mSLURL)); + self->getWindow()->copyTextToClipboard(utf8str_to_wstring(self->mSLURL)); LLSD args; args["SLURL"] = self->mSLURL; @@ -1375,7 +1329,7 @@ void LLFloaterWorldMap::fly() if (!pos_global.isExactlyZero()) { gAgent.startAutoPilotGlobal( pos_global ); - close(); + closeFloater(); } else { @@ -1536,14 +1490,10 @@ void LLFloaterWorldMap::flyToAvatar() } } -// static -void LLFloaterWorldMap::onCommitBackground(void* userdata, bool from_click) +void LLFloaterWorldMap::onCommitBackground() { - LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata; - // Find my index - S32 index = self->mTabs->getCurrentPanelIndex(); - + S32 index = mTabs->getCurrentPanelIndex(); LLWorldMap::getInstance()->setCurrentLayer(index); } @@ -1612,7 +1562,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) } else if (num_results == 0) { - list->addCommentText(std::string("None found.")); + list->setCommentText(std::string("None found.")); list->operateOnAll(LLCtrlListInterface::OP_DESELECT); } } diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index b0e72f298a..a7d7051b40 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -50,28 +50,27 @@ class LLInventoryModel; class LLInventoryObserver; class LLItemInfo; class LLTabContainer; -class LLWorldMapView; class LLFloaterWorldMap : public LLFloater { public: - LLFloaterWorldMap(); + LLFloaterWorldMap(const LLSD& key); virtual ~LLFloaterWorldMap(); + // Prefer this to gFloaterWorldMap + static LLFloaterWorldMap* getInstance(); + static void *createWorldMapView(void* data); BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); - static void show(void*, BOOL center_on_target ); static void reloadIcons(void*); - static void toggle(void*); - static void hide(void*); /*virtual*/ void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE ); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ void setVisible(BOOL visible); /*virtual*/ void draw(); // methods for dealing with inventory. The observe() method is @@ -117,16 +116,16 @@ protected: static void onGoHome(void* data); - static void onLandmarkComboPrearrange( LLUICtrl* ctrl, void* data ); + void onLandmarkComboPrearrange( ); static void onLandmarkComboCommit( LLUICtrl* ctrl, void* data ); - static void onAvatarComboPrearrange( LLUICtrl* ctrl, void* data ); + void onAvatarComboPrearrange( ); static void onAvatarComboCommit( LLUICtrl* ctrl, void* data ); - static void onCommitBackground(void* data, bool from_click); + void onCommitBackground(); - static void onComboTextEntry( LLLineEditor* ctrl, void* data ); - static void onSearchTextEntry( LLLineEditor* ctrl, void* data ); + void onComboTextEntry( ); + void onSearchTextEntry( LLLineEditor* ctrl ); static void onClearBtn(void*); static void onFlyBtn(void*); @@ -153,8 +152,8 @@ protected: void flyToAvatar(); void teleportToAvatar(); - static void updateSearchEnabled( LLUICtrl* ctrl, void* userdata ); - static void onLocationFocusChanged( LLFocusableElement* ctrl, void* userdata ); + void updateSearchEnabled( ); + void onLocationFocusChanged( LLFocusableElement* ctrl ); static void onLocationCommit( void* userdata ); static void onCommitLocation( LLUICtrl* ctrl, void* userdata ); static void onCommitSearchResult( LLUICtrl* ctrl, void* userdata ); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 97a3bd7c50..5b17c98ef0 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -45,15 +45,16 @@ #include "llinventory.h" #include "llcallbacklist.h" +#include "llinventorybridge.h" #include "llinventoryclipboard.h" // *TODO: remove this once hack below gone. #include "llinventoryview.h"// hacked in for the bonus context menu items. #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" -#include "llresmgr.h" #include "llpreview.h" #include "llscrollcontainer.h" // hack to allow scrolling #include "lltooldraganddrop.h" +#include "lltrans.h" #include "llui.h" #include "llviewerimage.h" #include "llviewerimagelist.h" @@ -110,28 +111,16 @@ void renamer_focus_lost( LLFocusableElement* handler, void* user_data ); // statics const LLFontGL* LLFolderViewItem::sFont = NULL; const LLFontGL* LLFolderViewItem::sSmallFont = NULL; -LLColor4 LLFolderViewItem::sFgColor; -LLColor4 LLFolderViewItem::sHighlightBgColor; -LLColor4 LLFolderViewItem::sHighlightFgColor; -LLColor4 LLFolderViewItem::sFilterBGColor; -LLColor4 LLFolderViewItem::sFilterTextColor; -LLColor4 LLFolderViewItem::sSuffixColor; -LLColor4 LLFolderViewItem::sSearchStatusColor; LLUIImagePtr LLFolderViewItem::sArrowImage; LLUIImagePtr LLFolderViewItem::sBoxImage; +const LLColor4U DEFAULT_WHITE(255, 255, 255); + //static void LLFolderViewItem::initClass() { - sFont = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); - sSmallFont = LLResMgr::getInstance()->getRes( LLFONT_SMALL ); - sFgColor = gColors.getColor( "MenuItemEnabledColor" ); - sHighlightBgColor = gColors.getColor( "MenuItemHighlightBgColor" ); - sHighlightFgColor = gColors.getColor( "MenuItemHighlightFgColor" ); - sFilterBGColor = gColors.getColor( "FilterBackgroundColor" ); - sFilterTextColor = gColors.getColor( "FilterTextColor" ); - sSuffixColor = gColors.getColor( "InventoryItemSuffixColor" ); - sSearchStatusColor = gColors.getColor( "InventorySearchStatusColor" ); + sFont = LLFontGL::getFontSansSerifSmall(); + sSmallFont = LLFontGL::getFontMonospace(); sArrowImage = LLUI::getUIImage("folder_arrow.tga"); sBoxImage = LLUI::getUIImage("rounded_square.tga"); } @@ -143,23 +132,18 @@ void LLFolderViewItem::cleanupClass() sBoxImage = NULL; } -// Default constructor // NOTE: Optimize this, we call it a *lot* when opening a large inventory -LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, - time_t creation_date, - LLFolderView* root, - LLFolderViewEventListener* listener ) : - LLUICtrl( name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL, FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT), - mLabel( name ), + +// Default constructor +LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p) +: LLView(p), mLabelWidth(0), - mCreationDate(creation_date), + mLabelWidthDirty(false), mParentFolder( NULL ), - mListener( listener ), mIsSelected( FALSE ), mIsCurSelection( FALSE ), mSelectPending(FALSE), mLabelStyle( LLFontGL::NORMAL ), - mIcon(icon), mHasVisibleChildren(FALSE), mIndentation(0), mNumDescendantsSelected(0), @@ -167,12 +151,16 @@ LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, mLastFilterGeneration(-1), mStringMatchOffset(std::string::npos), mControlLabelRotation(0.f), - mRoot( root ), mDragAndDropTarget(FALSE), - mIsLoading(FALSE) + mIsLoading(FALSE), + mLabel(p.name), + mRoot(p.root), + mCreationDate(p.creation_date), + mListener(p.listener), + mArrowImage(p.folder_arrow_image), + mBoxImage(p.selection_image) { - refresh(); // possible opt: only call refreshFromListener() - setTabStop(FALSE); + refresh(); } // Destroys the object @@ -258,7 +246,7 @@ BOOL LLFolderViewItem::potentiallyVisible() BOOL LLFolderViewItem::getFiltered() { - return mFiltered && mLastFilterGeneration >= mRoot->getFilter()->getMinRequiredGeneration(); + return mFiltered && mLastFilterGeneration >= getRoot()->getFilter()->getMinRequiredGeneration(); } BOOL LLFolderViewItem::getFiltered(S32 filter_generation) @@ -283,6 +271,15 @@ void LLFolderViewItem::refreshFromListener() if(mListener) { mLabel = mListener->getDisplayName(); + LLAssetType::EType preferred_type = mListener->getPreferredType(); + + // *TODO: to be removed when database supports multi language. This is a + // temporary attempt to display the inventory folder in the user locale. + if (preferred_type != LLAssetType::AT_NONE) + { + mLabel = LLTrans::getString("InvFolder " + mLabel); + }; + setIcon(mListener->getIcon()); time_t creation_date = mListener->getCreationDate(); if (mCreationDate != creation_date) @@ -307,20 +304,15 @@ void LLFolderViewItem::refresh() { mSearchableLabel.assign(searchable_label); dirtyFilter(); - // some part of label has changed, so overall width has potentially changed + // some part of label has changed, so overall width has potentially changed, and sort order too if (mParentFolder) { + mParentFolder->requestSort(); mParentFolder->requestArrange(); } } - S32 label_width = sFont->getWidth(mLabel); - if( mLabelSuffix.size() ) - { - label_width += sFont->getWidth( mLabelSuffix ); - } - - mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + label_width; + mLabelWidthDirty = true; } void LLFolderViewItem::applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor) @@ -397,6 +389,12 @@ BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView* roo S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation) { mIndentation = mParentFolder ? mParentFolder->getIndentation() + LEFT_INDENTATION : 0; + if (mLabelWidthDirty) + { + mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + sFont->getWidth(mSearchableLabel); + mLabelWidthDirty = false; + } + *width = llmax(*width, mLabelWidth + mIndentation); *height = getItemHeight(); return *height; @@ -574,14 +572,13 @@ void LLFolderViewItem::rename(const std::string& new_name) { if( !new_name.empty() ) { - mLabel = new_name; if( mListener ) { mListener->renameItem(new_name); if(mParentFolder) { - mParentFolder->resort(this); + mParentFolder->requestSort(); } } } @@ -796,6 +793,14 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, void LLFolderViewItem::draw() { + static LLCachedControl sFgColor(gSavedSkinSettings, "MenuItemEnabledColor", DEFAULT_WHITE); + static LLCachedControl sHighlightBgColor(gSavedSkinSettings, "MenuItemHighlightBgColor", DEFAULT_WHITE); + static LLCachedControl sHighlightFgColor(gSavedSkinSettings, "MenuItemHighlightFgColor", DEFAULT_WHITE); + static LLCachedControl sFilterBGColor(gSavedSkinSettings, "FilterBackgroundColor", DEFAULT_WHITE); + static LLCachedControl sFilterTextColor(gSavedSkinSettings, "FilterTextColor", DEFAULT_WHITE); + static LLCachedControl sSuffixColor(gSavedSkinSettings, "InventoryItemSuffixColor", DEFAULT_WHITE); + static LLCachedControl sSearchStatusColor(gSavedSkinSettings, "InventorySearchStatusColor", DEFAULT_WHITE); + bool possibly_has_children = false; bool up_to_date = mListener && mListener->isUpToDate(); if((up_to_date && hasVisibleChildren() ) || // we fetched our children and some of them have passed the filter... @@ -816,7 +821,7 @@ void LLFolderViewItem::draw() // If we have keyboard focus, draw selection filled BOOL show_context = getRoot()->getShowSelectionContext(); - BOOL filled = show_context || (gFocusMgr.getKeyboardFocus() == getRoot()); + BOOL filled = show_context || (getRoot()->getParentPanel()->hasFocus()); // always render "current" item, only render other selected items if // mShowSingleSelection is FALSE @@ -920,7 +925,7 @@ void LLFolderViewItem::draw() LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? LLColor4(0.5f, 0.8f, 0.5f, 1.f) : LLColor4(0.8f, 0.5f, 0.5f, 1.f); sSmallFont->renderUTF8(mStatusText, 0, text_left, y, filter_color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); text_left = right_x; } @@ -928,26 +933,25 @@ void LLFolderViewItem::draw() if ( mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime") ) { - // *TODO: Translate - sFont->renderUTF8( std::string("Loading... "), 0, text_left, y, sSearchStatusColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, S32_MAX, S32_MAX, &right_x, FALSE); + sFont->renderUTF8(LLTrans::getString("LoadingData"), 0, text_left, y, sSearchStatusColor, + LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE); text_left = right_x; } sFont->renderUTF8( mLabel, 0, text_left, y, color, - LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, + LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); if (!mLabelSuffix.empty()) { sFont->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, + LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); } if (sBoxImage.notNull() && mStringMatchOffset != std::string::npos) { // don't draw backgrounds for zero-length strings - S32 filter_string_length = mRoot->getFilterSubString().size(); + S32 filter_string_length = getRoot()->getFilterSubString().size(); if (filter_string_length > 0) { std::string combined_string = mLabel + mLabelSuffix; @@ -961,7 +965,7 @@ void LLFolderViewItem::draw() F32 match_string_left = text_left + sFont->getWidthF32(combined_string, 0, mStringMatchOffset); F32 y = (F32)getRect().getHeight() - sFont->getLineHeight() - (F32)TEXT_PAD; sFont->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y, - sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, + sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, mLabelStyle, LLFontGL::NO_SHADOW, filter_string_length, S32_MAX, &right_x, FALSE ); } } @@ -971,6 +975,13 @@ void LLFolderViewItem::draw() { drawDebugRect(); } + + //// *HACK: also draw debug rectangles around currently-being-edited LLView, and any elements that are being highlighted by GUI preview code (see LLFloaterUIPreview) + //std::set::iterator iter = std::find(sPreviewHighlightedElements.begin(), sPreviewHighlightedElements.end(), this); + //if ((sEditingUI && this == sEditingUIView) || (iter != sPreviewHighlightedElements.end() && sDrawPreviewHighlights)) + //{ + // drawDebugRect(); + //} } @@ -978,11 +989,8 @@ void LLFolderViewItem::draw() /// Class LLFolderViewFolder ///---------------------------------------------------------------------------- -// Default constructor -LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr icon, - LLFolderView* root, - LLFolderViewEventListener* listener ): - LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time +LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): + LLFolderViewItem( p ), // 0 = no create time mIsOpen(FALSE), mExpanderHighlighted(FALSE), mCurHeight(0.f), @@ -993,10 +1001,9 @@ LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr ic mLastArrangeGeneration( -1 ), mLastCalculatedWidth(0), mCompletedFilterGeneration(-1), - mMostFilteredDescendantGeneration(-1) -{ - mType = std::string("(folder)"); -} + mMostFilteredDescendantGeneration(-1), + mNeedsSort(false) +{} // Destroys the object LLFolderViewFolder::~LLFolderViewFolder( void ) @@ -1022,6 +1029,14 @@ BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder, LLFolderView* r // makes sure that this view and it's children are the right size. S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { + // sort before laying out contents + if (mNeedsSort) + { + mFolders.sort(mSortFunction); + mItems.sort(mSortFunction); + mNeedsSort = false; + } + mHasVisibleChildren = hasFilteredDescendants(filter_generation); LLInventoryFilter::EFolderShow show_folder_state = getRoot()->getShowFolderState(); @@ -1042,7 +1057,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { // set last arrange generation first, in case children are animating // and need to be arranged again - mLastArrangeGeneration = mRoot->getArrangeGeneration(); + mLastArrangeGeneration = getRoot()->getArrangeGeneration(); if (mIsOpen) { // Add sizes of children @@ -1163,7 +1178,14 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) BOOL LLFolderViewFolder::needsArrange() { - return mLastArrangeGeneration < mRoot->getArrangeGeneration(); + return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); +} + +void LLFolderViewFolder::requestSort() +{ + mNeedsSort = true; + // whenever item order changes, we need to lay things out again + requestArrange(); } void LLFolderViewFolder::setCompletedFilterGeneration(S32 generation, BOOL recurse_up) @@ -1256,7 +1278,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter.getMinRequiredGeneration())) { mMostFilteredDescendantGeneration = filter_generation; - if (mRoot->needsAutoSelect()) + if (getRoot()->needsAutoSelect()) { (*fit)->setOpenArrangeRecursively(TRUE); } @@ -1272,7 +1294,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter_generation)) { mMostFilteredDescendantGeneration = filter_generation; - if (mRoot->needsAutoSelect()) + if (getRoot()->needsAutoSelect()) { (*fit)->setOpenArrangeRecursively(TRUE); } @@ -1346,7 +1368,7 @@ void LLFolderViewFolder::dirtyFilter() BOOL LLFolderViewFolder::hasFilteredDescendants() { - return mMostFilteredDescendantGeneration >= mRoot->getFilter()->getCurrentGeneration(); + return mMostFilteredDescendantGeneration >= getRoot()->getFilter()->getCurrentGeneration(); } // Passes selection information on to children and record selection @@ -1702,14 +1724,6 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) removeChild(item); } -// This function is called by a child that needs to be resorted. -// This is only called for renaming an object because it won't work for date -void LLFolderViewFolder::resort(LLFolderViewItem* item) -{ - mItems.sort(mSortFunction); - mFolders.sort(mSortFunction); -} - bool LLFolderViewFolder::isTrash() const { if (mAmTrash == LLFolderViewFolder::UNKNOWN) @@ -1863,30 +1877,20 @@ BOOL LLFolderViewFolder::isRemovable() // this is an internal method used for adding items to folders. BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) { - - items_t::iterator it = std::lower_bound( - mItems.begin(), - mItems.end(), - item, - mSortFunction); - mItems.insert(it,item); + mItems.push_back(item); item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); item->setVisible(FALSE); addChild( item ); item->dirtyFilter(); requestArrange(); + requestSort(); return TRUE; } // this is an internal method used for adding items to folders. BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) { - folders_t::iterator it = std::lower_bound( - mFolders.begin(), - mFolders.end(), - folder, - mSortFunction); - mFolders.insert(it,folder); + mFolders.push_back(folder); folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); @@ -1894,6 +1898,7 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) folder->dirtyFilter(); // rearrange all descendants too, as our indentation level might have changed folder->requestArrange(TRUE); + requestSort(); return TRUE; } @@ -2209,7 +2214,7 @@ BOOL LLFolderViewFolder::potentiallyVisible() // folder should be visible by it's own filter status return LLFolderViewItem::potentiallyVisible() // or one or more of its descendants have passed the minimum filter requirement - || hasFilteredDescendants(mRoot->getFilter()->getMinRequiredGeneration()) + || hasFilteredDescendants(getRoot()->getFilter()->getMinRequiredGeneration()) // or not all of its descendants have been checked against minimum filter requirement || getCompletedFilterGeneration() < getRoot()->getFilter()->getMinRequiredGeneration(); } @@ -2494,21 +2499,13 @@ void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) ///---------------------------------------------------------------------------- // Default constructor -LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon, - const LLRect& rect, const LLUUID& source_id, LLView *parent_view ) : -#if LL_WINDOWS -#pragma warning( push ) -#pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list -#endif - LLFolderViewFolder( name, root_folder_icon, this, NULL ), -#if LL_WINDOWS -#pragma warning( pop ) -#endif +LLFolderView::LLFolderView(const Params& p) +: LLFolderViewFolder(p), mScrollContainer( NULL ), mPopupMenuHandle(), mAllowMultiSelect(TRUE), mShowFolderHierarchy(FALSE), - mSourceID(source_id), + mSourceID(p.task_id), mRenameItem( NULL ), mNeedsScroll( FALSE ), mLastScrollItem( NULL ), @@ -2517,16 +2514,18 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic mNeedsAutoRename(FALSE), mDebugFilters(FALSE), mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately - mFilter(name), + mFilter(p.name), mShowSelectionContext(FALSE), mShowSingleSelection(FALSE), mArrangeGeneration(0), - mUserData(NULL), - mSelectCallback(NULL), mSignalSelectCallback(0), mMinWidth(0), - mDragAndDropThisFrame(FALSE) + mDragAndDropThisFrame(FALSE), + mCallbackRegistrar(NULL), + mParentPanel(p.parent_panel) + { + LLRect rect = p.rect; LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); setRect( rect ); reshape(rect.getWidth(), rect.getHeight()); @@ -2543,30 +2542,29 @@ LLFolderView::LLFolderView( const std::string& name, LLUIImagePtr root_folder_ic // just make sure the label ("Inventory Folder") never shows up mLabel = LLStringUtil::null; - mRenamer = new LLLineEditor(std::string("ren"), getRect(), LLStringUtil::null, sFont, - DB_INV_ITEM_NAME_STR_LEN, - &LLFolderView::commitRename, - NULL, - NULL, - this, - &LLLineEditor::prevalidatePrintableNotPipe); //mRenamer->setWriteableBgColor(LLColor4::white); // Escape is handled by reverting the rename, not commiting it (default behavior) - mRenamer->setCommitOnFocusLost(TRUE); - mRenamer->setVisible(FALSE); + LLLineEditor::Params params; + params.name("ren"); + params.rect(getRect()); + params.font(sFont); + params.max_length_bytes(DB_INV_ITEM_NAME_STR_LEN); + params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2)); + params.prevalidate_callback(&LLLineEditor::prevalidatePrintableNotPipe); + params.commit_on_focus_lost(true); + params.visible(false); + mRenamer = LLUICtrlFactory::create (params); addChild(mRenamer); // make the popup menu available - LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_inventory.xml", parent_view); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory.xml", gMenuHolder); if (!menu) { - menu = new LLMenuGL(LLStringUtil::null); + menu = LLUICtrlFactory::createDummyWidget("inventory_menu"); } - menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); - menu->setVisible(FALSE); + menu->setBackgroundColor(gSavedSkinSettings.getColor("MenuPopupBgColor")); mPopupMenuHandle = menu->getHandle(); - setTabStop(TRUE); } // Destroys the object @@ -2580,7 +2578,6 @@ LLFolderView::~LLFolderView( void ) mScrollContainer = NULL; mRenameItem = NULL; mRenamer = NULL; - gFocusMgr.releaseFocusIfNeeded( this ); if( gEditMenuHandler == this ) { @@ -2670,11 +2667,12 @@ void LLFolderView::closeAllFolders() { // Close all the folders setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + arrangeAll(); } void LLFolderView::openFolder(const std::string& foldername) { - LLFolderViewFolder* inv = getChild(foldername); + LLFolderViewFolder* inv = findChild(foldername); if (inv) { setSelection(inv, FALSE, FALSE); @@ -2700,7 +2698,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen mHasVisibleChildren = hasFilteredDescendants(filter_generation); // arrange always finishes, so optimistically set the arrange generation to the most current - mLastArrangeGeneration = mRoot->getArrangeGeneration(); + mLastArrangeGeneration = getRoot()->getArrangeGeneration(); LLInventoryFilter::EFolderShow show_folder_state = getRoot()->getShowFolderState(); @@ -2807,6 +2805,8 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) } width = llmax(mMinWidth, min_width); LLView::reshape(width, height, called_from_parent); + + mReshapeSignal(mSelectedItems, FALSE); } void LLFolderView::addToSelectionList(LLFolderViewItem* item) @@ -2871,7 +2871,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, if( selection && take_keyboard_focus) { - setFocus(TRUE); + mParentPanel->setFocus(TRUE); } // clear selection down here because change of keyboard focus can potentially @@ -2896,6 +2896,30 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, return rv; } +void LLFolderView::setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus) +{ + LLFolderViewItem* itemp = getItemByID(obj_id); + if(itemp && itemp->getListener()) + { + itemp->getListener()->arrangeAndSet(itemp, TRUE, take_keyboard_focus); + mSelectThisID.setNull(); + return; + } + else + { + // save the desired item to be selected later (if/when ready) + mSelectThisID = obj_id; + } +} + +void LLFolderView::updateSelection() +{ + if (mSelectThisID.notNull()) + { + setSelectionByID(mSelectThisID, false); + } +} + BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) { BOOL rv = FALSE; @@ -3077,6 +3101,7 @@ void LLFolderView::clearSelection() recursiveDeselect(FALSE); mSelectedItems.clear(); } + mSelectThisID.setNull(); } BOOL LLFolderView::getSelectionList(std::set &selection) @@ -3113,24 +3138,21 @@ BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) return can_drag; } -void LLFolderView::commitRename( LLUICtrl* renamer, void* user_data ) +void LLFolderView::commitRename( const LLSD& data ) { - LLFolderView* root = reinterpret_cast(user_data); - if( root ) - { - root->finishRenamingItem(); - } + finishRenamingItem(); } void LLFolderView::draw() { + static LLCachedControl sSearchStatusColor(gSavedSkinSettings, "InventorySearchStatusColor", DEFAULT_WHITE); if (mDebugFilters) { std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", mFilter.getCurrentGeneration(), mFilter.getMinRequiredGeneration(), mFilter.getMustPassGeneration()); sSmallFont->renderUTF8(current_filter_string, 0, 2, getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } // if cursor has moved off of me during drag and drop @@ -3139,10 +3161,6 @@ void LLFolderView::draw() { closeAutoOpenedFolders(); } - if(this == gFocusMgr.getKeyboardFocus() && !getVisible()) - { - gFocusMgr.setKeyboardFocus( NULL ); - } // while dragging, update selection rendering to reflect single/multi drag status if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) @@ -3176,13 +3194,13 @@ void LLFolderView::draw() { if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration()) { - mStatusText = std::string("Searching..."); // *TODO:translate - sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + mStatusText = LLTrans::getString("Searching"); + sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } else { - mStatusText = std::string("No matching items found in inventory."); // *TODO:translate - sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE ); + mStatusText = LLTrans::getString("InventoryNoMatchingItems"); + sFont->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); } } @@ -3280,11 +3298,11 @@ void LLFolderView::removeSelectedItems( void ) // change selection on successful delete if (new_selection) { - setSelectionFromRoot(new_selection, new_selection->isOpen(), gFocusMgr.childHasKeyboardFocus(this)); + setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); } else { - setSelectionFromRoot(NULL, gFocusMgr.childHasKeyboardFocus(this)); + setSelectionFromRoot(NULL, mParentPanel->hasFocus()); } } } @@ -3310,11 +3328,11 @@ void LLFolderView::removeSelectedItems( void ) } if (new_selection) { - setSelectionFromRoot(new_selection, new_selection->isOpen(), gFocusMgr.childHasKeyboardFocus(this)); + setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); } else { - setSelectionFromRoot(NULL, gFocusMgr.childHasKeyboardFocus(this)); + setSelectionFromRoot(NULL, mParentPanel->hasFocus()); } for(S32 i = 0; i < count; ++i) @@ -3347,11 +3365,8 @@ void LLFolderView::openSelectedItems( void ) } else { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLMultiPreview* multi_previewp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100)); - gFloaterView->getNewFloaterPosition(&left, &top); - LLMultiProperties* multi_propertiesp = new LLMultiProperties(LLRect(left, top, left + 300, top - 100)); + LLMultiPreview* multi_previewp = new LLMultiPreview(); + LLMultiProperties* multi_propertiesp = new LLMultiProperties(); selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) @@ -3371,8 +3386,8 @@ void LLFolderView::openSelectedItems( void ) LLFloater::setFloaterHost(NULL); // *NOTE: LLMulti* will safely auto-delete when open'd // without any children. - multi_previewp->open(); - multi_propertiesp->open(); + multi_previewp->openFloater(LLSD()); + multi_propertiesp->openFloater(LLSD()); } } } @@ -3389,10 +3404,7 @@ void LLFolderView::propertiesSelectedItems( void ) } else { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - - LLMultiProperties* multi_propertiesp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100)); + LLMultiProperties* multi_propertiesp = new LLMultiProperties(); LLFloater::setFloaterHost(multi_propertiesp); @@ -3403,7 +3415,7 @@ void LLFolderView::propertiesSelectedItems( void ) } LLFloater::setFloaterHost(NULL); - multi_propertiesp->open(); /* Flawfinder: ignore */ + multi_propertiesp->openFloater(LLSD()); } } } @@ -3631,24 +3643,11 @@ void LLFolderView::startRenamingSelectedItem( void ) mRenamer->setVisible( TRUE ); // set focus will fail unless item is visible mRenamer->setFocus( TRUE ); - mRenamer->setLostTopCallback(onRenamerLost); + mRenamer->setTopLostCallback(onRenamerLost); gFocusMgr.setTopCtrl( mRenamer ); } } -void LLFolderView::setFocus(BOOL focus) -{ - if (focus) - { - if(!hasFocus()) - { - gEditMenuHandler = this; - } - } - - LLFolderViewFolder::setFocus(focus); -} - BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; @@ -3851,7 +3850,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) break; } - if (!handled && hasFocus()) + if (!handled && mParentPanel->hasFocus()) { if (key == KEY_BACKSPACE) { @@ -3940,20 +3939,11 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) mKeyboardSelection = FALSE; mSearchString.clear(); - setFocus(TRUE); + mParentPanel->setFocus(TRUE); return LLView::handleMouseDown( x, y, mask ); } -void LLFolderView::onFocusLost( ) -{ - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } - LLUICtrl::onFocusLost(); -} - BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward) { // get first selected item @@ -4030,13 +4020,15 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { // all user operations move keyboard focus to inventory // this way, we know when to stop auto-updating a search - setFocus(TRUE); + mParentPanel->setFocus(TRUE); BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if(handled && (count > 0) && menu) { + if (mCallbackRegistrar) + mCallbackRegistrar->pushScope(); //menu->empty(); const LLView::child_list_t *list = menu->getChildList(); @@ -4056,9 +4048,10 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) flags = 0x0; } - menu->arrange(); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); + if (mCallbackRegistrar) + mCallbackRegistrar->popScope(); } else { @@ -4232,6 +4225,72 @@ LLFolderViewItem* LLFolderView::getItemByID(const LLUUID& id) return NULL; } +bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata) +{ + std::string action = userdata.asString(); + + if ("rename" == action) + { + startRenamingSelectedItem(); + return true; + } + if ("delete" == action) + { + removeSelectedItems(); + return true; + } + + if ("copy" == action) + { + LLInventoryClipboard::instance().reset(); + } + + std::set selected_items; + getSelectionList(selected_items); + + LLMultiPreview* multi_previewp = NULL; + LLMultiProperties* multi_propertiesp = NULL; + + if (("task_open" == action || "open" == action) && selected_items.size() > 1) + { + multi_previewp = new LLMultiPreview(); + gFloaterView->addChild(multi_previewp); + + LLFloater::setFloaterHost(multi_previewp); + + } + else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1) + { + multi_propertiesp = new LLMultiProperties(); + gFloaterView->addChild(multi_propertiesp); + + LLFloater::setFloaterHost(multi_propertiesp); + } + + std::set::iterator set_iter; + + for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) + { + LLFolderViewItem* folder_item = getItemByID(*set_iter); + if(!folder_item) continue; + LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener(); + if(!bridge) continue; + + bridge->performAction(this, model, action); + } + + LLFloater::setFloaterHost(NULL); + if (multi_previewp) + { + multi_previewp->openFloater(LLSD()); + } + else if (multi_propertiesp) + { + multi_propertiesp->openFloater(LLSD()); + } + + return true; +} // Main idle routine void LLFolderView::doIdle() @@ -4295,11 +4354,11 @@ void LLFolderView::doIdle() } } - if (mSignalSelectCallback && mSelectCallback) + if (mSignalSelectCallback) { //RN: we use keyboard focus as a proxy for user-explicit actions BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); - mSelectCallback(mSelectedItems, take_keyboard_focus, mUserData); + mSelectSignal(mSelectedItems, take_keyboard_focus); } mSignalSelectCallback = FALSE; } @@ -4315,7 +4374,6 @@ void LLFolderView::idle(void* user_data) } } - void LLFolderView::dumpSelectionInformation() { llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; @@ -4400,9 +4458,13 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde } //static -void LLFolderView::onRenamerLost( LLUICtrl* renamer, void* user_data) +void LLFolderView::onRenamerLost( LLFocusableElement* renamer, void* user_data) { - renamer->setVisible(FALSE); + LLUICtrl* uictrl = dynamic_cast(renamer); + if (uictrl) + { + uictrl->setVisible(FALSE); + } } void delete_selected_item(void* user_data) @@ -4823,133 +4885,156 @@ std::string LLInventoryFilter::getFilterText() if (isFilterWith(LLInventoryType::IT_ANIMATION)) { - filtered_types += " Animations,"; + //filtered_types += " Animations,"; + filtered_types += LLTrans::getString("Animations"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Animations,"; + //not_filtered_types += " Animations,"; + not_filtered_types += LLTrans::getString("Animations"); + filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_CALLINGCARD)) { - filtered_types += " Calling Cards,"; + //filtered_types += " Calling Cards,"; + filtered_types += LLTrans::getString("Calling Cards"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Calling Cards,"; + //not_filtered_types += " Calling Cards,"; + not_filtered_types += LLTrans::getString("Calling Cards"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_WEARABLE)) { - filtered_types += " Clothing,"; + //filtered_types += " Clothing,"; + filtered_types += LLTrans::getString("Clothing"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Clothing,"; + //not_filtered_types += " Clothing,"; + not_filtered_types += LLTrans::getString("Clothing"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_GESTURE)) { - filtered_types += " Gestures,"; + //filtered_types += " Gestures,"; + filtered_types += LLTrans::getString("Gestures"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Gestures,"; + //not_filtered_types += " Gestures,"; + not_filtered_types += LLTrans::getString("Gestures"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_LANDMARK)) { - filtered_types += " Landmarks,"; + //filtered_types += " Landmarks,"; + filtered_types += LLTrans::getString("Landmarks"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Landmarks,"; + //not_filtered_types += " Landmarks,"; + not_filtered_types += LLTrans::getString("Landmarks"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_NOTECARD)) { - filtered_types += " Notecards,"; + //filtered_types += " Notecards,"; + filtered_types += LLTrans::getString("Notecards"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Notecards,"; + //not_filtered_types += " Notecards,"; + not_filtered_types += LLTrans::getString("Notecards"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_OBJECT) && isFilterWith(LLInventoryType::IT_ATTACHMENT)) { - filtered_types += " Objects,"; + //filtered_types += " Objects,"; + filtered_types += LLTrans::getString("Objects"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Objects,"; + //not_filtered_types += " Objects,"; + not_filtered_types += LLTrans::getString("Objects"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_LSL)) { - filtered_types += " Scripts,"; + //filtered_types += " Scripts,"; + filtered_types += LLTrans::getString("Scripts"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Scripts,"; + //not_filtered_types += " Scripts,"; + not_filtered_types += LLTrans::getString("Scripts"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_SOUND)) { - filtered_types += " Sounds,"; + //filtered_types += " Sounds,"; + filtered_types += LLTrans::getString("Sounds"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Sounds,"; + //not_filtered_types += " Sounds,"; + not_filtered_types += LLTrans::getString("Sounds"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_TEXTURE)) { - filtered_types += " Textures,"; + //filtered_types += " Textures,"; + filtered_types += LLTrans::getString("Textures"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Textures,"; + //not_filtered_types += " Textures,"; + not_filtered_types += LLTrans::getString("Textures"); filtered_by_all_types = FALSE; } if (isFilterWith(LLInventoryType::IT_SNAPSHOT)) { - filtered_types += " Snapshots,"; + //filtered_types += " Snapshots,"; + filtered_types += LLTrans::getString("Snapshots"); filtered_by_type = TRUE; num_filter_types++; } else { - not_filtered_types += " Snapshots,"; + //not_filtered_types += " Snapshots,"; + not_filtered_types += LLTrans::getString("Snapshots"); filtered_by_all_types = FALSE; } @@ -4962,7 +5047,8 @@ std::string LLInventoryFilter::getFilterText() } else { - mFilterText += "No "; + //mFilterText += "No "; + mFilterText += LLTrans::getString("No Filters"); mFilterText += not_filtered_types; } // remove the ',' at the end @@ -4971,7 +5057,8 @@ std::string LLInventoryFilter::getFilterText() if (isSinceLogoff()) { - mFilterText += " - Since Logoff"; + //mFilterText += " - Since Logoff"; + mFilterText += LLTrans::getString("Since Logoff"); } return mFilterText; } diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 3fe3095c58..2393aa627c 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -44,6 +44,9 @@ #include #include #include +#include +#include +#include #include "lluictrl.h" #include "v4color.h" @@ -70,7 +73,7 @@ class LLMenuGL; class LLFolderViewItem; class LLFolderView; class LLInventoryModel; -class LLScrollableContainerView; +class LLScrollContainer; class LLFolderViewEventListener { @@ -81,6 +84,7 @@ public: virtual const LLUUID& getUUID() const = 0; virtual time_t getCreationDate() const = 0; // UTC seconds virtual PermissionMask getPermissionMask() const = 0; + virtual LLAssetType::EType getPreferredType() const {return LLAssetType::AT_NONE;}; virtual LLUIImagePtr getIcon() const = 0; virtual LLFontGL::StyleFlags getLabelStyle() const = 0; virtual std::string getLabelSuffix() const = 0; @@ -314,28 +318,46 @@ class LLFontGL; class LLFolderViewFolder; class LLFolderView; -class LLFolderViewItem : public LLUICtrl +class LLFolderViewItem : public LLView { +public: + static void initClass(); + static void cleanupClass(); + struct Params : public LLInitParam::Block + { + Optional icon; + Optional root; + Optional listener; + + Optional folder_arrow_image; + Optional selection_image; + + Optional creation_date; //UTC seconds + Params() + : folder_arrow_image("", LLUI::getUIImage("folder_arrow.tga")), + selection_image("", LLUI::getUIImage("rounded_square.tga")) + { + mouse_opaque(true); + follows.flags(FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT); + tab_stop(false); + } + }; + protected: + friend class LLUICtrlFactory; friend class LLFolderViewEventListener; + LLFolderViewItem(Params = LLFolderViewItem::Params()); + static const LLFontGL* sFont; static const LLFontGL* sSmallFont; - static LLColor4 sFgColor; - static LLColor4 sHighlightBgColor; - static LLColor4 sHighlightFgColor; - static LLColor4 sFilterBGColor; - static LLColor4 sFilterTextColor; - static LLColor4 sSuffixColor; - static LLColor4 sSearchStatusColor; static LLUIImagePtr sArrowImage; static LLUIImagePtr sBoxImage; - std::string mLabel; std::string mSearchableLabel; - std::string mType; S32 mLabelWidth; - time_t mCreationDate; + bool mLabelWidthDirty; + time_t mCreationDate; LLFolderViewFolder* mParentFolder; LLFolderViewEventListener* mListener; BOOL mIsSelected; @@ -354,6 +376,8 @@ protected: F32 mControlLabelRotation; LLFolderView* mRoot; BOOL mDragAndDropTarget; + LLUIImagePtr mArrowImage; + LLUIImagePtr mBoxImage; BOOL mIsLoading; LLTimer mTimeSinceRequestStart; @@ -376,17 +400,12 @@ protected: virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; } public: - static void initClass(); - static void cleanupClass(); - // This function is called when the folder view is dirty. It's // implemented here but called by derived classes when folding the // views. void arrangeFromRoot(); void filterFromRoot( void ); - // creation_date is in UTC seconds - LLFolderViewItem( const std::string& name, LLUIImagePtr icon, time_t creation_date, LLFolderView* root, LLFolderViewEventListener* listener ); virtual ~LLFolderViewItem( void ); // addToFolder() returns TRUE if it succeeds. FALSE otherwise @@ -490,7 +509,7 @@ public: virtual BOOL isOpen() { return FALSE; } - LLFolderView* getRoot(); + virtual LLFolderView* getRoot(); BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor ); S32 getIndentation() { return mIndentation; } @@ -541,12 +560,16 @@ typedef bool (*sort_order_f)(LLFolderViewItem* a, LLFolderViewItem* b); class LLFolderViewFolder : public LLFolderViewItem { +protected: + LLFolderViewFolder( const LLFolderViewItem::Params& ); + friend class LLUICtrlFactory; + public: typedef enum e_trash { UNKNOWN, TRASH, NOT_TRASH } ETrash; - + protected: typedef std::list items_t; typedef std::list folders_t; @@ -565,6 +588,7 @@ protected: S32 mLastCalculatedWidth; S32 mCompletedFilterGeneration; S32 mMostFilteredDescendantGeneration; + bool mNeedsSort; public: typedef enum e_recurse_type { @@ -574,9 +598,7 @@ public: RECURSE_UP_DOWN } ERecurseType; - LLFolderViewFolder( const std::string& name, LLUIImagePtr icon, - LLFolderView* root, - LLFolderViewEventListener* listener ); + virtual ~LLFolderViewFolder( void ); virtual BOOL potentiallyVisible(); @@ -592,6 +614,7 @@ public: virtual S32 arrange( S32* width, S32* height, S32 filter_generation ); BOOL needsArrange(); + void requestSort(); // Returns the sort group (system, trash, folder) for this folder. virtual EInventorySortGroup getSortGroup() const; @@ -691,7 +714,7 @@ public: virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor); virtual void openItem( void ); - virtual BOOL addItem(LLFolderViewItem* item); + virtual BOOL addItem(LLFolderViewItem* item); virtual BOOL addFolder( LLFolderViewFolder* folder); // LLView functionality @@ -721,27 +744,34 @@ public: class LLUICtrl; class LLLineEditor; -class LLFolderView : public LLFolderViewFolder, LLEditMenuHandler +class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler { public: - typedef void (*SelectCallback)(const std::deque &items, BOOL user_action, void* data); - - static F32 sAutoOpenTime; - + struct Params : public LLInitParam::Block + { + Mandatory parent_panel; + Optional task_id; + }; LLFolderView( const std::string& name, LLUIImagePtr root_folder_icon, const LLRect& rect, - const LLUUID& source_id, LLView *parent_view ); + const LLUUID& source_id, LLPanel *parent_view ); + LLFolderView(const Params&); virtual ~LLFolderView( void ); virtual BOOL canFocusChildren() const; + virtual LLFolderView* getRoot() { return this; } + // FolderViews default to sort by name. This will change that, // and resort the items if necessary. void setSortOrder(U32 order); void checkTreeResortForModelChanged(); void setFilterPermMask(PermissionMask filter_perm_mask) { mFilter.setFilterPermissions(filter_perm_mask); } - void setSelectCallback(SelectCallback callback, void* user_data) { mSelectCallback = callback, mUserData = user_data; } void setAllowMultiSelect(BOOL allow) { mAllowMultiSelect = allow; } - + + typedef boost::signal& items, BOOL user_action)> signal_t; + void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } + void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } + LLInventoryFilter* getFilter() { return &mFilter; } const std::string getFilterSubString(BOOL trim = FALSE); U32 getFilterTypes() const { return mFilter.getFilterTypes(); } @@ -775,7 +805,13 @@ public: // Record the selected item and pass it down the hierachy. virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); - + + // Used by menu callbacks + void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); + + // Called once a frame to update the selection if mSelectThisID has been set + void updateSelection(); + // This method is used to toggle the selection of an item. Walks // children, and keeps track of selected objects. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); @@ -828,9 +864,6 @@ public: //void dragItemIntoFolder( LLFolderViewItem* moving_item, LLFolderViewFolder* dst_folder, BOOL drop, BOOL* accept ); //void dragFolderIntoFolder( LLFolderViewFolder* moving_folder, LLFolderViewFolder* dst_folder, BOOL drop, BOOL* accept ); - // LLUICtrl Functionality - /*virtual*/ void setFocus(BOOL focus); - // LLView functionality ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); @@ -845,14 +878,13 @@ public: EAcceptance* accept, std::string& tooltip_msg); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ void onFocusLost(); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void draw(); virtual void deleteAllChildren(); void scrollToShowSelection(); void scrollToShowItem(LLFolderViewItem* item); - void setScrollContainer( LLScrollableContainerView* parent ) { mScrollContainer = parent; } + void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; } LLRect getVisibleRect(); BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); @@ -865,7 +897,9 @@ public: void addItemID(const LLUUID& id, LLFolderViewItem* itemp); void removeItemID(const LLUUID& id); LLFolderViewItem* getItemByID(const LLUUID& id); - + + bool doToSelected(LLInventoryModel* model, const LLSD& userdata); + void doIdle(); // Real idle routine static void idle(void* user_data); // static glue to doIdle() @@ -873,20 +907,23 @@ public: BOOL needsAutoRename() { return mNeedsAutoRename; } void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; } + void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } + BOOL getDebugFilters() { return mDebugFilters; } + LLPanel* getParentPanel() { return mParentPanel; } // DEBUG only void dumpSelectionInformation(); protected: - LLScrollableContainerView* mScrollContainer; // NULL if this is not a child of a scroll container. + LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container. - static void commitRename( LLUICtrl* renamer, void* user_data ); - static void onRenamerLost( LLUICtrl* renamer, void* user_data); + void commitRename( const LLSD& data ); + static void onRenamerLost( LLFocusableElement* renamer, void* user_data); void finishRenamingItem( void ); void closeRenamer( void ); - + protected: LLHandle mPopupMenuHandle; @@ -921,13 +958,21 @@ protected: LLFrameTimer mMultiSelectionFadeTimer; S32 mArrangeGeneration; - void* mUserData; - SelectCallback mSelectCallback; + signal_t mSelectSignal; + signal_t mReshapeSignal; S32 mSignalSelectCallback; S32 mMinWidth; std::map mItemMap; BOOL mDragAndDropThisFrame; + + LLUUID mSelectThisID; // if non null, select this item + + LLPanel* mParentPanel; + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* mCallbackRegistrar; + +public: + static F32 sAutoOpenTime; }; bool sort_item_name(LLFolderViewItem* a, LLFolderViewItem* b); diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 2dbff92ba0..0f2951d9df 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -55,8 +55,9 @@ #include "llinventorymodel.h" #include "llnotify.h" #include "llviewermessage.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llviewerstats.h" +#include "llbottomtray.h" LLGestureManager gGestureManager; @@ -868,9 +869,11 @@ void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step) std::string chat_text = chat_step->mChatText; // Don't animate the nodding, as this might not blend with // other playing animations. + const BOOL animate = FALSE; - gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); + LLBottomTray::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); + gesture->mCurrentStep++; break; } diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 91beb801ad..3b3ada46a8 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -49,7 +49,7 @@ #include "lltextureentry.h" #include "llviewercamera.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llagent.h" #include "lltoolmgr.h" #include "llselectmgr.h" @@ -58,7 +58,6 @@ #include "llviewerobjectlist.h" #include "lltoolselectrect.h" #include "llviewerwindow.h" -#include "llcompass.h" #include "llsurface.h" #include "llwind.h" #include "llworld.h" @@ -338,127 +337,8 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) gViewerWindow->setup3DRender(); } - -const F32 COMPASS_SIZE = 64; -static const F32 COMPASS_RANGE = 0.33f; - -void LLCompass::draw() -{ - glMatrixMode(GL_MODELVIEW); - gGL.pushMatrix(); - - S32 width = 32; - S32 height = 32; - - LLGLSUIDefault gls_ui; - - gGL.translatef( COMPASS_SIZE/2.f, COMPASS_SIZE/2.f, 0.f); - - if (mBkgndTexture) - { - gGL.getTexUnit(0)->bind(mBkgndTexture.get()); - - gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - - gGL.begin(LLRender::QUADS); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(-width, height); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(-width, -height); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(width, -height); - - gGL.end(); - } - - // rotate subsequent draws to agent rotation - F32 rotation = atan2( gAgent.getFrameAgent().getAtAxis().mV[VX], gAgent.getFrameAgent().getAtAxis().mV[VY] ); - glRotatef( - rotation * RAD_TO_DEG, 0.f, 0.f, -1.f); - - if (mTexture) - { - gGL.getTexUnit(0)->bind(mTexture.get()); - gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); - - gGL.begin(LLRender::QUADS); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(-width, height); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(-width, -height); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(width, -height); - - gGL.end(); - } - - gGL.popMatrix(); - -} - - - -void LLHorizontalCompass::draw() -{ - LLGLSUIDefault gls_ui; - - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); - S32 half_width = width / 2; - - if( mTexture ) - { - const LLVector3& at_axis = LLViewerCamera::getInstance()->getAtAxis(); - F32 center = atan2( at_axis.mV[VX], at_axis.mV[VY] ); - - center += F_PI; - center = llclamp( center, 0.0f, F_TWO_PI ); // probably not necessary... - center /= F_TWO_PI; - F32 left = center - COMPASS_RANGE; - F32 right = center + COMPASS_RANGE; - - gGL.getTexUnit(0)->bind(mTexture.get()); - gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f ); - gGL.begin( LLRender::QUADS ); - - gGL.texCoord2f(right, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(left, 1.f); - gGL.vertex2i(0, height); - - gGL.texCoord2f(left, 0.f); - gGL.vertex2i(0, 0); - - gGL.texCoord2f(right, 0.f); - gGL.vertex2i(width, 0); - - gGL.end(); - } - - // Draw the focus line - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4fv( mFocusColor.mV ); - gl_line_2d( half_width, 0, half_width, height ); - } -} - - const F32 WIND_ALTITUDE = 180.f; - void LLWind::renderVectors() { // Renders the wind as vectors (used for debug) @@ -1008,8 +888,6 @@ void LLViewerObjectList::renderObjectBeacons() return; } - //const LLFontGL *font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF); - LLGLSUIDefault gls_ui; { diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp new file mode 100644 index 0000000000..cda30d8900 --- /dev/null +++ b/indra/newview/llgroupactions.cpp @@ -0,0 +1,141 @@ +/** + * @file llgroupactions.cpp + * @brief Group-related actions (join, leave, new, delete, etc) + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llgroupactions.h" + +#include "llagent.h" +#include "llfloatergroupinfo.h" +#include "llfloaterreg.h" +#include "llimview.h" // for gIMMgr + +// static +void LLGroupActions::search() +{ + LLFloaterReg::showInstance("search", LLSD().insert("panel", "group")); +} + +// static +void LLGroupActions::create() +{ + LLFloaterGroupInfo::showCreateGroup(NULL); +} + +// static +void LLGroupActions::leave(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + S32 count = gAgent.mGroups.count(); + S32 i; + for (i = 0; i < count; ++i) + { + if(gAgent.mGroups.get(i).mID == group_id) + break; + } + if (i < count) + { + LLSD args; + args["GROUP"] = gAgent.mGroups.get(i).mName; + LLSD payload; + payload["group_id"] = group_id; + LLNotifications::instance().add("GroupLeaveConfirmMember", args, payload, onLeaveGroup); + } +} + +// static +void LLGroupActions::activate(const LLUUID& group_id) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ActivateGroup); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_GroupID, group_id); + gAgent.sendReliableMessage(); +} + +// static +void LLGroupActions::info(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + LLFloaterGroupInfo::showFromUUID(group_id); +} + +// static +void LLGroupActions::startChat(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + LLGroupData group_data; + if (gAgent.getGroupData(group_id, group_data)) + { + gIMMgr->addSession( + group_data.mName, + IM_SESSION_GROUP_START, + group_id); + make_ui_sound("UISndStartIM"); + } + else + { + // this should never happen, as starting a group IM session + // relies on you belonging to the group and hence having the group data + make_ui_sound("UISndInvalidOp"); + } +} + +//-- Private methods ---------------------------------------------------------- + +// static +bool LLGroupActions::onLeaveGroup(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + LLUUID group_id = notification["payload"]["group_id"].asUUID(); + if(option == 0) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_LeaveGroupRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_GroupData); + msg->addUUIDFast(_PREHASH_GroupID, group_id); + gAgent.sendReliableMessage(); + } + return false; +} diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h new file mode 100644 index 0000000000..1e6caea17c --- /dev/null +++ b/indra/newview/llgroupactions.h @@ -0,0 +1,79 @@ +/** + * @file llgroupactions.h + * @brief Group-related actions (join, leave, new, delete, etc) + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLGROUPACTIONS_H +#define LL_LLGROUPACTIONS_H + +#include "llsd.h" +#include "lluuid.h" + +/** + * Group-related actions (join, leave, new, delete, etc) + */ +class LLGroupActions +{ +public: + /** + * Invokes group search floater. + */ + static void search(); + + /** + * Invokes group creation floater. + */ + static void create(); + + /** + * Invokes "Leave Group" floater. + */ + static void leave(const LLUUID& group_id); + + /** + * Activate group. + */ + static void activate(const LLUUID& group_id); + + /** + * Show group information dialog. + */ + static void info(const LLUUID& group_id); + + /** + * Start group instant messaging session. + */ + static void startChat(const LLUUID& group_id); + +private: + static bool onLeaveGroup(const LLSD& notification, const LLSD& response); +}; + +#endif // LL_LLGROUPACTIONS_H diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp new file mode 100644 index 0000000000..5d0bcab07a --- /dev/null +++ b/indra/newview/llgrouplist.cpp @@ -0,0 +1,70 @@ +/** + * @file llgrouplist.cpp + * @brief List of the groups the agent belongs to. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llgrouplist.h" + +// newview +#include "llagent.h" + +static LLDefaultWidgetRegistry::Register r("group_list"); + +LLGroupList::LLGroupList(const Params& p) +: LLAvatarList(p) +{ +} + +BOOL LLGroupList::updateList() +{ + LLCtrlListInterface *group_list = getListInterface(); + const LLUUID& highlight_id = gAgent.getGroupID(); + S32 count = gAgent.mGroups.count(); + LLUUID id; + + group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); + + for(S32 i = 0; i < count; ++i) + { + // *TODO: check powers mask? + id = gAgent.mGroups.get(i).mID; + const LLGroupData& group_data = gAgent.mGroups.get(i); + addItem(id, group_data.mName, highlight_id == id, ADD_BOTTOM); + } + + // add "none" to list at top + //name = LLTrans::getString("GroupsNone") + addItem(LLUUID::null, std::string("none"), highlight_id.isNull(), ADD_TOP); // *TODO: localize + + group_list->selectByValue(highlight_id); + return TRUE; +} diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h new file mode 100644 index 0000000000..ce26977fdb --- /dev/null +++ b/indra/newview/llgrouplist.h @@ -0,0 +1,53 @@ +/** + * @file llgrouplist.h + * @brief List of the groups the agent belongs to. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLGROUPLIST_H +#define LL_LLGROUPLIST_H + +#include + +#include "llavatarlist.h" + +// *TODO: derive from ListView when it's ready. +class LLGroupList: public LLAvatarList +{ + LOG_CLASS(LLGroupList); +public: + struct Params : public LLInitParam::Block + { + }; + + LLGroupList(const Params&); + BOOL updateList(); +}; + +#endif // LL_LLGROUPLIST_H diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 003a02c3cd..a8d97c6afb 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -1293,7 +1293,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) } else { - // *TODO:translate + // *TODO: Translate LLSD args; args["MESSAGE"] = message; LLNotifications::instance().add("UnableToCreateGroup", args); diff --git a/indra/newview/llhudeffect.h b/indra/newview/llhudeffect.h index 954cda7c8d..781e57fa6a 100644 --- a/indra/newview/llhudeffect.h +++ b/indra/newview/llhudeffect.h @@ -37,9 +37,6 @@ #include "lluuid.h" #include "v4coloru.h" -#include "llinterp.h" -#include "llframetimer.h" -#include "llmemory.h" const F32 LL_HUD_DUR_SHORT = 1.f; diff --git a/indra/newview/llhudicon.h b/indra/newview/llhudicon.h index 154e6df518..2c1c549521 100644 --- a/indra/newview/llhudicon.h +++ b/indra/newview/llhudicon.h @@ -33,7 +33,7 @@ #ifndef LL_LLHUDICON_H #define LL_LLHUDICON_H -#include "llmemory.h" +#include "llpointer.h" #include "lldarrayptr.h" #include "llhudobject.h" diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index 955d786187..e1e9d9c51e 100644 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -52,9 +52,9 @@ LLColor4 LLHUDManager::sChildColor; LLHUDManager::LLHUDManager() { - LLHUDManager::sParentColor = gColors.getColor("FocusColor"); + LLHUDManager::sParentColor = gSavedSkinSettings.getColor("FocusColor"); // rdw commented out since it's not used. Also removed from colors_base.xml - //LLHUDManager::sChildColor = gColors.getColor("FocusSecondaryColor"); + //LLHUDManager::sChildColor =gSavedSkinSettings.getColor("FocusSecondaryColor"); } LLHUDManager::~LLHUDManager() diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h index 615eb93a27..b2b4ffb559 100644 --- a/indra/newview/llhudmanager.h +++ b/indra/newview/llhudmanager.h @@ -36,7 +36,7 @@ // Responsible for managing all HUD elements. #include "llhudobject.h" -#include "lldarray.h" +#include "lldarrayptr.h" class LLViewerObject; class LLHUDEffect; diff --git a/indra/newview/llhudobject.h b/indra/newview/llhudobject.h index 2cd8abf886..d304ac41af 100644 --- a/indra/newview/llhudobject.h +++ b/indra/newview/llhudobject.h @@ -37,7 +37,7 @@ * Base class and manager for in-world 2.5D non-interactive objects */ -#include "llmemory.h" +#include "llpointer.h" #include "v4color.h" #include "v3math.h" diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 95b8442ec7..fe65a12c47 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -47,17 +47,19 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, const LLFontGL &font, const U8 style, + const LLFontGL::ShadowType shadow, const F32 x_offset, const F32 y_offset, const LLColor4& color, const BOOL orthographic) { LLWString wstr(utf8str_to_wstring(str)); - hud_render_text(wstr, pos_agent, font, style, x_offset, y_offset, color, orthographic); + hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic); } void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const LLFontGL &font, const U8 style, + const LLFontGL::ShadowType shadow, const F32 x_offset, const F32 y_offset, const LLColor4& color, const BOOL orthographic) @@ -75,8 +77,8 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLVector3 up_axis; if (orthographic) { - right_axis.setVec(0.f, -1.f / gViewerWindow->getWindowHeight(), 0.f); - up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWindowHeight()); + right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewWidth(), 0.f); + up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeight()); } else { @@ -104,26 +106,36 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, //get the render_pos in screen space F64 winX, winY, winZ; + LLRect world_view_rect = gViewerWindow->getWorldViewRect(); + S32 viewport[4]; + viewport[0] = world_view_rect.mLeft; + viewport[1] = world_view_rect.mBottom; + viewport[2] = world_view_rect.getWidth(); + viewport[3] = world_view_rect.getHeight(); gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2], - gGLModelView, gGLProjection, (GLint*) gGLViewport, + gGLModelView, gGLProjection, (GLint*) viewport, &winX, &winY, &winZ); - //fonts all render orthographically, set up projection + //fonts all render orthographically, set up projection`` glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); LLUI::pushMatrix(); - gViewerWindow->setup2DRender(); + gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight()); + gViewerWindow->setup3DViewport(); + //gViewerWindow->setup2DRender(); + winX -= world_view_rect.mLeft; + winY -= world_view_rect.mBottom; LLUI::loadIdentity(); LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); //glRotatef(angle * RAD_TO_DEG, axis.mV[VX], axis.mV[VY], axis.mV[VZ]); //glScalef(right_scale, up_scale, 1.f); F32 right_x; - font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, wstr.length(), 1000, &right_x); + font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x); LLUI::popMatrix(); glMatrixMode(GL_PROJECTION); diff --git a/indra/newview/llhudrender.h b/indra/newview/llhudrender.h index 5ca865737f..93de89f7b0 100644 --- a/indra/newview/llhudrender.h +++ b/indra/newview/llhudrender.h @@ -43,6 +43,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const LLFontGL &font, const U8 style, + const LLFontGL::ShadowType, const F32 x_offset, const F32 y_offset, const LLColor4& color, @@ -53,6 +54,7 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, const LLFontGL &font, const U8 style, + const LLFontGL::ShadowType, const F32 x_offset, const F32 y_offset, const LLColor4& color, diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 20140073f4..efeac9c197 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -113,7 +113,6 @@ LLHUDText::LLHUDText(const U8 type) : mRadius = 0.1f; LLPointer ptr(this); sTextObjects.insert(ptr); - //LLDebugVarMessageBox::show("max width", &HUD_TEXT_MAX_WIDTH, 500.f, 1.f); } LLHUDText::~LLHUDText() @@ -293,7 +292,7 @@ void LLHUDText::renderText(BOOL for_select) LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga"); // *TODO: make this a per-text setting - LLColor4 bg_color = gSavedSettings.getColor4("BackgroundChatColor"); + LLColor4 bg_color = gSavedSkinSettings.getColor4("BackgroundChatColor"); bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor); const S32 border_height = 16; @@ -319,8 +318,8 @@ void LLHUDText::renderText(BOOL for_select) if (mOnHUDAttachment) { - x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWindowWidth(); - y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWindowHeight(); + x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidth(); + y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeight(); } else { @@ -509,7 +508,7 @@ void LLHUDText::renderText(BOOL for_select) LLColor4 label_color(0.f, 0.f, 0.f, 1.f); label_color.mV[VALPHA] = alpha_factor; - hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, x_offset, y_offset, label_color, mOnHUDAttachment); + hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, mOnHUDAttachment); } } @@ -535,9 +534,10 @@ void LLHUDText::renderText(BOOL for_select) y_offset -= fontp->getLineHeight(); U8 style = segment_iter->mStyle; + LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW; if (mDropShadow) { - style |= LLFontGL::DROP_SHADOW; + shadow = LLFontGL::DROP_SHADOW; } F32 x_offset; @@ -553,7 +553,7 @@ void LLHUDText::renderText(BOOL for_select) text_color = segment_iter->mColor; text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, *fontp, style, x_offset, y_offset, text_color, mOnHUDAttachment); + hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); } } /// Reset the default color to white. The renderer expects this to be the default. @@ -797,44 +797,26 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, FALSE) && mVisibleOffScreen) { // bubble off-screen, so find a spot for it along screen edge - LLVector2 window_center(gViewerWindow->getWindowDisplayWidth() * 0.5f, gViewerWindow->getWindowDisplayHeight() * 0.5f); - LLVector2 delta_from_center(screen_pos.mX - window_center.mV[VX], - screen_pos.mY - window_center.mV[VY]); - delta_from_center.normVec(); - - F32 camera_aspect = LLViewerCamera::getInstance()->getAspect(); - F32 delta_aspect = llabs(delta_from_center.mV[VX] / delta_from_center.mV[VY]); - if (camera_aspect / llmax(delta_aspect, 0.001f) > 1.f) - { - // camera has wider aspect ratio than offset vector, so clamp to height - delta_from_center *= llabs(window_center.mV[VY] / delta_from_center.mV[VY]); - } - else - { - // camera has narrower aspect ratio than offset vector, so clamp to width - delta_from_center *= llabs(window_center.mV[VX] / delta_from_center.mV[VX]); - } - - screen_pos_vec = window_center + delta_from_center; - } - else - { - screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY); + LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos); } - S32 bottom = STATUS_BAR_HEIGHT; - if (gChatBar->getVisible()) + + screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY); + + LLRect world_rect = gViewerWindow->getVirtualWorldViewRect(); + S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT; + if (gChatBar && gChatBar->getVisible()) { bottom += CHAT_BAR_HEIGHT; } LLVector2 screen_center; - screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], mWidth * 0.5f, (F32)gViewerWindow->getWindowDisplayWidth() - mWidth * 0.5f); + screen_center.mV[VX] = llclamp((F32)screen_pos_vec.mV[VX], (F32)world_rect.mLeft + mWidth * 0.5f, (F32)world_rect.mRight - mWidth * 0.5f); if(mVertAlignment == ALIGN_VERT_TOP) { screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY], (F32)bottom, - (F32)gViewerWindow->getWindowDisplayHeight() - mHeight - (F32)MENU_BAR_HEIGHT); + (F32)world_rect.mTop - mHeight - (F32)MENU_BAR_HEIGHT); mSoftScreenRect.setLeftTopAndSize(screen_center.mV[VX] - (mWidth + BUFFER_SIZE) * 0.5f, screen_center.mV[VY] + (mHeight + BUFFER_SIZE), mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE); } @@ -842,7 +824,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset) { screen_center.mV[VY] = llclamp((F32)screen_pos_vec.mV[VY], (F32)bottom + mHeight * 0.5f, - (F32)gViewerWindow->getWindowDisplayHeight() - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT); + (F32)world_rect.mTop - mHeight * 0.5f - (F32)MENU_BAR_HEIGHT); mSoftScreenRect.setCenterAndSize(screen_center.mV[VX], screen_center.mV[VY], mWidth + BUFFER_SIZE, mHeight + BUFFER_SIZE); } diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 645cbc2698..dc14a8c764 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -33,7 +33,7 @@ #ifndef LL_LLHUDTEXT_H #define LL_LLHUDTEXT_H -#include "llmemory.h" +#include "llpointer.h" #include "lldarrayptr.h" #include "llhudobject.h" diff --git a/indra/newview/llhudview.cpp b/indra/newview/llhudview.cpp index 198514ce0c..6f22a68327 100644 --- a/indra/newview/llhudview.cpp +++ b/indra/newview/llhudview.cpp @@ -41,7 +41,6 @@ // viewer includes #include "llagent.h" #include "llcallingcard.h" -#include "llcolorscheme.h" #include "llviewercontrol.h" #include "llfloaterworldmap.h" #include "llworldmapview.h" @@ -55,10 +54,12 @@ const S32 HUD_ARROW_SIZE = 32; LLHUDView::LLHUDView() : LLPanel() -{ } +{ +} LLHUDView::~LLHUDView() -{ } +{ +} // virtual void LLHUDView::draw() diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 0586409283..6acd174fc3 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -49,18 +49,21 @@ #include "llchat.h" #include "llconsole.h" #include "llfloater.h" +#include "llfloatercall.h" #include "llfloatergroupinfo.h" +#include "llfriendactions.h" #include "llimview.h" #include "llinventory.h" #include "llinventorymodel.h" #include "llinventoryview.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llkeyboard.h" #include "lllineeditor.h" #include "llnotify.h" +#include "llrecentpeople.h" #include "llresmgr.h" +#include "lltrans.h" #include "lltabcontainer.h" #include "llviewertexteditor.h" #include "llviewermessage.h" @@ -216,7 +219,7 @@ private: bool send_start_session_messages( const LLUUID& temp_session_id, const LLUUID& other_participant_id, - const LLDynamicArray& ids, + const std::vector& ids, EInstantMessage dialog) { if ( dialog == IM_SESSION_GROUP_START ) @@ -246,7 +249,7 @@ bool send_start_session_messages( LLSD agents; for (int i = 0; i < (S32) ids.size(); i++) { - agents.append(ids.get(i)); + agents.append(ids[i]); } //we have a new way of starting conference calls now @@ -587,7 +590,6 @@ LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri) } } - void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id) { sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID)); @@ -622,6 +624,17 @@ void LLVoiceChannel::setState(EState state) mState = state; } +void LLVoiceChannel::toggleCallWindowIfNeeded(EState state) +{ + if (state == STATE_CONNECTED) + LLFloaterCall::openInstance(mSessionID); + // By checking that current state is CONNECTED we make sure that the call window + // has been shown, hence there's something to hide. This helps when user presses + // the "End call" button right after initiating the call. + // *TODO: move this check to LLFloaterCall? + else if (state == STATE_HUNG_UP && mState == STATE_CONNECTED) + LLFloaterCall::closeInstance(mSessionID); +} //static void LLVoiceChannel::initClass() @@ -693,6 +706,15 @@ void LLVoiceChannelGroup::activate() LLVoiceClient::getInstance()->setNonSpatialChannel( mURI, mCredentials); + +#if 0 // *TODO + if (!gAgent.isInGroup(mSessionID)) // ad-hoc channel + { + // Add the party to the list of people with which we've recently interacted. + for (/*people in the chat*/) + LLRecentPeople::instance().add(buddy_id); + } +#endif } } @@ -814,6 +836,9 @@ void LLVoiceChannelGroup::handleError(EStatusType status) void LLVoiceChannelGroup::setState(EState state) { + // HACK: Open/close the call window if needed. + toggleCallWindowIfNeeded(state); + switch(state) { case STATE_RINGING: @@ -999,6 +1024,9 @@ void LLVoiceChannelP2P::activate() // using the session handle invalidates it. Clear it out here so we can't reuse it by accident. mSessionHandle.clear(); } + + // Add the party to the list of people with which we've recently interacted. + LLRecentPeople::instance().add(mOtherUserID); } } @@ -1056,6 +1084,9 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s void LLVoiceChannelP2P::setState(EState state) { + // HACK: Open/close the call window if needed. + toggleCallWindowIfNeeded(state); + // you only "answer" voice invites in p2p mode // so provide a special purpose message here if (mReceivedCall && state == STATE_RINGING) @@ -1071,57 +1102,28 @@ void LLVoiceChannelP2P::setState(EState state) // // LLFloaterIMPanel // -LLFloaterIMPanel::LLFloaterIMPanel( - const std::string& session_label, - const LLUUID& session_id, - const LLUUID& other_participant_id, - EInstantMessage dialog) : - LLFloater(session_label, LLRect(), session_label), - mInputEditor(NULL), - mHistoryEditor(NULL), - mSessionUUID(session_id), - mVoiceChannel(NULL), - mSessionInitialized(FALSE), - mSessionStartMsgPos(0), - mOtherParticipantUUID(other_participant_id), - mDialog(dialog), - mTyping(FALSE), - mOtherTyping(FALSE), - mTypingLineStartIndex(0), - mSentTypingState(TRUE), - mNumUnreadMessages(0), - mShowSpeakersOnConnect(TRUE), - mAutoConnect(FALSE), - mTextIMPossible(TRUE), - mProfileButtonEnabled(TRUE), - mCallBackEnabled(TRUE), - mSpeakers(NULL), - mSpeakerPanel(NULL), - mFirstKeystrokeTimer(), - mLastKeystrokeTimer() -{ - init(session_label); -} -LLFloaterIMPanel::LLFloaterIMPanel( - const std::string& session_label, - const LLUUID& session_id, - const LLUUID& other_participant_id, - const LLDynamicArray& ids, - EInstantMessage dialog) : - LLFloater(session_label, LLRect(), session_label), +LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label, + const LLUUID& session_id, + const LLUUID& other_participant_id, + const std::vector& ids, + EInstantMessage dialog) +: LLFloater(session_id), mInputEditor(NULL), mHistoryEditor(NULL), mSessionUUID(session_id), + mSessionLabel(session_label), mVoiceChannel(NULL), mSessionInitialized(FALSE), mSessionStartMsgPos(0), mOtherParticipantUUID(other_participant_id), mDialog(dialog), + mSessionInitialTargetIDs(ids), mTyping(FALSE), mOtherTyping(FALSE), mTypingLineStartIndex(0), mSentTypingState(TRUE), + mNumUnreadMessages(0), mShowSpeakersOnConnect(TRUE), mAutoConnect(FALSE), mTextIMPossible(TRUE), @@ -1132,15 +1134,6 @@ LLFloaterIMPanel::LLFloaterIMPanel( mFirstKeystrokeTimer(), mLastKeystrokeTimer() { - mSessionInitialTargetIDs = ids; - init(session_label); -} - - -void LLFloaterIMPanel::init(const std::string& session_label) -{ - mSessionLabel = session_label; - std::string xml_filename; switch(mDialog) { @@ -1188,11 +1181,10 @@ void LLFloaterIMPanel::init(const std::string& session_label) } mSpeakers = new LLIMSpeakerMgr(mVoiceChannel); + // All participants will be added to the list of people we've recently interacted with. + mSpeakers->addListener(&LLRecentPeople::instance(), "add"); - LLUICtrlFactory::getInstance()->buildFloater(this, - xml_filename, - &getFactoryMap(), - FALSE); + LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, FALSE); setTitle(mSessionLabel); mInputEditor->setMaxTextLength(1023); @@ -1230,7 +1222,7 @@ void LLFloaterIMPanel::init(const std::string& session_label) addHistoryLine( session_start, - gSavedSettings.getColor4("SystemChatColor"), + gSavedSkinSettings.getColor4("SystemChatColor"), false); } } @@ -1283,9 +1275,8 @@ BOOL LLFloaterIMPanel::postBuild() mInputEditor = getChild("chat_editor"); mInputEditor->setFocusReceivedCallback( onInputEditorFocusReceived, this ); mInputEditor->setFocusLostCallback( onInputEditorFocusLost, this ); - mInputEditor->setKeystrokeCallback( onInputEditorKeystroke ); - mInputEditor->setCommitCallback( onCommitChat ); - mInputEditor->setCallbackUserData(this); + mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); + mInputEditor->setCommitCallback( onCommitChat, this ); mInputEditor->setCommitOnFocusLost( FALSE ); mInputEditor->setRevertOnEsc( FALSE ); mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); @@ -1479,7 +1470,7 @@ private: LLUUID mSessionID; }; -BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray& ids) +BOOL LLFloaterIMPanel::inviteToSession(const std::vector& ids) { LLViewerRegion* region = gAgent.getRegion(); if (!region) @@ -1487,7 +1478,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray& ids) return FALSE; } - S32 count = ids.count(); + S32 count = ids.size(); if( isInviteAllowed() && (count > 0) ) { @@ -1500,7 +1491,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray& ids) data["params"] = LLSD::emptyArray(); for (int i = 0; i < count; i++) { - data["params"].append(ids.get(i)); + data["params"].append(ids[i]); } data["method"] = "invite"; @@ -1637,24 +1628,11 @@ BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask ) { sendMsg(); handled = TRUE; - - // Close talk panels on hitting return - // but not shift-return or control-return - if ( !gSavedSettings.getBOOL("PinTalkViewOpen") && !(mask & MASK_CONTROL) && !(mask & MASK_SHIFT) ) - { - gIMMgr->toggle(NULL); - } } else if ( KEY_ESCAPE == key ) { handled = TRUE; gFocusMgr.setKeyboardFocus(NULL); - - // Close talk panel with escape - if( !gSavedSettings.getBOOL("PinTalkViewOpen") ) - { - gIMMgr->toggle(NULL); - } } // May need to call base class LLPanel::handleKeyHere if not handled @@ -1705,8 +1683,8 @@ BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop) { if(drop) { - LLDynamicArray ids; - ids.put(item->getCreatorUUID()); + std::vector ids; + ids.push_back(item->getCreatorUUID()); inviteToSession(ids); } } @@ -1738,10 +1716,11 @@ BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop) } else if(drop) { - LLDynamicArray ids; + std::vector ids; + ids.reserve(count); for(S32 i = 0; i < count; ++i) { - ids.put(items.get(i)->getCreatorUUID()); + ids.push_back(items.get(i)->getCreatorUUID()); } inviteToSession(ids); } @@ -1771,9 +1750,9 @@ void LLFloaterIMPanel::onClickProfile( void* userdata ) // Bring up the Profile window LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - if (self->mOtherParticipantUUID.notNull()) + if (self->getOtherParticipantID().notNull()) { - LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID()); + LLFriendActions::showProfile(self->getOtherParticipantID()); } } @@ -1792,7 +1771,7 @@ void LLFloaterIMPanel::onClickClose( void* userdata ) LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; if(self) { - self->close(); + self->closeFloater(); } } @@ -1887,6 +1866,9 @@ void LLFloaterIMPanel::onClose(bool app_quitting) } gIMMgr->removeSession(mSessionUUID); + // *HACK hide the voice floater + LLFloaterCall::toggleInstanceVisibility(FALSE, mSessionUUID); + destroy(); } @@ -1896,6 +1878,10 @@ void LLFloaterIMPanel::onVisibilityChange(BOOL new_visibility) { mNumUnreadMessages = 0; } + + LLFloaterCall::toggleInstanceVisibility( + new_visibility && mVoiceChannel->getState() == LLVoiceChannel::STATE_CONNECTED, + mSessionUUID); } void deliver_message(const std::string& utf8_text, @@ -1966,6 +1952,9 @@ void deliver_message(const std::string& utf8_text, default: ; // do nothing } } + + // Add the recipient to the recent people list. + LLRecentPeople::instance().add(other_participant_id); } void LLFloaterIMPanel::sendMsg() @@ -2015,7 +2004,7 @@ void LLFloaterIMPanel::sendMsg() BOOL other_was_typing = mOtherTyping; - addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID()); + addHistoryLine(history_echo, gSavedSkinSettings.getColor("IMChatColor"), true, gAgent.getID()); if (other_was_typing) { @@ -2186,7 +2175,7 @@ void LLFloaterIMPanel::addTypingIndicator(const std::string &name) mTypingLineStartIndex = mHistoryEditor->getWText().length(); LLUIString typing_start = sTypingStartString; typing_start.setArg("[NAME]", name); - addHistoryLine(typing_start, gSavedSettings.getColor4("SystemChatColor"), false); + addHistoryLine(typing_start, gSavedSkinSettings.getColor4("SystemChatColor"), false); mOtherTypingName = name; mOtherTyping = TRUE; } @@ -2224,14 +2213,14 @@ void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, std::string // add warning log enabled message if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) { - message = LLFloaterChat::getInstance()->getString("IM_logging_string"); + message = LLTrans::getString("IM_logging_string"); } break; case LLLogChat::LOG_END: // add log end message if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) { - message = LLFloaterChat::getInstance()->getString("IM_logging_string"); + message = LLTrans::getString("IM_logging_string"); } break; case LLLogChat::LOG_LINE: @@ -2243,7 +2232,7 @@ void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, std::string } //self->addHistoryLine(line, LLColor4::grey, FALSE); - self->mHistoryEditor->appendColoredText(message, false, true, LLColor4::grey); + self->mHistoryEditor->appendColoredText(message, false, true, gSavedSkinSettings.getColor4("ChatHistoryTextColor")); } void LLFloaterIMPanel::showSessionStartError( @@ -2325,7 +2314,7 @@ bool LLFloaterIMPanel::onConfirmForceCloseError(const LLSD& notification, const LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession( session_id); - if ( floaterp ) floaterp->close(FALSE); + if ( floaterp ) floaterp->closeFloater(FALSE); } return false; } diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 8b3ca202c7..7cd19d4872 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -77,6 +77,7 @@ public: virtual void getChannelInfo(); virtual BOOL isActive(); virtual BOOL callStarted(); + const std::string& getSessionName() const { return mSessionName; } const LLUUID getSessionID() { return mSessionID; } EState getState() { return mState; } @@ -94,6 +95,7 @@ public: protected: virtual void setState(EState state); + void toggleCallWindowIfNeeded(EState state); void setURI(std::string uri); std::string mURI; @@ -185,11 +187,7 @@ public: LLFloaterIMPanel(const std::string& session_label, const LLUUID& session_id, const LLUUID& target_id, - EInstantMessage dialog); - LLFloaterIMPanel(const std::string& session_label, - const LLUUID& session_id, - const LLUUID& target_id, - const LLDynamicArray& ids, + const std::vector& ids, EInstantMessage dialog); virtual ~LLFloaterIMPanel(); @@ -202,7 +200,7 @@ public: // add target ids to the session. // Return TRUE if successful, otherwise FALSE. - BOOL inviteToSession(const LLDynamicArray& agent_ids); + BOOL inviteToSession(const std::vector& agent_ids); void addHistoryLine(const std::string &utf8msg, const LLColor4& color = LLColor4::white, @@ -246,6 +244,7 @@ public: const LLUUID& getSessionID() const { return mSessionUUID; } const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; } + LLIMSpeakerMgr* getSpeakerManager() const { return mSpeakers; } void updateSpeakersList(const LLSD& speaker_updates); void processSessionUpdate(const LLSD& update); void setSpeakers(const LLSD& speaker_list); @@ -270,9 +269,6 @@ public: static bool onConfirmForceCloseError(const LLSD& notification, const LLSD& response); private: - // called by constructors - void init(const std::string& session_label); - // Called by UI methods. void sendMsg(); @@ -318,7 +314,7 @@ private: // inventory folder ==> first target id in list // 911 ==> sender LLUUID mOtherParticipantUUID; - LLDynamicArray mSessionInitialTargetIDs; + std::vector mSessionInitialTargetIDs; EInstantMessage mDialog; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a90ea39265..d6569663a2 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -34,6 +34,7 @@ #include "llimview.h" +#include "llfloaterreg.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -44,12 +45,12 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llavatariconctrl.h" #include "llcallingcard.h" #include "llchat.h" #include "llresmgr.h" #include "llfloaterchat.h" #include "llfloaterchatterbox.h" -#include "llfloaternewim.h" #include "llhttpnode.h" #include "llimpanel.h" #include "llresizebar.h" @@ -67,6 +68,8 @@ #include "llviewerwindow.h" #include "llnotify.h" #include "llviewerregion.h" +#include "llviewertexteditor.h" +#include "lltrans.h" #include "llfirstuse.h" @@ -145,11 +148,11 @@ public: floaterp->requestAutoConnect(); LLFloaterIMPanel::onClickStartCall(floaterp); // always open IM window when connecting to voice - LLFloaterChatterBox::showInstance(TRUE); + LLFloaterReg::showInstance("communicate", LLSD(), TRUE); } else if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE ) { - LLFloaterChatterBox::showInstance(TRUE); + LLFloaterReg::showInstance("communicate", LLSD(), TRUE); } } @@ -234,7 +237,8 @@ LLUUID LLIMMgr::computeSessionID( // LLFloaterIM //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LLFloaterIM::LLFloaterIM() +LLFloaterIM::LLFloaterIM() + : LLMultiFloater() { // autoresize=false is necessary to avoid resizing of the IM window whenever // a session is opened or closed (it would otherwise resize the window to match @@ -324,6 +328,168 @@ BOOL LLFloaterIM::postBuild() return TRUE; } +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLIncomingCallDialog +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) : + LLModalDialog(LLStringUtil::null, 240, 200), + mPayload(payload) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_incoming_call.xml"); +} + +BOOL LLIncomingCallDialog::postBuild() +{ + LLSD caller_id = mPayload["caller_id"]; + EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + + std::string call_type = getString("VoiceInviteP2P"); + std::string caller_name = mPayload["caller_name"].asString() + " "; + setTitle(caller_name + call_type); + + // If it is not a P2P invite, then it's an AdHoc invite + if ( type != IM_SESSION_P2P_INVITE ) + { + call_type = getString("VoiceInviteAdHoc"); + } + + LLViewerTextEditor* text = getChild("caller name"); + text->setEmbeddedText(caller_name + call_type); + LLAvatarIconCtrl* icon = getChild("avatar_icon"); + icon->setValue(caller_id); + + childSetAction("Accept", onAccept, this); + childSetAction("Reject", onReject, this); + childSetAction("Start IM", onStartIM, this); + childSetFocus("Accept"); + + return TRUE; +} + +//static +void LLIncomingCallDialog::onAccept(void* user_data) +{ + LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data; + self->processCallResponse(0); + self->closeFloater(); +} + +//static +void LLIncomingCallDialog::onReject(void* user_data) +{ + LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data; + self->processCallResponse(1); + self->closeFloater(); +} + +//static +void LLIncomingCallDialog::onStartIM(void* user_data) +{ + LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data; + self->processCallResponse(2); + self->closeFloater(); +} + +void LLIncomingCallDialog::processCallResponse(S32 response) +{ + LLUUID session_id = mPayload["session_id"].asUUID(); + EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger(); + LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger(); + bool voice = true; + switch(response) + { + case 2: // start IM: just don't start the voice chat + { + voice = false; + /* FALLTHROUGH */ + } + case 0: // accept + { + if (type == IM_SESSION_P2P_INVITE) + { + // create a normal IM session + session_id = gIMMgr->addP2PSession( + mPayload["session_name"].asString(), + mPayload["caller_id"].asUUID(), + mPayload["session_handle"].asString()); + + if (voice) + { + LLFloaterIMPanel* im_floater = + gIMMgr->findFloaterBySession( + session_id); + + if (im_floater) + { + im_floater->requestAutoConnect(); + LLFloaterIMPanel::onClickStartCall(im_floater); + } + } + + // always open IM window when connecting to voice + LLFloaterReg::showInstance("communicate", session_id); + + gIMMgr->clearPendingAgentListUpdates(session_id); + gIMMgr->clearPendingInvitation(session_id); + } + else + { + gIMMgr->addSession( + mPayload["session_name"].asString(), + type, + session_id); + + std::string url = gAgent.getRegion()->getCapability( + "ChatSessionRequest"); + + if (voice) + { + LLSD data; + data["method"] = "accept invitation"; + data["session-id"] = session_id; + LLHTTPClient::post( + url, + data, + new LLViewerChatterBoxInvitationAcceptResponder( + session_id, + inv_type)); + } + } + if (voice) + { + break; + } + } + case 1: // decline + { + if (type == IM_SESSION_P2P_INVITE) + { + if(gVoiceClient) + { + std::string s = mPayload["session_handle"].asString(); + gVoiceClient->declineInvite(s); + } + } + else + { + std::string url = gAgent.getRegion()->getCapability( + "ChatSessionRequest"); + + LLSD data; + data["method"] = "decline invitation"; + data["session-id"] = session_id; + LLHTTPClient::post( + url, + data, + NULL); + } + } + + gIMMgr->clearPendingAgentListUpdates(session_id); + gIMMgr->clearPendingInvitation(session_id); + } +} + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLIMViewFriendObserver // @@ -375,7 +541,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) im_floater->requestAutoConnect(); LLFloaterIMPanel::onClickStartCall(im_floater); // always open IM window when connecting to voice - LLFloaterChatterBox::showInstance(session_id); + LLFloaterReg::showInstance("communicate", session_id, TRUE); } gIMMgr->clearPendingAgentListUpdates(session_id); @@ -467,54 +633,6 @@ EInstantMessage LLIMMgr::defaultIMTypeForAgent(const LLUUID& agent_id) return type; } -// static -//void LLIMMgr::onPinButton(void*) -//{ -// BOOL state = gSavedSettings.getBOOL( "PinTalkViewOpen" ); -// gSavedSettings.setBOOL( "PinTalkViewOpen", !state ); -//} - -// static -void LLIMMgr::toggle(void*) -{ - static BOOL return_to_mouselook = FALSE; - - // Hide the button and show the floater or vice versa. - llassert( gIMMgr ); - BOOL old_state = gIMMgr->getFloaterOpen(); - - // If we're in mouselook and we triggered the Talk View, we want to talk. - if( gAgent.cameraMouselook() && old_state ) - { - return_to_mouselook = TRUE; - gAgent.changeCameraToDefault(); - return; - } - - BOOL new_state = !old_state; - - if (new_state) - { - // ...making visible - if ( gAgent.cameraMouselook() ) - { - return_to_mouselook = TRUE; - gAgent.changeCameraToDefault(); - } - } - else - { - // ...hiding - if ( gAgent.cameraThirdPerson() && return_to_mouselook ) - { - gAgent.changeCameraToMouselook(); - } - return_to_mouselook = FALSE; - } - - gIMMgr->setFloaterOpen( new_state ); -} - // // Member Functions // @@ -607,6 +725,8 @@ void LLIMMgr::addMessage( dialog, FALSE); + notifyObserverSessionAdded(floater->getSessionID(), name, other_participant_id); + // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons // when answering questions. @@ -614,10 +734,10 @@ void LLIMMgr::addMessage( { // *TODO:translate (low priority, god ability) std::ostringstream bonus_info; - bonus_info << "*** parent estate: " + bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + ":" + " " << parent_estate_id - << ((parent_estate_id == 1) ? ", mainland" : "") - << ((parent_estate_id == 5) ? ", teen" : ""); + << ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "") + << ((parent_estate_id == 5) ? "," + LLTrans::getString ("IMTeen") : ""); // once we have web-services (or something) which returns // information about a region id, we can print this out @@ -625,7 +745,7 @@ void LLIMMgr::addMessage( //<< "*** region_id: " << region_id << std::endl //<< "*** position: " << position << std::endl; - floater->addHistoryLine(bonus_info.str(), gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(bonus_info.str(), gSavedSkinSettings.getColor4("SystemChatColor")); } make_ui_sound("UISndNewIncomingIMSession"); @@ -634,8 +754,8 @@ void LLIMMgr::addMessage( // now add message to floater bool is_from_system = target_id.isNull() || (from == SYSTEM_FROM); const LLColor4& color = ( is_from_system ? - gSavedSettings.getColor4("SystemChatColor") : - gSavedSettings.getColor("IMChatColor")); + gSavedSkinSettings.getColor4("SystemChatColor") : + gSavedSkinSettings.getColor("IMChatColor")); if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally @@ -645,10 +765,10 @@ void LLIMMgr::addMessage( floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message } - LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(LLSD()); - - if( !chat_floater->getVisible() && !floater->getVisible()) + if( !LLFloaterReg::instanceVisible("communicate") && !floater->getVisible()) { + LLFloaterChatterBox* chat_floater = LLFloaterChatterBox::getInstance(); + //if the IM window is not open and the floater is not visible (i.e. not torn off) LLFloater* previouslyActiveFloater = chat_floater->getActiveFloater(); @@ -675,14 +795,12 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess // null session id means near me (chat history) if (session_id.isNull()) { - LLFloaterChat* floaterp = LLFloaterChat::getInstance(); - - message = floaterp->getString(message_name); + message = LLTrans::getString(message_name); message.setArgs(args); LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLFloaterChat::getInstance()->addChatHistory(chat); + LLFloaterChat::addChatHistory(chat); } else // going to IM session { @@ -699,7 +817,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess void LLIMMgr::notifyNewIM() { - if(!gIMMgr->getFloaterOpen()) + if(!LLFloaterReg::instanceVisible("communicate")) { mIMReceived = TRUE; } @@ -767,21 +885,21 @@ LLUUID LLIMMgr::addSession( TRUE); noteOfflineUsers(floater, ids); - LLFloaterChatterBox::showInstance(session_id); + LLFloaterReg::showInstance("communicate", session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) { noteMutedUsers(floater, ids); } - LLFloaterChatterBox::getInstance(LLSD())->showFloater(floater); } else { - floater->open(); + floater->openFloater(); } //mTabContainer->selectTabPanel(panel); floater->setInputFocus(TRUE); + notifyObserverSessionAdded(floater->getSessionID(), name, other_participant_id); return floater->getSessionID(); } @@ -818,7 +936,7 @@ LLUUID LLIMMgr::addSession( if ( !floater ) return LLUUID::null; noteOfflineUsers(floater, ids); - LLFloaterChatterBox::showInstance(session_id); + LLFloaterReg::showInstance("communicate", session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) @@ -828,10 +946,11 @@ LLUUID LLIMMgr::addSession( } else { - floater->open(); + floater->openFloater(); } //mTabContainer->selectTabPanel(panel); floater->setInputFocus(TRUE); + notifyObserverSessionAdded(floater->getSessionID(), name, other_participant_id); return floater->getSessionID(); } @@ -843,12 +962,13 @@ void LLIMMgr::removeSession(const LLUUID& session_id) if(floater) { mFloaters.erase(floater->getHandle()); - LLFloaterChatterBox::getInstance(LLSD())->removeFloater(floater); + LLFloaterChatterBox::getInstance()->removeFloater(floater); //mTabContainer->removeTabPanel(floater); clearPendingInvitation(session_id); clearPendingAgentListUpdates(session_id); } + notifyObserverSessionRemoved(session_id); } void LLIMMgr::inviteToSession( @@ -932,65 +1052,60 @@ void LLIMMgr::inviteToSession( { if (caller_name.empty()) { - gCacheName->getName(caller_id, onInviteNameLookup, new LLSD(payload)); + gCacheName->get(caller_id, FALSE, boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2, _3, _4)); } else { - LLSD args; - args["NAME"] = caller_name; - args["GROUP"] = session_name; - - LLNotifications::instance().add(notify_box_type, - args, - payload, - &inviteUserResponse); - + if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc") + { + LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload); + dialog->startModal(); + } + else + { + LLSD args; + args["NAME"] = caller_name; + args["GROUP"] = session_name; + + LLNotifications::instance().add(notify_box_type, + args, + payload, + &inviteUserResponse); + } } mPendingInvitations[session_id.asString()] = LLSD(); } } -//static -void LLIMMgr::onInviteNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* userdata) +void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) { - LLSD payload = *(LLSD*)userdata; - delete (LLSD*)userdata; - payload["caller_name"] = first + " " + last; payload["session_name"] = payload["caller_name"].asString(); - LLSD args; - args["NAME"] = payload["caller_name"].asString(); + std::string notify_box_type = payload["notify_box_type"].asString(); - LLNotifications::instance().add( - payload["notify_box_type"].asString(), - args, - payload, - &inviteUserResponse); -} - -void LLIMMgr::refresh() -{ -} - -void LLIMMgr::setFloaterOpen(BOOL set_open) -{ - if (set_open) + if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc") { - LLFloaterChatterBox::showInstance(); + LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload); + dialog->startModal(); } else { - LLFloaterChatterBox::hideInstance(); + LLSD args; + args["NAME"] = payload["caller_name"].asString(); + + LLNotifications::instance().add( + payload["notify_box_type"].asString(), + args, + payload, + &inviteUserResponse); } } - -BOOL LLIMMgr::getFloaterOpen() +void LLIMMgr::refresh() { - return LLFloaterChatterBox::instanceVisible(LLSD()); } - + void LLIMMgr::disconnectAllSessions() { LLFloaterIMPanel* floater = NULL; @@ -1007,7 +1122,7 @@ void LLIMMgr::disconnectAllSessions() if (floater) { floater->setEnabled(FALSE); - floater->close(TRUE); + floater->closeFloater(TRUE); } } } @@ -1128,6 +1243,32 @@ void LLIMMgr::clearPendingAgentListUpdates(const LLUUID& session_id) } } +void LLIMMgr::notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++) + { + (*it)->sessionAdded(session_id, name, other_participant_id); + } +} + +void LLIMMgr::notifyObserverSessionRemoved(const LLUUID& session_id) +{ + for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++) + { + (*it)->sessionRemoved(session_id); + } +} + +void LLIMMgr::addSessionObserver(LLIMSessionObserver *observer) +{ + mSessionObservers.push_back(observer); +} + +void LLIMMgr::removeSessionObserver(LLIMSessionObserver *observer) +{ + mSessionObservers.remove(observer); +} + // create a floater and update internal representation for // consistency. Returns the pointer, caller (the class instance since // it is a private method) is not responsible for deleting the @@ -1146,12 +1287,14 @@ LLFloaterIMPanel* LLIMMgr::createFloater( llinfos << "LLIMMgr::createFloater: from " << other_participant_id << " in session " << session_id << llendl; + std::vector ids; LLFloaterIMPanel* floater = new LLFloaterIMPanel(session_label, session_id, other_participant_id, + ids, dialog); LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt); + LLFloaterChatterBox::getInstance()->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); return floater; } @@ -1177,7 +1320,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater( ids, dialog); LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - LLFloaterChatterBox::getInstance(LLSD())->addFloater(floater, FALSE, i_pt); + LLFloaterChatterBox::getInstance()->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); return floater; } @@ -1189,7 +1332,7 @@ void LLIMMgr::noteOfflineUsers( S32 count = ids.count(); if(count == 0) { - floater->addHistoryLine(sOnlyUserMessage, gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(sOnlyUserMessage, gSavedSkinSettings.getColor4("SystemChatColor")); } else { @@ -1205,7 +1348,7 @@ void LLIMMgr::noteOfflineUsers( LLUIString offline = sOfflineMessage; offline.setArg("[FIRST]", first); offline.setArg("[LAST]", last); - floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor")); + floater->addHistoryLine(offline, gSavedSkinSettings.getColor4("SystemChatColor")); } } } @@ -1267,11 +1410,6 @@ void LLIMMgr::updateFloaterSessionID( } } -LLFloaterChatterBox* LLIMMgr::getFloater() -{ - return LLFloaterChatterBox::getInstance(LLSD()); -} - class LLViewerChatterBoxSessionStartReply : public LLHTTPNode { public: diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index a4e419694d..469f6ec21d 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -33,9 +33,10 @@ #ifndef LL_LLIMVIEW_H #define LL_LLIMVIEW_H -#include "llfloater.h" +#include "llmodaldialog.h" #include "llinstantmessage.h" #include "lluuid.h" +#include "llmultifloater.h" class LLFloaterChatterBox; class LLUUID; @@ -43,6 +44,14 @@ class LLFloaterIMPanel; class LLFriendObserver; class LLFloaterIM; +class LLIMSessionObserver +{ +public: + virtual ~LLIMSessionObserver() {} + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0; + virtual void sessionRemoved(const LLUUID& session_id) = 0; +}; + class LLIMMgr : public LLSingleton { public: @@ -134,19 +143,12 @@ public: // IM received that you haven't seen yet BOOL getIMReceived() const; - void setFloaterOpen(BOOL open); /*Flawfinder: ignore*/ - BOOL getFloaterOpen(); - - LLFloaterChatterBox* getFloater(); - // This method is used to go through all active sessions and // disable all of them. This method is usally called when you are // forced to log out or similar situations where you do not have a // good connection. void disconnectAllSessions(); - static void toggle(void*); - // This is a helper function to determine what kind of im session // should be used for the given agent. static EInstantMessage defaultIMTypeForAgent(const LLUUID& agent_id); @@ -171,6 +173,9 @@ public: //HACK: need a better way of enumerating existing session, or listening to session create/destroy events const std::set >& getIMFloaterHandles() { return mFloaters; } + void addSessionObserver(LLIMSessionObserver *); + void removeSessionObserver(LLIMSessionObserver *); + private: // create a panel and update internal representation for // consistency. Returns the pointer, caller (the class instance @@ -198,12 +203,18 @@ private: void processIMTypingCore(const LLIMInfo* im_info, BOOL typing); - static void onInviteNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* userdata); + static void onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); + + void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + void notifyObserverSessionRemoved(const LLUUID& session_id); private: std::set > mFloaters; LLFriendObserver* mFriendObserver; + typedef std::list session_observers_list_t; + session_observers_list_t mSessionObservers; + // An IM has been received that you haven't seen yet. BOOL mIMReceived; @@ -223,6 +234,23 @@ public: static std::map sForceCloseSessionMap; }; +class LLIncomingCallDialog : public LLModalDialog +{ +public: + LLIncomingCallDialog(const LLSD& payload); + + /*virtual*/ BOOL postBuild(); + + static void onAccept(void* user_data); + static void onReject(void* user_data); + static void onStartIM(void* user_data); + +private: + void processCallResponse(S32 response); + + LLSD mPayload; +}; + // Globals extern LLIMMgr *gIMMgr; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5d09d8748f..540cefbc46 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -40,8 +40,10 @@ #include "message.h" #include "llagent.h" +#include "llagentwearables.h" #include "llcallingcard.h" #include "llcheckboxctrl.h" // for radio buttons +#include "llfloaterreg.h" #include "llradiogroup.h" #include "llspinctrl.h" #include "lltextbox.h" @@ -49,13 +51,13 @@ #include "llviewercontrol.h" #include "llfirstuse.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloaterproperties.h" #include "llfloaterworldmap.h" #include "llfocusmgr.h" #include "llfolderview.h" +#include "llfriendactions.h" #include "llgesturemgr.h" #include "lliconctrl.h" #include "llinventorymodel.h" @@ -82,10 +84,12 @@ #include "llwearablelist.h" #include "llviewermessage.h" #include "llviewerregion.h" +#include "llvoavatarself.h" #include "lltabcontainer.h" #include "lluictrlfactory.h" #include "llselectmgr.h" #include "llfloateropenobject.h" +#include "lltrans.h" using namespace LLOldEvents; @@ -106,12 +110,13 @@ void dec_busy_count() // Function declarations struct LLWearableHoldingPattern; +void wear_add_inventory_item_on_avatar(LLInventoryItem* item); void wear_inventory_category_on_avatar(LLInventoryCategory* category, BOOL append); -void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata); +void wear_inventory_category_on_avatar_step2( BOOL proceed, LLUUID category, BOOL append); void wear_inventory_category_on_avatar_loop(LLWearable* wearable, void*); void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, BOOL append); void remove_inventory_category_from_avatar(LLInventoryCategory* category); -void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata); +void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id); bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*); bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response); @@ -144,17 +149,13 @@ std::string ICON_NAME[ICON_NAME_COUNT] = "inv_item_undershirt.tga", "inv_item_underpants.tga", "inv_item_skirt.tga", + "inv_item_alpha.tga", + "inv_item_tattoo.tga", "inv_item_animation.tga", "inv_item_gesture.tga", }; -struct LLWearInfo -{ - LLUUID mCategoryID; - BOOL mAppend; -}; - BOOL gAddToOutfit = FALSE; // +=================================================+ @@ -192,7 +193,7 @@ time_t LLInvFVBridge::getCreationDate() const // Can be destoryed (or moved to trash) BOOL LLInvFVBridge::isItemRemovable() { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; if(model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID())) { @@ -210,14 +211,14 @@ BOOL LLInvFVBridge::isItemMovable() // *TODO: make sure this does the right thing void LLInvFVBridge::showProperties() { - LLShowProps::showProperties(mUUID); + LLFloaterProperties::show(mUUID); } void LLInvFVBridge::removeBatch(LLDynamicArray& batch) { // Deactivate gestures when moving them into Trash LLInvFVBridge* bridge; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); LLViewerInventoryItem* item = NULL; LLViewerInventoryCategory* cat = NULL; LLInventoryModel::cat_array_t descendent_categories; @@ -265,7 +266,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArraygetModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return; LLMessageSystem* msg = gMessageSystem; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); @@ -369,7 +370,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArraygetModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; BOOL is_agent_inventory = model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID()); @@ -381,8 +382,8 @@ BOOL LLInvFVBridge::isClipboardPasteable() const } void hideContextEntries(LLMenuGL& menu, - const std::vector &entries_to_show, - const std::vector &disabled_entries) + const std::vector &entries_to_show, + const std::vector &disabled_entries) { const LLView::child_list_t *list = menu.getChildList(); @@ -426,10 +427,10 @@ void hideContextEntries(LLMenuGL& menu, } // Helper for commonly-used entries -void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector &items, - std::vector &disabled_items, U32 flags) +void LLInvFVBridge::getClipboardEntries(bool show_asset_id, + std::vector &items, + std::vector &disabled_items, U32 flags) { - // *TODO: Translate items.push_back(std::string("Rename")); if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0) { @@ -471,18 +472,17 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector items; std::vector disabled_items; if(isInTrash()) { - items.push_back(std::string("Purge Item")); + items.push_back(std::string("PurgeItem")); if (!isItemRemovable()) { - disabled_items.push_back(std::string("Purge Item")); + disabled_items.push_back(std::string("PurgeItem")); } - items.push_back(std::string("Restore Item")); + items.push_back(std::string("RestoreItem")); } else { @@ -526,7 +526,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const LLInventoryObject* LLInvFVBridge::getInventoryObject() const { LLInventoryObject* obj = NULL; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(model) { obj = (LLInventoryObject*)model->getObject(mUUID); @@ -534,9 +534,15 @@ LLInventoryObject* LLInvFVBridge::getInventoryObject() const return obj; } +LLInventoryModel* LLInvFVBridge::getInventoryModel() const +{ + LLInventoryPanel* panel = dynamic_cast(mInventoryPanel.get()); + return panel ? panel->getModel() : NULL; +} + BOOL LLInvFVBridge::isInTrash() const { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); return model->isObjectDescendentOf(mUUID, trash_id); @@ -544,7 +550,7 @@ BOOL LLInvFVBridge::isInTrash() const BOOL LLInvFVBridge::isAgentInventory() const { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; if(gAgent.getInventoryRootID() == mUUID) return TRUE; return model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID()); @@ -602,22 +608,21 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model, } -const char* safe_inv_type_lookup(LLInventoryType::EType inv_type) +const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type) { - const char* rv = LLInventoryType::lookup(inv_type); - if(!rv) + const std::string rv= LLInventoryType::lookup(inv_type); + if(rv.empty()) { - const char* INVALID_TYPE = ""; - rv = INVALID_TYPE; + return std::string(""); } return rv; } LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, - LLInventoryPanel* inventory, - const LLUUID& uuid, - U32 flags) + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + const LLUUID& uuid, + U32 flags) { LLInvFVBridge* new_listener = NULL; switch(asset_type) @@ -715,6 +720,10 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_ROOT_CATEGORY: new_listener = new LLFolderBridge(inventory, uuid); break; + + case LLAssetType::AT_FAVORITE: + new_listener = new LLFolderBridge(inventory, uuid); + break; default: llinfos << "Unhandled asset type (llassetstorage.h): " @@ -811,7 +820,7 @@ void LLItemBridge::restoreItem() LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); if(item) { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); LLUUID new_parent = model->findCategoryUUIDForType(item->getType()); // do not restamp on restore. LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE); @@ -906,6 +915,11 @@ void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name) std::string LLItemBridge::getLabelSuffix() const { + // assume that this won't be called before string table is loaded + static const char* NO_COPY =LLTrans::getString("NO_COPY").c_str(); + static const char* NO_MOD = LLTrans::getString("NO_MOD").c_str(); + static const char* NO_XFER = LLTrans::getString("NO_XFER").c_str(); + std::string suffix; LLInventoryItem* item = getItem(); if(item) @@ -918,11 +932,8 @@ std::string LLItemBridge::getLabelSuffix() const BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); - // *TODO: Translate + const char* EMPTY = ""; - const char* NO_COPY = " (no copy)"; - const char* NO_MOD = " (no modify)"; - const char* NO_XFER = " (no transfer)"; const char* scopy; if(copy) scopy = EMPTY; else scopy = NO_COPY; @@ -961,10 +972,12 @@ BOOL LLItemBridge::isItemRenameable() const BOOL LLItemBridge::renameItem(const std::string& new_name) { - if(!isItemRenameable()) return FALSE; - LLPreview::rename(mUUID, getPrefix() + new_name); - LLInventoryModel* model = mInventoryPanel->getModel(); - if(!model) return FALSE; + if(!isItemRenameable()) + return FALSE; + LLPreview::dirty(mUUID); + LLInventoryModel* model = getInventoryModel(); + if(!model) + return FALSE; LLViewerInventoryItem* item = getItem(); if(item && (item->getName() != new_name)) { @@ -989,7 +1002,7 @@ BOOL LLItemBridge::removeItem() } // move it to the trash LLPreview::hide(mUUID, TRUE); - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); LLViewerInventoryItem* item = getItem(); @@ -1015,7 +1028,7 @@ BOOL LLItemBridge::isItemCopyable() const if (item) { // can't copy worn objects. DEV-15183 - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); if( !avatarp ) { return FALSE; @@ -1044,7 +1057,7 @@ BOOL LLItemBridge::copyToClipboard() const LLViewerInventoryItem* LLItemBridge::getItem() const { LLViewerInventoryItem* item = NULL; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(model) { item = (LLViewerInventoryItem*)model->getItem(mUUID); @@ -1091,7 +1104,7 @@ void LLFolderBridge::selectItem() // Can be destroyed (or moved to trash) BOOL LLFolderBridge::isItemRemovable() { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) { return FALSE; @@ -1102,7 +1115,7 @@ BOOL LLFolderBridge::isItemRemovable() return FALSE; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if( !avatar ) { return FALSE; @@ -1139,7 +1152,7 @@ BOOL LLFolderBridge::isItemRemovable() if( (item->getType() == LLAssetType::AT_CLOTHING) || (item->getType() == LLAssetType::AT_BODYPART) ) { - if( gAgent.isWearingItem( item->getUUID() ) ) + if( gAgentWearables.isWearingItem( item->getUUID() ) ) { return FALSE; } @@ -1159,7 +1172,7 @@ BOOL LLFolderBridge::isItemRemovable() BOOL LLFolderBridge::isUpToDate() const { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); if( !category ) @@ -1177,10 +1190,10 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // the UI will get confused and pass in a NULL. if(!inv_cat) return FALSE; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if(!avatar) return FALSE; // cannot drag into library @@ -1233,7 +1246,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if( (item->getType() == LLAssetType::AT_CLOTHING) || (item->getType() == LLAssetType::AT_BODYPART) ) { - if( gAgent.isWearingItem( item->getUUID() ) ) + if( gAgentWearables.isWearingItem( item->getUUID() ) ) { is_movable = FALSE; // It's generally movable, but not into the trash! break; @@ -1394,7 +1407,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, else { LLNotification::Params params("MoveInventoryFromObject"); - params.functor(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); + params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); } } @@ -1626,7 +1639,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model } else if ("removefromoutfit" == action) { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return; LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; @@ -1657,7 +1670,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model void LLFolderBridge::openItem() { lldebugs << "LLFolderBridge::openItem()" << llendl; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return; model->fetchDescendentsOf(mUUID); } @@ -1679,13 +1692,25 @@ void LLFolderBridge::restoreItem() cat = (LLViewerInventoryCategory*)getCategory(); if(cat) { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); LLUUID new_parent = model->findCategoryUUIDForType(cat->getType()); // do not restamp children on restore LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE); } } +LLAssetType::EType LLFolderBridge::getPreferredType() const +{ + LLAssetType::EType preferred_type = LLAssetType::AT_NONE; + LLViewerInventoryCategory* cat = getCategory(); + if(cat) + { + preferred_type = cat->getPreferredType(); + } + + return preferred_type; +} + // Icons for folders are based on the preferred type LLUIImagePtr LLFolderBridge::getIcon() const { @@ -1744,6 +1769,10 @@ LLUIImagePtr LLFolderBridge::getIcon() const case LLAssetType::AT_GESTURE: control = "inv_folder_gesture.tga"; break; + case LLAssetType::AT_FAVORITE: + //TODO - need icon + control = "inv_folder_plain_closed.tga"; + break; default: control = "inv_folder_plain_closed.tga"; break; @@ -1753,9 +1782,11 @@ LLUIImagePtr LLFolderBridge::getIcon() const BOOL LLFolderBridge::renameItem(const std::string& new_name) { - if(!isItemRenameable()) return FALSE; - LLInventoryModel* model = mInventoryPanel->getModel(); - if(!model) return FALSE; + if(!isItemRenameable()) + return FALSE; + LLInventoryModel* model = getInventoryModel(); + if(!model) + return FALSE; LLViewerInventoryCategory* cat = getCategory(); if(cat && (cat->getName() != new_name)) { @@ -1778,7 +1809,7 @@ BOOL LLFolderBridge::removeItem() } // move it to the trash LLPreview::hide(mUUID); - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; LLUUID trash_id; @@ -1822,7 +1853,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const void LLFolderBridge::pasteFromClipboard() { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(model && isClipboardPasteable()) { LLInventoryItem* item = NULL; @@ -1857,9 +1888,7 @@ void LLFolderBridge::folderOptionsMenu() { std::vector disabled_items; - // *TODO: Translate - - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return; const LLInventoryCategory* category = model->getCategory(mUUID); @@ -1919,10 +1948,9 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv // Flags unused void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; // std::vector disabled_items; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return; LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); @@ -1952,31 +1980,6 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } else if(isAgentInventory()) // do not allow creating in library { - // only mature accounts can create undershirts/underwear - /*if (!gAgent.isTeen()) - { - sub_menu->append(new LLMenuItemCallGL("New Undershirt", - &createNewUndershirt, - NULL, - (void*)this)); - sub_menu->append(new LLMenuItemCallGL("New Underpants", - &createNewUnderpants, - NULL, - (void*)this)); - }*/ - -/* BOOL contains_calling_cards = FALSE; - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - - LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); - model->collectDescendentsIf(mUUID, - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_callingcard); - if(item_array.count() > 0) contains_calling_cards = TRUE; -*/ mItems.push_back(std::string("New Folder")); mItems.push_back(std::string("New Script")); mItems.push_back(std::string("New Note")); @@ -2037,7 +2040,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) BOOL LLFolderBridge::hasChildren() const { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; LLInventoryModel::EHasChildren has_children; has_children = gInventory.categoryHasChildren(mUUID); @@ -2079,7 +2082,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, LLViewerInventoryCategory* LLFolderBridge::getCategory() const { LLViewerInventoryCategory* cat = NULL; - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(model) { cat = (LLViewerInventoryCategory*)model->getCategory(mUUID); @@ -2099,7 +2102,8 @@ void LLFolderBridge::createNewCategory(void* user_data) { LLFolderBridge* bridge = (LLFolderBridge*)user_data; if(!bridge) return; - LLInventoryPanel* panel = bridge->mInventoryPanel; + LLInventoryPanel* panel = dynamic_cast(bridge->mInventoryPanel.get()); + if (!panel) return; LLInventoryModel* model = panel->getModel(); if(!model) return; LLUUID id; @@ -2191,7 +2195,7 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type) // static void LLFolderBridge::createWearable(LLUUID parent_id, EWearableType type) { - LLWearable* wearable = gWearableList.createNewWearable(type); + LLWearable* wearable = LLWearableList::instance().createNewWearable(type); LLAssetType::EType asset_type = wearable->getAssetType(); LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; create_inventory_item(gAgent.getID(), gAgent.getSessionID(), @@ -2203,7 +2207,7 @@ void LLFolderBridge::createWearable(LLUUID parent_id, EWearableType type) void LLFolderBridge::modifyOutfit(BOOL append) { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return; LLViewerInventoryCategory* cat = getCategory(); if(!cat) return; @@ -2254,7 +2258,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop) { - LLInventoryModel* model = mInventoryPanel->getModel(); + LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; // cannot drag into library @@ -2263,7 +2267,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, return FALSE; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if(!avatar) return FALSE; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); @@ -2294,7 +2298,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, { case LLAssetType::AT_CLOTHING: case LLAssetType::AT_BODYPART: - is_movable = !gAgent.isWearingItem(inv_item->getUUID()); + is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID()); break; case LLAssetType::AT_OBJECT: @@ -2320,18 +2324,33 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (LLInventoryView::getActiveInventory()) { LLInventoryPanel* active_panel = LLInventoryView::getActiveInventory()->getPanel(); - if (active_panel && (mInventoryPanel != active_panel)) + LLInventoryPanel* panel = dynamic_cast(mInventoryPanel.get()); + if (active_panel && (panel != active_panel)) { active_panel->unSelectAll(); } } - // restamp if the move is into the trash. - LLInvFVBridge::changeItemParent( - model, - (LLViewerInventoryItem*)inv_item, - mUUID, - move_is_into_trash); + LLUUID favorites_id = model->findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + if (favorites_id == mUUID) // if target is the favorites folder we use copy + { + copy_inventory_item( + gAgent.getID(), + inv_item->getPermissions().getOwner(), + inv_item->getUUID(), + mUUID, + std::string(), + LLPointer(NULL)); + } + else + { + // restamp if the move is into the trash. + LLInvFVBridge::changeItemParent( + model, + (LLViewerInventoryItem*)inv_item, + mUUID, + move_is_into_trash); + } } } else if(LLToolDragAndDrop::SOURCE_WORLD == source) @@ -2380,7 +2399,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, else { LLNotification::Params params("MoveInventoryFromObject"); - params.functor(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); + params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); LLNotifications::instance().forceResponse(params, 0); } } @@ -2433,49 +2452,18 @@ LLUIImagePtr LLScriptBridge::getIcon() const // | LLTextureBridge | // +=================================================+ -std::string LLTextureBridge::sPrefix("Texture: "); - - LLUIImagePtr LLTextureBridge::getIcon() const { return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE); } -void open_texture(const LLUUID& item_id, - const std::string& title, - BOOL show_keep_discard, - const LLUUID& source_id, - BOOL take_focus) -{ - // See if we can bring an exiting preview to the front - if( !LLPreview::show( item_id, take_focus ) ) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - - LLPreviewTexture* preview; - preview = new LLPreviewTexture("preview texture", - rect, - title, - item_id, - LLUUID::null, - show_keep_discard); - preview->setSourceID(source_id); - if(take_focus) preview->setFocus(TRUE); - - gFloaterView->adjustToFitScreen(preview, FALSE); - } -} - void LLTextureBridge::openItem() { LLViewerInventoryItem* item = getItem(); - if(item) + + if (item) { - open_texture(mUUID, getPrefix() + item->getName(), FALSE); + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } } @@ -2483,9 +2471,6 @@ void LLTextureBridge::openItem() // | LLSoundBridge | // +=================================================+ -std::string LLSoundBridge::sPrefix("Sound: "); - - LLUIImagePtr LLSoundBridge::getIcon() const { return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE); @@ -2493,6 +2478,13 @@ LLUIImagePtr LLSoundBridge::getIcon() const void LLSoundBridge::openItem() { + LLViewerInventoryItem* item = getItem(); + + if (item) + { + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); + } +/* // Changed this back to the way it USED to work: // only open the preview dialog through the contextual right-click menu // double-click just plays the sound @@ -2503,18 +2495,7 @@ void LLSoundBridge::openItem() openSoundPreview((void*)this); //send_uuid_sound_trigger(item->getAssetUUID(), 1.0); } - -// if(!LLPreview::show(mUUID)) -// { -// S32 left, top; -// gFloaterView->getNewFloaterPosition(&left, &top); -// LLRect rect = gSavedSettings.getRect("PreviewSoundRect"); -// rect.translate(left - rect.mLeft, top - rect.mTop); -// new LLPreviewSound("preview sound", -// rect, -// getPrefix() + getName(), -// mUUID)); -// } +*/ } void LLSoundBridge::previewItem() @@ -2529,20 +2510,7 @@ void LLSoundBridge::previewItem() void LLSoundBridge::openSoundPreview(void* which) { LLSoundBridge *me = (LLSoundBridge *)which; - if(!LLPreview::show(me->mUUID)) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewSoundRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLPreviewSound* preview = new LLPreviewSound("preview sound", - rect, - me->getPrefix() + me->getName(), - me->mUUID); - preview->setFocus(TRUE); - // Keep entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + LLFloaterReg::showInstance("preview_sound", LLSD(me->mUUID), TAKE_FOCUS_YES); } void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) @@ -2551,7 +2519,6 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) std::vector items; std::vector disabled_items; - // *TODO: Translate if(isInTrash()) { items.push_back(std::string("Purge Item")); @@ -2580,8 +2547,6 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // | LLLandmarkBridge | // +=================================================+ -std::string LLLandmarkBridge::sPrefix("Landmark: "); - LLUIImagePtr LLLandmarkBridge::getIcon() const { return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE); @@ -2592,7 +2557,6 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) std::vector items; std::vector disabled_items; - // *TODO: Translate lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl; if(isInTrash()) { @@ -2619,6 +2583,20 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } +// Convenience function for the two functions below. +void teleport_via_landmark(const LLUUID& asset_id) +{ + gAgent.teleportViaLandmark( asset_id ); + + // we now automatically track the landmark you're teleporting to + // because you'll probably arrive at a telehub instead + LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance(); + if( floater_world_map ) + { + floater_world_map->trackLandmark( asset_id ); + } +} + // virtual void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { @@ -2627,52 +2605,20 @@ void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* mod LLViewerInventoryItem* item = getItem(); if(item) { - gAgent.teleportViaLandmark(item->getAssetUUID()); - - // we now automatically track the landmark you're teleporting to - // because you'll probably arrive at a telehub instead - if( gFloaterWorldMap ) - { - gFloaterWorldMap->trackLandmark( item->getAssetUUID() ); - } + teleport_via_landmark(item->getAssetUUID()); } } - if ("about" == action) + else if ("about" == action) { LLViewerInventoryItem* item = getItem(); if(item) { - open_landmark(item, std::string(" ") + getPrefix() + item->getName(), FALSE); + LLFloaterReg::showInstance("preview_landmark", LLSD(item->getUUID()), TAKE_FOCUS_YES); } } - else LLItemBridge::performAction(folder, model, action); -} - -void open_landmark(LLViewerInventoryItem* inv_item, - const std::string& title, - BOOL show_keep_discard, - const LLUUID& source_id, - BOOL take_focus) -{ - // See if we can bring an exiting preview to the front - if( !LLPreview::show( inv_item->getUUID(), take_focus ) ) + else { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewLandmarkRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - - LLPreviewLandmark* preview = new LLPreviewLandmark(title, - rect, - title, - inv_item->getUUID(), - show_keep_discard, - inv_item); - preview->setSourceID(source_id); - if(take_focus) preview->setFocus(TRUE); - // keep onscreen - gFloaterView->adjustToFitScreen(preview, FALSE); + LLItemBridge::performAction(folder, model, action); } } @@ -2683,15 +2629,7 @@ static bool open_landmark_callback(const LLSD& notification, const LLSD& respons LLUUID asset_id = notification["payload"]["asset_id"].asUUID(); if (option == 0) { - // HACK: This is to demonstrate teleport on double click for landmarks - gAgent.teleportViaLandmark( asset_id ); - - // we now automatically track the landmark you're teleporting to - // because you'll probably arrive at a telehub instead - if( gFloaterWorldMap ) - { - gFloaterWorldMap->trackLandmark( asset_id ); - } + teleport_via_landmark(asset_id); } return false; @@ -2702,15 +2640,23 @@ static LLNotificationFunctorRegistration open_landmark_callback_reg("TeleportFro void LLLandmarkBridge::openItem() { LLViewerInventoryItem* item = getItem(); + + if (item) + { + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); + } +/* + LLViewerInventoryItem* item = getItem(); if( item ) { // Opening (double-clicking) a landmark immediately teleports, // but warns you the first time. - // open_landmark(item, std::string(" ") + getPrefix() + item->getName(), FALSE); + // open_landmark(item); LLSD payload; payload["asset_id"] = item->getAssetUUID(); LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload); } +*/ } @@ -2726,8 +2672,6 @@ void LLCallingCardObserver::changed(U32 mask) // | LLCallingCardBridge | // +=================================================+ -std::string LLCallingCardBridge::sPrefix("Calling Card: "); - LLCallingCardBridge::LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) : LLItemBridge(inventory, uuid) { @@ -2743,7 +2687,8 @@ LLCallingCardBridge::~LLCallingCardBridge() void LLCallingCardBridge::refreshFolderViewItem() { - LLFolderViewItem* itemp = mInventoryPanel->getRootFolder()->getItemByID(mUUID); + LLInventoryPanel* panel = dynamic_cast(mInventoryPanel.get()); + LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL; if (itemp) { itemp->refresh(); @@ -2759,7 +2704,6 @@ void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* if (item && (item->getCreatorUUID() != gAgent.getID()) && (!item->getCreatorUUID().isNull())) { - gIMMgr->setFloaterOpen(TRUE); gIMMgr->addSession(item->getName(), IM_NOTHING_SPECIAL, item->getCreatorUUID()); } } @@ -2769,7 +2713,7 @@ void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* if (item && (item->getCreatorUUID() != gAgent.getID()) && (!item->getCreatorUUID().isNull())) { - handle_lure(item->getCreatorUUID()); + LLFriendActions::offerTeleport(item->getCreatorUUID()); } } else LLItemBridge::performAction(folder, model, action); @@ -2802,17 +2746,22 @@ std::string LLCallingCardBridge::getLabelSuffix() const void LLCallingCardBridge::openItem() { LLViewerInventoryItem* item = getItem(); + + if (item) + { + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); + } +/* + LLViewerInventoryItem* item = getItem(); if(item && !item->getCreatorUUID().isNull()) { - BOOL online; - online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); - LLFloaterAvatarInfo::showFromFriend(item->getCreatorUUID(), online); + LLFriendActions::showProfile(item->getCreatorUUID()); } +*/ } void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; std::vector items; std::vector disabled_items; @@ -2933,68 +2882,27 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, // | LLNotecardBridge | // +=================================================+ -std::string LLNotecardBridge::sPrefix("Note: "); - - LLUIImagePtr LLNotecardBridge::getIcon() const { return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE); } -void open_notecard(LLViewerInventoryItem* inv_item, - const std::string& title, - const LLUUID& object_id, - BOOL show_keep_discard, - const LLUUID& source_id, - BOOL take_focus) -{ - // See if we can bring an existing preview to the front - if(!LLPreview::show(inv_item->getUUID(), take_focus)) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("NotecardEditorRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLPreviewNotecard* preview; - preview = new LLPreviewNotecard("preview notecard", rect, title, - inv_item->getUUID(), object_id, inv_item->getAssetUUID(), - show_keep_discard, inv_item); - preview->setSourceID(source_id); - if(take_focus) preview->setFocus(TRUE); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - - //if (source_id.notNull()) - //{ - // // look for existing tabbed view for content from same source - // LLPreview* existing_preview = LLPreview::getPreviewForSource(source_id); - // if (existing_preview) - // { - // // found existing preview from this source - // // is it already hosted in a multi-preview window? - // LLMultiPreview* preview_hostp = (LLMultiPreview*)existing_preview->getHost(); - // if (!preview_hostp) - // { - // // create new multipreview if it doesn't exist - // LLMultiPreview* preview_hostp = new LLMultiPreview(existing_preview->getRect()); - // preview_hostp->addFloater(existing_preview); - // } - // // add this preview to existing host - // preview_hostp->addFloater(preview); - // } - //} - } -} - - void LLNotecardBridge::openItem() { LLViewerInventoryItem* item = getItem(); + if (item) { - open_notecard(item, getPrefix() + item->getName(), LLUUID::null, FALSE); + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } + +/* + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); + } +*/ } @@ -3002,8 +2910,6 @@ void LLNotecardBridge::openItem() // | LLGestureBridge | // +=================================================+ -std::string LLGestureBridge::sPrefix("Gesture: "); - LLUIImagePtr LLGestureBridge::getIcon() const { return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE); @@ -3066,22 +2972,19 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode void LLGestureBridge::openItem() { LLViewerInventoryItem* item = getItem(); - if (!item) return; - - // See if we can bring an existing preview to the front - if(!LLPreview::show(mUUID)) + + if (item) { - LLUUID item_id = mUUID; - std::string title = getPrefix() + item->getName(); - LLUUID object_id = LLUUID::null; - - // TODO: save the rectangle - LLPreviewGesture* preview = LLPreviewGesture::show(title, item_id, object_id); + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); + } +/* + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); preview->setFocus(TRUE); - - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); } +*/ } BOOL LLGestureBridge::removeItem() @@ -3093,7 +2996,6 @@ BOOL LLGestureBridge::removeItem() void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; std::vector items; std::vector disabled_items; @@ -3117,15 +3019,6 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Gesture Separator")); items.push_back(std::string("Activate")); items.push_back(std::string("Deactivate")); - - /*menu.append(new LLMenuItemCallGL("Activate", - handleActivateGesture, - enableActivateGesture, - (void*)this)); - menu.append(new LLMenuItemCallGL("Deactivate", - handleDeactivateGesture, - enableDeactivateGesture, - (void*)this));*/ } hideContextEntries(menu, items, disabled_items); } @@ -3134,9 +3027,6 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // | LLAnimationBridge | // +=================================================+ -std::string LLAnimationBridge::sPrefix("Animation: "); - - LLUIImagePtr LLAnimationBridge::getIcon() const { return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE); @@ -3144,7 +3034,6 @@ LLUIImagePtr LLAnimationBridge::getIcon() const void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate std::vector items; std::vector disabled_items; @@ -3178,32 +3067,18 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) // virtual void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { - S32 activate = 0; - if ((action == "playworld") || (action == "playlocal")) { - - if ("playworld" == action) activate = 1; - if ("playlocal" == action) activate = 2; - - // See if we can bring an existing preview to the front - if( !LLPreview::show( mUUID ) ) + if (getItem()) { - // There isn't one, so make a new preview - LLViewerInventoryItem* item = getItem(); - if( item ) + LLPreviewAnim::e_activation_type activate = LLPreviewAnim::NONE; + if ("playworld" == action) activate = LLPreviewAnim::PLAY; + if ("playlocal" == action) activate = LLPreviewAnim::AUDITION; + + LLPreviewAnim* preview = LLFloaterReg::showTypedInstance("preview_anim", LLSD(mUUID)); + if (preview) { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - LLPreviewAnim* preview = new LLPreviewAnim("preview anim", - rect, - getPrefix() + item->getName(), - mUUID, - activate); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); + preview->activate(activate); } } } @@ -3215,42 +3090,31 @@ void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* mo void LLAnimationBridge::openItem() { - // See if we can bring an existing preview to the front - if( !LLPreview::show( mUUID ) ) + LLViewerInventoryItem* item = getItem(); + + if (item) { - // There isn't one, so make a new preview - LLViewerInventoryItem* item = getItem(); - if( item ) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewAnimRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - LLPreviewAnim* preview = new LLPreviewAnim("preview anim", - rect, - getPrefix() + item->getName(), - mUUID, - 0); - preview->setFocus(TRUE); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } +/* + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); + } +*/ } // +=================================================+ // | LLObjectBridge | // +=================================================+ -// static -std::string LLObjectBridge::sPrefix("Object: "); - // static LLUUID LLObjectBridge::sContextMenuItemID; BOOL LLObjectBridge::isItemRemovable() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if(!avatar) return FALSE; if(avatar->isWearingAttachment(mUUID)) return FALSE; return LLInvFVBridge::isItemRemovable(); @@ -3261,8 +3125,6 @@ LLUIImagePtr LLObjectBridge::getIcon() const return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject ); } -void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment); - // virtual void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) { @@ -3318,15 +3180,21 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model void LLObjectBridge::openItem() { - /* Disabled -- this preview isn't useful. JC */ - // CP: actually, this code is required - made changes to match LLAnimationBridge::openItem() idiom - // The properties preview is useful, converting to show object properties. - DaveP - LLShowProps::showProperties(mUUID); + LLViewerInventoryItem* item = getItem(); + + if (item) + { + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); + } + + /* + LLFloaterProperties::show(mUUID); + */ } LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if( avatar && avatar->isWearingAttachment( mUUID ) ) { return LLFontGL::BOLD; @@ -3339,7 +3207,7 @@ LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const std::string LLObjectBridge::getLabelSuffix() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if( avatar && avatar->isWearingAttachment( mUUID ) ) { std::string attachment_point_name = avatar->getAttachedPointName(mUUID); @@ -3413,7 +3281,6 @@ static LLNotificationFunctorRegistration confirm_replace_attachment_rez_reg("Rep void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate std::vector items; std::vector disabled_items; if(isInTrash()) @@ -3437,7 +3304,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem* item = getItem(); if(item) { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); if( !avatarp ) { return; @@ -3460,35 +3327,36 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE); LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE); LLVOAvatar *avatarp = gAgent.getAvatarObject(); - if (attach_menu && (attach_menu->getChildCount() == 0) && - attach_hud_menu && (attach_hud_menu->getChildCount() == 0) && - avatarp) + if (attach_menu + && (attach_menu->getChildCount() == 0) + && attach_hud_menu + && (attach_hud_menu->getChildCount() == 0) + && avatarp) { for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; - LLMenuItemCallGL *new_item; - if (attachment->getIsHUDAttachment()) + LLMenuItemCallGL::Params p; + std::string submenu_name = attachment->getName(); + if (LLTrans::getString(submenu_name) != "") { - attach_hud_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), - NULL, //&LLObjectBridge::attachToAvatar, - NULL, &attach_label, (void*)attachment)); + p.name = (" ")+LLTrans::getString(submenu_name)+" "; } else { - attach_menu->append(new_item = new LLMenuItemCallGL(attachment->getName(), - NULL, //&LLObjectBridge::attachToAvatar, - NULL, &attach_label, (void*)attachment)); - } - - LLSimpleListener* callback = mInventoryPanel->getListenerByName("Inventory.AttachObject"); - - if (callback) - { - new_item->addListener(callback, "on_click", LLSD(attachment->getName())); + p.name = submenu_name; } + LLSD cbparams; + cbparams["index"] = curiter->first; + cbparams["label"] = attachment->getName(); + p.on_click.function_name = "Inventory.AttachObject"; + p.on_click.parameter = LLSD(attachment->getName()); + p.on_enable.function_name = "Attachment.Label"; + p.on_enable.parameter = cbparams; + LLView* parent = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu; + LLUICtrlFactory::create(p, parent); } } } @@ -3499,10 +3367,12 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) BOOL LLObjectBridge::renameItem(const std::string& new_name) { - if(!isItemRenameable()) return FALSE; - LLPreview::rename(mUUID, getPrefix() + new_name); - LLInventoryModel* model = mInventoryPanel->getModel(); - if(!model) return FALSE; + if(!isItemRenameable()) + return FALSE; + LLPreview::dirty(mUUID); + LLInventoryModel* model = getInventoryModel(); + if(!model) + return FALSE; LLViewerInventoryItem* item = getItem(); if(item && (item->getName() != new_name)) { @@ -3513,7 +3383,7 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) model->updateItem(new_item); model->notifyObservers(); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if( avatar ) { LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); @@ -3535,8 +3405,6 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name) // | LLLSLTextBridge | // +=================================================+ -std::string LLLSLTextBridge::sPrefix("Script: "); - LLUIImagePtr LLLSLTextBridge::getIcon() const { return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE); @@ -3544,27 +3412,19 @@ LLUIImagePtr LLLSLTextBridge::getIcon() const void LLLSLTextBridge::openItem() { - // See if we can bring an exiting preview to the front - if(!LLPreview::show(mUUID)) + LLViewerInventoryItem* item = getItem(); + + if (item) { - LLViewerInventoryItem* item = getItem(); - if (item) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewScriptRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - - LLPreviewLSL* preview = new LLPreviewLSL("preview lsl text", - rect, - getPrefix() + item->getName(), - mUUID); - preview->setFocus(TRUE); - // keep onscreen - gFloaterView->adjustToFitScreen(preview, FALSE); - } + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); } + /* + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); + } + */ } // +=================================================+ @@ -3579,7 +3439,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item ) lldebugs << "wear_inventory_item_on_avatar( " << item->getName() << " )" << llendl; - gWearableList.getAsset(item->getAssetUUID(), + LLWearableList::instance().getAsset(item->getAssetUUID(), item->getName(), item->getType(), LLWearableBridge::onWearOnAvatarArrived, @@ -3587,6 +3447,22 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item ) } } +void wear_add_inventory_item_on_avatar( LLInventoryItem* item ) +{ + if(item) + { + lldebugs << "wear_add_inventory_item_on_avatar( " << item->getName() + << " )" << llendl; + + LLWearableList::instance().getAsset(item->getAssetUUID(), + item->getName(), + item->getType(), + LLWearableBridge::onWearAddOnAvatarArrived, + new LLUUID(item->getUUID())); + } +} + + struct LLFoundData { LLFoundData(const LLUUID& item_id, @@ -3900,30 +3776,18 @@ void wear_inventory_category_on_avatar( LLInventoryCategory* category, BOOL appe lldebugs << "wear_inventory_category_on_avatar( " << category->getName() << " )" << llendl; - LLWearInfo* userdata = new LLWearInfo; - userdata->mAppend = append; - userdata->mCategoryID = category->getUUID(); - if( gFloaterCustomize ) { - gFloaterCustomize->askToSaveIfDirty( - wear_inventory_category_on_avatar_step2, - userdata); + gFloaterCustomize->askToSaveIfDirty(boost::bind(wear_inventory_category_on_avatar_step2, _1, category->getUUID(), append)); } else { - wear_inventory_category_on_avatar_step2( - TRUE, - userdata ); + wear_inventory_category_on_avatar_step2(TRUE, category->getUUID(), append ); } } - -void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) +void wear_inventory_category_on_avatar_step2( BOOL proceed, LLUUID category, BOOL append ) { - LLWearInfo* wear_info = (LLWearInfo*)userdata; - if (!wear_info) return; - // Find all the wearables that are in the category's subtree. lldebugs << "wear_inventory_category_on_avatar_step2()" << llendl; if(proceed) @@ -3931,7 +3795,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; LLFindWearables is_wearable; - gInventory.collectDescendentsIf(wear_info->mCategoryID, + gInventory.collectDescendentsIf(category, cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, @@ -3942,7 +3806,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) LLInventoryModel::cat_array_t obj_cat_array; LLInventoryModel::item_array_t obj_item_array; LLIsType is_object( LLAssetType::AT_OBJECT ); - gInventory.collectDescendentsIf(wear_info->mCategoryID, + gInventory.collectDescendentsIf(category, obj_cat_array, obj_item_array, LLInventoryModel::EXCLUDE_TRASH, @@ -3953,7 +3817,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) LLInventoryModel::cat_array_t gest_cat_array; LLInventoryModel::item_array_t gest_item_array; LLIsType is_gesture( LLAssetType::AT_GESTURE ); - gInventory.collectDescendentsIf(wear_info->mCategoryID, + gInventory.collectDescendentsIf(category, gest_cat_array, gest_item_array, LLInventoryModel::EXCLUDE_TRASH, @@ -3963,7 +3827,6 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) if( !wearable_count && !obj_count && !gest_count) { LLNotifications::instance().add("CouldNotPutOnOutfit"); - delete wear_info; return; } @@ -3982,7 +3845,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) // Update the inventory item labels to reflect the fact // they are active. - LLViewerInventoryCategory* catp = gInventory.getCategory(wear_info->mCategoryID); + LLViewerInventoryCategory* catp = gInventory.getCategory(category); if (catp) { gInventory.updateCategory(catp); @@ -4010,10 +3873,10 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) } for(i = 0; i < wearable_count; ++i) { - gAddToOutfit = wear_info->mAppend; + gAddToOutfit = append; found = found_container.get(i); - gWearableList.getAsset(found->mAssetID, + LLWearableList::instance().getAsset(found->mAssetID, found->mName, found->mAssetType, wear_inventory_category_on_avatar_loop, @@ -4023,10 +3886,10 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) //If not appending and the folder doesn't contain only gestures, take off all attachments. - if (!wear_info->mAppend + if (!append && !(wearable_count == 0 && obj_count == 0 && gest_count > 0) ) { - LLAgent::userRemoveAllAttachments(NULL); + LLAgentWearables::userRemoveAllAttachments(NULL); } if( obj_count > 0 ) @@ -4064,7 +3927,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) msg->nextBlockFast(_PREHASH_HeaderData); msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id ); msg->addU8Fast(_PREHASH_TotalObjects, obj_count ); - msg->addBOOLFast(_PREHASH_FirstDetachAll, !wear_info->mAppend ); + msg->addBOOLFast(_PREHASH_FirstDetachAll, !append ); } LLInventoryItem* item = obj_item_array.get(i); @@ -4085,8 +3948,6 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata ) } } } - delete wear_info; - wear_info = NULL; } void wear_inventory_category_on_avatar_loop(LLWearable* wearable, void* data) @@ -4135,18 +3996,6 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B item = (LLViewerInventoryItem*)gInventory.getItem(data->mItemID); if( item && (item->getAssetUUID() == wearable->getID()) ) { - //RN: after discussing with Brashears, I disabled this code - //Metadata should reside in the item, not the asset - //And this code does not handle failed asset uploads properly -// if(!wearable->isMatchedToInventoryItem(item )) -// { -// wearable = gWearableList.createWearableMatchedToInventoryItem( wearable, item ); -// // Now that we have an asset that matches the -// // item, update the item to point to the new -// // asset. -// item->setAssetUUID(wearable->getID()); -// item->updateAssetOnServer(); -// } items.put(item); wearables.put(wearable); } @@ -4157,7 +4006,7 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B if(wearables.count() > 0) { - gAgent.setWearableOutfit(items, wearables, !append); + gAgentWearables.setWearableOutfit(items, wearables, !append); gInventory.notifyObservers(); } @@ -4173,36 +4022,29 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category ) << " )" << llendl; - LLUUID* uuid = new LLUUID(category->getUUID()); - if( gFloaterCustomize ) { gFloaterCustomize->askToSaveIfDirty( - remove_inventory_category_from_avatar_step2, - uuid); + boost::bind(remove_inventory_category_from_avatar_step2, _1, category->getUUID())); } else { - remove_inventory_category_from_avatar_step2( - TRUE, - uuid ); + remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); } } -void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) +void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id) { // Find all the wearables that are in the category's subtree. - LLUUID* category_id = (LLUUID *)userdata; - lldebugs << "remove_inventory_category_from_avatar_step2()" << llendl; if(proceed) { LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; LLFindWearables is_wearable; - gInventory.collectDescendentsIf(*category_id, + gInventory.collectDescendentsIf(category_id, cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, @@ -4213,7 +4055,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) LLInventoryModel::cat_array_t obj_cat_array; LLInventoryModel::item_array_t obj_item_array; LLIsType is_object( LLAssetType::AT_OBJECT ); - gInventory.collectDescendentsIf(*category_id, + gInventory.collectDescendentsIf(category_id, obj_cat_array, obj_item_array, LLInventoryModel::EXCLUDE_TRASH, @@ -4224,7 +4066,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) LLInventoryModel::cat_array_t gest_cat_array; LLInventoryModel::item_array_t gest_item_array; LLIsType is_gesture( LLAssetType::AT_GESTURE ); - gInventory.collectDescendentsIf(*category_id, + gInventory.collectDescendentsIf(category_id, gest_cat_array, gest_item_array, LLInventoryModel::EXCLUDE_TRASH, @@ -4235,9 +4077,9 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) { for(i = 0; i < wearable_count; ++i) { - if( gAgent.isWearingItem (item_array.get(i)->getUUID()) ) + if( gAgentWearables.isWearingItem (item_array.get(i)->getUUID()) ) { - gWearableList.getAsset(item_array.get(i)->getAssetUUID(), + LLWearableList::instance().getAsset(item_array.get(i)->getAssetUUID(), item_array.get(i)->getName(), item_array.get(i)->getType(), LLWearableBridge::onRemoveFromAvatarArrived, @@ -4286,28 +4128,26 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata) } } } - delete category_id; - category_id = NULL; } BOOL LLWearableBridge::renameItem(const std::string& new_name) { - if( gAgent.isWearingItem( mUUID ) ) + if( gAgentWearables.isWearingItem( mUUID ) ) { - gAgent.setWearableName( mUUID, new_name ); + gAgentWearables.setWearableName( mUUID, new_name ); } return LLItemBridge::renameItem(new_name); } BOOL LLWearableBridge::isItemRemovable() { - if(gAgent.isWearingItem(mUUID)) return FALSE; + if(gAgentWearables.isWearingItem(mUUID)) return FALSE; return LLInvFVBridge::isItemRemovable(); } LLFontGL::StyleFlags LLWearableBridge::getLabelStyle() const { - if( gAgent.isWearingItem( mUUID ) ) + if( gAgentWearables.isWearingItem( mUUID ) ) { // llinfos << "BOLD" << llendl; return LLFontGL::BOLD; @@ -4320,7 +4160,7 @@ LLFontGL::StyleFlags LLWearableBridge::getLabelStyle() const std::string LLWearableBridge::getLabelSuffix() const { - if( gAgent.isWearingItem( mUUID ) ) + if( gAgentWearables.isWearingItem( mUUID ) ) { return LLItemBridge::getLabelSuffix() + " (worn)"; } @@ -4342,6 +4182,10 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod { wearOnAvatar(); } + else if ("wear_add" == action) + { + wearAddOnAvatar(); + } else if ("edit" == action) { editOnAvatar(); @@ -4349,12 +4193,12 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod } else if ("take_off" == action) { - if(gAgent.isWearingItem(mUUID)) + if(gAgentWearables.isWearingItem(mUUID)) { LLViewerInventoryItem* item = getItem(); if (item) { - gWearableList.getAsset(item->getAssetUUID(), + LLWearableList::instance().getAsset(item->getAssetUUID(), item->getName(), item->getType(), LLWearableBridge::onRemoveFromAvatarArrived, @@ -4367,13 +4211,20 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod void LLWearableBridge::openItem() { + LLViewerInventoryItem* item = getItem(); + + if (item) + { + LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); + } + /* if( isInTrash() ) { LLNotifications::instance().add("CannotWearTrash"); } else if(isAgentInventory()) { - if( !gAgent.isWearingItem( mUUID ) ) + if( !gAgentWearables.isWearingItem( mUUID ) ) { wearOnAvatar(); } @@ -4401,11 +4252,11 @@ void LLWearableBridge::openItem() LLNotifications::instance().add("CannotWearInfoNotComplete"); } } + */ } void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - // *TODO: Translate lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; std::vector items; std::vector disabled_items; @@ -4442,29 +4293,17 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Wearable Separator")); items.push_back(std::string("Wearable Wear")); + items.push_back(std::string("Wearable Add")); items.push_back(std::string("Wearable Edit")); if ((flags & FIRST_SELECTED_ITEM) == 0) { disabled_items.push_back(std::string("Wearable Edit")); } - //menu.appendSeparator(); - //menu.append(new LLMenuItemCallGL("Wear", - // LLWearableBridge::onWearOnAvatar, - // LLWearableBridge::canWearOnAvatar, - // (void*)this)); - //menu.append(new LLMenuItemCallGL("Edit", - // LLWearableBridge::onEditOnAvatar, - // LLWearableBridge::canEditOnAvatar, - // (void*)this)); if( item && (item->getType() == LLAssetType::AT_CLOTHING) ) { items.push_back(std::string("Take Off")); - /*menu.append(new LLMenuItemCallGL("Take Off", - LLWearableBridge::onRemoveFromAvatar, - LLWearableBridge::canRemoveFromAvatar, - (void*)this));*/ } } hideContextEntries(menu, items, disabled_items); @@ -4481,7 +4320,7 @@ BOOL LLWearableBridge::canWearOnAvatar(void* user_data) LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); if(!item || !item->isComplete()) return FALSE; } - return (!gAgent.isWearingItem(self->mUUID)); + return (!gAgentWearables.isWearingItem(self->mUUID)); } // Called from menus @@ -4497,7 +4336,7 @@ void LLWearableBridge::wearOnAvatar() { // Don't wear anything until initial wearables are loaded, can // destroy clothing items. - if (!gAgent.areWearablesLoaded()) + if (!gAgentWearables.areWearablesLoaded()) { LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); return; @@ -4524,6 +4363,37 @@ void LLWearableBridge::wearOnAvatar() } } +void LLWearableBridge::wearAddOnAvatar() +{ + // Don't wear anything until initial wearables are loaded, can + // destroy clothing items. + if (!gAgentWearables.areWearablesLoaded()) + { + LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); + return; + } + + LLViewerInventoryItem* item = getItem(); + if(item) + { + if(!isAgentInventory()) + { + LLPointer cb = new WearOnAvatarCallback(); + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + LLUUID::null, + std::string(), + cb); + } + else + { + wear_add_inventory_item_on_avatar(item); + } + } +} + // static void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) { @@ -4536,22 +4406,33 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda { if(item->getAssetUUID() == wearable->getID()) { - //RN: after discussing with Brashears, I disabled this code - //Metadata should reside in the item, not the asset - //And this code does not handle failed asset uploads properly + gAgentWearables.setWearable(item, wearable); + gInventory.notifyObservers(); + //self->getFolderItem()->refreshFromRoot(); + } + else + { + llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; + } + } + } + delete item_id; +} -// if(!wearable->isMatchedToInventoryItem(item)) -// { -// LLWearable* new_wearable = gWearableList.createWearableMatchedToInventoryItem( wearable, item ); -// -// // Now that we have an asset that matches the -// // item, update the item to point to the new -// // asset. -// item->setAssetUUID(new_wearable->getID()); -// item->updateAssetOnServer(); -// wearable = new_wearable; -// } - gAgent.setWearable(item, wearable); +// static +void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) +{ + LLUUID* item_id = (LLUUID*) userdata; + if(wearable) + { + LLViewerInventoryItem* item = NULL; + item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); + if(item) + { + if(item->getAssetUUID() == wearable->getID()) + { + bool do_append = true; + gAgentWearables.setWearable(item, wearable, do_append); gInventory.notifyObservers(); //self->getFolderItem()->refreshFromRoot(); } @@ -4570,7 +4451,7 @@ BOOL LLWearableBridge::canEditOnAvatar(void* user_data) LLWearableBridge* self = (LLWearableBridge*)user_data; if(!self) return FALSE; - return (gAgent.isWearingItem(self->mUUID)); + return (gAgentWearables.isWearingItem(self->mUUID)); } // static @@ -4585,11 +4466,12 @@ void LLWearableBridge::onEditOnAvatar(void* user_data) void LLWearableBridge::editOnAvatar() { - LLWearable* wearable = gAgent.getWearableFromWearableItem(mUUID); + LLWearable* wearable = gAgentWearables.getWearableFromWearableItem(mUUID); if( wearable ) { // Set the tab to the right wearable. - LLFloaterCustomize::setCurrentWearableType( wearable->getType() ); + if (gFloaterCustomize) + gFloaterCustomize->setCurrentWearableType( wearable->getType() ); if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() ) { @@ -4605,7 +4487,7 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) LLWearableBridge* self = (LLWearableBridge*)user_data; if( self && (LLAssetType::AT_BODYPART != self->mAssetType) ) { - return gAgent.isWearingItem( self->mUUID ); + return gAgentWearables.isWearingItem( self->mUUID ); } return FALSE; } @@ -4615,12 +4497,12 @@ void LLWearableBridge::onRemoveFromAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; if(!self) return; - if(gAgent.isWearingItem(self->mUUID)) + if(gAgentWearables.isWearingItem(self->mUUID)) { LLViewerInventoryItem* item = self->getItem(); if (item) { - gWearableList.getAsset(item->getAssetUUID(), + LLWearableList::instance().getAsset(item->getAssetUUID(), item->getName(), item->getType(), onRemoveFromAvatarArrived, @@ -4636,16 +4518,304 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, LLUUID* item_id = (LLUUID*) userdata; if(wearable) { - if( gAgent.isWearingItem( *item_id ) ) + if( gAgentWearables.isWearingItem( *item_id ) ) { EWearableType type = wearable->getType(); if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&& //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) { - gAgent.removeWearable( type ); + // MULTI_WEARABLE: FIXME HACK - always remove all + bool do_remove_all = false; + gAgentWearables.removeWearable( type, do_remove_all, 0 ); } } } delete item_id; } + + +LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type, + const LLUUID& uuid,LLInventoryModel* model) +{ + LLInvFVBridgeAction* action = NULL; + switch(asset_type) + { + case LLAssetType::AT_TEXTURE: + action = new LLTextureBridgeAction(uuid,model); + break; + + case LLAssetType::AT_SOUND: + action = new LLSoundBridgeAction(uuid,model); + break; + + case LLAssetType::AT_LANDMARK: + action = new LLLandmarkBridgeAction(uuid,model); + break; + + case LLAssetType::AT_CALLINGCARD: + action = new LLCallingCardBridgeAction(uuid,model); + break; + + case LLAssetType::AT_OBJECT: + action = new LLObjectBridgeAction(uuid,model); + break; + + case LLAssetType::AT_NOTECARD: + action = new LLNotecardBridgeAction(uuid,model); + break; + + case LLAssetType::AT_ANIMATION: + action = new LLAnimationBridgeAction(uuid,model); + break; + + case LLAssetType::AT_GESTURE: + action = new LLGestureBridgeAction(uuid,model); + break; + + case LLAssetType::AT_LSL_TEXT: + action = new LLLSLTextBridgeAction(uuid,model); + break; + + case LLAssetType::AT_CLOTHING: + case LLAssetType::AT_BODYPART: + action = new LLWearableBridgeAction(uuid,model); + + break; + + default: + break; + } + return action; +} + +//static +void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type, + const LLUUID& uuid,LLInventoryModel* model) +{ + LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); + if(action) + { + action->doIt(); + delete action; + } +} + +//static +void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model) +{ + LLAssetType::EType asset_type = model->getItem(uuid)->getType(); + LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); + if(action) + { + action->doIt(); + delete action; + } +} + +LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const +{ + if(mModel) + return (LLViewerInventoryItem*)mModel->getItem(mUUID); + return NULL; +} + +//virtual +void LLTextureBridgeAction::doIt() +{ + if (getItem()) + { + LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); + } + + LLInvFVBridgeAction::doIt(); +} + +//virtual +void LLSoundBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if(item) + { + LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES); + } + + LLInvFVBridgeAction::doIt(); +} + + +//virtual +void LLLandmarkBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if( item ) + { + // Opening (double-clicking) a landmark immediately teleports, + // but warns you the first time. + LLSD payload; + payload["asset_id"] = item->getAssetUUID(); + LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload); + } + + LLInvFVBridgeAction::doIt(); +} + + +//virtual +void LLCallingCardBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if(item && item->getCreatorUUID().notNull()) + { + LLFriendActions::showProfile(item->getCreatorUUID()); + } + + LLInvFVBridgeAction::doIt(); +} + +//virtual +void +LLNotecardBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); + } + + LLInvFVBridgeAction::doIt(); +} + +//virtual +void LLGestureBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); + preview->setFocus(TRUE); + } + + LLInvFVBridgeAction::doIt(); +} + +//virtual +void LLAnimationBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); + } + + LLInvFVBridgeAction::doIt(); +} + + +//virtual +void LLObjectBridgeAction::doIt() +{ + LLFloaterProperties::show(mUUID); + + LLInvFVBridgeAction::doIt(); +} + + +//virtual +void LLLSLTextBridgeAction::doIt() +{ + LLViewerInventoryItem* item = getItem(); + if (item) + { + LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); + } + + LLInvFVBridgeAction::doIt(); +} + + +BOOL LLWearableBridgeAction::isInTrash() const +{ + if(!mModel) return FALSE; + LLUUID trash_id = mModel->findCategoryUUIDForType(LLAssetType::AT_TRASH); + return mModel->isObjectDescendentOf(mUUID, trash_id); +} + +BOOL LLWearableBridgeAction::isAgentInventory() const +{ + if(!mModel) return FALSE; + if(gAgent.getInventoryRootID() == mUUID) return TRUE; + return mModel->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID()); +} + +void LLWearableBridgeAction::wearOnAvatar() +{ + // Don't wear anything until initial wearables are loaded, can + // destroy clothing items. + if (!gAgentWearables.areWearablesLoaded()) + { + LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); + return; + } + + LLViewerInventoryItem* item = getItem(); + if(item) + { + if(!isAgentInventory()) + { + LLPointer cb = new WearOnAvatarCallback(); + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + LLUUID::null, + std::string(), + cb); + } + else + { + wear_inventory_item_on_avatar(item); + } + } +} + +//virtual +void LLWearableBridgeAction::doIt() +{ + if( isInTrash() ) + { + LLNotifications::instance().add("CannotWearTrash"); + } + else if(isAgentInventory()) + { + if( !gAgentWearables.isWearingItem( mUUID ) ) + { + wearOnAvatar(); + } + } + else + { + // must be in the inventory library. copy it to our inventory + // and put it on right away. + LLViewerInventoryItem* item = getItem(); + if(item && item->isComplete()) + { + LLPointer cb = new WearOnAvatarCallback(); + copy_inventory_item( + gAgent.getID(), + item->getPermissions().getOwner(), + item->getUUID(), + LLUUID::null, + std::string(), + cb); + } + else if(item) + { + // *TODO: We should fetch the item details, and then do + // the operation above. + LLNotifications::instance().add("CannotWearInfoNotComplete"); + } + } + + LLInvFVBridgeAction::doIt(); +} diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 526b30f214..3958f7e9c2 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -30,10 +30,15 @@ * $/LicenseInfo$ */ +#ifndef LL_LLINVENTORYBRIDGE_H +#define LL_LLINVENTORYBRIDGE_H + #include "llfloaterproperties.h" #include "llwearable.h" #include "llviewercontrol.h" #include "llcallingcard.h" +#include "llinventorymodel.h" +#include "llinventoryview.h" enum EInventoryIcon { @@ -64,6 +69,8 @@ enum EInventoryIcon CLOTHING_UNDERSHIRT_ICON_NAME, CLOTHING_UNDERPANTS_ICON_NAME, CLOTHING_SKIRT_ICON_NAME, + CLOTHING_ALPHA_ICON_NAME, + CLOTHING_TATTOO_ICON_NAME, ANIMATION_ICON_NAME, GESTURE_ICON_NAME, @@ -93,31 +100,6 @@ struct LLAttachmentRezAction }; -//helper functions -class LLShowProps -{ -public: - - static void showProperties(const LLUUID& uuid) - { - if(!LLFloaterProperties::show(uuid, LLUUID::null)) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PropertiesRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - LLFloaterProperties* floater; - floater = new LLFloaterProperties("item properties", - rect, - "Inventory Item Properties", - uuid, - LLUUID::null); - // keep onscreen - gFloaterView->adjustToFitScreen(floater, FALSE); - } - } -}; - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryPanelObserver // @@ -158,7 +140,6 @@ public: virtual const LLUUID& getUUID() const { return mUUID; } - virtual const std::string& getPrefix() { return LLStringUtil::null; } virtual void restoreItem() {} virtual void restoreToWorld() {} @@ -201,9 +182,14 @@ public: protected: LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : - mInventoryPanel(inventory), mUUID(uuid), mInvType(LLInventoryType::IT_NONE) {} + mUUID(uuid), mInvType(LLInventoryType::IT_NONE) + { + mInventoryPanel = inventory->getHandle(); + } LLInventoryObject* getInventoryObject() const; + LLInventoryModel* getInventoryModel() const; + BOOL isInTrash() const; // return true if the item is in agent inventory. if false, it // must be lost or in the inventory library. @@ -218,9 +204,9 @@ protected: const LLUUID& new_parent, BOOL restamp); void removeBatchNoCheck(LLDynamicArray& batch); - + protected: - LLInventoryPanel* mInventoryPanel; + LLHandle mInventoryPanel; LLUUID mUUID; // item id LLInventoryType::EType mInvType; }; @@ -277,6 +263,7 @@ public: virtual void selectItem(); virtual void restoreItem(); + virtual LLAssetType::EType getPreferredType() const; virtual LLUIImagePtr getIcon() const; virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); @@ -351,15 +338,12 @@ class LLTextureBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type) : LLItemBridge(inventory, uuid), mInvType(type) {} - static std::string sPrefix; LLInventoryType::EType mInvType; }; @@ -367,8 +351,6 @@ class LLSoundBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual LLUIImagePtr getIcon() const; virtual void openItem(); virtual void previewItem(); @@ -378,15 +360,12 @@ public: protected: LLSoundBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : LLItemBridge(inventory, uuid) {} - static std::string sPrefix; }; class LLLandmarkBridge : public LLItemBridge { friend class LLInvFVBridge; public: - static const std::string& prefix() { return sPrefix; } - virtual const std::string& getPrefix() { return sPrefix; } virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual LLUIImagePtr getIcon() const; @@ -404,7 +383,6 @@ protected: } protected: - static std::string sPrefix; BOOL mVisited; }; @@ -425,8 +403,6 @@ class LLCallingCardBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual std::string getLabelSuffix() const; //virtual const std::string& getDisplayName() const; virtual LLUIImagePtr getIcon() const; @@ -445,7 +421,6 @@ protected: ~LLCallingCardBridge(); protected: - static std::string sPrefix; LLCallingCardObserver* mObserver; }; @@ -454,25 +429,18 @@ class LLNotecardBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: LLNotecardBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : LLItemBridge(inventory, uuid) {} - -protected: - static std::string sPrefix; }; class LLGestureBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual LLUIImagePtr getIcon() const; // Only suffix for gesture items, not task items, because only @@ -489,9 +457,6 @@ public: protected: LLGestureBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : LLItemBridge(inventory, uuid) {} - -protected: - static std::string sPrefix; }; @@ -499,7 +464,6 @@ class LLAnimationBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); @@ -509,9 +473,6 @@ public: protected: LLAnimationBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : LLItemBridge(inventory, uuid) {} - -protected: - static std::string sPrefix; }; @@ -519,8 +480,6 @@ class LLObjectBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual LLUIImagePtr getIcon() const; virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); virtual void openItem(); @@ -540,7 +499,6 @@ protected: } protected: - static std::string sPrefix; static LLUUID sContextMenuItemID; // Only valid while the context menu is open. LLInventoryType::EType mInvType; U32 mAttachPt; @@ -552,17 +510,12 @@ class LLLSLTextBridge : public LLItemBridge { friend class LLInvFVBridge; public: - virtual const std::string& getPrefix() { return sPrefix; } - virtual LLUIImagePtr getIcon() const; virtual void openItem(); protected: LLLSLTextBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) : LLItemBridge(inventory, uuid) {} - -protected: - static std::string sPrefix; }; @@ -584,6 +537,9 @@ public: static void onWearOnAvatarArrived( LLWearable* wearable, void* userdata ); void wearOnAvatar(); + static void onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ); + void wearAddOnAvatar(); + static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu static void onEditOnAvatar( void* userdata ); void editOnAvatar(); @@ -605,3 +561,183 @@ protected: LLInventoryType::EType mInvType; EWearableType mWearableType; }; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInvFVBridgeAction (& it's derived classes) +// +// This is an implementation class to be able to +// perform action to view inventory items. +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLInvFVBridgeAction +{ +public: + // This method is a convenience function which creates the correct + // type of bridge action based on some basic information + static LLInvFVBridgeAction* createAction(LLAssetType::EType asset_type, + const LLUUID& uuid,LLInventoryModel* model); + + static void doAction(LLAssetType::EType asset_type, + const LLUUID& uuid, LLInventoryModel* model); + static void doAction(const LLUUID& uuid, LLInventoryModel* model); + + virtual void doIt() { }; + virtual ~LLInvFVBridgeAction(){}//need this because of warning on OSX +protected: + LLInvFVBridgeAction(const LLUUID& id,LLInventoryModel* model):mUUID(id),mModel(model){} + + LLViewerInventoryItem* getItem() const; +protected: + const LLUUID& mUUID; // item id + LLInventoryModel* mModel; + +}; + + + +class LLTextureBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLTextureBridgeAction(){} +protected: + LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLSoundBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLSoundBridgeAction(){} +protected: + LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLLandmarkBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLLandmarkBridgeAction(){} +protected: + LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLCallingCardBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLCallingCardBridgeAction(){} +protected: + LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLNotecardBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLNotecardBridgeAction(){} +protected: + LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLGestureBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLGestureBridgeAction(){} +protected: + LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLAnimationBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLAnimationBridgeAction(){} +protected: + LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLObjectBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLObjectBridgeAction(){} +protected: + LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLLSLTextBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt() ; + virtual ~LLLSLTextBridgeAction(){} +protected: + LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + +}; + + +class LLWearableBridgeAction: public LLInvFVBridgeAction +{ + friend class LLInvFVBridgeAction; +public: + virtual void doIt(); + virtual ~LLWearableBridgeAction(){} +protected: + LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){} + + + BOOL isInTrash() const; + // return true if the item is in agent inventory. if false, it + // must be lost or in the inventory library. + BOOL isAgentInventory() const; + + void wearOnAvatar(); + +}; + +void wear_inventory_item_on_avatar(LLInventoryItem* item); +void wear_outfit_by_name(const std::string& name); +void wear_inventory_category(LLInventoryCategory* category, bool copy, bool append); + +void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment); + +// Move items from an in-world object's "Contents" folder to a specified +// folder in agent inventory. +BOOL move_inv_category_world_to_agent(const LLUUID& object_id, + const LLUUID& category_id, + BOOL drop, + void (*callback)(S32, void*) = NULL, + void* user_data = NULL); + + + +void teleport_via_landmark(const LLUUID& asset_id); + +#endif // LL_LLINVENTORYBRIDGE_H diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index f98a3f9ee5..9177d51d5c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -42,8 +42,10 @@ #include "message.h" #include "llagent.h" +#include "llagentwearables.h" #include "llfloater.h" #include "llfocusmgr.h" +#include "llinventorybridge.h" #include "llinventoryview.h" #include "llviewerinventory.h" #include "llviewermessage.h" @@ -53,11 +55,11 @@ #include "lldbstrings.h" #include "llviewerstats.h" #include "llmutelist.h" -#include "llnotify.h" +#include "llnotifications.h" #include "llcallbacklist.h" #include "llpreview.h" #include "llviewercontrol.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llsdutil.h" #include @@ -87,33 +89,6 @@ static std::deque sFetchQueue; const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f; const S32 MAX_FETCH_RETRIES = 10; const char CACHE_FORMAT_STRING[] = "%s.inv"; -const char* NEW_CATEGORY_NAME = "New Folder"; -const char* NEW_CATEGORY_NAMES[LLAssetType::AT_COUNT] = -{ - "Textures", // AT_TEXTURE - "Sounds", // AT_SOUND - "Calling Cards", // AT_CALLINGCARD - "Landmarks", // AT_LANDMARK - "Scripts", // AT_SCRIPT (deprecated?) - "Clothing", // AT_CLOTHING - "Objects", // AT_OBJECT - "Notecards", // AT_NOTECARD - "New Folder", // AT_CATEGORY - "Inventory", // AT_ROOT_CATEGORY - "Scripts", // AT_LSL_TEXT - "Scripts", // AT_LSL_BYTECODE - "Uncompressed Images", // AT_TEXTURE_TGA - "Body Parts", // AT_BODYPART - "Trash", // AT_TRASH - "Photo Album", // AT_SNAPSHOT_CATEGORY - "Lost And Found", // AT_LOST_AND_FOUND - "Uncompressed Sounds", // AT_SOUND_WAV - "Uncompressed Images", // AT_IMAGE_TGA - "Uncompressed Images", // AT_IMAGE_JPEG - "Animations", // AT_ANIMATION - "Gestures", // AT_GESTURE - "New Folder" // AT_SIMSTATE -}; struct InventoryIDPtrLess { @@ -388,14 +363,9 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, { name.assign(pname); } - else if((preferred_type >= LLAssetType::AT_TEXTURE) && - (preferred_type < LLAssetType::AT_SIMSTATE)) - { - name.assign(NEW_CATEGORY_NAMES[preferred_type]); - } else { - name.assign(NEW_CATEGORY_NAME); + name.assign(LLAssetType::lookupCategoryName(preferred_type)); } // Add the category to the internal representation @@ -545,7 +515,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) LLViewerInventoryItem* old_item = getItem(item->getUUID()); if(old_item) { - // We already have an old item, modify it's values + // We already have an old item, modify its values LLUUID old_parent_id = old_item->getParentUUID(); LLUUID new_parent_id = item->getParentUUID(); if(old_parent_id != new_parent_id) @@ -1042,7 +1012,7 @@ void LLInventoryModel::mock(const LLUUID& root_id) root_id, LLUUID::null, LLAssetType::AT_CATEGORY, - NEW_CATEGORY_NAMES[LLAssetType::AT_ROOT_CATEGORY], + LLAssetType::lookupCategoryName(LLAssetType::AT_ROOT_CATEGORY), gAgent.getID()); addCategory(cat); gInventory.buildParentChildMap(); @@ -3158,6 +3128,63 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) } } +//---------------------------------------------------------------------------- + +// Trash: LLAssetType::AT_TRASH, "ConfirmEmptyTrash" +// Lost&Found: LLAssetType::AT_LOST_AND_FOUND, "ConfirmEmptyLostAndFound" + +bool LLInventoryModel::callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLAssetType::EType folder_type) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + if (option == 0) // YES + { + LLUUID folder_id = findCategoryUUIDForType(folder_type); + purgeDescendentsOf(folder_id); + notifyObservers(); + } + return false; +} + +void LLInventoryModel::emptyFolderType(const std::string notification, LLAssetType::EType folder_type) +{ + if (!notification.empty()) + { + LLNotifications::instance().add(notification, LLSD(), LLSD(), + boost::bind(&LLInventoryModel::callbackEmptyFolderType, this, _1, _2, folder_type)); + } + else + { + LLUUID folder_id = findCategoryUUIDForType(folder_type); + purgeDescendentsOf(folder_id); + notifyObservers(); + } +} + +//---------------------------------------------------------------------------- + +void LLInventoryModel::removeItem(const LLUUID& item_id) +{ + LLViewerInventoryItem* item = getItem(item_id); + const LLUUID& new_parent = findCategoryUUIDForType(LLAssetType::AT_TRASH); + if (item && item->getParentUUID() != new_parent) + { + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); + update.push_back(old_folder); + LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1); + update.push_back(new_folder); + accountForUpdate(update); + + LLPointer new_item = new LLViewerInventoryItem(item); + new_item->setParent(new_parent); + new_item->updateParentOnServer(TRUE); + updateItem(new_item); + notifyObservers(); + } +} + +//---------------------------------------------------------------------------- + // *NOTE: DEBUG functionality void LLInventoryModel::dumpInventory() { @@ -3205,7 +3232,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite return false; bool allowed = false; - LLVOAvatar* my_avatar = NULL; + LLVOAvatarSelf* my_avatar = NULL; switch(item->getType()) { @@ -3223,7 +3250,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(!gAgent.isWearingItem(item->getUUID())) + if(!gAgentWearables.isWearingItem(item->getUUID())) { allowed = true; } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index d73fef7207..2193552f4a 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -365,7 +365,15 @@ public: // returns true iff category version is known and theoretical // descendents == actual descendents. bool isCategoryComplete(const LLUUID& cat_id) const; + + // callbacks + // Trigger a notification and empty the folder type (AT_TRASH or AT_LOST_AND_FOUND) if confirmed + void emptyFolderType(const std::string notification, LLAssetType::EType folder_type); + bool callbackEmptyFolderType(const LLSD& notification, const LLSD& response, LLAssetType::EType folder_type); + // Utility Functions + void removeItem(const LLUUID& item_id); + // start and stop background breadth-first fetching of inventory contents // this gets triggered when performing a filter-search static void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); // start fetch process diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 326c511fcf..8e6889a379 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -49,8 +49,12 @@ #include "llglheaders.h" -static LLRegisterWidget r1("joystick_slide"); -static LLRegisterWidget r2("joystick_turn"); +static LLDefaultWidgetRegistry::Register r1("joystick_slide"); +static LLDefaultWidgetRegistry::Register r2("joystick_turn"); +static LLDefaultWidgetRegistry::Register r3("joystick_rotate"); +static LLDefaultWidgetRegistry::Register r4("joystick_zoom"); +static LLDefaultWidgetRegistry::Register r5("joystick_track"); + const F32 NUDGE_TIME = 0.25f; // in seconds @@ -59,15 +63,18 @@ const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed // // Public Methods // -LLJoystick::LLJoystick( - const std::string& name, - LLRect rect, - const std::string &default_image, - const std::string &selected_image, - EJoystickQuadrant initial_quadrant ) - : - LLButton(name, rect, default_image, selected_image, LLStringUtil::null, NULL, NULL), - mInitialQuadrant(initial_quadrant), +void QuadrantNames::declareValues() +{ + declare("origin", JQ_ORIGIN); + declare("up", JQ_UP); + declare("down", JQ_DOWN); + declare("left", JQ_LEFT); + declare("right", JQ_RIGHT); +} + + +LLJoystick::LLJoystick(const LLJoystick::Params& p) +: LLButton(p), mInitialOffset(0, 0), mLastMouse(0, 0), mFirstMouse(0, 0), @@ -76,10 +83,10 @@ LLJoystick::LLJoystick( mHorizSlopNear(0), mHorizSlopFar(0), mHeldDown(FALSE), - mHeldDownTimer() + mHeldDownTimer(), + mInitialQuadrant(p.quadrant) { - setHeldDownCallback(&LLJoystick::onHeldDown); - setCallbackUserData(this); + setHeldDownCallback(&LLJoystick::onBtnHeldDown, this); } @@ -178,16 +185,14 @@ F32 LLJoystick::getElapsedHeldDownTime() } // static -void LLJoystick::onHeldDown(void *userdata) +void LLJoystick::onBtnHeldDown(void *userdata) { LLJoystick *self = (LLJoystick *)userdata; - - // somebody removed this function without checking the - // build. Removed 2007-03-26. - //llassert( gViewerWindow->hasMouseCapture( self ) ); - - self->mHeldDown = TRUE; - self->onHeldDown(); + if (self) + { + self->mHeldDown = TRUE; + self->onHeldDown(); + } } EJoystickQuadrant LLJoystick::selectQuadrant(LLXMLNodePtr node) @@ -246,23 +251,6 @@ EJoystickQuadrant LLJoystick::quadrantFromName(const std::string& sQuadrant) } -LLXMLNodePtr LLJoystick::getXML(bool save_children) const -{ - LLXMLNodePtr node = LLUICtrl::getXML(); - - node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign())); - node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); - - addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),std::string("image_unselected")); - addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),std::string("image_selected")); - - node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage()); - - return node; -} - - - //------------------------------------------------------------------------------- // LLJoystickAgentTurn //------------------------------------------------------------------------------- @@ -327,46 +315,6 @@ void LLJoystickAgentTurn::onHeldDown() } } -LLView* LLJoystickAgentTurn::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("button"); - node->getAttributeString("name", name); - - std::string image_unselected; - if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); - - std::string image_selected; - if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); - - EJoystickQuadrant quad = JQ_ORIGIN; - if (node->hasAttribute("quadrant")) quad = selectQuadrant(node); - - LLJoystickAgentTurn *button = new LLJoystickAgentTurn(name, - LLRect(), - image_unselected, - image_selected, - quad); - - if (node->hasAttribute("halign")) - { - LLFontGL::HAlign halign = selectFontHAlign(node); - button->setHAlign(halign); - } - - if (node->hasAttribute("scale_image")) - { - BOOL needsScale = FALSE; - node->getAttributeBOOL("scale_image",needsScale); - button->setScaleImage( needsScale ); - } - - button->initFromXML(node, parent); - - return button; -} - - - //------------------------------------------------------------------------------- // LLJoystickAgentSlide //------------------------------------------------------------------------------- @@ -435,54 +383,12 @@ void LLJoystickAgentSlide::onHeldDown() } -// static -LLView* LLJoystickAgentSlide::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("button"); - node->getAttributeString("name", name); - - std::string image_unselected; - if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); - - std::string image_selected; - if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); - - - EJoystickQuadrant quad = JQ_ORIGIN; - if (node->hasAttribute("quadrant")) quad = selectQuadrant(node); - - LLJoystickAgentSlide *button = new LLJoystickAgentSlide(name, - LLRect(), - image_unselected, - image_selected, - quad); - - if (node->hasAttribute("halign")) - { - LLFontGL::HAlign halign = selectFontHAlign(node); - button->setHAlign(halign); - } - - if (node->hasAttribute("scale_image")) - { - BOOL needsScale = FALSE; - node->getAttributeBOOL("scale_image",needsScale); - button->setScaleImage( needsScale ); - } - - button->initFromXML(node, parent); - - return button; -} - - //------------------------------------------------------------------------------- // LLJoystickCameraRotate //------------------------------------------------------------------------------- -LLJoystickCameraRotate::LLJoystickCameraRotate(const std::string& name, LLRect rect, const std::string &out_img, const std::string &in_img) - : - LLJoystick(name, rect, out_img, in_img, JQ_ORIGIN), +LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Params& p) +: LLJoystick(p), mInLeft( FALSE ), mInTop( FALSE ), mInRight( FALSE ), @@ -636,6 +542,13 @@ void LLJoystickCameraRotate::draw() { drawDebugRect(); } + + //// *HACK: also draw debug rectangles around currently-being-edited LLView, and any elements that are being highlighted by GUI preview code (see LLFloaterUIPreview) + //std::set::iterator iter = std::find(sPreviewHighlightedElements.begin(), sPreviewHighlightedElements.end(), this); + //if ((sEditingUI && this == sEditingUIView) || (iter != sPreviewHighlightedElements.end() && sDrawPreviewHighlights)) + //{ + // drawDebugRect(); + //} } // Draws image rotated by multiples of 90 degrees @@ -679,6 +592,15 @@ void LLJoystickCameraRotate::drawRotatedImage( LLImageGL* image, S32 rotations ) // LLJoystickCameraTrack //------------------------------------------------------------------------------- +LLJoystickCameraTrack::Params::Params() +{ + held_down_delay.seconds(0.0); +} + +LLJoystickCameraTrack::LLJoystickCameraTrack(const LLJoystickCameraTrack::Params& p) +: LLJoystickCameraRotate(p) +{} + void LLJoystickCameraTrack::onHeldDown() { @@ -717,17 +639,15 @@ void LLJoystickCameraTrack::onHeldDown() // LLJoystickCameraZoom //------------------------------------------------------------------------------- -LLJoystickCameraZoom::LLJoystickCameraZoom(const std::string& name, LLRect rect, const std::string &out_img, const std::string &plus_in_img, const std::string &minus_in_img) - : - LLJoystick(name, rect, out_img, LLStringUtil::null, JQ_ORIGIN), +LLJoystickCameraZoom::LLJoystickCameraZoom(const LLJoystickCameraZoom::Params& p) +: LLJoystick(p), mInTop( FALSE ), - mInBottom( FALSE ) + mInBottom( FALSE ), + mPlusInImage(p.plus_image), + mMinusInImage(p.minus_image) { - mPlusInImage = LLUIImageList::getInstance()->getUIImage(plus_in_img); - mMinusInImage = LLUIImageList::getInstance()->getUIImage(minus_in_img); } - BOOL LLJoystickCameraZoom::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = LLJoystick::handleMouseDown(x, y, mask); @@ -808,6 +728,13 @@ void LLJoystickCameraZoom::draw() { drawDebugRect(); } + + //// *HACK: also draw debug rectangles around currently-being-edited LLView, and any elements that are being highlighted by GUI preview code (see LLFloaterUIPreview) + //std::set::iterator iter = std::find(sPreviewHighlightedElements.begin(), sPreviewHighlightedElements.end(), this); + //if ((sEditingUI && this == sEditingUIView) || (iter != sPreviewHighlightedElements.end() && sDrawPreviewHighlights)) + //{ + // drawDebugRect(); + //} } void LLJoystickCameraZoom::updateSlop() diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 076a506f14..954a8c481d 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -46,11 +46,27 @@ typedef enum e_joystick_quadrant JQ_RIGHT } EJoystickQuadrant; +struct QuadrantNames : public LLInitParam::TypeValuesHelper +{ + static void declareValues(); +}; + class LLJoystick : public LLButton { public: - LLJoystick(const std::string& name, LLRect rect, const std::string &default_image, const std::string &selected_image, EJoystickQuadrant initial); + struct Params + : public LLInitParam::Block + { + Optional quadrant; + + Params() + : quadrant("quadrant", JQ_ORIGIN) + { + label(""); + } + }; + LLJoystick(const Params&); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -60,10 +76,9 @@ public: virtual void onHeldDown() = 0; F32 getElapsedHeldDownTime(); - static void onHeldDown(void *userdata); // called by llbutton callback handler + static void onBtnHeldDown(void *userdata); // called by llbutton callback handler void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; }; - virtual LLXMLNodePtr getXML(bool save_children = true) const; static std::string nameFromQuadrant(const EJoystickQuadrant quadrant); static EJoystickQuadrant quadrantFromName(const std::string& name); static EJoystickQuadrant selectQuadrant(LLXMLNodePtr node); @@ -91,14 +106,9 @@ class LLJoystickAgentTurn : public LLJoystick { public: - LLJoystickAgentTurn(const std::string& name, LLRect rect, const std::string &default_image, const std::string &selected_image, EJoystickQuadrant initial) - : LLJoystick(name, rect, default_image, selected_image, initial) - { } - + struct Params : public LLJoystick::Params {}; + LLJoystickAgentTurn(const Params& p) : LLJoystick(p) {} virtual void onHeldDown(); - - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - }; @@ -107,14 +117,11 @@ class LLJoystickAgentSlide : public LLJoystick { public: - LLJoystickAgentSlide(const std::string& name, LLRect rect, const std::string &default_image, const std::string &selected_image, EJoystickQuadrant initial) - : LLJoystick(name, rect, default_image, selected_image, initial) - { } - + struct Params : public LLJoystick::Params {}; + LLJoystickAgentSlide(const Params& p) : LLJoystick(p) {} + virtual void onHeldDown(); virtual void onMouseUp(); - - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); }; @@ -123,7 +130,16 @@ class LLJoystickCameraRotate : public LLJoystick { public: - LLJoystickCameraRotate(const std::string& name, LLRect rect, const std::string &out_img, const std::string &in_img); + struct Params + : public LLInitParam::Block + { + Params() + { + held_down_delay.seconds(0.0); + } + }; + + LLJoystickCameraRotate(const LLJoystickCameraRotate::Params&); virtual void setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom ); @@ -149,10 +165,13 @@ class LLJoystickCameraTrack : public LLJoystickCameraRotate { public: - LLJoystickCameraTrack(const std::string& name, LLRect rect, const std::string &out_img, const std::string &in_img) - : LLJoystickCameraRotate(name, rect, out_img, in_img) - { } + struct Params + : public LLInitParam::Block + { + Params(); + }; + LLJoystickCameraTrack(const LLJoystickCameraTrack::Params&); virtual void onHeldDown(); }; @@ -162,7 +181,20 @@ class LLJoystickCameraZoom : public LLJoystick { public: - LLJoystickCameraZoom(const std::string& name, LLRect rect, const std::string &out_img, const std::string &plus_in_img, const std::string &minus_in_img); + struct Params + : public LLInitParam::Block + { + Optional plus_image; + Optional minus_image; + + Params() + : plus_image ("plus_image", NULL), + minus_image ("minus_image", NULL) + { + held_down_delay.seconds(0.0); + } + }; + LLJoystickCameraZoom(const Params&); virtual void setToggleState( BOOL top, BOOL bottom ); diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index 2f43b41042..318344f9ef 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -54,7 +54,7 @@ LLLandmarkList::~LLLandmarkList() std::for_each(mList.begin(), mList.end(), DeletePairedPointer()); } -LLLandmark* LLLandmarkList::getAsset( const LLUUID& asset_uuid ) +LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t cb) { LLLandmark* landmark = get_ptr_in_map(mList, asset_uuid); if(landmark) @@ -65,6 +65,12 @@ LLLandmark* LLLandmarkList::getAsset( const LLUUID& asset_uuid ) { if ( gLandmarkList.mBadList.find(asset_uuid) == gLandmarkList.mBadList.end() ) { + if (cb) + { + loaded_callback_map_t::value_type vt(asset_uuid, cb); + mLoadedCallbackMap.insert(vt); + } + gAssetStorage->getAssetData( asset_uuid, LLAssetType::AT_LANDMARK, @@ -96,6 +102,8 @@ void LLLandmarkList::processGetAssetReply( LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0]); if (landmark) { + gLandmarkList.mList[ uuid ] = landmark; + LLVector3d pos; if(!landmark->getGlobalPos(pos)) { @@ -106,10 +114,15 @@ void LLLandmarkList::processGetAssetReply( gMessageSystem, gAgent.getRegionHost(), region_id, - NULL); + boost::bind(&LLLandmarkList::onRegionHandle, &gLandmarkList, uuid)); } + + // the callback will be called when we get the region handle. + } + else + { + gLandmarkList.makeCallbacks(uuid); } - gLandmarkList.mList[ uuid ] = landmark; } } else @@ -134,3 +147,45 @@ BOOL LLLandmarkList::assetExists(const LLUUID& asset_uuid) { return mList.count(asset_uuid) != 0 || mBadList.count(asset_uuid) != 0; } + +void LLLandmarkList::onRegionHandle(const LLUUID& landmark_id) +{ + LLLandmark* landmark = getAsset(landmark_id); + + if (!landmark) + { + llwarns << "Got region handle but the landmark not found." << llendl; + return; + } + + // Calculate landmark global position. + // This should succeed since the region handle is available. + LLVector3d pos; + if (!landmark->getGlobalPos(pos)) + { + llwarns << "Got region handle but the landmark global position is still unknown." << llendl; + return; + } + + makeCallbacks(landmark_id); +} + +void LLLandmarkList::makeCallbacks(const LLUUID& landmark_id) +{ + LLLandmark* landmark = getAsset(landmark_id); + + if (!landmark) + { + llwarns << "Landmark to make callbacks for not found." << llendl; + } + + // make all the callbacks here. + loaded_callback_map_t::iterator it; + while((it = mLoadedCallbackMap.find(landmark_id)) != mLoadedCallbackMap.end()) + { + if (landmark) + (*it).second(landmark); + + mLoadedCallbackMap.erase(it); + } +} diff --git a/indra/newview/lllandmarklist.h b/indra/newview/lllandmarklist.h index c41ba7a0f0..ebf1b65e97 100644 --- a/indra/newview/lllandmarklist.h +++ b/indra/newview/lllandmarklist.h @@ -33,6 +33,7 @@ #ifndef LL_LLLANDMARKLIST_H #define LL_LLLANDMARKLIST_H +#include #include #include "lllandmark.h" #include "lluuid.h" @@ -45,6 +46,8 @@ class LLInventoryItem; class LLLandmarkList { public: + typedef boost::function loaded_callback_t; + LLLandmarkList() {} ~LLLandmarkList(); @@ -53,7 +56,7 @@ public: //const LLLandmark* getNext() { return mList.getNextData(); } BOOL assetExists(const LLUUID& asset_uuid); - LLLandmark* getAsset(const LLUUID& asset_uuid); + LLLandmark* getAsset(const LLUUID& asset_uuid, loaded_callback_t cb = NULL); static void processGetAssetReply( LLVFS *vfs, const LLUUID& uuid, @@ -63,11 +66,19 @@ public: LLExtStat ext_status ); protected: + void onRegionHandle(const LLUUID& landmark_id); + void makeCallbacks(const LLUUID& landmark_id); + typedef std::map landmark_list_t; landmark_list_t mList; typedef std::set landmark_bad_list_t; landmark_bad_list_t mBadList; + + // *TODO: make the callback multimap a template class and make use of it + // here and in LLLandmark. + typedef std::multimap loaded_callback_map_t; + loaded_callback_map_t mLoadedCallbackMap; }; diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp new file mode 100644 index 0000000000..179eca2532 --- /dev/null +++ b/indra/newview/lllocationhistory.cpp @@ -0,0 +1,134 @@ +/** + * @file lllocationhistory.cpp + * @brief Typed locations history + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lllocationhistory.h" + +#include // for std::setw() + +#include "llui.h" + +LLLocationHistory::LLLocationHistory() : + mFilename("typed_locations.txt"), + mLoadedCallback(NULL) +{ +} + +void LLLocationHistory::addItem(std::string item) +{ + static LLUICachedControl max_items("LocationHistoryMaxSize", 100); + + mItems.push_back(item); + + // If the vector size exceeds the maximum, purge the oldest items. + if ((S32)mItems.size() > max_items) + mItems.erase(mItems.begin(), mItems.end()-max_items); +} + + +bool LLLocationHistory::getMatchingItems(std::string substring, location_list_t& result) const +{ + // *TODO: an STL algorithm would look nicer + result.clear(); + + std::string needle = substring; + LLStringUtil::toLower(needle); + + for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it) + { + std::string haystack = *it; + LLStringUtil::toLower(haystack); + + if (haystack.find(needle) != std::string::npos) + result.push_back(*it); + } + + return result.size(); +} + +void LLLocationHistory::dump() const +{ + llinfos << "Location history dump:" << llendl; + int i = 0; + for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it, ++i) + { + llinfos << "#" << std::setw(2) << std::setfill('0') << i << ": " << *it << llendl; + } +} + +void LLLocationHistory::save() const +{ + // build filename for each user + std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename); + + // open a file for writing + llofstream file (resolved_filename); + if (!file.is_open()) + { + llwarns << "can't open location history file \"" << mFilename << "\" for writing" << llendl; + return; + } + + for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it) + file << (*it) << std::endl; + + file.close(); +} + +void LLLocationHistory::load() +{ + llinfos << "Loading location history." << llendl; + + // build filename for each user + std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename); + llifstream file(resolved_filename); + + if (!file.is_open()) + { + llwarns << "can't load location history from file \"" << mFilename << "\"" << llendl; + return; + } + + // remove current entries before we load over them + mItems.clear(); + + // add each line in the file to the list + std::string line; + while (std::getline(file, line)) + addItem(line); + + file.close(); + + if (mLoadedCallback) + mLoadedCallback(); +} diff --git a/indra/newview/lllocationhistory.h b/indra/newview/lllocationhistory.h new file mode 100644 index 0000000000..d2a959ae62 --- /dev/null +++ b/indra/newview/lllocationhistory.h @@ -0,0 +1,68 @@ +/** + * @file llocationhistory.h + * @brief Typed locations history + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLLOCATIONHISTORY_H +#define LL_LLLOCATIONHISTORY_H + +#include "llsingleton.h" // for LLSingleton + +#include +#include +#include + +class LLLocationHistory: public LLSingleton +{ + LOG_CLASS(LLLocationHistory); + +public: + typedef std::vector location_list_t; + typedef boost::function loaded_callback_t; + + LLLocationHistory(); + + void addItem(std::string item); + size_t getItemCount() const { return mItems.size(); } + const location_list_t& getItems() const { return mItems; } + bool getMatchingItems(std::string substring, location_list_t& result) const; + void setLoadedCallback(loaded_callback_t cb) { mLoadedCallback = cb; } + + void save() const; + void load(); + void dump() const; + +private: + std::vector mItems; + std::string mFilename; /// File to store the history to. + loaded_callback_t mLoadedCallback; +}; + +#endif diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp new file mode 100644 index 0000000000..4aaa7ca6cb --- /dev/null +++ b/indra/newview/lllocationinputctrl.cpp @@ -0,0 +1,513 @@ +/** + * @file lllocationinputctrl.cpp + * @brief Combobox-like location input control + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +// file includes +#include "lllocationinputctrl.h" + +// common includes +#include "llbutton.h" +#include "llfloaterreg.h" +#include "llfocusmgr.h" +#include "llkeyboard.h" +#include "llstring.h" +#include "lluictrlfactory.h" +#include "v2math.h" + +// newview includes +#include "llagent.h" +#include "llfloaterland.h" +#include "llinventorymodel.h" +#include "lllandmarklist.h" +#include "lllocationhistory.h" +#include "llpanelplaces.h" +#include "llsidetray.h" +#include "llviewerinventory.h" +#include "llviewerparcelmgr.h" + +//============================================================================ +/* + * "ADD LANDMARK" BUTTON UPDATING LOGIC + * + * If the current parcel has been landmarked, we should draw + * a special image on the button. + * + * To avoid determining the appropriate image on every draw() we do that + * only in the following cases: + * 1) Navbar is shown for the first time after login. + * 2) Agent moves to another parcel. + * 3) A landmark is created or removed. + * + * The first case is handled by the handleLoginComplete() method. + * + * The second case is handled by setting the "agent parcel changed" callback + * on LLViewerParcelMgr. + * + * The third case is the most complex one. We have two inventory observers for that: + * one is designated to handle adding landmarks, the other handles removal. + * Let's see how the former works. + * + * When we get notified about landmark addition, the landmark position is unknown yet. What we can + * do at that point is initiate loading the landmark data by LLLandmarkList and set the + * "loading finished" callback on it. Finally, when the callback is triggered, + * we can determine whether the landmark refers to a point within the current parcel + * and choose the appropriate image for the "Add landmark" button. + */ + +// Returns true if the given inventory item is a landmark pointing to the current parcel. +// Used to filter inventory items. +class LLIsAgentParcelLandmark : public LLInventoryCollectFunctor +{ +public: + /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) + { + if (!item || item->getType() != LLAssetType::AT_LANDMARK) + return false; + + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID()); + if (!landmark) // the landmark not been loaded yet + return false; + + LLVector3d landmark_global_pos; + if (!landmark->getGlobalPos(landmark_global_pos)) + return false; + + return LLViewerParcelMgr::getInstance()->inAgentParcel(landmark_global_pos); + } +}; + +/** + * Initiates loading the landmarks that have been just added. + * + * Once the loading is complete we'll be notified + * with the callback we set for LLLandmarkList. + */ +class LLAddLandmarkObserver : public LLInventoryAddedObserver +{ +public: + LLAddLandmarkObserver(LLLocationInputCtrl* input) : mInput(input) {} + +private: + /*virtual*/ void done() + { + std::vector::const_iterator it = mAdded.begin(), end = mAdded.end(); + for(; it != end; ++it) + { + LLInventoryItem* item = gInventory.getItem(*it); + if (!item || item->getType() != LLAssetType::AT_LANDMARK) + continue; + + // Start loading the landmark. + LLLandmark* lm = gLandmarkList.getAsset( + item->getAssetUUID(), + boost::bind(&LLLocationInputCtrl::onLandmarkLoaded, mInput, _1)); + if (lm) + { + // Already loaded? Great, handle it immediately (the callback won't be called). + mInput->onLandmarkLoaded(lm); + } + } + + mAdded.clear(); + } + + LLLocationInputCtrl* mInput; +}; + +/** + * Updates the "Add landmark" button once a landmark gets removed. + */ +class LLRemoveLandmarkObserver : public LLInventoryObserver +{ +public: + LLRemoveLandmarkObserver(LLLocationInputCtrl* input) : mInput(input) {} + +private: + /*virtual*/ void changed(U32 mask) + { + if (mask & (~(LLInventoryObserver::LABEL|LLInventoryObserver::INTERNAL|LLInventoryObserver::ADD))) + { + mInput->updateAddLandmarkButton(); + } + } + + LLLocationInputCtrl* mInput; +}; + +//============================================================================ + + +static LLDefaultWidgetRegistry::Register r("location_input"); + +LLLocationInputCtrl::Params::Params() +: add_landmark_image_enabled("add_landmark_image_enabled"), + add_landmark_image_disabled("add_landmark_image_disabled"), + add_landmark_button("add_landmark_button"), + add_landmark_hpad("add_landmark_hpad", 0), + info_button("info_button"), + background("background") +{ +} + +LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) +: LLComboBox(p), + mAddLandmarkHPad(p.add_landmark_hpad), + mInfoBtn(NULL), + mAddLandmarkBtn(NULL) +{ + // Background image. + LLButton::Params bg_params = p.background; + mBackground = LLUICtrlFactory::create(bg_params); + addChildInBack(mBackground); + + // "Place information" button. + LLButton::Params info_params = p.info_button; + mInfoBtn = LLUICtrlFactory::create(info_params); + mInfoBtn->setClickedCallback(boost::bind(&LLLocationInputCtrl::onInfoButtonClicked, this)); + addChild(mInfoBtn); + + // "Add landmark" button. + LLButton::Params al_params = p.add_landmark_button; + if (p.add_landmark_image_enabled()) + { + al_params.image_unselected = p.add_landmark_image_enabled; + al_params.image_selected = p.add_landmark_image_enabled; + } + if (p.add_landmark_image_disabled()) + { + al_params.image_disabled = p.add_landmark_image_disabled; + al_params.image_disabled_selected = p.add_landmark_image_disabled; + } + al_params.click_callback.function(boost::bind(&LLLocationInputCtrl::onAddLandmarkButtonClicked, this)); + mAddLandmarkBtn = LLUICtrlFactory::create(al_params); + enableAddLandmarkButton(true); + addChild(mAddLandmarkBtn); + + setFocusReceivedCallback(boost::bind(&LLLocationInputCtrl::onFocusReceived, this)); + setFocusLostCallback(boost::bind(&LLLocationInputCtrl::onFocusLost, this)); + setPrearrangeCallback(boost::bind(&LLLocationInputCtrl::onLocationPrearrange, this, _2)); + + updateWidgetlayout(); + + // - Make the "Add landmark" button updated when either current parcel gets changed + // or a landmark gets created or removed from the inventory. + // - Update the location string on parcel change. + LLViewerParcelMgr::getInstance()->setAgentParcelChangedCallback( + boost::bind(&LLLocationInputCtrl::onAgentParcelChange, this)); + + LLLocationHistory::getInstance()->setLoadedCallback( + boost::bind(&LLLocationInputCtrl::onLocationHistoryLoaded, this)); + + mRemoveLandmarkObserver = new LLRemoveLandmarkObserver(this); + mAddLandmarkObserver = new LLAddLandmarkObserver(this); + gInventory.addObserver(mRemoveLandmarkObserver); + gInventory.addObserver(mAddLandmarkObserver); +} + +LLLocationInputCtrl::~LLLocationInputCtrl() +{ + gInventory.removeObserver(mRemoveLandmarkObserver); + gInventory.removeObserver(mAddLandmarkObserver); + delete mRemoveLandmarkObserver; + delete mAddLandmarkObserver; +} + +void LLLocationInputCtrl::setEnabled(BOOL enabled) +{ + LLComboBox::setEnabled(enabled); + mAddLandmarkBtn->setEnabled(enabled); +} + +void LLLocationInputCtrl::hideList() +{ + LLComboBox::hideList(); + if (mTextEntry && hasFocus()) + focusTextEntry(); +} + +BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) +{ + // Let the buttons show their tooltips. + if (LLUICtrl::handleToolTip(x, y, msg, sticky_rect_screen) && !msg.empty()) + { + return TRUE; + } + + // Cursor is above the text entry. + msg = LLUI::sShowXUINames ? getShowNamesToolTip() : gAgent.getSLURL(); + if (mTextEntry && sticky_rect_screen) + { + *sticky_rect_screen = mTextEntry->calcScreenRect(); + } + + return TRUE; +} + +BOOL LLLocationInputCtrl::handleKeyHere(KEY key, MASK mask) +{ + BOOL result = LLComboBox::handleKeyHere(key, mask); + + if (key == KEY_DOWN && hasFocus() && mList->getItemCount() != 0) + { + showList(); + } + + return result; +} + +void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor) +{ + KEY key = gKeyboard->currentKey(); + + if (line_editor->getText().empty()) + { + prearrangeList(); // resets filter + hideList(); + } + // Typing? (moving cursor should not affect showing the list) + else if (key != KEY_LEFT && key != KEY_RIGHT && key != KEY_HOME && key != KEY_END) + { + prearrangeList(line_editor->getText()); + if (mList->getItemCount() != 0) + { + showList(); + focusTextEntry(); + } + else + { + // Hide the list if it's empty. + hideList(); + } + } + + LLComboBox::onTextEntry(line_editor); +} + +/** + * Useful if we want to just set the text entry value, no matter what the list contains. + * + * This is faster than setTextEntry(). + */ +void LLLocationInputCtrl::setText(const LLStringExplicit& text) +{ + if (mTextEntry) + { + mTextEntry->setText(text); + mHasAutocompletedText = FALSE; + } +} + +void LLLocationInputCtrl::setFocus(BOOL b) +{ + LLComboBox::setFocus(b); + + if (mTextEntry && b && !mList->getVisible()) + mTextEntry->setFocus(TRUE); +} + +void LLLocationInputCtrl::handleLoginComplete() +{ + // An agent parcel update hasn't occurred yet, so we have to + // manually set location and the appropriate "Add landmark" icon. + refresh(); +} + +//== private methods ========================================================= + +void LLLocationInputCtrl::onFocusReceived() +{ + prearrangeList(); + setText(gAgent.getSLURL()); + if (mTextEntry) + mTextEntry->endSelection(); // we don't want handleMouseUp() to "finish" the selection +} + +void LLLocationInputCtrl::onFocusLost() +{ + refreshLocation(); +} + +void LLLocationInputCtrl::onInfoButtonClicked() +{ + LLSD key; + key["type"] = LLPanelPlaces::AGENT; + + LLSideTray::getInstance()->showPanel("panel_places", key); +} + +void LLLocationInputCtrl::onAddLandmarkButtonClicked() +{ + LLFloaterReg::showInstance("add_landmark"); +} + +void LLLocationInputCtrl::onAgentParcelChange() +{ + refresh(); +} + +void LLLocationInputCtrl::onLandmarkLoaded(LLLandmark* lm) +{ + (void) lm; + updateAddLandmarkButton(); +} + +void LLLocationInputCtrl::onLocationHistoryLoaded() +{ + rebuildLocationHistory(); +} + +void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) +{ + std::string filter = data.asString(); + rebuildLocationHistory(filter); + mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item. +} + +void LLLocationInputCtrl::refresh() +{ + refreshLocation(); // update location string + updateAddLandmarkButton(); // indicate whether current parcel has been landmarked +} + +void LLLocationInputCtrl::refreshLocation() +{ + // Is one of our children focused? + if (LLUICtrl::hasFocus() || mButton->hasFocus() || mList->hasFocus() || + (mTextEntry && mTextEntry->hasFocus()) || (mAddLandmarkBtn->hasFocus())) + + { + llwarns << "Location input should not be refreshed when having focus" << llendl; + return; + } + + // Update location field. + std::string location_name; + + if (!gAgent.buildLocationString(location_name, LLAgent::LOCATION_FORMAT_NORMAL)) + location_name = "Unknown"; + + setText(location_name); +} + +void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) +{ + LLLocationHistory::location_list_t filtered_items; + const LLLocationHistory::location_list_t* itemsp = NULL; + LLLocationHistory* lh = LLLocationHistory::getInstance(); + + if (filter.empty()) + itemsp = &lh->getItems(); + else + { + lh->getMatchingItems(filter, filtered_items); + itemsp = &filtered_items; + } + + removeall(); + for (LLLocationHistory::location_list_t::const_reverse_iterator it = itemsp->rbegin(); it != itemsp->rend(); it++) + add(*it); +} + +void LLLocationInputCtrl::focusTextEntry() +{ + // We can't use "mTextEntry->setFocus(TRUE)" instead because + // if the "select_on_focus" parameter is true it places the cursor + // at the beginning (after selecting text), thus screwing up updateSelection(). + if (mTextEntry) + gFocusMgr.setKeyboardFocus(mTextEntry); +} + +void LLLocationInputCtrl::enableAddLandmarkButton(bool val) +{ + // Enable/disable the button. + mAddLandmarkBtn->setEnabled(val); +} + +// Change the "Add landmark" button image +// depending on whether current parcel has been landmarked. +void LLLocationInputCtrl::updateAddLandmarkButton() +{ + bool cur_parcel_landmarked = false; + + // Determine whether there are landmarks pointing to the current parcel. + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLIsAgentParcelLandmark is_current_parcel_landmark; + gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + is_current_parcel_landmark); + cur_parcel_landmarked = !items.empty(); + + enableAddLandmarkButton(!cur_parcel_landmarked); +} + +void LLLocationInputCtrl::updateWidgetlayout() +{ + const LLRect& rect = getLocalRect(); + const LLRect& hist_btn_rect = mButton->getRect(); + LLRect info_btn_rect = mButton->getRect(); + + // info button + info_btn_rect.setOriginAndSize( + 0, (rect.getHeight() - info_btn_rect.getHeight()) / 2, + info_btn_rect.getWidth(), info_btn_rect.getHeight()); + mInfoBtn->setRect(info_btn_rect); + + // background + mBackground->setRect(LLRect(info_btn_rect.getWidth(), rect.mTop, + rect.mRight - hist_btn_rect.getWidth(), rect.mBottom)); + + // history button + mButton->setRightHPad(0); + + // "Add Landmark" button + { + LLRect al_btn_rect = mAddLandmarkBtn->getRect(); + al_btn_rect.translate( + hist_btn_rect.mLeft - mAddLandmarkHPad - al_btn_rect.getWidth(), + (rect.getHeight() - al_btn_rect.getHeight()) / 2); + mAddLandmarkBtn->setRect(al_btn_rect); + } + + // text entry + if (mTextEntry) + { + LLRect text_entry_rect(rect); + text_entry_rect.mLeft = info_btn_rect.getWidth(); + text_entry_rect.mRight = mAddLandmarkBtn->getRect().mLeft; + text_entry_rect.stretch(0, -1); // make space for border + mTextEntry->setRect(text_entry_rect); + } +} diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h new file mode 100644 index 0000000000..1732853263 --- /dev/null +++ b/indra/newview/lllocationinputctrl.h @@ -0,0 +1,119 @@ +/** + * @file lllocationinputctrl.h + * @brief Combobox-like location input control + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLLOCATIONINPUTCTRL_H +#define LL_LLLOCATIONINPUTCTRL_H + +#include + +class LLLandmark; + +// internals +class LLAddLandmarkObserver; +class LLRemoveLandmarkObserver; + +/** + * Location input control. + * + * @see LLNavigationBar + */ +class LLLocationInputCtrl +: public LLComboBox +{ + LOG_CLASS(LLLocationInputCtrl); + friend class LLAddLandmarkObserver; + friend class LLRemoveLandmarkObserver; + +public: + struct Params + : public LLInitParam::Block + { + Optional add_landmark_image_enabled, + add_landmark_image_disabled; + Optional add_landmark_hpad; + Optional add_landmark_button, + info_button, + background; + Params(); + }; + + // LLView interface + /*virtual*/ void setEnabled(BOOL enabled); + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + //======================================================================== + + // LLUICtrl interface + /*virtual*/ void setFocus(BOOL b); + //======================================================================== + + // LLComboBox interface + void hideList(); + void onTextEntry(LLLineEditor* line_editor); + //======================================================================== + + LLLineEditor* getTextEntry() const { return mTextEntry; } + void handleLoginComplete(); + +private: + friend class LLUICtrlFactory; + LLLocationInputCtrl(const Params&); + virtual ~LLLocationInputCtrl(); + + void focusTextEntry(); + void enableAddLandmarkButton(bool val); + void refresh(); + void refreshLocation(); + void rebuildLocationHistory(std::string filter = ""); + void setText(const LLStringExplicit& text); + void updateAddLandmarkButton(); + void updateWidgetlayout(); + + void onFocusReceived(); + void onFocusLost(); + void onInfoButtonClicked(); + void onLocationHistoryLoaded(); + void onLocationPrearrange(const LLSD& data); + void onLandmarkLoaded(LLLandmark* lm); + void onAddLandmarkButtonClicked(); + void onAgentParcelChange(); + + LLButton* mBackground; + LLButton* mAddLandmarkBtn; + LLButton* mInfoBtn; + S32 mAddLandmarkHPad; + + LLAddLandmarkObserver* mAddLandmarkObserver; + LLRemoveLandmarkObserver* mRemoveLandmarkObserver; +}; + +#endif diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 1709d6465d..69214b5cab 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -35,6 +35,7 @@ #include "lllogchat.h" #include "llappviewer.h" #include "llfloaterchat.h" +#include "lltrans.h" const S32 LOG_RECALL_SIZE = 2048; @@ -64,20 +65,26 @@ std::string LLLogChat::timestamp(bool withdate) time_t utc_time; utc_time = time_corrected(); - // There's only one internal tm buffer. - struct tm* timep; + std::string timeStr; + LLSD substitution; + substitution["datetime"] = (S32) utc_time; - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); - - std::string text; if (withdate) - text = llformat("[%d/%02d/%02d %d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min); + { + timeStr = "["+LLTrans::getString ("TimeYear")+"]/[" + +LLTrans::getString ("TimeMonth")+"]/[" + +LLTrans::getString ("TimeDay")+"] [" + +LLTrans::getString ("TimeHour")+"]:[" + +LLTrans::getString ("TimeMin")+"] "; + } else - text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); + { + timeStr = "[" + LLTrans::getString("TimeHour") + "]:[" + + LLTrans::getString ("TimeMin")+"] "; + } - return text; + LLStringUtil::format (timeStr, substitution); + return timeStr; } @@ -114,7 +121,7 @@ void LLLogChat::loadHistory(std::string filename , void (*callback)(ELogLineType LLFILE* fptr = LLFile::fopen(makeLogFileName(filename), "r"); /*Flawfinder: ignore*/ if (!fptr) { - //LLUIString message = LLFloaterChat::getInstance()->getString("IM_logging_string"); + //LLUIString message = LLTrans::getString("IM_logging_string"); //callback(LOG_EMPTY,"IM_logging_string",userdata); callback(LOG_EMPTY,LLStringUtil::null,userdata); return; //No previous conversation with this name. diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp index 053f798882..554163c8e1 100644 --- a/indra/newview/llloginhandler.cpp +++ b/indra/newview/llloginhandler.cpp @@ -156,15 +156,9 @@ void LLLoginHandler::parse(const LLSD& queryMap) { LLURLSimString::setString(queryMap["region"].asString()); } - else if (startLocation == "home") + else if (!startLocation.empty()) // "last" or "home" or ??? (let LLURLSimString figure it out) { - gSavedSettings.setBOOL("LoginLastLocation", FALSE); - LLURLSimString::setString(LLStringUtil::null); - } - else if (startLocation == "last") - { - gSavedSettings.setBOOL("LoginLastLocation", TRUE); - LLURLSimString::setString(LLStringUtil::null); + LLURLSimString::setString(startLocation); } } diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 53c74aaec1..7039776585 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -452,35 +452,36 @@ void LLManip::renderXYZ(const LLVector3 &vec) gViewerWindow->setup3DRender(); { + LLFontGL* font = LLFontGL::getFontSansSerif(); LLLocale locale(LLLocale::USER_LOCALE); LLGLDepthTest gls_depth(GL_FALSE); // render drop shadowed text feedback_string = llformat("X: %.3f", vec.mV[VX]); - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); feedback_string = llformat("Y: %.3f", vec.mV[VY]); - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); feedback_string = llformat("Z: %.3f", vec.mV[VZ]); - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE); // render text on top feedback_string = llformat("X: %.3f", vec.mV[VX]); - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE); glColor3f(0.5f, 1.f, 0.5f); feedback_string = llformat("Y: %.3f", vec.mV[VY]); - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE); glColor3f(0.5f, 0.5f, 1.f); feedback_string = llformat("Z: %.3f", vec.mV[VZ]); - hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); + hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE); } } void LLManip::renderTickText(const LLVector3& pos, const std::string& text, const LLColor4 &color) { - const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const LLFontGL* big_fontp = LLFontGL::getFontSansSerif(); BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; glMatrixMode(GL_MODELVIEW); @@ -498,10 +499,10 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons // render shadow first LLColor4 shadow_color = LLColor4::black; shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f; - gViewerWindow->setupViewport(1, -1); - hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); - gViewerWindow->setupViewport(); - hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + gViewerWindow->setup3DViewport(1, -1); + hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + gViewerWindow->setup3DViewport(); + hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); glPopMatrix(); } @@ -510,8 +511,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string { LLLocale locale(LLLocale::USER_LOCALE); - const LLFontGL* big_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); - const LLFontGL* small_fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); + const LLFontGL* big_fontp = LLFontGL::getFontSansSerif(); + const LLFontGL* small_fontp = LLFontGL::getFontSansSerifSmall(); std::string val_string; std::string fraction_string; @@ -560,29 +561,29 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string { fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str()); - gViewerWindow->setupViewport(1, -1); - hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); - hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, 1.f, 3.f, shadow_color, hud_selection); + gViewerWindow->setup3DViewport(1, -1); + hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); + hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 1.f, 3.f, shadow_color, hud_selection); - gViewerWindow->setupViewport(); - hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); - hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, 1.f, 3.f, color, hud_selection); + gViewerWindow->setup3DViewport(); + hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); + hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 1.f, 3.f, color, hud_selection); } else { - gViewerWindow->setupViewport(1, -1); - hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); - gViewerWindow->setupViewport(); - hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); + gViewerWindow->setup3DViewport(1, -1); + hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); + gViewerWindow->setup3DViewport(); + hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); } glPopMatrix(); } LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass) { - static LLColor4 grid_color_fg = gColors.getColor("GridlineColor"); - static LLColor4 grid_color_bg = gColors.getColor("GridlineBGColor"); - static LLColor4 grid_color_shadow = gColors.getColor("GridlineShadowColor"); + static LLColor4 grid_color_fg = gSavedSkinSettings.getColor("GridlineColor"); + static LLColor4 grid_color_bg = gSavedSkinSettings.getColor("GridlineBGColor"); + static LLColor4 grid_color_shadow = gSavedSkinSettings.getColor("GridlineShadowColor"); LLColor4 line_color; F32 line_alpha = gSavedSettings.getF32("GridOpacity"); @@ -591,14 +592,14 @@ LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass) { case 0: // shadow - gViewerWindow->setupViewport(1, -1); + gViewerWindow->setup3DViewport(1, -1); line_color = grid_color_shadow; line_color.mV[VALPHA] *= line_alpha; LLUI::setLineWidth(2.f); break; case 1: // hidden lines - gViewerWindow->setupViewport(); + gViewerWindow->setup3DViewport(); line_color = grid_color_bg; line_color.mV[VALPHA] *= line_alpha; LLUI::setLineWidth(1.f); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 8b0484bba6..f228ea624b 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -63,6 +63,7 @@ #include "pipeline.h" #include "lldrawable.h" #include "llglheaders.h" +#include "lltrans.h" const F32 RADIUS_PIXELS = 100.f; // size in screen space const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS; @@ -897,7 +898,6 @@ void LLManipRotate::renderSnapGuides() } gGL.end(); - // *TODO: Translate //RN: text rendering does own shadow pass, so only render once if (pass == 1 && render_text && i % 16 == 0) { @@ -905,32 +905,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Forward") : LLTrans::getString("East"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VZ] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Left") : LLTrans::getString("North"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Right") : LLTrans::getString("South"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Back") : LLTrans::getString("West"), LLColor4::white); } else { if (constraint_axis.mV[VZ] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Right") : LLTrans::getString("South"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Left") : LLTrans::getString("North"), LLColor4::white); } } } @@ -938,32 +938,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Left") : std::string("North"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Left") : LLTrans::getString("North"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VX] > 0.f) { - renderTickText(text_point, std::string("Up"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Up"), LLColor4::white); } else { - renderTickText(text_point, std::string("Down"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Down"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Right") : std::string("South"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Right") : LLTrans::getString("South"), LLColor4::white); } else { if (constraint_axis.mV[VX] > 0.f) { - renderTickText(text_point, std::string("Down"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Down"), LLColor4::white); } else { - renderTickText(text_point, std::string("Up"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Up"), LLColor4::white); } } } @@ -971,32 +971,32 @@ void LLManipRotate::renderSnapGuides() { if (i == 0) { - renderTickText(text_point, std::string("Up"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Up"), LLColor4::white); } else if (i == 16) { if (constraint_axis.mV[VY] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Forward") : LLTrans::getString("East"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Back") : LLTrans::getString("West"), LLColor4::white); } } else if (i == 32) { - renderTickText(text_point, std::string("Down"), LLColor4::white); + renderTickText(text_point, LLTrans::getString("Down"), LLColor4::white); } else { if (constraint_axis.mV[VY] > 0.f) { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Back") : std::string("West"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Back") : LLTrans::getString("West"), LLColor4::white); } else { - renderTickText(text_point, mObjectSelection->isAttachment() ? std::string("Forward") : std::string("East"), LLColor4::white); + renderTickText(text_point, mObjectSelection->isAttachment() ? LLTrans::getString("Forward") : LLTrans::getString("East"), LLColor4::white); } } } diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index b1cdfe3886..5261c130ea 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -415,7 +415,7 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask) // Patch up textures, if possible. LLSelectMgr::getInstance()->adjustTexturesByScale(FALSE, getStretchTextures()); - gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLSCALE); + gViewerWindow->setCursor(UI_CURSOR_TOOLSCALE); return TRUE; } @@ -1827,10 +1827,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) std::string help_text = "Move mouse cursor over ruler"; LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); help_text = "to snap to grid"; help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f; - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); } } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index f2585c8543..b8c2a3d64b 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -61,7 +61,7 @@ #include "llviewerjoint.h" #include "llviewerobject.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" #include "llui.h" #include "pipeline.h" @@ -1441,10 +1441,10 @@ void LLManipTranslate::renderSnapGuides() std::string help_text = "Move mouse cursor over ruler to snap"; LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); help_text = "to snap to grid"; help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f; - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); } } } @@ -1522,7 +1522,7 @@ void LLManipTranslate::renderSnapGuides() float a = line_alpha; - LLColor4 col = gColors.getColor("SilhouetteChildColor"); + LLColor4 col = gSavedSkinSettings.getColor("SilhouetteChildColor"); { //draw grid behind objects LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index 215cc6940b..ab5db93027 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -35,34 +35,20 @@ #include "indra_constants.h" #include "llmemoryview.h" -#include "llrect.h" -#include "llerror.h" -#include "llgl.h" -#include "llmath.h" -#include "llfontgl.h" -#include "llmemtype.h" - -#include "llcharacter.h" -#include "llui.h" +#include "llappviewer.h" +#include "llallocator_heap_profile.h" +#include "llviewerwindow.h" #include "llviewercontrol.h" -#include "llstat.h" -#include "llfasttimer.h" +#include +#include - -LLMemoryView::LLMemoryView(const std::string& name, const LLRect& rect) -: LLView(name, rect, TRUE), -mDelay(120) +LLMemoryView::LLMemoryView(const LLMemoryView::Params& p) +: LLView(p), + //mDelay(120), + mAlloc(NULL) { - setVisible(FALSE); - mDumpTimer.reset(); - -#ifdef MEM_DUMP_DATA - // clear out file. - LLFILE *dump = LLFile::fopen("memusagedump.txt", "w"); - fclose(dump); -#endif } LLMemoryView::~LLMemoryView() @@ -94,62 +80,101 @@ BOOL LLMemoryView::handleHover(S32 x, S32 y, MASK mask) return FALSE; } -////////////////////////////////////////////////////////////////////////////// - -struct mtv_display_info { - S32 memtype; - const char *desc; - const LLColor4 *color; -}; - -static const LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f); - -static const struct mtv_display_info mtv_display_table[] = +void LLMemoryView::refreshProfile() { - { LLMemType::MTYPE_INIT, "Init", &LLColor4::white }, - { LLMemType::MTYPE_STARTUP, "Startup", &LLColor4::cyan1 }, - { LLMemType::MTYPE_MAIN, "Main", &LLColor4::cyan2 }, - { LLMemType::MTYPE_IMAGEBASE, "ImageBase", &LLColor4::yellow1 }, - { LLMemType::MTYPE_IMAGERAW, "ImageRaw", &LLColor4::yellow2 }, - { LLMemType::MTYPE_IMAGEFORMATTED, "ImageFmtd", &LLColor4::yellow3 }, - { LLMemType::MTYPE_APPFMTIMAGE, "ViewerImageFmt", &LLColor4::orange1 }, - { LLMemType::MTYPE_APPRAWIMAGE, "ViewerImageRaw", &LLColor4::orange2 }, - { LLMemType::MTYPE_APPAUXRAWIMAGE, "ViewerImageAux", &LLColor4::orange3 }, - { LLMemType::MTYPE_DRAWABLE, "Drawable", &LLColor4::green1 }, - { LLMemType::MTYPE_OBJECT, "ViewerObject", &LLColor4::green2 }, - { LLMemType::MTYPE_PIPELINE, "Pipeline", &LLColor4::green3 }, - { LLMemType::MTYPE_PARTICLES, "Particles", &LLColor4::green4 }, - { LLMemType::MTYPE_SPACE_PARTITION, "Space Partition", &LLColor4::blue2 }, - { LLMemType::MTYPE_VERTEX_DATA, "Vertex Buffer", &LLColor4::blue3 }, - { LLMemType::MTYPE_AVATAR, "Avatar", &LLColor4::purple1 }, - { LLMemType::MTYPE_AVATAR_MESH, "Avatar Mesh", &LLColor4::purple2 }, - { LLMemType::MTYPE_ANIMATION, "Animation", &LLColor4::purple3 }, - { LLMemType::MTYPE_REGIONS, "Regions", &LLColor4::blue1 }, - { LLMemType::MTYPE_VOLUME, "Volume", &LLColor4::pink1 }, - { LLMemType::MTYPE_PRIMITIVE, "Profile", &LLColor4::pink2 }, - { LLMemType::MTYPE_TEMP1, "Temp1", &LLColor4::red1 }, - { LLMemType::MTYPE_TEMP2, "Temp2", &LLColor4::magenta1 }, - { LLMemType::MTYPE_TEMP3, "Temp3", &LLColor4::red2 }, - { LLMemType::MTYPE_TEMP4, "Temp4", &LLColor4::magenta2 }, - { LLMemType::MTYPE_TEMP5, "Temp5", &LLColor4::red3 }, - { LLMemType::MTYPE_TEMP6, "Temp6", &LLColor4::magenta3 }, - { LLMemType::MTYPE_TEMP7, "Temp7", &LLColor4::red4 }, - { LLMemType::MTYPE_TEMP8, "Temp8", &LLColor4::magenta4 }, - - { LLMemType::MTYPE_OTHER, "Other", &red0 }, -}; -static const int MTV_DISPLAY_NUM = LL_ARRAY_SIZE(mtv_display_table); + /* + LLAllocator & alloc = LLAppViewer::instance()->getAllocator(); + if(alloc.isProfiling()) { + std::string profile_text = alloc.getRawProfile(); + + boost::algorithm::split(mLines, profile_text, boost::bind(std::equal_to(), '\n', _1)); + } else { + mLines.clear(); + } + */ + if (mAlloc == NULL) { + mAlloc = &LLAppViewer::instance()->getAllocator(); + } + + mLines.clear(); + + if(mAlloc->isProfiling()) + { + const LLAllocatorHeapProfile &prof = mAlloc->getProfile(); + for(size_t i = 0; i < prof.mLines.size(); ++i) + { + std::stringstream ss; + ss << "Unfreed Mem: " << (prof.mLines[i].mLiveSize >> 20) << " M Trace: "; + for(size_t k = 0; k < prof.mLines[i].mTrace.size(); ++k) + { + ss << LLMemType::getNameFromID(prof.mLines[i].mTrace[k]) << " "; + } + mLines.push_back(utf8string_to_wstring(ss.str())); + } + } +} void LLMemoryView::draw() { - std::string tdesc; - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); + const S32 UPDATE_INTERVAL = 60; + const S32 MARGIN_AMT = 10; + static S32 curUpdate = UPDATE_INTERVAL; + static LLCachedControl s_console_color(gSavedSkinSettings, "ConsoleBackground", LLColor4U::black); + + // setup update interval + if (curUpdate >= UPDATE_INTERVAL) + { + refreshProfile(); + curUpdate = 0; + } + curUpdate++; + + // setup window properly + S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); + S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.9f); + setRect(LLRect().setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height)); + // setup window color + F32 console_opacity = llclamp(gSavedSettings.getF32("ConsoleBackgroundOpacity"), 0.f, 1.f); + LLColor4 color = s_console_color; + color.mV[VALPHA] *= console_opacity; + LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(0, height, width, 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_rect_2d(0, height, width, 0, color); + LLFontGL * font = LLFontGL::getFontSansSerifSmall(); + + // draw remaining lines + F32 y_pos = 0.f; + F32 y_off = 0.f; + + F32 line_height = font->getLineHeight(); + S32 target_width = width - 2 * MARGIN_AMT; + + // cut off lines on bottom + U32 max_lines = U32((height - 2 * line_height) / line_height); + std::vector::const_iterator end = mLines.end(); + if(mLines.size() > max_lines) { + end = mLines.begin() + max_lines; + } + + y_pos = height - MARGIN_AMT - line_height; + y_off = 0.f; + for (std::vector::const_iterator i = mLines.begin(); i != end; ++i) + { + font->render(*i, 0, MARGIN_AMT, y_pos - y_off, + LLColor4::white, + LLFontGL::LEFT, + LLFontGL::BASELINE, + LLFontGL::NORMAL, + LLFontGL::DROP_SHADOW, + S32_MAX, + target_width + ); + y_off += line_height; + } + #if MEM_TRACK_TYPE S32 left, top, right, bottom; @@ -267,40 +292,3 @@ void LLMemoryView::draw() LLView::draw(); } - -void LLMemoryView::setDataDumpInterval(float delay) -{ - mDelay = delay; -} - -void LLMemoryView::dumpData() -{ -#if MEM_TRACK_TYPE && MEM_DUMP_DATA - if (mDelay && (mDumpTimer.getElapsedTimeF32() > mDelay )) - { - // reset timer - mDumpTimer.reset(); - // append dump info to text file - LLFILE *dump = LLFile::fopen("memusagedump.txt", "a"); - - if (dump) - { - // write out total memory usage - fprintf (dump, "Total memory in use = %09d (%03d MB)\n", LLMemType::sTotalMem, LLMemType::sTotalMem>>20); - fprintf (dump, "High Water Mark = %09d (%03d MB)\n\n", LLMemType::sMaxTotalMem, LLMemType::sMaxTotalMem>>20); - // dump out usage of 'new' for each memory type - for (S32 i=0; i>20, LLMemType::sMaxMemCount[i], LLMemType::sMaxMemCount[i]>>20, LLMemType::sNewCount[i]); - fprintf (dump, "%s\n", outData.c_str()); - } - } - fprintf (dump, "\n\n"); - - fclose(dump); - } - } -#endif -} diff --git a/indra/newview/llmemoryview.h b/indra/newview/llmemoryview.h index 81466bd6b0..774a52b88b 100644 --- a/indra/newview/llmemoryview.h +++ b/indra/newview/llmemoryview.h @@ -35,10 +35,20 @@ #include "llview.h" +class LLAllocator; + class LLMemoryView : public LLView { public: - LLMemoryView(const std::string& name, const LLRect& rect); + struct Params : public LLInitParam::Block + { + Params() + { + mouse_opaque = true; + visible = false; + } + }; + LLMemoryView(const LLMemoryView::Params&); virtual ~LLMemoryView(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -46,14 +56,12 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual void draw(); -private: - void setDataDumpInterval(float delay); - void dumpData(); - - float mDelay; - LLFrameTimer mDumpTimer; + void refreshProfile(); private: + std::vector mLines; + LLAllocator* mAlloc; + }; #endif diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index ac77a920a5..80bc2ad861 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -35,6 +35,7 @@ #include "llmenucommands.h" #include "imageids.h" +#include "llfloaterreg.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -48,7 +49,6 @@ #include "llfirstuse.h" #include "llfloaterchat.h" #include "llfloaterdirectory.h" -#include "llfloatermap.h" #include "llfloaterworldmap.h" #include "llgivemoney.h" #include "llinventoryview.h" @@ -67,14 +67,7 @@ #include "llworld.h" #include "llworldmap.h" #include "llfocusmgr.h" - -void handle_track_avatar(const LLUUID& agent_id, const std::string& name) -{ - LLAvatarTracker::instance().track(agent_id, name); - - LLFloaterDirectory::hide(NULL); - LLFloaterWorldMap::show(NULL, TRUE); -} +#include "llbottomtray.h" void handle_pay_by_id(const LLUUID& agent_id) { @@ -88,43 +81,11 @@ void handle_mouselook(void*) } -void handle_map(void*) -{ - LLFloaterWorldMap::toggle(NULL); -} - -void handle_mini_map(void*) -{ - LLFloaterMap::toggleInstance(); -} - - -void handle_find(void*) -{ - LLFloaterDirectory::toggleFind(NULL); -} - - -void handle_events(void*) -{ - LLFloaterDirectory::toggleEvents(NULL); -} - - -void handle_inventory(void*) -{ - // We're using the inventory, possibly for the - // first time. - LLFirstUse::useInventory(); - - LLInventoryView::toggleVisibility(NULL); -} - - void handle_chat(void*) { // give focus to chatbar if it's open but not focused - if (gSavedSettings.getBOOL("ChatVisible") && gFocusMgr.childHasKeyboardFocus(gChatBar)) + if (gSavedSettings.getBOOL("ChatVisible") && gFocusMgr.childHasKeyboardFocus( + LLBottomTray::getInstance()->getChatBox())) { LLChatBar::stopChat(); } diff --git a/indra/newview/llmenucommands.h b/indra/newview/llmenucommands.h index 03f7a2571c..368c6fe752 100644 --- a/indra/newview/llmenucommands.h +++ b/indra/newview/llmenucommands.h @@ -35,14 +35,8 @@ class LLUUID; -void handle_track_avatar(const LLUUID& agent_id, const std::string& name); void handle_pay_by_id(const LLUUID& agent_id); void handle_mouselook(void*); -void handle_map(void*); -void handle_mini_map(void*); -void handle_find(void*); -void handle_events(void*); -void handle_inventory(void*); void handle_chat(void*); void handle_return_key(void*); void handle_slash_key(void*); diff --git a/indra/newview/llmetricperformancetester.cpp b/indra/newview/llmetricperformancetester.cpp new file mode 100644 index 0000000000..93288c98d7 --- /dev/null +++ b/indra/newview/llmetricperformancetester.cpp @@ -0,0 +1,258 @@ +/** + * @file llmetricperformancetester.cpp + * @brief LLMetricPerformanceTester class implementation + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "indra_constants.h" +#include "llerror.h" +#include "llmath.h" +#include "llfontgl.h" +#include "llsdserialize.h" +#include "llstat.h" +#include "lltreeiterators.h" +#include "llmetricperformancetester.h" + +LLMetricPerformanceTester::name_tester_map_t LLMetricPerformanceTester::sTesterMap ; + +//static +void LLMetricPerformanceTester::initClass() +{ +} +//static +void LLMetricPerformanceTester::cleanClass() +{ + for(name_tester_map_t::iterator iter = sTesterMap.begin() ; iter != sTesterMap.end() ; ++iter) + { + delete iter->second ; + } + sTesterMap.clear() ; +} + +//static +void LLMetricPerformanceTester::addTester(LLMetricPerformanceTester* tester) +{ + if(!tester) + { + llerrs << "invalid tester!" << llendl ; + return ; + } + + std::string name = tester->getName() ; + if(getTester(name)) + { + llerrs << "Tester name is used by some other tester: " << name << llendl ; + return ; + } + + sTesterMap.insert(std::make_pair(name, tester)); + + return ; +} + +//static +LLMetricPerformanceTester* LLMetricPerformanceTester::getTester(std::string label) +{ + name_tester_map_t::iterator found_it = sTesterMap.find(label) ; + if(found_it != sTesterMap.end()) + { + return found_it->second ; + } + + return NULL ; +} + +LLMetricPerformanceTester::LLMetricPerformanceTester(std::string name, BOOL use_default_performance_analysis) + : mName(name), + mBaseSessionp(NULL), + mCurrentSessionp(NULL), + mCount(0), + mUseDefaultPerformanceAnalysis(use_default_performance_analysis) +{ + if(mName == std::string()) + { + llerrs << "invalid name." << llendl ; + } + + LLMetricPerformanceTester::addTester(this) ; +} + +/*virtual*/ +LLMetricPerformanceTester::~LLMetricPerformanceTester() +{ + if(mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if(mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } +} + +void LLMetricPerformanceTester::incLabel() +{ + mCurLabel = llformat("%s-%d", mName.c_str(), mCount++) ; +} +void LLMetricPerformanceTester::preOutputTestResults(LLSD* sd) +{ + incLabel() ; + (*sd)[mCurLabel]["Name"] = mName ; +} +void LLMetricPerformanceTester::postOutputTestResults(LLSD* sd) +{ + LLMutexLock lock(LLFastTimer::sLogLock); + LLFastTimer::sLogQueue.push((*sd)); +} + +void LLMetricPerformanceTester::outputTestResults() +{ + LLSD sd ; + preOutputTestResults(&sd) ; + + outputTestRecord(&sd) ; + + postOutputTestResults(&sd) ; +} + +void LLMetricPerformanceTester::addMetricString(std::string str) +{ + mMetricStrings.push_back(str) ; +} + +const std::string& LLMetricPerformanceTester::getMetricString(U32 index) const +{ + return mMetricStrings[index] ; +} + +void LLMetricPerformanceTester::prePerformanceAnalysis() +{ + mCount = 0 ; + incLabel() ; +} + +// +//default analyzing the performance +// +/*virtual*/ +void LLMetricPerformanceTester::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) +{ + if(mUseDefaultPerformanceAnalysis)//use default performance analysis + { + prePerformanceAnalysis() ; + + BOOL in_base = (*base).has(mCurLabel) ; + BOOL in_current = (*current).has(mCurLabel) ; + + while(in_base || in_current) + { + LLSD::String label = mCurLabel ; + + if(in_base && in_current) + { + *os << llformat("%s\n", label.c_str()) ; + + for(U32 index = 0 ; index < mMetricStrings.size() ; index++) + { + switch((*current)[label][ mMetricStrings[index] ].type()) + { + case LLSD::TypeInteger: + compareTestResults(os, mMetricStrings[index], + (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; + break ; + case LLSD::TypeReal: + compareTestResults(os, mMetricStrings[index], + (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; + break; + default: + llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; + } + } + } + + incLabel() ; + in_base = (*base).has(mCurLabel) ; + in_current = (*current).has(mCurLabel) ; + } + }//end of default + else + { + //load the base session + prePerformanceAnalysis() ; + mBaseSessionp = loadTestSession(base) ; + + //load the current session + prePerformanceAnalysis() ; + mCurrentSessionp = loadTestSession(current) ; + + if(!mBaseSessionp || !mCurrentSessionp) + { + llerrs << "memory error during loading test sessions." << llendl ; + } + + //compare + compareTestSessions(os) ; + + //release memory + if(mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if(mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } + } +} + +//virtual +void LLMetricPerformanceTester::compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) +{ + *os << llformat(" ,%s, %d, %d, %d, %.4f\n", metric_string.c_str(), v_base, v_current, + v_current - v_base, (v_base != 0) ? 100.f * v_current / v_base : 0) ; +} + +//virtual +void LLMetricPerformanceTester::compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) +{ + *os << llformat(" ,%s, %.4f, %.4f, %.4f, %.4f\n", metric_string.c_str(), v_base, v_current, + v_current - v_base, (fabs(v_base) > 0.0001f) ? 100.f * v_current / v_base : 0.f ) ; +} + +//virtual +LLMetricPerformanceTester::LLTestSession::~LLTestSession() +{ +} + diff --git a/indra/newview/llmetricperformancetester.h b/indra/newview/llmetricperformancetester.h new file mode 100644 index 0000000000..ab5ccaeb8e --- /dev/null +++ b/indra/newview/llmetricperformancetester.h @@ -0,0 +1,159 @@ +/** + * @file LLMetricPerformanceTester.h + * @brief LLMetricPerformanceTester class definition + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_METRICPERFORMANCETESTER_H +#define LL_METRICPERFORMANCETESTER_H + +class LLMetricPerformanceTester +{ +public: + // + //name passed to the constructor is a unique string for each tester. + //an error is reported if the name is already used by some other tester. + // + LLMetricPerformanceTester(std::string name, BOOL use_default_performance_analysis) ; + virtual ~LLMetricPerformanceTester(); + + // + //return the name of the tester + // + std::string getName() const { return mName ;} + // + //return the number of the test metrics in this tester + // + S32 getNumOfMetricStrings() const { return mMetricStrings.size() ;} + // + //return the metric string at the index + // + const std::string& getMetricString(U32 index) const ; + + // + //this function to compare the test results. + //by default, it compares the test results against the baseline one by one, item by item, + //in the increasing order of the LLSD label counter, starting from the first one. + //you can define your own way to analyze performance by passing FALSE to "use_default_performance_analysis", + //and implement two abstract virtual functions below: loadTestSession(...) and compareTestSessions(...). + // + void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; + +protected: + // + //insert metric strings used in the tester. + // + void addMetricString(std::string str) ; + + // + //increase LLSD label by 1 + // + void incLabel() ; + + // + //the function to write a set of test results to the log LLSD. + // + void outputTestResults() ; + + // + //compare the test results. + //you can write your own to overwrite the default one. + // + virtual void compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) ; + virtual void compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) ; + + // + //for performance analysis use + //it defines an interface for the two abstract virtual functions loadTestSession(...) and compareTestSessions(...). + //please make your own test session class derived from it. + // + class LLTestSession + { + public: + virtual ~LLTestSession() ; + }; + + // + //load a test session for log LLSD + //you need to implement it only when you define your own way to analyze performance. + //otherwise leave it empty. + // + virtual LLMetricPerformanceTester::LLTestSession* loadTestSession(LLSD* log) = 0 ; + // + //compare the base session and the target session + //you need to implement it only when you define your own way to analyze performance. + //otherwise leave it empty. + // + virtual void compareTestSessions(std::ofstream* os) = 0 ; + // + //the function to write a set of test results to the log LLSD. + //you have to write you own version of this function. + // + virtual void outputTestRecord(LLSD* sd) = 0 ; + +private: + void preOutputTestResults(LLSD* sd) ; + void postOutputTestResults(LLSD* sd) ; + void prePerformanceAnalysis() ; + +protected: + // + //the unique name string of the tester + // + std::string mName ; + // + //the current label counter for the log LLSD + // + std::string mCurLabel ; + S32 mCount ; + + BOOL mUseDefaultPerformanceAnalysis ; + LLTestSession* mBaseSessionp ; + LLTestSession* mCurrentSessionp ; + + //metrics strings + std::vector< std::string > mMetricStrings ; + +//static members +private: + static void addTester(LLMetricPerformanceTester* tester) ; + +public: + typedef std::map< std::string, LLMetricPerformanceTester* > name_tester_map_t; + static name_tester_map_t sTesterMap ; + + static LLMetricPerformanceTester* getTester(std::string label) ; + static BOOL hasMetricPerformanceTesters() {return !sTesterMap.empty() ;} + + static void initClass() ; + static void cleanClass() ; +}; + +#endif + diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index 18fd20d12a..f562e45770 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -47,7 +47,7 @@ #include "lltoolmgr.h" #include "lltoolmorph.h" #include "llviewercamera.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llviewerwindow.h" #include "pipeline.h" @@ -67,9 +67,8 @@ const F32 CAMERA_DIST_STEP = 1.5f; //----------------------------------------------------------------------------- // LLMorphView() //----------------------------------------------------------------------------- -LLMorphView::LLMorphView(const std::string& name, const LLRect& rect) - : - LLView(name, rect, FALSE, FOLLOWS_ALL), +LLMorphView::LLMorphView(const LLMorphView::Params& p) +: LLView(p), mCameraTargetJoint( NULL ), mCameraOffset(-0.5f, 0.05f, 0.07f ), mCameraTargetOffset(0.f, 0.f, 0.05f ), @@ -78,8 +77,7 @@ LLMorphView::LLMorphView(const std::string& name, const LLRect& rect) mCameraYaw( 0.f ), mCameraDist( -1.f ), mCameraDrivenByKeys( FALSE ) -{ -} +{} //----------------------------------------------------------------------------- // initialize() @@ -110,7 +108,7 @@ void LLMorphView::initialize() //----------------------------------------------------------------------------- void LLMorphView::shutdown() { - LLVOAvatar::onCustomizeEnd(); + LLVOAvatarSelf::onCustomizeEnd(); LLVOAvatar *avatarp = gAgent.getAvatarObject(); if(avatarp && !avatarp->isDead()) @@ -137,7 +135,7 @@ void LLMorphView::setVisible(BOOL visible) llassert( !gFloaterCustomize ); gFloaterCustomize = new LLFloaterCustomize(); gFloaterCustomize->fetchInventory(); - gFloaterCustomize->open(); /*Flawfinder: ignore*/ + gFloaterCustomize->openFloater(); // Must do this _after_ gFloaterView is initialized. gFloaterCustomize->switchToDefaultSubpart(); diff --git a/indra/newview/llmorphview.h b/indra/newview/llmorphview.h index 1dd8ef7a5f..493f906c6b 100644 --- a/indra/newview/llmorphview.h +++ b/indra/newview/llmorphview.h @@ -43,7 +43,15 @@ class LLFloaterCustomize; class LLMorphView : public LLView { public: - LLMorphView(const std::string& name, const LLRect& rect); + struct Params : public LLInitParam::Block + { + Params() + { + mouse_opaque(false); + follows.flags(FOLLOWS_ALL); + } + }; + LLMorphView(const LLMorphView::Params&); void initialize(); void shutdown(); diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index a180047875..36ec2c779a 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -59,13 +59,28 @@ const F32 NUDGE_TIME = 0.25f; // in seconds // protected LLFloaterMove::LLFloaterMove(const LLSD& key) -: LLFloater(std::string("move floater")) +: LLFloater() { setIsChrome(TRUE); const BOOL DONT_OPEN = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_moveview.xml", NULL, DONT_OPEN); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_moveview.xml", DONT_OPEN); +} + +// virtual +void LLFloaterMove::onClose(bool app_quitting) +{ + destroy(); + + if (!app_quitting) + { + gSavedSettings.setBOOL("ShowMovementControls", FALSE); + } +} +// virtual +BOOL LLFloaterMove::postBuild() +{ mForwardButton = getChild("forward btn"); mForwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); @@ -80,41 +95,29 @@ LLFloaterMove::LLFloaterMove(const LLSD& key) mTurnLeftButton = getChild("turn left btn"); mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mTurnLeftButton->setHeldDownCallback( turnLeft ); + mTurnLeftButton->setHeldDownCallback( turnLeft, NULL ); mTurnRightButton = getChild("turn right btn"); mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mTurnRightButton->setHeldDownCallback( turnRight ); + mTurnRightButton->setHeldDownCallback( turnRight, NULL ); mMoveUpButton = getChild("move up btn"); childSetAction("move up btn",moveUp,NULL); mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mMoveUpButton->setHeldDownCallback( moveUp ); + mMoveUpButton->setHeldDownCallback( moveUp, NULL ); mMoveDownButton = getChild("move down btn"); childSetAction("move down btn",moveDown,NULL); mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mMoveDownButton->setHeldDownCallback( moveDown ); -} - -// virtual -void LLFloaterMove::onClose(bool app_quitting) -{ - LLFloater::onClose(app_quitting); - - if (!app_quitting) - { - gSavedSettings.setBOOL("ShowMovementControls", FALSE); - } + mMoveDownButton->setHeldDownCallback( moveDown, NULL ); + return TRUE; } - // // Static member functions // -void LLFloaterMove::onOpen() +void LLFloaterMove::onOpen(const LLSD& key) { - LLFloater::onOpen(); gSavedSettings.setBOOL("ShowMovementControls", TRUE); } diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h index e772551efe..8d7cdc881d 100644 --- a/indra/newview/llmoveview.h +++ b/indra/newview/llmoveview.h @@ -54,9 +54,9 @@ protected: ~LLFloaterMove() {} public: - /*virtual*/ void onOpen(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); - + /*virtual*/ BOOL postBuild(); static F32 getYawRate(F32 time); protected: diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 40b1c64146..b47d6f4214 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -71,6 +71,7 @@ #include "lluistring.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" +#include "lltrans.h" namespace { @@ -111,11 +112,6 @@ static LLDispatchEmptyMuteList sDispatchEmptyMuteList; //----------------------------------------------------------------------------- // LLMute() //----------------------------------------------------------------------------- -const char BY_NAME_SUFFIX[] = " (by name)"; -const char AGENT_SUFFIX[] = " (resident)"; -const char OBJECT_SUFFIX[] = " (object)"; -const char GROUP_SUFFIX[] = " (group)"; - LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) : mID(id), @@ -149,16 +145,16 @@ std::string LLMute::getDisplayName() const { case BY_NAME: default: - name_with_suffix += BY_NAME_SUFFIX; + name_with_suffix += " " + LLTrans::getString("MuteByName"); break; case AGENT: - name_with_suffix += AGENT_SUFFIX; + name_with_suffix += " " + LLTrans::getString("MuteAgent"); break; case OBJECT: - name_with_suffix += OBJECT_SUFFIX; + name_with_suffix += " " + LLTrans::getString("MuteObject"); break; case GROUP: - name_with_suffix += GROUP_SUFFIX; + name_with_suffix += " " + LLTrans::getString("MuteGroup"); break; } return name_with_suffix; @@ -169,7 +165,7 @@ void LLMute::setFromDisplayName(const std::string& display_name) size_t pos = 0; mName = display_name; - pos = mName.rfind(GROUP_SUFFIX); + pos = mName.rfind(" " + LLTrans::getString("MuteGroup")); if (pos != std::string::npos) { mName.erase(pos); @@ -177,7 +173,7 @@ void LLMute::setFromDisplayName(const std::string& display_name) return; } - pos = mName.rfind(OBJECT_SUFFIX); + pos = mName.rfind(" " + LLTrans::getString("MuteObject")); if (pos != std::string::npos) { mName.erase(pos); @@ -185,7 +181,7 @@ void LLMute::setFromDisplayName(const std::string& display_name) return; } - pos = mName.rfind(AGENT_SUFFIX); + pos = mName.rfind(" " + LLTrans::getString("MuteAgent")); if (pos != std::string::npos) { mName.erase(pos); @@ -193,7 +189,7 @@ void LLMute::setFromDisplayName(const std::string& display_name) return; } - pos = mName.rfind(BY_NAME_SUFFIX); + pos = mName.rfind(" " + LLTrans::getString("MuteByName")); if (pos != std::string::npos) { mName.erase(pos); @@ -501,11 +497,8 @@ void LLMuteList::updateRemove(const LLMute& mute) gAgent.sendReliableMessage(); } -void notify_automute_callback(const LLUUID& agent_id, const std::string& first_name, const std::string& last_name, BOOL is_group, void* user_data) +void notify_automute_callback(const LLUUID& agent_id, const std::string& first_name, const std::string& last_name, BOOL is_group, LLMuteList::EAutoReason reason) { - U32 temp_data = (U32) (uintptr_t) user_data; - LLMuteList::EAutoReason reason = (LLMuteList::EAutoReason)temp_data; - std::string notif_name; switch (reason) { @@ -561,18 +554,18 @@ BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, co if (gCacheName->getName(agent_id, cache_first, cache_last)) { // name in cache, call callback directly - notify_automute_callback(agent_id, cache_first, cache_last, FALSE, (void *)reason); + notify_automute_callback(agent_id, cache_first, cache_last, FALSE, reason); } else { // not in cache, lookup name from cache - gCacheName->get(agent_id, FALSE, notify_automute_callback, (void *)reason); + gCacheName->get(agent_id, FALSE, boost::bind(¬ify_automute_callback, _1, _2, _3, _4, reason)); } } else { // call callback directly - notify_automute_callback(agent_id, first_name, last_name, FALSE, (void *)reason); + notify_automute_callback(agent_id, first_name, last_name, FALSE, reason); } } diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 98c7a4b631..b85c1c759d 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -46,20 +46,15 @@ // statics std::set LLNameBox::sInstances; +static LLDefaultWidgetRegistry::Register r("name_box"); -LLNameBox::LLNameBox(const std::string& name, const LLRect& rect, const LLUUID& name_id, BOOL is_group, const LLFontGL* font, BOOL mouse_opaque) -: LLTextBox(name, rect, std::string("(retrieving)"), font, mouse_opaque), - mNameID(name_id) + +LLNameBox::LLNameBox(const Params& p) +: LLTextBox(p) { + mNameID = LLUUID::null; LLNameBox::sInstances.insert(this); - if(!name_id.isNull()) - { - setNameID(name_id, is_group); - } - else - { - setText(LLStringUtil::null); - } + setText(LLStringUtil::null); } LLNameBox::~LLNameBox() diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index f76850bd3c..3edb36883f 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -44,10 +44,15 @@ class LLNameBox : public LLTextBox { public: - LLNameBox(const std::string& name, const LLRect& rect, const LLUUID& name_id = LLUUID::null, BOOL is_group = FALSE, const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); - // By default, follows top and left and is mouse-opaque. - // If no text, text = name. - // If no font, uses default system font. + struct Params : public LLInitParam::Block + { + Optional is_group; + + Params() + : is_group("is_group", false) + {} + }; + virtual ~LLNameBox(); void setNameID(const LLUUID& name_id, BOOL is_group); @@ -57,6 +62,10 @@ public: static void refreshAll(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group); +protected: + LLNameBox (const Params&); + + friend class LLUICtrlFactory; private: static std::set sInstances; diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index e4a65734d8..7f9ba8ba5a 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -43,40 +43,22 @@ #include "llstring.h" #include "llui.h" -static LLRegisterWidget r("name_editor"); +static LLDefaultWidgetRegistry::Register r("name_editor"); // statics std::set LLNameEditor::sInstances; -LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, - const LLUUID& name_id, - BOOL is_group, - const LLFontGL* glfont, - S32 max_text_length, - void (*commit_callback)(LLUICtrl* caller, void* user_data), - void (*keystroke_callback)(LLLineEditor* caller, void* user_data), - void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data), - void* userdata, - LLLinePrevalidateFunc prevalidate_func) -: LLLineEditor(name, rect, - std::string("(retrieving)"), - glfont, - max_text_length, - commit_callback, - keystroke_callback, - focus_lost_callback, - userdata, - prevalidate_func), - mNameID(name_id) +LLNameEditor::LLNameEditor(const LLNameEditor::Params& p) +: LLLineEditor(p) { LLNameEditor::sInstances.insert(this); - if(!name_id.isNull()) + + if(!p.name_id().isNull()) { - setNameID(name_id, is_group); + setNameID(p.name_id, p.is_group); } } - LLNameEditor::~LLNameEditor() { LLNameEditor::sInstances.erase(this); @@ -141,35 +123,3 @@ LLSD LLNameEditor::getValue() const return LLSD(mNameID); } -LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("name_editor"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - S32 max_text_length = 128; - node->getAttributeS32("max_length", max_text_length); - - LLFontGL* font = LLView::selectFont(node); - - LLUICtrlCallback commit_callback = NULL; - - LLNameEditor* line_editor = new LLNameEditor(name, - rect, - LLUUID::null, FALSE, - font, - max_text_length, - commit_callback); - - std::string label; - if(node->getAttributeString("label", label)) - { - line_editor->setLabel(label); - } - line_editor->setColorParameters(node); - line_editor->initFromXML(node, parent); - - return line_editor; -} diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index bc5a67866c..f9cabb5831 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -46,24 +46,18 @@ class LLNameEditor : public LLLineEditor { public: - LLNameEditor(const std::string& name, const LLRect& rect, - const LLUUID& name_id = LLUUID::null, - BOOL is_group = FALSE, - const LLFontGL* glfont = NULL, - S32 max_text_length = 254, - void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, - void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, - void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data) = NULL, - void* userdata = NULL, - LLLinePrevalidateFunc prevalidate_func = NULL); - // By default, follows top and left and is mouse-opaque. - // If no text, text = name. - // If no font, uses default system font. - + struct Params : public LLInitParam::Block + { + Optional is_group; + Optional name_id; + }; + +protected: + LLNameEditor(const Params&); + friend class LLUICtrlFactory; +public: virtual ~LLNameEditor(); - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - void setNameID(const LLUUID& name_id, BOOL is_group); void refresh(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index baf06567c1..722113928b 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -39,51 +39,46 @@ #include "llcachename.h" #include "llagent.h" #include "llinventory.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" +#include "llscrolllistcolumn.h" +#include "llsdparam.h" -static LLRegisterWidget r("name_list"); - -// statics -std::set LLNameListCtrl::sInstances; - -LLNameListCtrl::LLNameListCtrl(const std::string& name, - const LLRect& rect, - LLUICtrlCallback cb, - void* userdata, - BOOL allow_multiple_selection, - BOOL draw_border, - S32 name_column_index, - const std::string& tooltip) -: LLScrollListCtrl(name, rect, cb, userdata, allow_multiple_selection, - draw_border), - mNameColumnIndex(name_column_index), - mAllowCallingCardDrop(FALSE) +static LLDefaultWidgetRegistry::Register r("name_list"); + +void LLNameListCtrl::NameTypeNames::declareValues() { - setToolTip(tooltip); - LLNameListCtrl::sInstances.insert(this); + declare("INDIVIDUAL", LLNameListCtrl::INDIVIDUAL); + declare("GROUP", LLNameListCtrl::GROUP); + declare("SPECIAL", LLNameListCtrl::SPECIAL); } - -// virtual -LLNameListCtrl::~LLNameListCtrl() +LLNameListCtrl::Params::Params() +: name_column(""), + allow_calling_card_drop("allow_calling_card_drop", false) { - LLNameListCtrl::sInstances.erase(this); + name = "name_list"; } +LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) +: LLScrollListCtrl(p), + mAllowCallingCardDrop(p.allow_calling_card_drop), + mNameColumn(p.name_column.column_name), + mNameColumnIndex(p.name_column.column_index) +{} // public -BOOL LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, +void LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, BOOL enabled, std::string& suffix) { //llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl; std::string fullname; - BOOL result = gCacheName->getFullName(agent_id, fullname); + gCacheName->getFullName(agent_id, fullname); fullname.append(suffix); addStringUUIDItem(fullname, agent_id, pos, enabled); - - return result; } // virtual, public @@ -138,75 +133,70 @@ BOOL LLNameListCtrl::handleDragAndDrop( void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos, BOOL enabled) { - //llinfos << "LLNameListCtrl::addGroupNameItem " << group_id << llendl; - std::string group_name; - gCacheName->getGroupName(group_id, group_name); - addStringUUIDItem(group_name, group_id, pos, enabled); + NameItem item; + item.value = group_id; + item.enabled = enabled; + item.target = GROUP; + + addRow(item, pos); } // public -void LLNameListCtrl::addGroupNameItem(LLScrollListItem* item, EAddPosition pos) - +void LLNameListCtrl::addGroupNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos) { - //llinfos << "LLNameListCtrl::addGroupNameItem " << item->getUUID() << llendl; - - std::string group_name; - gCacheName->getGroupName(item->getUUID(), group_name); - - LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); - ((LLScrollListText*)cell)->setText( std::string(group_name) ); - - addItem(item, pos); + item.target = GROUP; + addRow(item, pos); } -BOOL LLNameListCtrl::addNameItem(LLScrollListItem* item, EAddPosition pos) +void LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos) { - //llinfos << "LLNameListCtrl::addNameItem " << item->getUUID() << llendl; - - std::string fullname; - BOOL result = gCacheName->getFullName(item->getUUID(), fullname); - - LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); - ((LLScrollListText*)cell)->setText( fullname ); - - addItem(item, pos); - - // this column is resizable - LLScrollListColumn* columnp = getColumn(mNameColumnIndex); - if (columnp && columnp->mHeader) - { - columnp->mHeader->setHasResizableElement(TRUE); - } + item.target = INDIVIDUAL; + addRow(item, pos); +} - return result; +LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata) +{ + LLNameListCtrl::NameItem item_params; + LLParamSDParser::instance().readSD(element, item_params); + item_params.userdata = userdata; + return addRow(item_params, pos); } -LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos, void* userdata) + +LLScrollListItem* LLNameListCtrl::addRow(const LLNameListCtrl::NameItem& name_item, EAddPosition pos) { - LLScrollListItem* item = LLScrollListCtrl::addElement(value, pos, userdata); + LLScrollListItem* item = LLScrollListCtrl::addRow(name_item, pos); + if (!item) return NULL; // use supplied name by default - std::string fullname = value["name"].asString(); - if (value["target"].asString() == "GROUP") + std::string fullname = name_item.display_name; + switch(name_item.target) { - gCacheName->getGroupName(item->getUUID(), fullname); + case GROUP: + gCacheName->getGroupName(name_item.value().asUUID(), fullname); // fullname will be "nobody" if group not found - } - else if (value["target"].asString() == "SPECIAL") - { + break; + case SPECIAL: // just use supplied name - } - else // normal resident - { - std::string name; - if (gCacheName->getFullName(item->getUUID(), name)) + break; + case INDIVIDUAL: { - fullname = name; + std::string name; + if (gCacheName->getFullName(name_item.value().asUUID(), name)) + { + fullname = name; + } + break; } + default: + break; } - LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); - ((LLScrollListText*)cell)->setText( fullname ); + LLScrollListCell* cell = item->getColumn(mNameColumnIndex); + if (cell) + { + cell->setValue(fullname); + } dirtyColumns(); @@ -259,9 +249,11 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, if (item->getUUID() == id) { LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(0); - cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); - - ((LLScrollListText*)cell)->setText( fullname ); + cell = item->getColumn(mNameColumnIndex); + if (cell) + { + cell->setValue(fullname); + } } } @@ -273,186 +265,24 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first, void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) { - std::set::iterator it; - for (it = LLNameListCtrl::sInstances.begin(); - it != LLNameListCtrl::sInstances.end(); - ++it) + LLInstanceTracker::instance_iter it; + for (it = beginInstances(); it != endInstances(); ++it) { LLNameListCtrl* ctrl = *it; ctrl->refresh(id, first, last, is_group); } } -// virtual -LLXMLNodePtr LLNameListCtrl::getXML(bool save_children) const +void LLNameListCtrl::updateColumns() { - LLXMLNodePtr node = LLScrollListCtrl::getXML(); - - node->createChild("allow_calling_card_drop", TRUE)->setBoolValue(mAllowCallingCardDrop); - - if (mNameColumnIndex != 0) - { - node->createChild("name_column_index", TRUE)->setIntValue(mNameColumnIndex); - } - - // Don't save contents, probably filled by code - - return node; -} - -LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("name_list"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - BOOL multi_select = FALSE; - node->getAttributeBOOL("multi_select", multi_select); - - BOOL draw_border = TRUE; - node->getAttributeBOOL("draw_border", draw_border); - - BOOL draw_heading = FALSE; - node->getAttributeBOOL("draw_heading", draw_heading); - - S32 name_column_index = 0; - node->getAttributeS32("name_column_index", name_column_index); + LLScrollListCtrl::updateColumns(); - LLUICtrlCallback callback = NULL; - - LLNameListCtrl* name_list = new LLNameListCtrl(name, - rect, - callback, - NULL, - multi_select, - draw_border, - name_column_index); - - name_list->setDisplayHeading(draw_heading); - if (node->hasAttribute("heading_height")) - { - S32 heading_height; - node->getAttributeS32("heading_height", heading_height); - name_list->setHeadingHeight(heading_height); - } - - BOOL allow_calling_card_drop = FALSE; - if (node->getAttributeBOOL("allow_calling_card_drop", allow_calling_card_drop)) - { - name_list->setAllowCallingCardDrop(allow_calling_card_drop); - } - - name_list->setScrollListParameters(node); - - name_list->initFromXML(node, parent); - - LLSD columns; - S32 index = 0; - //S32 total_static = 0; - LLXMLNodePtr child; - for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) - { - if (child->hasName("column")) - { - std::string labelname(""); - child->getAttributeString("label", labelname); - - std::string columnname(labelname); - child->getAttributeString("name", columnname); - - BOOL columndynamicwidth = FALSE; - child->getAttributeBOOL("dynamicwidth", columndynamicwidth); - - std::string sortname(columnname); - child->getAttributeString("sort", sortname); - - S32 columnwidth = -1; - if (child->hasAttribute("relwidth")) - { - F32 columnrelwidth = 0.f; - child->getAttributeF32("relwidth", columnrelwidth); - columns[index]["relwidth"] = columnrelwidth; - } - else - { - child->getAttributeS32("width", columnwidth); - columns[index]["width"] = columnwidth; - } - - LLFontGL::HAlign h_align = LLFontGL::LEFT; - h_align = LLView::selectFontHAlign(child); - - //if(!columndynamicwidth) total_static += llmax(0, columnwidth); - - columns[index]["name"] = columnname; - columns[index]["label"] = labelname; - columns[index]["halign"] = (S32)h_align; - columns[index]["dynamicwidth"] = columndynamicwidth; - columns[index]["sort"] = sortname; - - index++; - } - } - name_list->setColumnHeadings(columns); - - - for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) + if (!mNameColumn.empty()) { - if (child->hasName("row")) + LLScrollListColumn* name_column = getColumn(mNameColumn); + if (name_column) { - LLUUID id; - child->getAttributeUUID("id", id); - - LLSD row; - - row["id"] = id; - - S32 column_idx = 0; - LLXMLNodePtr row_child; - for (row_child = node->getFirstChild(); row_child.notNull(); row_child = row_child->getNextSibling()) - { - if (row_child->hasName("column")) - { - std::string value = row_child->getTextContents(); - - std::string columnname(""); - row_child->getAttributeString("name", columnname); - - std::string font(""); - row_child->getAttributeString("font", font); - - std::string font_style(""); - row_child->getAttributeString("font-style", font_style); - - row["columns"][column_idx]["column"] = columnname; - row["columns"][column_idx]["value"] = value; - row["columns"][column_idx]["font"] = font; - row["columns"][column_idx]["font-style"] = font_style; - column_idx++; - } - } - name_list->addElement(row); + mNameColumnIndex = name_column->mIndex; } } - - std::string contents = node->getTextContents(); - - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("\t\n"); - tokenizer tokens(contents, sep); - tokenizer::iterator token_iter = tokens.begin(); - - while(token_iter != tokens.end()) - { - const std::string& line = *token_iter; - name_list->addCommentText(line); - ++token_iter; - } - - return name_list; } - - - diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 1b7795ddff..379cd48a6a 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -39,35 +39,68 @@ class LLNameListCtrl -: public LLScrollListCtrl +: public LLScrollListCtrl, protected LLInstanceTracker { public: - LLNameListCtrl(const std::string& name, - const LLRect& rect, - LLUICtrlCallback callback, - void* userdata, - BOOL allow_multiple_selection, - BOOL draw_border = TRUE, - S32 name_column_index = 0, - const std::string& tooltip = LLStringUtil::null); - virtual ~LLNameListCtrl(); - - virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - + typedef enum e_name_type + { + INDIVIDUAL, + GROUP, + SPECIAL + } ENameType; + + // provide names for enums + struct NameTypeNames : public LLInitParam::TypeValuesHelper + { + static void declareValues(); + }; + + struct NameItem : public LLInitParam::Block + { + Optional display_name; + Optional target; + + NameItem() + : display_name("name"), + target("target", INDIVIDUAL) + {} + }; + + struct NameColumn : public LLInitParam::Choice + { + Option column_index; + Option column_name; + NameColumn() + : column_name("name_column"), + column_index("name_column_index", 0) + {} + }; + + struct Params : public LLInitParam::Block + { + Optional name_column; + Optional allow_calling_card_drop; + Params(); + }; + +protected: + LLNameListCtrl(const Params&); + friend class LLUICtrlFactory; +public: // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. - BOOL addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, + void addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, std::string& suffix = LLStringUtil::null); - BOOL addNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM); + void addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); - virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); + /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); + LLScrollListItem* addRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM); // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - void addGroupNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM); + void addGroupNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); void removeNameItem(const LLUUID& agent_id); @@ -84,10 +117,11 @@ public: void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; } + /*virtual*/ void updateColumns(); private: - static std::set sInstances; - S32 mNameColumnIndex; - BOOL mAllowCallingCardDrop; + S32 mNameColumnIndex; + std::string mNameColumn; + BOOL mAllowCallingCardDrop; }; #endif diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp new file mode 100644 index 0000000000..cf1d9a5d86 --- /dev/null +++ b/indra/newview/llnavigationbar.cpp @@ -0,0 +1,533 @@ +/** + * @file llnavigationbar.cpp + * @brief Navigation bar implementation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llnavigationbar.h" + +#include +#include +#include +#include +#include + +#include "llagent.h" +#include "llfloaterhtmlhelp.h" +#include "lllocationhistory.h" +#include "lllocationinputctrl.h" +#include "llteleporthistory.h" +#include "llslurl.h" +#include "llurlsimstring.h" +#include "llviewerinventory.h" +#include "llviewermenu.h" +#include "llviewerparcelmgr.h" +#include "llworldmap.h" + +//-- LLTeleportHistoryMenuItem ----------------------------------------------- + +/** + * Item look varies depending on the type (backward/current/forward). + */ +class LLTeleportHistoryMenuItem : public LLMenuItemCallGL +{ +public: + typedef enum e_item_type + { + TYPE_BACKWARD, + TYPE_CURRENT, + TYPE_FORWARD, + } EType; + + struct Params : public LLInitParam::Block + { + Mandatory item_type; + + Params() {} + Params(EType type, std::string title); + }; + + /*virtual*/ void draw(); + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + +private: + LLTeleportHistoryMenuItem(const Params&); + friend class LLUICtrlFactory; + + static const S32 ICON_WIDTH = 16; + static const S32 ICON_HEIGHT = 16; + static const std::string ICON_IMG_BACKWARD; + static const std::string ICON_IMG_FORWARD; + + LLIconCtrl* mArrowIcon; +}; + +const std::string LLTeleportHistoryMenuItem::ICON_IMG_BACKWARD("teleport_history_backward.tga"); +const std::string LLTeleportHistoryMenuItem::ICON_IMG_FORWARD("teleport_history_forward.tga"); + +LLTeleportHistoryMenuItem::Params::Params(EType type, std::string title) +{ + item_type(type); + font.name("SansSerif"); + + if (type == TYPE_CURRENT) + font.style("BOLD"); + else + title = " " + title; + + name(title); + label(title); +} + +LLTeleportHistoryMenuItem::LLTeleportHistoryMenuItem(const Params& p) +: LLMenuItemCallGL(p), + mArrowIcon(NULL) +{ + LLIconCtrl::Params icon_params; + icon_params.name("icon"); + icon_params.rect(LLRect(0, ICON_HEIGHT, ICON_WIDTH, 0)); + icon_params.mouse_opaque(false); + icon_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); + icon_params.tab_stop(false); + icon_params.visible(false); + + mArrowIcon = LLUICtrlFactory::create (icon_params); + + // no image for the current item + if (p.item_type == TYPE_BACKWARD) + mArrowIcon->setValue(ICON_IMG_BACKWARD); + else if (p.item_type == TYPE_FORWARD) + mArrowIcon->setValue(ICON_IMG_FORWARD); + + addChild(mArrowIcon); +} + +void LLTeleportHistoryMenuItem::draw() +{ + // Draw menu item itself. + LLMenuItemCallGL::draw(); + + // Draw children if any. *TODO: move this to LLMenuItemGL? + LLUICtrl::draw(); +} + +void LLTeleportHistoryMenuItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mArrowIcon->setVisible(TRUE); +} + +void LLTeleportHistoryMenuItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mArrowIcon->setVisible(FALSE); +} + +//-- LNavigationBar ---------------------------------------------------------- + +/* +TODO: +- Load navbar height from saved settings (as it's done for status bar) or think of a better way. +*/ + +S32 NAVIGATION_BAR_HEIGHT = 60; // *HACK +LLNavigationBar* LLNavigationBar::sInstance = 0; + +LLNavigationBar* LLNavigationBar::getInstance() +{ + if (!sInstance) + sInstance = new LLNavigationBar(); + + return sInstance; +} + +LLNavigationBar::LLNavigationBar() +: mTeleportHistoryMenu(NULL), + mLocationContextMenu(NULL), + mBtnBack(NULL), + mBtnForward(NULL), + mBtnHome(NULL), + mBtnHelp(NULL), + mCmbLocation(NULL), + mLeSearch(NULL) +{ + setIsChrome(TRUE); + + // Register callbacks and load the location field context menu (NB: the order matters). + mCommitCallbackRegistrar.add("Navbar.Action", boost::bind(&LLNavigationBar::onLocationContextMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("Navbar.EnableMenuItem", boost::bind(&LLNavigationBar::onLocationContextMenuItemEnabled, this, _2)); + + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_navigation_bar.xml"); + + // navigation bar can never get a tab + setFocusRoot(FALSE); +} + +LLNavigationBar::~LLNavigationBar() +{ + sInstance = 0; +} + +BOOL LLNavigationBar::postBuild() +{ + mBtnBack = getChild("back_btn"); + mBtnForward = getChild("forward_btn"); + mBtnHome = getChild("home_btn"); + mBtnHelp = getChild("help_btn"); + + mCmbLocation= getChild("location_combo"); + mLeSearch = getChild("search_input"); + + LLButton* search_btn = getChild("search_btn"); + + if (!mBtnBack || !mBtnForward || !mBtnHome || !mBtnHelp || + !mCmbLocation || !mLeSearch || !search_btn) + { + llwarns << "Malformed navigation bar" << llendl; + return FALSE; + } + + mBtnBack->setEnabled(FALSE); + mBtnBack->setClickedCallback(boost::bind(&LLNavigationBar::onBackButtonClicked, this)); + mBtnBack->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this, _2)); + + mBtnForward->setEnabled(FALSE); + mBtnForward->setClickedCallback(boost::bind(&LLNavigationBar::onForwardButtonClicked, this)); + mBtnForward->setHeldDownCallback(boost::bind(&LLNavigationBar::onBackOrForwardButtonHeldDown, this, _2)); + + mBtnHome->setClickedCallback(boost::bind(&LLNavigationBar::onHomeButtonClicked, this)); + mBtnHelp->setClickedCallback(boost::bind(&LLNavigationBar::onHelpButtonClicked, this)); + + mCmbLocation->setSelectionCallback(boost::bind(&LLNavigationBar::onLocationSelection, this)); + + mLeSearch->setCommitCallback(boost::bind(&LLNavigationBar::onSearchCommit, this)); + search_btn->setClickedCallback(boost::bind(&LLNavigationBar::onSearchCommit, this)); + + // Load the location field context menu + mLocationContextMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_navbar.xml", gMenuHolder); + if (!mLocationContextMenu) + { + llwarns << "Error loading navigation bar context menu" << llendl; + return FALSE; + } + + // we'll be notified on teleport history changes + LLTeleportHistory::getInstance()->setHistoryChangedCallback( + boost::bind(&LLNavigationBar::onTeleportHistoryChanged, this)); + + return TRUE; +} + +void LLNavigationBar::draw() +{ + LLPanel::draw(); +} + +BOOL LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + // *HACK. We should use mCmbLocation's right click callback instead. + + // If the location field is clicked then show its context menu. + if (mCmbLocation->getRect().pointInRect(x, y)) + { + // Pass the focus to the line editor when it is right-clicked + mCmbLocation->setFocus(TRUE); + + if (mLocationContextMenu) + { + mLocationContextMenu->buildDrawLabels(); + mLocationContextMenu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, mLocationContextMenu, x, y); + } + return TRUE; + } + return LLPanel:: handleRightMouseDown(x, y, mask); +} + +void LLNavigationBar::onBackButtonClicked() +{ + LLTeleportHistory::getInstance()->goBack(); +} + +void LLNavigationBar::onBackOrForwardButtonHeldDown(const LLSD& param) +{ + if (param["count"].asInteger() == 0) + showTeleportHistoryMenu(); +} + +void LLNavigationBar::onForwardButtonClicked() +{ + LLTeleportHistory::getInstance()->goForward(); +} + +void LLNavigationBar::onHomeButtonClicked() +{ + gAgent.teleportHome(); +} + +void LLNavigationBar::onHelpButtonClicked() +{ + gViewerHtmlHelp.show(); +} + +void LLNavigationBar::onSearchCommit() +{ + invokeSearch(mLeSearch->getText()); +} + +void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata) +{ + int idx = userdata.asInteger(); + LLTeleportHistory::getInstance()->goToItem(idx); +} + +// This is called when user presses enter in the location input +// or selects a location from the typed locations dropdown. +void LLNavigationBar::onLocationSelection() +{ + std::string typed_location = mCmbLocation->getSimple(); + + // Will not teleport to empty location. + if (typed_location.empty()) + return; + + std::string region_name; + LLVector3 local_coords(128, 128, 0); + + // Is the typed location a SLURL? + if (LLSLURL::isSLURL(typed_location)) + { + // Yes. Extract region name and local coordinates from it. + S32 x = 0, y = 0, z = 0; + if (LLURLSimString::parse(LLSLURL::stripProtocol(typed_location), ®ion_name, &x, &y, &z)) + local_coords.set(x, y, z); + else + return; + } + else + { + // Treat it as region name. + region_name = typed_location; + } + + // Resolve the region name to its global coordinates. + // If resolution succeeds we'll teleport. + LLWorldMap::url_callback_t cb = boost::bind( + &LLNavigationBar::onRegionNameResponse, this, + typed_location, region_name, local_coords, _1, _2, _3, _4); + LLWorldMap::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false); +} + +void LLNavigationBar::onTeleportHistoryChanged() +{ + // Update navigation controls. + LLTeleportHistory* h = LLTeleportHistory::getInstance(); + int cur_item = h->getCurrentItemIndex(); + mBtnBack->setEnabled(cur_item > 0); + mBtnForward->setEnabled(cur_item < ((int)h->getItems().size() - 1)); +} + +void LLNavigationBar::rebuildTeleportHistoryMenu() +{ + // Has the pop-up menu been built? + if (mTeleportHistoryMenu) + { + // Clear it. + mTeleportHistoryMenu->empty(); + } + else + { + // Create it. + LLMenuGL::Params menu_p; + menu_p.name("popup"); + menu_p.can_tear_off(false); + menu_p.visible(false); + menu_p.bg_visible(true); + menu_p.scrollable(true); + mTeleportHistoryMenu = LLUICtrlFactory::create(menu_p); + + addChild(mTeleportHistoryMenu); + } + + // Populate the menu with teleport history items. + LLTeleportHistory* hist = LLTeleportHistory::getInstance(); + const LLTeleportHistory::slurl_list_t& hist_items = hist->getItems(); + int cur_item = hist->getCurrentItemIndex(); + + // Items will be shown in the reverse order, just like in Firefox. + for (int i = (int)hist_items.size()-1; i >= 0; i--) + { + LLTeleportHistoryMenuItem::EType type; + if (i < cur_item) + type = LLTeleportHistoryMenuItem::TYPE_BACKWARD; + else if (i > cur_item) + type = LLTeleportHistoryMenuItem::TYPE_FORWARD; + else + type = LLTeleportHistoryMenuItem::TYPE_CURRENT; + + LLTeleportHistoryMenuItem::Params item_params(type, hist_items[i].mTitle); + item_params.on_click.function(boost::bind(&LLNavigationBar::onTeleportHistoryMenuItemClicked, this, i)); + mTeleportHistoryMenu->addChild(LLUICtrlFactory::create(item_params)); + } +} + +void LLNavigationBar::onRegionNameResponse( + std::string typed_location, + std::string region_name, + LLVector3 local_coords, + U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport) +{ + // Invalid location? + if (!region_handle) + { + invokeSearch(typed_location); + return; + } + + // Location is valid. Add it to the typed locations history. + S32 selected_item = mCmbLocation->getCurrentIndex(); + if (selected_item == -1) // user has typed text + { + LLLocationHistory* lh = LLLocationHistory::getInstance(); + mCmbLocation->add(typed_location); + lh->addItem(typed_location); + lh->save(); + } + + // Teleport to the location. + LLVector3d region_pos = from_region_handle(region_handle); + LLVector3d global_pos = region_pos + (LLVector3d) local_coords; + + llinfos << "Teleporting to: " << global_pos << llendl; + gAgent.teleportViaLocation(global_pos); +} + +void LLNavigationBar::showTeleportHistoryMenu() +{ + // Don't show the popup if teleport history is empty. + if (LLTeleportHistory::getInstance()->isEmpty()) + { + lldebugs << "Teleport history is empty, will not show the menu." << llendl; + return; + } + + rebuildTeleportHistoryMenu(); + + if (mTeleportHistoryMenu == NULL) + return; + + // *TODO: why to draw/update anything before showing the menu? + mTeleportHistoryMenu->buildDrawLabels(); + mTeleportHistoryMenu->updateParent(LLMenuGL::sMenuContainer); + LLRect btnBackRect = mBtnBack->getRect(); + LLMenuGL::showPopup(this, mTeleportHistoryMenu, btnBackRect.mLeft, btnBackRect.mBottom); + + // *HACK pass the mouse capturing to the drop-down menu + gFocusMgr.setMouseCapture( NULL ); +} + +void LLNavigationBar::onLocationContextMenuItemClicked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + LLLineEditor* location_entry = mCmbLocation->getTextEntry(); + + if (item == std::string("copy_url")) + { + std::string sl_url = gAgent.getSLURL(); + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(sl_url)); + + LLSD args; + args["SLURL"] = sl_url; + LLNotifications::instance().add("CopySLURL", args); + } + else if (item == std::string("landmark")) + { + LLFloaterReg::showInstance("add_landmark"); + } + else if (item == std::string("cut")) + { + location_entry->cut(); + } + else if (item == std::string("copy")) + { + location_entry->copy(); + } + else if (item == std::string("paste")) + { + location_entry->paste(); + } + else if (item == std::string("delete")) + { + location_entry->deleteSelection(); + } + else if (item == std::string("select_all")) + { + location_entry->selectAll(); + } +} + +bool LLNavigationBar::onLocationContextMenuItemEnabled(const LLSD& userdata) +{ + std::string item = userdata.asString(); + const LLLineEditor* location_entry = mCmbLocation->getTextEntry(); + + if (item == std::string("can_cut")) + { + return location_entry->canCut(); + } + else if (item == std::string("can_copy")) + { + return location_entry->canCopy(); + } + else if (item == std::string("can_paste")) + { + return location_entry->canPaste(); + } + else if (item == std::string("can_delete")) + { + return location_entry->canDeselect(); + } + else if (item == std::string("can_select_all")) + { + return location_entry->canSelectAll(); + } + + return false; +} + +void LLNavigationBar::handleLoginComplete() +{ + mCmbLocation->handleLoginComplete(); +} + +void LLNavigationBar::invokeSearch(std::string search_text) +{ + LLFloaterReg::showInstance("search", LLSD().insert("panel", "all").insert("id", LLSD(search_text))); +} diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h new file mode 100644 index 0000000000..4c8375839e --- /dev/null +++ b/indra/newview/llnavigationbar.h @@ -0,0 +1,103 @@ +/** + * @file llnavigationbar.h + * @brief Navigation bar definition + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLNAVIGATIONBAR_H +#define LL_LLNAVIGATIONBAR_H + +#include "llpanel.h" + +extern S32 NAVIGATION_BAR_HEIGHT; + +class LLButton; +class LLLocationInputCtrl; +class LLMenuGL; +class LLLineEditor; + +/** + * Web browser-like navigation bar. + */ +class LLNavigationBar +: public LLPanel +{ + LOG_CLASS(LLNavigationBar); + +public: + static LLNavigationBar* getInstance(); + virtual ~LLNavigationBar(); + + /*virtual*/ void draw(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + + void handleLoginComplete(); + +private: + LLNavigationBar(); + + void rebuildTeleportHistoryMenu(); + void showTeleportHistoryMenu(); + void invokeSearch(std::string search_text); + + // callbacks + bool onLocationContextMenuItemEnabled(const LLSD& userdata); + void onLocationContextMenuItemClicked(const LLSD& userdata); + void onTeleportHistoryMenuItemClicked(const LLSD& userdata); + void onTeleportHistoryChanged(); + void onBackButtonClicked(); + void onBackOrForwardButtonHeldDown(const LLSD& param); + void onForwardButtonClicked(); + void onHomeButtonClicked(); + void onHelpButtonClicked(); + void onLocationSelection(); + void onLocationPrearrange(const LLSD& data); + void onLocationHistoryLoaded(); + void onSearchCommit(); + void onRegionNameResponse( + std::string typed_location, + std::string region_name, + LLVector3 local_coords, + U64 region_handle, const std::string& url, + const LLUUID& snapshot_id, bool teleport); + + static LLNavigationBar *sInstance; + + LLMenuGL* mLocationContextMenu; + LLMenuGL* mTeleportHistoryMenu; + LLButton* mBtnBack; + LLButton* mBtnForward; + LLButton* mBtnHome; + LLButton* mBtnHelp; + LLLineEditor* mLeSearch; + LLLocationInputCtrl* mCmbLocation; +}; + +#endif diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 23d32fee81..b40af37f7e 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -1,7 +1,7 @@ /** * @file llnetmap.cpp * @author James Cook - * @brief Display of surrounding regions, objects, and agents. View contained by LLFloaterMap. + * @brief Display of surrounding regions, objects, and agents. * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -36,83 +36,43 @@ #include "llnetmap.h" #include "indra_constants.h" -#include "llui.h" -#include "llmath.h" // clampf() +#include "llmath.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "llrender.h" +#include "llui.h" + +#include "llglheaders.h" #include "llagent.h" -#include "llcallingcard.h" -#include "llcolorscheme.h" -#include "llviewercontrol.h" -#include "llfloateravatarinfo.h" -#include "llfloaterworldmap.h" -#include "llframetimer.h" +#include "llappviewer.h" // for gDisconnected +#include "llcallingcard.h" // LLAvatarTracker #include "lltracker.h" -#include "llmenugl.h" #include "llsurface.h" -#include "lltextbox.h" -#include "lluictrlfactory.h" -#include "lluuid.h" #include "llviewercamera.h" -#include "llviewerimage.h" -#include "llviewerimagelist.h" -#include "llviewermenu.h" +#include "llviewercontrol.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "llviewerwindow.h" -#include "llvoavatar.h" #include "llworld.h" #include "llworldmapview.h" // shared draw code -#include "llappviewer.h" // Only for constants! - -#include "llglheaders.h" -using namespace LLOldEvents; +static LLDefaultWidgetRegistry::Register r1("net_map"); const F32 MAP_SCALE_MIN = 64; const F32 MAP_SCALE_MID = 172; const F32 MAP_SCALE_MAX = 512; const F32 MAP_SCALE_INCREMENT = 16; const F32 MAP_MIN_PICK_DIST = 4; -const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; - -const S32 TRACKING_RADIUS = 3; - -LLNetMap::LLNetMap(const std::string& name) : - LLPanel(name), - mScale(128.f), - mObjectMapTPM(1.f), - mObjectMapPixels(255.f), - mTargetPanX( 0.f ), - mTargetPanY( 0.f ), - mCurPanX( 0.f ), - mCurPanY( 0.f ), - mUpdateNow( FALSE ) -{ - mScale = gSavedSettings.getF32("MiniMapScale"); - mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); +const F32 MAX_PRIM_RADIUS = 256.0f; // Don't try to draw giant mega-prims on the mini map +LLNetMap::LLNetMap (const Params & p) : + LLUICtrl (p), + mScale(128.0f), + mBackgroundColor (p.bg_color()), + mRotateMap(FALSE) +{ mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); - - // Register event listeners for popup menu - (new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel"); - (new LLStopTracking())->registerListener(this, "MiniMap.StopTracking"); - (new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking"); - (new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile"); - (new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile"); - - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); - - updateMinorDirections(); - - LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this); - if (!menu) - { - menu = new LLMenuGL(LLStringUtil::null); - } - menu->setVisible(FALSE); - mPopupMenuHandle = menu->getHandle(); + mPixelsPerMeter = mScale / REGION_WIDTH_METERS; } LLNetMap::~LLNetMap() @@ -121,26 +81,21 @@ LLNetMap::~LLNetMap() void LLNetMap::setScale( F32 scale ) { - mScale = scale; - if (mScale == 0.f) - { - mScale = 0.1f; - } - gSavedSettings.setF32("MiniMapScale", mScale); - + mScale = llclamp(scale, 0.1f, 16.f*1024.f); // [reasonably small , unreasonably large] + if (mObjectImagep.notNull()) { - F32 width = (F32)(getRect().getWidth()); - F32 height = (F32)(getRect().getHeight()); - F32 diameter = sqrt(width * width + height * height); - F32 region_widths = diameter / mScale; + F32 half_width = (F32)(getRect().getWidth() / 2); + F32 half_height = (F32)(getRect().getHeight() / 2); + F32 radius = sqrt( half_width * half_width + half_height * half_height ); + F32 region_widths = (2.f*radius)/mScale; F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters(); F32 num_pixels = (F32)mObjectImagep->getWidth(); - mObjectMapTPM = num_pixels / meters; - mObjectMapPixels = diameter; + mObjectMapTPM = num_pixels/meters; + mObjectMapPixels = 2.f*radius; } - mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); + mPixelsPerMeter = mScale / REGION_WIDTH_METERS; mUpdateNow = TRUE; } @@ -157,21 +112,27 @@ void LLNetMap::translatePan( F32 delta_x, F32 delta_y ) void LLNetMap::draw() { static LLFrameTimer map_timer; - + static LLCachedControl map_avatar_color(gSavedSkinSettings, "MapAvatarColor", LLColor4::white); + static LLCachedControl map_avatar_friend_color(gSavedSkinSettings, "MapAvatarFriendColor", LLColor4::white); + static LLCachedControl map_track_color(gSavedSkinSettings, "MapTrackColor", LLColor4::white); + static LLCachedControl map_track_disabled_color(gSavedSkinSettings, "MapTrackDisabledColor", LLColor4::white); + static LLCachedControl map_frustum_color(gSavedSkinSettings, "MapFrustumColor", LLColor4::white); + static LLCachedControl map_frustum_rotating_color(gSavedSkinSettings, "MapFrustumRotatingColor", LLColor4::white); + if (mObjectImagep.isNull()) { createObjectImage(); } - + mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); + // Prepare a scissor region F32 rotation = 0; - // Prepare a scissor region { LLGLEnable scissor(GL_SCISSOR_TEST); - + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLLocalClipRect clip(getLocalRect()); @@ -179,11 +140,9 @@ void LLNetMap::draw() glMatrixMode(GL_MODELVIEW); // Draw background rectangle - if(isBackgroundVisible()) - { - gGL.color4fv(isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0); - } + LLColor4 background_color = mBackgroundColor.get(); + gGL.color4fv( background_color.mV ); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0); } // region 0,0 is in the middle @@ -194,8 +153,7 @@ void LLNetMap::draw() gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f); - BOOL rotate_map = gSavedSettings.getBOOL( "MiniMapRotate" ); - if( rotate_map ) + if( mRotateMap ) { // rotate subsequent draws to agent rotation rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); @@ -204,9 +162,6 @@ void LLNetMap::draw() // figure out where agent is S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); - LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" ); - LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" ); - LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" ); for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) @@ -224,10 +179,18 @@ void LLNetMap::draw() F32 top = bottom + mScale ; F32 right = left + mScale ; - gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV); + if (regionp == gAgent.getRegion()) + { + gGL.color4f(1.f, 1.f, 1.f, 1.f); + } + else + { + gGL.color4f(0.8f, 0.8f, 0.8f, 1.f); + } + if (!regionp->isAlive()) { - gGL.color4fv(dead_region_color.mV); + gGL.color4f(1.f, 0.5f, 0.5f, 1.f); } @@ -319,57 +282,86 @@ void LLNetMap::draw() // Mouse pointer in local coordinates S32 local_mouse_x; S32 local_mouse_y; + //localMouse(&local_mouse_x, &local_mouse_y); LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y); mClosestAgentToCursor.setNull(); F32 closest_dist = F32_MAX; // Draw avatars - LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); - LLColor4 friend_color = gColors.getColor( "MapFriend" ); - std::vector avatar_ids; - std::vector positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); - for(U32 i=0; igetRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { + LLViewerRegion* regionp = *iter; + const LLVector3d& origin_global = regionp->getOriginGlobal(); + + S32 count = regionp->mMapAvatars.count(); + S32 i; + LLVector3 pos_local; + U32 compact_local; + U8 bits; // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. // just be careful to sort the avatar IDs along with the positions. -MG - pos_map = globalPosToView(positions[i], rotate_map); + for (i = 0; i < count; i++) + { + compact_local = regionp->mMapAvatars.get(i); - LLWorldMapView::drawAvatar( - pos_map.mV[VX], pos_map.mV[VY], - is_agent_friend(avatar_ids[i]) ? friend_color : avatar_color, - pos_map.mV[VZ]); + bits = compact_local & 0xFF; + pos_local.mV[VZ] = F32(bits) * 4.f; + compact_local >>= 8; - F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); - if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist) - { - closest_dist = dist_to_cursor; - mClosestAgentToCursor = avatar_ids[i]; + bits = compact_local & 0xFF; + pos_local.mV[VY] = (F32)bits; + compact_local >>= 8; + + bits = compact_local & 0xFF; + pos_local.mV[VX] = (F32)bits; + + pos_global.setVec( pos_local ); + pos_global += origin_global; + + pos_map = globalPosToView(pos_global); + + BOOL show_as_friend = FALSE; + if( i < regionp->mMapAvatarIDs.count()) + { + show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(regionp->mMapAvatarIDs.get(i)) != NULL); + } + LLWorldMapView::drawAvatar( + pos_map.mV[VX], pos_map.mV[VY], + show_as_friend ? map_avatar_friend_color : map_avatar_color, + pos_map.mV[VZ]); + + F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); + if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist) + { + closest_dist = dist_to_cursor; + mClosestAgentToCursor = regionp->mMapAvatarIDs.get(i); + } } } // Draw dot for autopilot target if (gAgent.getAutoPilot()) { - drawTracking( gAgent.getAutoPilotTargetGlobal(), rotate_map, gTrackColor ); + drawTracking( gAgent.getAutoPilotTargetGlobal(), map_track_color ); } else { LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if ( LLTracker::TRACKING_AVATAR == tracking_status ) { - drawTracking( LLAvatarTracker::instance().getGlobalPos(), rotate_map, gTrackColor ); + drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color ); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status || LLTracker::TRACKING_LOCATION == tracking_status ) { - drawTracking( LLTracker::getTrackedPositionGlobal(), rotate_map, gTrackColor ); + drawTracking( LLTracker::getTrackedPositionGlobal(), map_track_color ); } } // Draw dot for self avatar position pos_global = gAgent.getPositionGlobal(); - pos_map = globalPosToView(pos_global, rotate_map); + pos_map = globalPosToView(pos_global); LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage; you->draw( llround(pos_map.mV[VX]) - you->getWidth()/2, @@ -391,9 +383,9 @@ void LLNetMap::draw() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if( rotate_map ) + if( mRotateMap ) { - gGL.color4fv(gColors.getColor("NetMapFrustum").mV); + gGL.color4fv((map_frustum_color()).mV); gGL.begin( LLRender::TRIANGLES ); gGL.vertex2f( ctr_x, ctr_y ); @@ -403,7 +395,7 @@ void LLNetMap::draw() } else { - gGL.color4fv(gColors.getColor("NetMapFrustumRotating").mV); + gGL.color4fv((map_frustum_rotating_color()).mV); // If we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); @@ -418,27 +410,11 @@ void LLNetMap::draw() } } - // Rotation of 0 means that North is up - setDirectionPos( getChild("e_label"), rotation); - setDirectionPos( getChild("n_label"), rotation + F_PI_BY_TWO); - setDirectionPos( getChild("w_label"), rotation + F_PI); - setDirectionPos( getChild("s_label"), rotation + F_PI + F_PI_BY_TWO); - - setDirectionPos( getChild("ne_label"), rotation + F_PI_BY_TWO / 2); - setDirectionPos( getChild("nw_label"), rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2); - setDirectionPos( getChild("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2); - setDirectionPos( getChild("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); - - LLView::draw(); + LLUICtrl::draw(); } -void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) +LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) { - LLPanel::reshape(width, height, called_from_parent); - updateMinorDirections(); -} - -LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated ){ LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal(); LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles @@ -447,7 +423,7 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated pos_local.mV[VY] *= mPixelsPerMeter; // leave Z component in meters - if( rotated ) + if( mRotateMap ) { F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); @@ -460,10 +436,10 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated return pos_local; } -void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated, - const LLColor4& color, BOOL draw_arrow ) +void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, + BOOL draw_arrow ) { - LLVector3 pos_local = globalPosToView( pos_global, rotated ); + LLVector3 pos_local = globalPosToView( pos_global ); if( (pos_local.mV[VX] < 0) || (pos_local.mV[VY] < 0) || (pos_local.mV[VX] >= getRect().getWidth()) || @@ -486,16 +462,16 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated, } } -LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated ) +LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) { x -= llround(getRect().getWidth() / 2 + mCurPanX); y -= llround(getRect().getHeight() / 2 + mCurPanY); - LLVector3 pos_local( (F32)x, (F32)y, 0.f ); + LLVector3 pos_local( (F32)x, (F32)y, 0 ); F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); - if( rotated ) + if( mRotateMap ) { LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); pos_local.rotVec( rot ); @@ -524,87 +500,55 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec { return FALSE; } - LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) ); + + // mToolTipMsg = "[AGENT][REGION](Double-click to open Map)" + + LLStringUtil::format_map_t args; + std::string fullname; + if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) + { + args["[AGENT]"] = fullname + "\n"; + } + else + { + args["[AGENT]"] = ""; + } + + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); if( region ) { - msg.assign(""); - std::string fullname; - if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) - { - msg.append(fullname); - msg.append("\n"); - } - msg.append( region->getName() ); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - std::string buffer; - msg.append("\n"); - buffer = region->getHost().getHostName(); - msg.append(buffer); - msg.append("\n"); - buffer = region->getHost().getString(); - msg.append(buffer); -#endif - msg.append("\n"); - msg.append(getToolTip()); - + args["[REGION]"] = region->getName() + "\n"; + } + else + { + args["[REGION]"] = ""; + } + + msg = mToolTipMsg; + LLStringUtil::format(msg, args); + + // set sticky_rect + if (region) + { S32 SLOP = 4; localPointToScreen( x - SLOP, y - SLOP, &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; - handled = TRUE; - } - if(!handled) - { - return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); } + + handled = TRUE; return handled; } -void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) -{ - // Rotation is in radians. - // Rotation of 0 means x = 1, y = 0 on the unit circle. - - F32 half_height = (F32)( (getRect().getHeight() - text_box->getRect().getHeight()) / 2); - F32 half_width = (F32)( (getRect().getWidth() - text_box->getRect().getWidth()) / 2); - F32 radius = llmin( half_height, half_width ); - - // Inset by a little to account for position display. - radius -= 8.f; - - text_box->setOrigin(llround(half_width + radius * cos( rotation )), - llround(half_height + radius * sin( rotation ))); -} - -void LLNetMap::updateMinorDirections() -{ - if (getChild("ne_label") == NULL) - { - return; - } - - // Hide minor directions if they cover too much of the map - bool show_minors = getChild("ne_label")->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD * - llmin(getRect().getWidth(), getRect().getHeight()); - - getChild("ne_label")->setVisible(show_minors); - getChild("nw_label")->setVisible(show_minors); - getChild("sw_label")->setVisible(show_minors); - getChild("se_label")->setVisible(show_minors); -} - void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters ) { LLVector3 local_pos; local_pos.setVec( pos - mObjectImageCenterGlobal ); - // DEV-17370 - megaprims of size > 4096 cause lag. (go figger.) - const F32 MAX_RADIUS = 256.0f; - F32 radius_clamped = llmin(radius_meters, MAX_RADIUS); + F32 radius_clamped = llmin(radius_meters, MAX_PRIM_RADIUS); S32 diameter_pixels = llround(2 * radius_clamped * mObjectMapTPM); renderPoint( local_pos, color, diameter_pixels ); @@ -699,10 +643,10 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color, void LLNetMap::createObjectImage() { // Find the size of the side of a square that surrounds the circle that surrounds getRect(). - // ... which is, the diagonal of the rect. - F32 width = getRect().getWidth(); - F32 height = getRect().getHeight(); - S32 square_size = llround( sqrt(width*width + height*height) ); + F32 half_width = (F32)(getRect().getWidth() / 2); + F32 half_height = (F32)(getRect().getHeight() / 2); + F32 radius = sqrt( half_width * half_width + half_height * half_height ); + S32 square_size = S32( 2 * radius ); // Find the least power of two >= the minimum size. const S32 MIN_SIZE = 32; @@ -725,75 +669,3 @@ void LLNetMap::createObjectImage() } mUpdateNow = TRUE; } - -BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask ) -{ - LLFloaterWorldMap::show(NULL, FALSE); - return TRUE; -} - -BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - mClosestAgentAtLastRightClick = mClosestAgentToCursor; - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if (menu) - { - menu->buildDrawLabels(); - menu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(this, menu, x, y); - } - return TRUE; -} - - -// static -bool LLNetMap::LLScaleMap::handleEvent(LLPointer event, const LLSD& userdata) -{ - LLNetMap *self = mPtr; - - S32 level = userdata.asInteger(); - - switch(level) - { - case 0: - self->setScale(MAP_SCALE_MIN); - break; - case 1: - self->setScale(MAP_SCALE_MID); - break; - case 2: - self->setScale(MAP_SCALE_MAX); - break; - default: - break; - } - - return true; -} - -bool LLNetMap::LLStopTracking::handleEvent(LLPointer event, const LLSD& userdata) -{ - LLTracker::stopTracking(NULL); - return true; -} - -bool LLNetMap::LLEnableTracking::handleEvent(LLPointer event, const LLSD& userdata) -{ - LLNetMap *self = mPtr; - self->findControl(userdata["control"].asString())->setValue(LLTracker::isTracking(NULL)); - return true; -} - -bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer event, const LLSD& userdata) -{ - LLNetMap *self = mPtr; - LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick); - return true; -} - -bool LLNetMap::LLEnableProfile::handleEvent(LLPointer event, const LLSD& userdata) -{ - LLNetMap *self = mPtr; - self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor()); - return true; -} diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 9fbd5097fd..cebc4af165 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -33,55 +33,67 @@ #ifndef LL_LLNETMAP_H #define LL_LLNETMAP_H -#include "llpanel.h" -#include "llmemberlistener.h" +#include "llmath.h" +#include "lluictrl.h" #include "v3math.h" #include "v3dmath.h" #include "v4color.h" #include "llimage.h" #include "llimagegl.h" - +class LLColor4U; +class LLCoordGL; class LLTextBox; -class LLNetMap : public LLPanel +class LLNetMap : public LLUICtrl { public: - LLNetMap(const std::string& name); - virtual ~LLNetMap(); + struct Params + : public LLInitParam::Block + { + Optional bg_color; - virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); + Params() + : bg_color("bg_color") + {} + }; - void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); +protected: + LLNetMap (const Params & p); + friend class LLUICtrlFactory; -private: +public: + virtual ~LLNetMap(); + /*virtual*/ void draw(); + /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); + void setScale( F32 scale ); - - // *TODO: Enable panning of the mini-map + void setRotateMap( BOOL b ) { mRotateMap = b; } + void setToolTipMsg(const std::string& msg) { mToolTipMsg = msg; } + BOOL getRotateMap( ) { return mRotateMap; } + void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); + +private: void translatePan( F32 delta_x, F32 delta_y ); void setPan( F32 x, F32 y ) { mTargetPanX = x; mTargetPanY = y; } - void renderPoint(const LLVector3 &pos, const LLColor4U &color, - S32 diameter, S32 relative_height = 0); - LLVector3 globalPosToView(const LLVector3d& global_pos, BOOL rotated); - LLVector3d viewPosToGlobal(S32 x,S32 y, BOOL rotated); + const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; } + void renderPoint(const LLVector3 &pos, const LLColor4U &color, + S32 diameter, S32 relative_height = 0); - void drawTracking( const LLVector3d& pos_global, - BOOL rotated, - const LLColor4& color, - BOOL draw_arrow = TRUE); + LLVector3 globalPosToView(const LLVector3d& global_pos); + LLVector3d viewPosToGlobal(S32 x,S32 y); - void setDirectionPos( LLTextBox* text_box, F32 rotation ); - void updateMinorDirections(); - void createObjectImage(); + void drawTracking( const LLVector3d& pos_global, + const LLColor4& color, + BOOL draw_arrow = TRUE); - LLHandle mPopupMenuHandle; + void createObjectImage(); + +private: + LLUIColor mBackgroundColor; F32 mScale; // Size of a region in pixels F32 mPixelsPerMeter; // world meters to map pixels @@ -96,45 +108,11 @@ private: LLPointer mObjectRawImagep; LLPointer mObjectImagep; -private: LLUUID mClosestAgentToCursor; LLUUID mClosestAgentAtLastRightClick; - static BOOL sRotateMap; - static LLNetMap* sInstance; - static BOOL isAgentUnderCursor(void*) { return sInstance && sInstance->mClosestAgentToCursor.notNull(); } - static void showAgentProfile(void*); - BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); } - - class LLScaleMap : public LLMemberListener - { - public: - /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - }; - - class LLStopTracking : public LLMemberListener - { - public: - /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - }; - - class LLEnableTracking : public LLMemberListener - { - public: - /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - }; - - class LLShowAgentProfile : public LLMemberListener - { - public: - /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - }; - - class LLEnableProfile : public LLMemberListener - { - public: - /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - }; + BOOL mRotateMap; + std::string mToolTipMsg; }; diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp new file mode 100644 index 0000000000..ff26707a56 --- /dev/null +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -0,0 +1,141 @@ +/** + * @file lloutputmonitorctrl.cpp + * @brief LLOutputMonitorCtrl base class + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "lloutputmonitorctrl.h" + +// library includes +#include "llui.h" + +// viewer includes +#include "llvoiceclient.h" + +static LLDefaultWidgetRegistry::Register r("output_monitor"); + +// The defaults will be initialized in the constructor. +LLColor4 LLOutputMonitorCtrl::sColorMuted; +LLColor4 LLOutputMonitorCtrl::sColorOverdriven; +LLColor4 LLOutputMonitorCtrl::sColorNormal; +LLColor4 LLOutputMonitorCtrl::sColorBound; +S32 LLOutputMonitorCtrl::sRectsNumber = 0; +F32 LLOutputMonitorCtrl::sRectWidthRatio = 0.f; +F32 LLOutputMonitorCtrl::sRectHeightRatio = 0.f; + +LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p) +: LLView(p), + mPower(0), + mIsMuted(true) +{ + static LLUICachedControl output_monitor_muted_color("OutputMonitorMutedColor", LLColor4::orange); + static LLUICachedControl output_monitor_overdriven_color("OutputMonitorOverdrivenColor", LLColor4::red); + static LLUICachedControl output_monitor_normal_color("OutputMonitorNotmalColor", LLColor4::green); + static LLUICachedControl output_monitor_bound_color("OutputMonitorBoundColor", LLColor4::white); + static LLUICachedControl output_monitor_rects_number("OutputMonitorRectanglesNumber", 20); + static LLUICachedControl output_monitor_rect_width_ratio("OutputMonitorRectangleWidthRatio", 0.5f); + static LLUICachedControl output_monitor_rect_height_ratio("OutputMonitorRectangleHeightRatio", 0.8f); + + // IAN BUG compare to existing pattern where these are members - some will change per-widget and need to be anyway + // sent feedback to PE + + // *TODO: it looks suboptimal to load the defaults every time an output monitor is constructed. + sColorMuted = output_monitor_muted_color; + sColorOverdriven = output_monitor_overdriven_color; + sColorNormal = output_monitor_normal_color; + sColorBound = output_monitor_bound_color; + sRectsNumber = output_monitor_rects_number; + sRectWidthRatio = output_monitor_rect_width_ratio; + sRectHeightRatio = output_monitor_rect_height_ratio; + + mBorder = p.draw_border; +} + +LLOutputMonitorCtrl::~LLOutputMonitorCtrl() +{ +} + +void LLOutputMonitorCtrl::setPower(F32 val) +{ + mPower = llmax(0.f, llmin(1.f, val)); +} + +void LLOutputMonitorCtrl::draw() +{ + // + // Fill the monitor with a bunch of small rectangles. + // The rectangles will be filled with gradient color, + // beginning with sColorNormal and ending with sColorOverdriven. + // + // *TODO: would using a (partially drawn) pixmap instead be faster? + // + const int monh = getRect().getHeight(); + const int monw = getRect().getWidth(); + int maxrects = sRectsNumber; + const int period = llmax(1, monw / maxrects, 0, 0); // "1" - min value for the period + const int rectw = llmax(1, llfloor(period * sRectWidthRatio), 0, 0); // "1" - min value for the rect's width + const int recth = llfloor(monh * sRectHeightRatio); + + if(period == 1 && rectw == 1) //if we have so small control, then "maxrects = monitor's_width - 2*monitor_border's_width + maxrects = monw-2; + + const int nrects = mIsMuted ? maxrects : llfloor(mPower * maxrects); // how many rects to draw? + const int rectbtm = (monh - recth) / 2; + const int recttop = rectbtm + recth; + + LLColor4 rect_color; + + for (int i=1, xpos = 0; i <= nrects; i++) + { + // Calculate color to use for the current rectangle. + if (mIsMuted) + { + rect_color = sColorMuted; + } + else + { + F32 frac = (mPower * i/nrects) / LLVoiceClient::OVERDRIVEN_POWER_LEVEL; + // Use overdriven color if the power exceeds overdriven level. + if (frac > 1.0f) + frac = 1.0f; + rect_color = lerp(sColorNormal, sColorOverdriven, frac); + } + + // Draw rectangle filled with the color. + gl_rect_2d(xpos, recttop, xpos+rectw, rectbtm, rect_color, TRUE); + xpos += period; + } + + // + // Draw bounding box. + // + if(mBorder) + gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE); +} diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h new file mode 100644 index 0000000000..881ad0f010 --- /dev/null +++ b/indra/newview/lloutputmonitorctrl.h @@ -0,0 +1,92 @@ +/** + * @file lloutputmonitorctrl.h + * @brief LLOutputMonitorCtrl base class + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLOUTPUTMONITORCTRL_H +#define LL_LLOUTPUTMONITORCTRL_H + +#include "v4color.h" +#include "llview.h" + +class LLTextBox; +class LLUICtrlFactory; + +// +// Classes +// + +class LLOutputMonitorCtrl +: public LLView +{ +public: + struct Params : public LLInitParam::Block + { + Optional draw_border; + + Params() + { + draw_border = true; + name = "output_monitor"; + follows.flags(FOLLOWS_LEFT|FOLLOWS_TOP); + mouse_opaque = false; + }; + }; +protected: + bool mBorder; + LLOutputMonitorCtrl(const Params&); + friend class LLUICtrlFactory; + +public: + virtual ~LLOutputMonitorCtrl(); + + // llview overrides + virtual void draw(); + + void setPower(F32 val); + F32 getPower(F32 val) const { return mPower; } + + bool getIsMuted() const { return mIsMuted; } + void setIsMuted(bool val) { mIsMuted = val; } + +private: + static LLColor4 sColorMuted; + static LLColor4 sColorNormal; + static LLColor4 sColorOverdriven; + static LLColor4 sColorBound; + static S32 sRectsNumber; + static F32 sRectWidthRatio; + static F32 sRectHeightRatio; + + F32 mPower; + bool mIsMuted; +}; + +#endif diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index b16f56d0d8..2ccd729e0a 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -45,7 +45,6 @@ #include "llfocusmgr.h" #include "llimview.h" #include "llmediaremotectrl.h" -#include "llpanelaudiovolume.h" #include "llparcel.h" #include "lltextbox.h" #include "llui.h" @@ -60,7 +59,7 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llvoiceclient.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoiceremotectrl.h" #include "llwebbrowserctrl.h" #include "llselectmgr.h" @@ -89,7 +88,7 @@ void* LLOverlayBar::createMediaRemote(void* userdata) void* LLOverlayBar::createVoiceRemote(void* userdata) { LLOverlayBar *self = (LLOverlayBar*)userdata; - self->mVoiceRemote = new LLVoiceRemoteCtrl(std::string("voice_remote")); + self->mVoiceRemote = new LLVoiceRemoteCtrl(); return self->mVoiceRemote; } @@ -110,23 +109,24 @@ LLOverlayBar::LLOverlayBar() mBuilt = false; - LLCallbackMap::map_t factory_map; - factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); - factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); - factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this); + mFactoryMap["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); + mFactoryMap["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); + mFactoryMap["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml"); } BOOL LLOverlayBar::postBuild() { - childSetAction("IM Received",onClickIMReceived,this); childSetAction("Set Not Busy",onClickSetNotBusy,this); childSetAction("Mouselook",onClickMouselook,this); childSetAction("Stand Up",onClickStandUp,this); childSetAction("Flycam",onClickFlycam,this); childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); + mVoiceRemote->expandOrCollapse(); + mMediaRemote->expandOrCollapse(); + setFocusRoot(TRUE); mBuilt = true; @@ -168,8 +168,9 @@ void LLOverlayBar::layoutButtons() // calculate button widths const S32 MAX_BUTTON_WIDTH = 150; + const S32 STATUS_BAR_PAD = 10; S32 segment_width = llclamp(lltrunc((F32)(bar_width) / (F32)button_list.size()), 0, MAX_BUTTON_WIDTH); - S32 btn_width = segment_width - gSavedSettings.getS32("StatusBarPad"); + S32 btn_width = segment_width - STATUS_BAR_PAD; // Evenly space all buttons, starting from left S32 left = 0; @@ -282,13 +283,6 @@ void LLOverlayBar::refresh() // Static functions //----------------------------------------------------------------------- -// static -void LLOverlayBar::onClickIMReceived(void*) -{ - gIMMgr->setFloaterOpen(TRUE); -} - - // static void LLOverlayBar::onClickSetNotBusy(void*) { diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h index 852d033a10..f0cf480458 100644 --- a/indra/newview/lloverlaybar.h +++ b/indra/newview/lloverlaybar.h @@ -67,7 +67,6 @@ public: // helpers for returning desired state BOOL musicPlaying() { return mMusicState == PLAYING; } - static void onClickIMReceived(void* data); static void onClickSetNotBusy(void* data); static void onClickMouselook(void* data); static void onClickStandUp(void* data); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 9d5a4ad01c..d7929cc5c2 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -34,58 +34,17 @@ #include "llpanelavatar.h" -#include "llclassifiedflags.h" -#include "llfontgl.h" -#include "llcachename.h" - -#include "llavatarconstants.h" -#include "lluiconstants.h" -#include "lltextbox.h" -#include "llviewertexteditor.h" -#include "lltexturectrl.h" #include "llagent.h" -#include "llviewerwindow.h" -#include "llbutton.h" +#include "llavatarconstants.h" #include "llcallingcard.h" -#include "llcheckboxctrl.h" -#include "llfloater.h" - -#include "llfloaterfriends.h" -#include "llfloatergroupinfo.h" -#include "llfloaterworldmap.h" -#include "llfloatermute.h" -#include "llfloateravatarinfo.h" -#include "lliconctrl.h" -#include "llinventoryview.h" -#include "lllineeditor.h" -#include "llnameeditor.h" -#include "llmutelist.h" -#include "llpanelclassified.h" -#include "llpanelpick.h" -#include "llscrolllistctrl.h" -#include "llstatusbar.h" -#include "lltabcontainer.h" -#include "lltabcontainervertical.h" +#include "llcombobox.h" +#include "llfriendactions.h" #include "llimview.h" +#include "lltexteditor.h" +#include "lltexturectrl.h" #include "lltooldraganddrop.h" -#include "lluiconstants.h" -#include "llvoavatar.h" -#include "llviewercontrol.h" #include "llviewermenu.h" // *FIX: for is_agent_friend() -#include "llviewergenericmessage.h" // send_generic_message -#include "llviewerobjectlist.h" -#include "llviewerregion.h" -#include "llweb.h" -#include "llinventorymodel.h" -#include "roles_constants.h" -#include "lluictrlfactory.h" - -// Statics -std::list LLPanelAvatar::sAllPanels; -BOOL LLPanelAvatar::sAllowFirstLife = FALSE; - -extern void handle_lure(const LLUUID& invitee); -extern void handle_pay_by_id(const LLUUID& payee); +#include "llscrollcontainer.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLDropTarget @@ -98,7 +57,17 @@ extern void handle_pay_by_id(const LLUUID& payee); class LLDropTarget : public LLView { public: - LLDropTarget(const std::string& name, const LLRect& rect, const LLUUID& agent_id); + struct Params : public LLInitParam::Block + { + Optional agent_id; + Params() + { + mouse_opaque(false); + follows.flags(FOLLOWS_ALL); + } + }; + + LLDropTarget(const Params&); ~LLDropTarget(); void doDrop(EDragAndDropType cargo_type, void* cargo_data); @@ -115,17 +84,13 @@ protected: LLUUID mAgentID; }; - -LLDropTarget::LLDropTarget(const std::string& name, const LLRect& rect, - const LLUUID& agent_id) : - LLView(name, rect, NOT_MOUSE_OPAQUE, FOLLOWS_ALL), - mAgentID(agent_id) -{ -} +LLDropTarget::LLDropTarget(const LLDropTarget::Params& p) +: LLView(p), + mAgentID(p.agent_id) +{} LLDropTarget::~LLDropTarget() -{ -} +{} void LLDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { @@ -149,2156 +114,553 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return FALSE; } +static LLDefaultWidgetRegistry::Register r("drop_target"); +////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -// LLPanelAvatarTab() +// LLPanelProfileTab() //----------------------------------------------------------------------------- -LLPanelAvatarTab::LLPanelAvatarTab(const std::string& name, const LLRect &rect, - LLPanelAvatar* panel_avatar) -: LLPanel(name, rect), - mPanelAvatar(panel_avatar), - mDataRequested(false) -{ } - -// virtual -void LLPanelAvatarTab::draw() +////////////////////////////////////////////////////////////////////////// +LLPanelProfileTab::LLPanelProfileTab(const LLUUID& avatar_id) + : LLPanel() + , mAvatarId(LLUUID::null) + , mProfileType(PT_UNKNOWN) { - refresh(); - - LLPanel::draw(); + setAvatarId(avatar_id); } -void LLPanelAvatarTab::sendAvatarProfileRequestIfNeeded(const std::string& method) +LLPanelProfileTab::LLPanelProfileTab(const Params& params ) + : LLPanel() + , mAvatarId(LLUUID::null) + , mProfileType(PT_UNKNOWN) { - if (!mDataRequested) - { - std::vector strings; - strings.push_back( mPanelAvatar->getAvatarID().asString() ); - send_generic_message(method, strings); - mDataRequested = true; - } -} -//----------------------------------------------------------------------------- -// LLPanelAvatarSecondLife() -//----------------------------------------------------------------------------- -LLPanelAvatarSecondLife::LLPanelAvatarSecondLife(const std::string& name, - const LLRect &rect, - LLPanelAvatar* panel_avatar ) -: LLPanelAvatarTab(name, rect, panel_avatar), - mPartnerID() -{ } -void LLPanelAvatarSecondLife::refresh() +LLPanelProfileTab::~LLPanelProfileTab() { - updatePartnerName(); + // *TODO Vadim: use notNull() instead. (there are several similar cases below) + if(mAvatarId.notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + } } -void LLPanelAvatarSecondLife::updatePartnerName() +void LLPanelProfileTab::setAvatarId(const LLUUID& avatar_id) { - if (mPartnerID.notNull()) + if(avatar_id.notNull()) { - std::string first, last; - BOOL found = gCacheName->getName(mPartnerID, first, last); - if (found) + if(mAvatarId.notNull()) { - childSetTextArg("partner_edit", "[FIRST]", first); - childSetTextArg("partner_edit", "[LAST]", last); + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId,this); } - childSetEnabled("partner_info", TRUE); + mAvatarId = avatar_id; + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(),this); + setProfileType(); } } -//----------------------------------------------------------------------------- -// clearControls() -// Empty the data out of the controls, since we have to wait for new -// data off the network. -//----------------------------------------------------------------------------- -void LLPanelAvatarSecondLife::clearControls() +void LLPanelProfileTab::setProfileType() { - LLTextureCtrl* image_ctrl = getChild("img"); - if(image_ctrl) - { - image_ctrl->setImageAssetID(LLUUID::null); - } - childSetValue("about", ""); - childSetValue("born", ""); - childSetValue("acct", ""); - - childSetTextArg("partner_edit", "[FIRST]", LLStringUtil::null); - childSetTextArg("partner_edit", "[LAST]", LLStringUtil::null); - - mPartnerID = LLUUID::null; - - LLScrollListCtrl* group_list = getChild("groups"); - if(group_list) - { - group_list->deleteAllItems(); - } - LLScrollListCtrl* ratings_list = getChild("ratings"); - if(ratings_list) - { - ratings_list->deleteAllItems(); - } - + mProfileType = (gAgentID == mAvatarId) ? PT_OWN : PT_OTHER; } - -//----------------------------------------------------------------------------- -// enableControls() -//----------------------------------------------------------------------------- -void LLPanelAvatarSecondLife::enableControls(BOOL self) +void LLPanelProfileTab::onActivate(const LLUUID& id) { - childSetEnabled("img", self); - childSetEnabled("about", self); - childSetVisible("allow_publish", self); - childSetEnabled("allow_publish", self); - childSetVisible("?", self); - childSetEnabled("?", self); + setAvatarId(id); + updateData(); } - -// static -void LLPanelAvatarSecondLife::onClickImage(void *) -{ } - -// static -void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data) +void LLPanelProfileTab::onAddFriend() { - LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - - - LLScrollListCtrl* group_list = self->getChild("groups"); - if(group_list) + if (getAvatarId().notNull()) { - LLScrollListItem* item = group_list->getFirstSelected(); - - if(item && item->getUUID().notNull()) - { - llinfos << "Show group info " << item->getUUID() << llendl; - - LLFloaterGroupInfo::showFromUUID(item->getUUID()); - } + std::string name; + gCacheName->getFullName(getAvatarId(),name); + LLFriendActions::requestFriendshipDialog(getAvatarId(), name); } } -// static -void LLPanelAvatarSecondLife::onClickPublishHelp(void *) -{ - LLNotifications::instance().add("ClickPublishHelpAvatar"); -} - -// static -void LLPanelAvatarSecondLife::onClickPartnerHelp(void *) +void LLPanelProfileTab::onIM() { - LLNotifications::instance().add("ClickPartnerHelpAvatar", LLSD(), LLSD(), onClickPartnerHelpLoadURL); -} - -// static -bool LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) + if (getAvatarId().notNull()) { - LLWeb::loadURL("http://secondlife.com/partner"); + std::string name; + gCacheName->getFullName(getAvatarId(), name); + gIMMgr->addSession(name, IM_NOTHING_SPECIAL, getAvatarId()); } - return false; } -// static -void LLPanelAvatarSecondLife::onClickPartnerInfo(void *data) +void LLPanelProfileTab::onTeleport() { - LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*) data; - if (self->mPartnerID.notNull()) + if(getAvatarId().notNull()) { - LLFloaterAvatarInfo::showFromProfile(self->mPartnerID, - self->getScreenRect()); + LLFriendActions::offerTeleport(getAvatarId()); } } +////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- -// LLPanelAvatarFirstLife() +// LLPanelAvatarProfile() //----------------------------------------------------------------------------- -LLPanelAvatarFirstLife::LLPanelAvatarFirstLife(const std::string& name, - const LLRect &rect, - LLPanelAvatar* panel_avatar ) -: LLPanelAvatarTab(name, rect, panel_avatar) +////////////////////////////////////////////////////////////////////////// +LLPanelAvatarProfile::LLPanelAvatarProfile(const LLUUID& avatar_id /* = LLUUID::null */) + : LLPanelProfileTab(avatar_id), mUpdated(false), mEditMode(false), mStatusCombobox(NULL), mStatusMessage(NULL) { + updateData(); } -void LLPanelAvatarFirstLife::enableControls(BOOL self) +LLPanelAvatarProfile::LLPanelAvatarProfile(const Params& params ) + : LLPanelProfileTab(params), mUpdated(false), mEditMode(false), mStatusCombobox(NULL), mStatusMessage(NULL) { - childSetEnabled("img", self); - childSetEnabled("about", self); } -//----------------------------------------------------------------------------- -// postBuild -//----------------------------------------------------------------------------- - -BOOL LLPanelAvatarSecondLife::postBuild(void) +LLPanelAvatarProfile::~LLPanelAvatarProfile() { - childSetEnabled("born", FALSE); - childSetEnabled("partner_edit", FALSE); - childSetAction("partner_help",onClickPartnerHelp,this); - childSetAction("partner_info", onClickPartnerInfo, this); - childSetEnabled("partner_info", mPartnerID.notNull()); - - childSetAction("?",onClickPublishHelp,this); - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - enableControls(own_avatar); - - childSetVisible("About:",LLPanelAvatar::sAllowFirstLife); - childSetVisible("(500 chars)",LLPanelAvatar::sAllowFirstLife); - childSetVisible("about",LLPanelAvatar::sAllowFirstLife); - - childSetVisible("allow_publish",LLPanelAvatar::sAllowFirstLife); - childSetVisible("?",LLPanelAvatar::sAllowFirstLife); - - childSetVisible("online_yes",FALSE); - - // These are cruft but may still exist in some xml files - // TODO: remove the following 2 lines once translators grab these changes - childSetVisible("online_unknown",FALSE); - childSetVisible("online_no",FALSE); - - childSetAction("Find on Map", LLPanelAvatar::onClickTrack, getPanelAvatar()); - childSetAction("Instant Message...", LLPanelAvatar::onClickIM, getPanelAvatar()); - - childSetAction("Add Friend...", LLPanelAvatar::onClickAddFriend, getPanelAvatar()); - childSetAction("Pay...", LLPanelAvatar::onClickPay, getPanelAvatar()); - childSetAction("Mute", LLPanelAvatar::onClickMute, getPanelAvatar() ); - - childSetAction("Offer Teleport...", LLPanelAvatar::onClickOfferTeleport, - getPanelAvatar() ); - - childSetDoubleClickCallback("groups", onDoubleClickGroup, this ); - - getChild("img")->setFallbackImageName("default_profile_picture.j2c"); - - return TRUE; + if(getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + } } -BOOL LLPanelAvatarFirstLife::postBuild(void) +void* LLPanelAvatarProfile::create(void* data /* = NULL */) { - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - enableControls(own_avatar); - - getChild("img")->setFallbackImageName("default_profile_picture.j2c"); - - return TRUE; + LLSD* id = NULL; + if(data) + { + id = static_cast(data); + return new LLPanelAvatarProfile(LLUUID(id->asUUID())); + } + return new LLPanelAvatarProfile(); } -BOOL LLPanelAvatarNotes::postBuild(void) +void LLPanelAvatarProfile::updateData() { - childSetCommitCallback("notes edit",onCommitNotes,this); - - LLTextEditor* te = getChild("notes edit"); - if(te) te->setCommitOnFocusLost(TRUE); - return TRUE; + if (getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->sendDataRequest(getAvatarId(),APT_PROPERTIES); + LLAvatarPropertiesProcessor::getInstance()->sendDataRequest(getAvatarId(),APT_GROUPS); + } } -BOOL LLPanelAvatarWeb::postBuild(void) +void LLPanelAvatarProfile::processProperties(void* data, EAvatarProcessorType type) { - childSetKeystrokeCallback("url_edit", onURLKeystroke, this); - childSetCommitCallback("load", onCommitLoad, this); - - childSetAction("web_profile_help",onClickWebProfileHelp,this); - - childSetCommitCallback("url_edit",onCommitURL,this); - - childSetControlName("auto_load","AutoLoadWebProfiles"); - - mWebBrowser = getChild("profile_html"); - - // links open in internally - mWebBrowser->setOpenInExternalBrowser( false ); - - // observe browser events - mWebBrowser->addObserver( this ); + if(APT_PROPERTIES == type) + { + const LLAvatarData* avatar_data = static_cast(data); + if(avatar_data && getAvatarId() == avatar_data->avatar_id) + { + childSetValue("register_date", avatar_data->born_on); + childSetValue("sl_description_edit", avatar_data->about_text); + childSetValue("fl_description_edit",avatar_data->fl_about_text); + childSetValue("2nd_life_pic", avatar_data->image_id); + childSetValue("1st_life_pic", avatar_data->fl_image_id); + childSetValue("homepage_edit", avatar_data->profile_url); - return TRUE; -} + if (!isEditMode()) + { + setCaptionText(avatar_data); + } + childSetValue("show_in_search_checkbox", (BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH)); -BOOL LLPanelAvatarClassified::postBuild(void) -{ - childSetAction("New...",onClickNew,NULL); - childSetAction("Delete...",onClickDelete,NULL); - return TRUE; -} + if (avatar_data->partner_id.notNull()) + { + std::string first, last; + BOOL found = gCacheName->getName(avatar_data->partner_id, first, last); + if (found) + { + childSetTextArg("partner_text", "[FIRST]", first); + childSetTextArg("partner_text", "[LAST]", last); + } + } + //http://secondlife.com/partner -BOOL LLPanelAvatarPicks::postBuild(void) -{ - childSetAction("New...",onClickNew,NULL); - childSetAction("Delete...",onClickDelete,NULL); - return TRUE; -} + bool online = avatar_data->flags & AVATAR_ONLINE; + if(is_agent_friend(avatar_data->avatar_id)) + { + // Online status NO could be because they are hidden + // If they are a friend, we may know the truth! + online = LLAvatarTracker::instance().isBuddyOnline(avatar_data->avatar_id); + } + childSetValue("online_status", online ? + "Online" : "Offline"); + childSetColor("online_status", online ? + LLColor4::green : LLColor4::red); -BOOL LLPanelAvatarAdvanced::postBuild() -{ - for(size_t ii = 0; ii < LL_ARRAY_SIZE(mWantToCheck); ++ii) - mWantToCheck[ii] = NULL; - for(size_t ii = 0; ii < LL_ARRAY_SIZE(mSkillsCheck); ++ii) - mSkillsCheck[ii] = NULL; - mWantToCount = (8>LL_ARRAY_SIZE(mWantToCheck))?LL_ARRAY_SIZE(mWantToCheck):8; - for(S32 tt=0; tt < mWantToCount; ++tt) - { - std::string ctlname = llformat("chk%d", tt); - mWantToCheck[tt] = getChild(ctlname); - } - mSkillsCount = (6>LL_ARRAY_SIZE(mSkillsCheck))?LL_ARRAY_SIZE(mSkillsCheck):6; - - for(S32 tt=0; tt < mSkillsCount; ++tt) + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + } + if (isOwnProfile() && NULL != mStatusCombobox) + { + std::string status; + if (gAgent.getAFK()) + { + status = "away"; + } + else if (gAgent.getBusy()) + { + status = "busy"; + } + else + { + status = "online"; + } + mStatusCombobox->setValue(status); + } + } + else if(APT_GROUPS == type) { - //Find the Skills checkboxes and save off thier controls - std::string ctlname = llformat("schk%d",tt); - mSkillsCheck[tt] = getChild(ctlname); + LLAvatarGroups* avatar_groups = static_cast(data); + if(avatar_groups) + { + std::string groups; + LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin(); + for(; avatar_groups->group_list.end() != it; ++it) + { + LLAvatarGroups::LLGroupData group_data = *it; + groups += group_data.group_name; + groups += ", "; + } + childSetValue("sl_groups",groups); + } } - - mWantToEdit = getChild("want_to_edit"); - mSkillsEdit = getChild("skills_edit"); - childSetVisible("skills_edit",LLPanelAvatar::sAllowFirstLife); - childSetVisible("want_to_edit",LLPanelAvatar::sAllowFirstLife); - - return TRUE; } -//----------------------------------------------------------------------------- -// LLPanelAvatarWeb -//----------------------------------------------------------------------------- -LLPanelAvatarWeb::LLPanelAvatarWeb(const std::string& name, const LLRect& rect, - LLPanelAvatar* panel_avatar) -: LLPanelAvatarTab(name, rect, panel_avatar), - mWebBrowser(NULL) +void LLPanelAvatarProfile::clear() { + clearControls(); } -LLPanelAvatarWeb::~LLPanelAvatarWeb() +void LLPanelAvatarProfile::clearControls() { - // stop observing browser events - if ( mWebBrowser ) - { - mWebBrowser->remObserver( this ); - }; + childSetValue("2nd_life_pic",LLUUID::null); + childSetValue("1st_life_pic",LLUUID::null); + childSetValue("online_status",LLStringUtil::null); + childSetValue("status_message",LLStringUtil::null); + childSetValue("sl_description_edit",LLStringUtil::null); + childSetValue("fl_description_edit",LLStringUtil::null); + childSetValue("sl_groups",LLStringUtil::null); + childSetValue("homepage_edit",LLStringUtil::null); + childSetValue("register_date",LLStringUtil::null); + childSetValue("acc_status_text",LLStringUtil::null); + childSetTextArg("partner_text", "[FIRST]", LLStringUtil::null); + childSetTextArg("partner_text", "[LAST]", LLStringUtil::null); } -void LLPanelAvatarWeb::refresh() +void LLPanelAvatarProfile::setCaptionText(const LLAvatarData* avatar_data) { - if (mNavigateTo != "") + std::string caption_text = avatar_data->caption_text; + if(caption_text.empty()) { - llinfos << "Loading " << mNavigateTo << llendl; - mWebBrowser->navigateTo( mNavigateTo ); - mNavigateTo = ""; - } -} - - -void LLPanelAvatarWeb::enableControls(BOOL self) -{ - childSetEnabled("url_edit",self); -} - -void LLPanelAvatarWeb::setWebURL(std::string url) -{ - bool changed_url = (mHome != url); + LLStringUtil::format_map_t args; + caption_text = getString("CaptionTextAcctInfo"); + BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED); + BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED); + BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations - mHome = url; - bool have_url = !mHome.empty(); - - childSetText("url_edit", mHome); - childSetEnabled("load", mHome.length() > 0); + const char* ACCT_TYPE[] = { + "AcctTypeResident", + "AcctTypeTrial", + "AcctTypeCharterMember", + "AcctTypeEmployee" + }; + U8 caption_index = llclamp(avatar_data->caption_index, (U8)0, (U8)(LL_ARRAY_SIZE(ACCT_TYPE)-1)); + args["[ACCTTYPE]"] = getString(ACCT_TYPE[caption_index]); + + std::string payment_text = " "; + const S32 DEFAULT_CAPTION_LINDEN_INDEX = 3; + if(caption_index != DEFAULT_CAPTION_LINDEN_INDEX) + { + if(transacted) + { + payment_text = "PaymentInfoUsed"; + } + else if (identified) + { + payment_text = "PaymentInfoOnFile"; + } + else + { + payment_text = "NoPaymentInfoOnFile"; + } + args["[PAYMENTINFO]"] = getString(payment_text); - if (have_url - && gSavedSettings.getBOOL("AutoLoadWebProfiles")) - { - if (changed_url) + std::string age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; + // Do not display age verification status at this time + //args["[[AGEVERIFICATION]]"] = mPanelSecondLife->getString(age_text); + args["[AGEVERIFICATION]"] = " "; + } + else { - load(mHome); + args["[PAYMENTINFO]"] = " "; + args["[AGEVERIFICATION]"] = " "; } + LLStringUtil::format(caption_text, args); } - else - { - childSetVisible("profile_html",false); - childSetVisible("status_text", false); - } + + childSetValue("acc_status_text", caption_text); } -// static -void LLPanelAvatarWeb::onCommitURL(LLUICtrl* ctrl, void* data) +void LLPanelAvatarProfile::onAddFriendButtonClick() { - LLPanelAvatarWeb* self = (LLPanelAvatarWeb*)data; - - if (!self) return; - - self->load( self->childGetText("url_edit") ); + onAddFriend(); } -// static -void LLPanelAvatarWeb::onClickWebProfileHelp(void *) +void LLPanelAvatarProfile::onIMButtonClick() { - LLNotifications::instance().add("ClickWebProfileHelpAvatar"); + onIM(); } -void LLPanelAvatarWeb::load(std::string url) +void LLPanelAvatarProfile::onTeleportButtonClick() { - bool have_url = (!url.empty()); - - - childSetVisible("profile_html", have_url); - childSetVisible("status_text", have_url); - childSetText("status_text", LLStringUtil::null); - - if (have_url) - { - mNavigateTo = url; - } + onTeleport(); } -//static -void LLPanelAvatarWeb::onURLKeystroke(LLLineEditor* editor, void* data) +void LLPanelAvatarProfile::onCallButtonClick() { - LLPanelAvatarWeb* self = (LLPanelAvatarWeb*)data; - if (!self) return; - LLSD::String url = editor->getText(); - self->childSetEnabled("load", url.length() > 0); - return; + } -// static -void LLPanelAvatarWeb::onCommitLoad(LLUICtrl* ctrl, void* data) +void LLPanelAvatarProfile::onShareButtonClick() { - LLPanelAvatarWeb* self = (LLPanelAvatarWeb*)data; - if (!self) return; +} - LLSD::String valstr = ctrl->getValue().asString(); - LLSD::String urlstr = self->childGetText("url_edit"); - if (valstr == "") // load url string into browser panel +/*virtual*/ BOOL LLPanelAvatarProfile::postBuild(void) +{ + mStatusCombobox = getChild("status_combo", TRUE, FALSE); + if (NULL != mStatusCombobox) { - self->load(urlstr); + mStatusCombobox->setCommitCallback(boost::bind(&LLPanelAvatarProfile::onStatusChanged, this)); } - else if (valstr == "open") // open in user's external browser + mStatusMessage = getChild("status_me_message_edit", TRUE, FALSE); + if (NULL != mStatusMessage) { - if (!urlstr.empty()) - { - LLWeb::loadURLExternal(urlstr); - } + mStatusMessage->setCommitCallback(boost::bind(&LLPanelAvatarProfile::onStatusMessageChanged, this)); } - else if (valstr == "home") // reload profile owner's home page + + childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL); + childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL); + childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL); + childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL); + childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL); + + LLTextureCtrl* pic = getChild("2nd_life_pic",TRUE,FALSE); + if(pic) { - if (!self->mHome.empty()) - { - self->load(self->mHome); - } + pic->setFallbackImageName("default_land_picture.j2c"); + } + pic = getChild("1st_life_pic",TRUE,FALSE); + if(pic) + { + pic->setFallbackImageName("default_land_picture.j2c"); } -} -void LLPanelAvatarWeb::onStatusTextChange( const EventType& eventIn ) -{ - childSetText("status_text", eventIn.getStringValue() ); -} + clearControls(); + updateChildrenList(); -void LLPanelAvatarWeb::onLocationChange( const EventType& eventIn ) -{ - childSetText("url_edit", eventIn.getStringValue() ); + return TRUE; } - - -//----------------------------------------------------------------------------- -// LLPanelAvatarAdvanced -//----------------------------------------------------------------------------- -LLPanelAvatarAdvanced::LLPanelAvatarAdvanced(const std::string& name, - const LLRect& rect, - LLPanelAvatar* panel_avatar) -: LLPanelAvatarTab(name, rect, panel_avatar), - mWantToCount(0), - mSkillsCount(0), - mWantToEdit( NULL ), - mSkillsEdit( NULL ) +void LLPanelAvatarProfile::onOpen(const LLSD& key) { + setAvatarId(key); + scrollToTop(); + updateChildrenList(); + updateData(); } -void LLPanelAvatarAdvanced::enableControls(BOOL self) +void LLPanelAvatarProfile::scrollToTop() { - S32 t; - for(t=0;tsetEnabled(self); - } - for(t=0;t("profile_scroll", FALSE, FALSE); + if (NULL != scrollContainer) { - if(mSkillsCheck[t])mSkillsCheck[t]->setEnabled(self); + scrollContainer->goToTop(); } - - if (mWantToEdit) mWantToEdit->setEnabled(self); - if (mSkillsEdit) mSkillsEdit->setEnabled(self); - childSetEnabled("languages_edit",self); } -void LLPanelAvatarAdvanced::setWantSkills(U32 want_to_mask, const std::string& want_to_text, - U32 skills_mask, const std::string& skills_text, - const std::string& languages_text) +void LLPanelAvatarProfile::updateChildrenList() { - for(int id =0;idset( want_to_mask & 1<set( skills_mask & 1<setText( want_to_text ); - mSkillsEdit->setText( skills_text ); - } + case PT_OWN: + childSetVisible("status_panel",FALSE); + childSetVisible("profile_buttons_panel",FALSE); + childSetVisible("title_groups_text",FALSE); + childSetVisible("sl_groups",FALSE); + mUpdated = true; + childSetVisible("status_me_panel",TRUE); + childSetVisible("profile_me_buttons_panel",TRUE); - childSetText("languages_edit",languages_text); -} + break; + case PT_OTHER: + childSetVisible("status_me_panel",FALSE); + childSetVisible("profile_me_buttons_panel",FALSE); + + childSetVisible("status_panel",TRUE); + childSetVisible("profile_buttons_panel",TRUE); + childSetVisible("title_groups_text",TRUE); + childSetVisible("sl_groups",TRUE); -void LLPanelAvatarAdvanced::getWantSkills(U32* want_to_mask, std::string& want_to_text, - U32* skills_mask, std::string& skills_text, - std::string& languages_text) + // account actions + childSetVisible("account_actions_panel", FALSE); + childSetVisible("partner_edit_link", FALSE); + + mUpdated = true; + break; + case PT_UNKNOWN: break;//do nothing + default: + llassert(false); + } +} +void LLPanelAvatarProfile::onStatusChanged() { - if (want_to_mask) + LLSD::String status = mStatusCombobox->getValue().asString(); + + if ("online" == status) { - *want_to_mask = 0; - for(int t=0;tget()) - *want_to_mask |= 1<get()) - *skills_mask |= 1<getText(); + gAgent.clearAFK(); + gAgent.setBusy(); + LLNotifications::instance().add("BusyModeSet"); } - - if (mSkillsEdit) + else { - skills_text = mSkillsEdit->getText(); } - languages_text = childGetText("languages_edit"); -} - -//----------------------------------------------------------------------------- -// LLPanelAvatarNotes() -//----------------------------------------------------------------------------- -LLPanelAvatarNotes::LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar) -: LLPanelAvatarTab(name, rect, panel_avatar) -{ -} - -void LLPanelAvatarNotes::refresh() -{ - sendAvatarProfileRequestIfNeeded("avatarnotesrequest"); -} - -void LLPanelAvatarNotes::clearControls() -{ - childSetText("notes edit", getString("Loading")); - childSetEnabled("notes edit", false); } -// static -void LLPanelAvatarNotes::onCommitNotes(LLUICtrl*, void* userdata) +void LLPanelAvatarProfile::onStatusMessageChanged() { - LLPanelAvatarNotes* self = (LLPanelAvatarNotes*)userdata; - - self->getPanelAvatar()->sendAvatarNotesUpdate(); + updateData(); } //----------------------------------------------------------------------------- -// LLPanelAvatarClassified() +// LLPanelAvatarNotes() //----------------------------------------------------------------------------- -LLPanelAvatarClassified::LLPanelAvatarClassified(const std::string& name, const LLRect& rect, - LLPanelAvatar* panel_avatar) -: LLPanelAvatarTab(name, rect, panel_avatar) +LLPanelAvatarNotes::LLPanelAvatarNotes(const LLUUID& id /* = LLUUID::null */) +:LLPanelProfileTab(id) { + updateData(); } - -void LLPanelAvatarClassified::refresh() +LLPanelAvatarNotes::LLPanelAvatarNotes(const Params& params) +: LLPanelProfileTab(params) { - BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - - LLTabContainer* tabs = getChild("classified tab"); - - S32 tab_count = tabs ? tabs->getTabCount() : 0; - - bool allow_new = tab_count < MAX_CLASSIFIEDS; - bool allow_delete = (tab_count > 0); - bool show_help = (tab_count == 0); - - // *HACK: Don't allow making new classifieds from inside the directory. - // The logic for save/don't save when closing is too hairy, and the - // directory is conceptually read-only. JC - bool in_directory = false; - LLView* view = this; - while (view) - { - if (view->getName() == "directory") - { - in_directory = true; - break; - } - view = view->getParent(); - } - childSetEnabled("New...", self && !in_directory && allow_new); - childSetVisible("New...", !in_directory); - childSetEnabled("Delete...", self && !in_directory && allow_delete); - childSetVisible("Delete...", !in_directory); - childSetVisible("classified tab",!show_help); - sendAvatarProfileRequestIfNeeded("avatarclassifiedsrequest"); } - -BOOL LLPanelAvatarClassified::canClose() +LLPanelAvatarNotes::~LLPanelAvatarNotes() { - LLTabContainer* tabs = getChild("classified tab"); - for (S32 i = 0; i < tabs->getTabCount(); i++) + if(getAvatarId().notNull()) { - LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); - if (!panel->canClose()) - { - return FALSE; - } + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } - return TRUE; } -BOOL LLPanelAvatarClassified::titleIsValid() +void* LLPanelAvatarNotes::create(void* data) { - LLTabContainer* tabs = getChild("classified tab"); - if ( tabs ) + if(data) { - LLPanelClassified* panel = (LLPanelClassified*)tabs->getCurrentPanel(); - if ( panel ) - { - if ( ! panel->titleIsValid() ) - { - return FALSE; - }; - }; - }; - - return TRUE; + LLSD* id = static_cast(data); + return new LLPanelAvatarNotes(LLUUID(id->asUUID())); + } + return new LLPanelAvatarNotes(); } -void LLPanelAvatarClassified::apply() +void LLPanelAvatarNotes::updateData() { - LLTabContainer* tabs = getChild("classified tab"); - for (S32 i = 0; i < tabs->getTabCount(); i++) + LLAvatarPropertiesProcessor::getInstance()->sendDataRequest(getAvatarId(),APT_NOTES); + + const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + if(relation) { - LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); - panel->apply(); - } -} + childSetEnabled("status_check",TRUE); + childSetEnabled("map_check",TRUE); + childSetEnabled("objects_check",TRUE); + S32 rights = relation->getRightsGrantedTo(); -void LLPanelAvatarClassified::deleteClassifiedPanels() -{ - LLTabContainer* tabs = getChild("classified tab"); - if (tabs) - { - tabs->deleteAllTabs(); + childSetValue("status_check",LLRelationship::GRANT_ONLINE_STATUS & rights ? TRUE : FALSE); + childSetValue("map_check",LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE); + childSetValue("objects_check",LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE); } - - childSetVisible("New...", false); - childSetVisible("Delete...", false); - childSetVisible("loading_text", true); } - -void LLPanelAvatarClassified::processAvatarClassifiedReply(LLMessageSystem* msg, void**) +BOOL LLPanelAvatarNotes::postBuild() { - S32 block = 0; - S32 block_count = 0; - LLUUID classified_id; - std::string classified_name; - LLPanelClassified* panel_classified = NULL; + childSetCommitCallback("status_check",boost::bind(&LLPanelAvatarNotes::onCommitRights,this),NULL); + childSetCommitCallback("map_check",boost::bind(&LLPanelAvatarNotes::onCommitRights,this),NULL); + childSetCommitCallback("objects_check",boost::bind(&LLPanelAvatarNotes::onCommitRights,this),NULL); - LLTabContainer* tabs = getChild("classified tab"); + childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriend,this)),NULL); + childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIM,this)),NULL); +// childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this))); + childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleport,this)),NULL); +// childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this))); - // Don't remove old panels. We need to be able to process multiple - // packets for people who have lots of classifieds. JC - - block_count = msg->getNumberOfBlocksFast(_PREHASH_Data); - for (block = 0; block < block_count; block++) + LLTextEditor* te = getChild("notes_edit",TRUE,FALSE); + if(te) { - msg->getUUIDFast(_PREHASH_Data, _PREHASH_ClassifiedID, classified_id, block); - msg->getStringFast(_PREHASH_Data, _PREHASH_Name, classified_name, block); - - panel_classified = new LLPanelClassified(false, false); + te->setCommitCallback(boost::bind(&LLPanelAvatarNotes::onCommitNotes,this)); + te->setCommitOnFocusLost(TRUE); + } - panel_classified->setClassifiedID(classified_id); + return TRUE; +} - // This will request data from the server when the pick is first drawn. - panel_classified->markForServerRequest(); +void LLPanelAvatarNotes::onCommitNotes() +{ + std::string notes = childGetValue("notes_edit").asString(); + LLAvatarPropertiesProcessor::getInstance()-> sendNotes(getAvatarId(),notes); +} - // The button should automatically truncate long names for us - if(tabs) - { - tabs->addTabPanel(panel_classified, classified_name); - } - } +void LLPanelAvatarNotes::onCommitRights() +{ + S32 rights = 0; - // Make sure somebody is highlighted. This works even if there - // are no tabs in the container. - if(tabs) - { - tabs->selectFirstTab(); - } + if(childGetValue("status_check").asBoolean()) + rights |= LLRelationship::GRANT_ONLINE_STATUS; + if(childGetValue("map_check").asBoolean()) + rights |= LLRelationship::GRANT_MAP_LOCATION; + if(childGetValue("objects_check").asBoolean()) + rights |= LLRelationship::GRANT_MODIFY_OBJECTS; - childSetVisible("New...", true); - childSetVisible("Delete...", true); - childSetVisible("loading_text", false); + LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(),rights); } - -// Create a new classified panel. It will automatically handle generating -// its own id when it's time to save. -// static -void LLPanelAvatarClassified::onClickNew(void* data) +void LLPanelAvatarNotes::clear() { - LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; + childSetValue("notes_edit",LLStringUtil::null); - LLNotifications::instance().add("AddClassified", LLSD(), LLSD(), boost::bind(&LLPanelAvatarClassified::callbackNew, self, _1, _2)); - + childSetEnabled("status_check",FALSE); + childSetEnabled("map_check",FALSE); + childSetEnabled("objects_check",FALSE); } -bool LLPanelAvatarClassified::callbackNew(const LLSD& notification, const LLSD& response) +void LLPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type) { - S32 option = LLNotification::getSelectedOption(notification, response); - if (0 == option) + if(APT_NOTES == type) { - LLPanelClassified* panel_classified = new LLPanelClassified(false, false); - panel_classified->initNewClassified(); - LLTabContainer* tabs = getChild("classified tab"); - if(tabs) + LLAvatarNotes* avatar_notes = static_cast(data); + if(avatar_notes && getAvatarId() == avatar_notes->target_id) { - tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); - tabs->selectLastTab(); + childSetValue("notes_edit",avatar_notes->notes); + childSetEnabled("notes edit", true); + + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } } - return false; -} - - -// static -void LLPanelAvatarClassified::onClickDelete(void* data) -{ - LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - - LLTabContainer* tabs = self->getChild("classified tab"); - LLPanelClassified* panel_classified = NULL; - if(tabs) - { - panel_classified = (LLPanelClassified*)tabs->getCurrentPanel(); - } - if (!panel_classified) return; - - LLSD args; - args["NAME"] = panel_classified->getClassifiedName(); - LLNotifications::instance().add("DeleteClassified", args, LLSD(), boost::bind(&LLPanelAvatarClassified::callbackDelete, self, _1, _2)); - -} - - -bool LLPanelAvatarClassified::callbackDelete(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - LLTabContainer* tabs = getChild("classified tab"); - LLPanelClassified* panel_classified=NULL; - if(tabs) - { - panel_classified = (LLPanelClassified*)tabs->getCurrentPanel(); - } - - LLMessageSystem* msg = gMessageSystem; - - if (!panel_classified) return false; - - if (0 == option) - { - msg->newMessageFast(_PREHASH_ClassifiedDelete); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Data); - msg->addUUIDFast(_PREHASH_ClassifiedID, panel_classified->getClassifiedID()); - gAgent.sendReliableMessage(); - - if(tabs) - { - tabs->removeTabPanel(panel_classified); - } - delete panel_classified; - panel_classified = NULL; - } - return false; -} - - -//----------------------------------------------------------------------------- -// LLPanelAvatarPicks() -//----------------------------------------------------------------------------- -LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name, - const LLRect& rect, - LLPanelAvatar* panel_avatar) -: LLPanelAvatarTab(name, rect, panel_avatar) -{ -} - - -void LLPanelAvatarPicks::refresh() -{ - BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - LLTabContainer* tabs = getChild("picks tab"); - S32 tab_count = tabs ? tabs->getTabCount() : 0; - childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS); - childSetEnabled("Delete...", self && tab_count > 0); - childSetVisible("New...", self && getPanelAvatar()->isEditable()); - childSetVisible("Delete...", self && getPanelAvatar()->isEditable()); - - sendAvatarProfileRequestIfNeeded("avatarpicksrequest"); -} - - -void LLPanelAvatarPicks::deletePickPanels() -{ - LLTabContainer* tabs = getChild("picks tab"); - if(tabs) - { - tabs->deleteAllTabs(); - } - - childSetVisible("New...", false); - childSetVisible("Delete...", false); - childSetVisible("loading_text", true); -} - -void LLPanelAvatarPicks::processAvatarPicksReply(LLMessageSystem* msg, void**) -{ - S32 block = 0; - S32 block_count = 0; - LLUUID pick_id; - std::string pick_name; - LLPanelPick* panel_pick = NULL; - - LLTabContainer* tabs = getChild("picks tab"); - - // Clear out all the old panels. We'll replace them with the correct - // number of new panels. - deletePickPanels(); - - // The database needs to know for which user to look up picks. - LLUUID avatar_id = getPanelAvatar()->getAvatarID(); - - block_count = msg->getNumberOfBlocks("Data"); - for (block = 0; block < block_count; block++) - { - msg->getUUID("Data", "PickID", pick_id, block); - msg->getString("Data", "PickName", pick_name, block); - - panel_pick = new LLPanelPick(FALSE); - - panel_pick->setPickID(pick_id, avatar_id); - - // This will request data from the server when the pick is first - // drawn. - panel_pick->markForServerRequest(); - - // The button should automatically truncate long names for us - if(tabs) - { - tabs->addTabPanel(panel_pick, pick_name); - } - } - - // Make sure somebody is highlighted. This works even if there - // are no tabs in the container. - if(tabs) - { - tabs->selectFirstTab(); - } - - childSetVisible("New...", true); - childSetVisible("Delete...", true); - childSetVisible("loading_text", false); -} - - -// Create a new pick panel. It will automatically handle generating -// its own id when it's time to save. -// static -void LLPanelAvatarPicks::onClickNew(void* data) -{ - LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLPanelPick* panel_pick = new LLPanelPick(FALSE); - LLTabContainer* tabs = self->getChild("picks tab"); - - panel_pick->initNewPick(); - if(tabs) - { - tabs->addTabPanel(panel_pick, panel_pick->getPickName()); - tabs->selectLastTab(); - } -} - - -// static -void LLPanelAvatarPicks::onClickDelete(void* data) -{ - LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainer* tabs = self->getChild("picks tab"); - LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; - - if (!panel_pick) return; - - LLSD args; - args["PICK"] = panel_pick->getPickName(); - - LLNotifications::instance().add("DeleteAvatarPick", args, LLSD(), - boost::bind(&LLPanelAvatarPicks::callbackDelete, self, _1, _2)); -} - - -// static -bool LLPanelAvatarPicks::callbackDelete(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - LLTabContainer* tabs = getChild("picks tab"); - LLPanelPick* panel_pick = tabs ? (LLPanelPick*)tabs->getCurrentPanel() : NULL; - LLMessageSystem* msg = gMessageSystem; - - if (!panel_pick) return false; - - if (0 == option) - { - // If the viewer has a hacked god-mode, then this call will - // fail. - if(gAgent.isGodlike()) - { - msg->newMessage("PickGodDelete"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("PickID", panel_pick->getPickID()); - // *HACK: We need to send the pick's creator id to accomplish - // the delete, and we don't use the query id for anything. JC - msg->addUUID( "QueryID", panel_pick->getPickCreatorID() ); - } - else - { - msg->newMessage("PickDelete"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("PickID", panel_pick->getPickID()); - } - gAgent.sendReliableMessage(); - - if(tabs) - { - tabs->removeTabPanel(panel_pick); - } - delete panel_pick; - panel_pick = NULL; - } - return false; -} - - -//----------------------------------------------------------------------------- -// LLPanelAvatar -//----------------------------------------------------------------------------- -LLPanelAvatar::LLPanelAvatar( - const std::string& name, - const LLRect &rect, - BOOL allow_edit) - : - LLPanel(name, rect, FALSE), - mPanelSecondLife(NULL), - mPanelAdvanced(NULL), - mPanelClassified(NULL), - mPanelPicks(NULL), - mPanelNotes(NULL), - mPanelFirstLife(NULL), - mPanelWeb(NULL), - mDropTarget(NULL), - mAvatarID( LLUUID::null ), // mAvatarID is set with 'setAvatar' or 'setAvatarID' - mHaveProperties(FALSE), - mHaveStatistics(FALSE), - mHaveNotes(false), - mLastNotes(), - mAllowEdit(allow_edit) -{ - - sAllPanels.push_back(this); - - LLCallbackMap::map_t factory_map; - - factory_map["2nd Life"] = LLCallbackMap(createPanelAvatarSecondLife, this); - factory_map["WebProfile"] = LLCallbackMap(createPanelAvatarWeb, this); - factory_map["Interests"] = LLCallbackMap(createPanelAvatarInterests, this); - factory_map["Picks"] = LLCallbackMap(createPanelAvatarPicks, this); - factory_map["Classified"] = LLCallbackMap(createPanelAvatarClassified, this); - factory_map["1st Life"] = LLCallbackMap(createPanelAvatarFirstLife, this); - factory_map["My Notes"] = LLCallbackMap(createPanelAvatarNotes, this); - - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar.xml", &factory_map); - - selectTab(0); - - -} - -BOOL LLPanelAvatar::postBuild(void) -{ - mTab = getChild("tab"); - childSetAction("Kick",onClickKick,this); - childSetAction("Freeze",onClickFreeze, this); - childSetAction("Unfreeze", onClickUnfreeze, this); - childSetAction("csr_btn", onClickCSR, this); - childSetAction("OK", onClickOK, this); - childSetAction("Cancel", onClickCancel, this); - - if(mTab && !sAllowFirstLife) - { - LLPanel* panel = mTab->getPanelByName("1st Life"); - if (panel) mTab->removeTabPanel(panel); - - panel = mTab->getPanelByName("WebProfile"); - if (panel) mTab->removeTabPanel(panel); - } - childSetVisible("Kick",FALSE); - childSetEnabled("Kick",FALSE); - childSetVisible("Freeze",FALSE); - childSetEnabled("Freeze",FALSE); - childSetVisible("Unfreeze",FALSE); - childSetEnabled("Unfreeze",FALSE); - childSetVisible("csr_btn", FALSE); - childSetEnabled("csr_btn", FALSE); - - return TRUE; -} - - -LLPanelAvatar::~LLPanelAvatar() -{ - sAllPanels.remove(this); -} - - -BOOL LLPanelAvatar::canClose() -{ - return mPanelClassified && mPanelClassified->canClose(); -} - -void LLPanelAvatar::setAvatar(LLViewerObject *avatarp) -{ - // find the avatar and grab the name - LLNameValue *firstname = avatarp->getNVPair("FirstName"); - LLNameValue *lastname = avatarp->getNVPair("LastName"); - - std::string name; - if (firstname && lastname) - { - name.assign( firstname->getString() ); - name.append(" "); - name.append( lastname->getString() ); - } - else - { - name.assign(""); - } - - // If we have an avatar pointer, they must be online. - setAvatarID(avatarp->getID(), name, ONLINE_STATUS_YES); -} - -void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) -{ - // Online status NO could be because they are hidden - // If they are a friend, we may know the truth! - if ((ONLINE_STATUS_YES != online_status) - && mIsFriend - && (LLAvatarTracker::instance().isBuddyOnline( mAvatarID ))) - { - online_status = ONLINE_STATUS_YES; - } - - mPanelSecondLife->childSetVisible("online_yes", (online_status == ONLINE_STATUS_YES)); - - // Since setOnlineStatus gets called after setAvatarID - // need to make sure that "Offer Teleport" doesn't get set - // to TRUE again for yourself - if (mAvatarID != gAgent.getID()) - { - childSetVisible("Offer Teleport...",TRUE); - } - - BOOL in_prelude = gAgent.inPrelude(); - if(gAgent.isGodlike()) - { - childSetEnabled("Offer Teleport...", TRUE); - childSetToolTip("Offer Teleport...", childGetValue("TeleportGod").asString()); - } - else if (in_prelude) - { - childSetEnabled("Offer Teleport...",FALSE); - childSetToolTip("Offer Teleport...",childGetValue("TeleportPrelude").asString()); - } - else - { - childSetEnabled("Offer Teleport...", (online_status == ONLINE_STATUS_YES)); - childSetToolTip("Offer Teleport...", childGetValue("TeleportNormal").asString()); - } -} - -void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name, - EOnlineStatus online_status) -{ - if (avatar_id.isNull()) return; - - BOOL avatar_changed = FALSE; - if (avatar_id != mAvatarID) - { - avatar_changed = TRUE; - } - mAvatarID = avatar_id; - - // Determine if we have their calling card. - mIsFriend = is_agent_friend(mAvatarID); - - // setOnlineStatus uses mIsFriend - setOnlineStatus(online_status); - - BOOL own_avatar = (mAvatarID == gAgent.getID() ); - BOOL avatar_is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; - - mPanelSecondLife->enableControls(own_avatar && mAllowEdit); - mPanelWeb->enableControls(own_avatar && mAllowEdit); - mPanelAdvanced->enableControls(own_avatar && mAllowEdit); - // Teens don't have this. - if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit); - - LLView *target_view = getChild("drop_target_rect"); - if(target_view) - { - if (mDropTarget) - { - delete mDropTarget; - } - mDropTarget = new LLDropTarget("drop target", target_view->getRect(), mAvatarID); - addChild(mDropTarget); - mDropTarget->setAgentID(mAvatarID); - } - - LLNameEditor* name_edit = getChild("name"); - if(name_edit) - { - if (name.empty()) - { - name_edit->setNameID(avatar_id, FALSE); - } - else - { - name_edit->setText(name); - } - } -// if (avatar_changed) - { - // While we're waiting for data off the network, clear out the - // old data. - mPanelSecondLife->clearControls(); - - mPanelPicks->deletePickPanels(); - mPanelPicks->setDataRequested(false); - - mPanelClassified->deleteClassifiedPanels(); - mPanelClassified->setDataRequested(false); - - mPanelNotes->clearControls(); - mPanelNotes->setDataRequested(false); - mHaveNotes = false; - mLastNotes.clear(); - - // Request just the first two pages of data. The picks, - // classifieds, and notes will be requested when that panel - // is made visible. JC - sendAvatarPropertiesRequest(); - - if (own_avatar) - { - if (mAllowEdit) - { - // OK button disabled until properties data arrives - childSetVisible("OK", true); - childSetEnabled("OK", false); - childSetVisible("Cancel",TRUE); - childSetEnabled("Cancel",TRUE); - } - else - { - childSetVisible("OK",FALSE); - childSetEnabled("OK",FALSE); - childSetVisible("Cancel",FALSE); - childSetEnabled("Cancel",FALSE); - } - childSetVisible("Instant Message...",FALSE); - childSetEnabled("Instant Message...",FALSE); - childSetVisible("Mute",FALSE); - childSetEnabled("Mute",FALSE); - childSetVisible("Offer Teleport...",FALSE); - childSetEnabled("Offer Teleport...",FALSE); - childSetVisible("drop target",FALSE); - childSetEnabled("drop target",FALSE); - childSetVisible("Find on Map",FALSE); - childSetEnabled("Find on Map",FALSE); - childSetVisible("Add Friend...",FALSE); - childSetEnabled("Add Friend...",FALSE); - childSetVisible("Pay...",FALSE); - childSetEnabled("Pay...",FALSE); - } - else - { - childSetVisible("OK",FALSE); - childSetEnabled("OK",FALSE); - - childSetVisible("Cancel",FALSE); - childSetEnabled("Cancel",FALSE); - - childSetVisible("Instant Message...",TRUE); - childSetEnabled("Instant Message...",FALSE); - childSetVisible("Mute",TRUE); - childSetEnabled("Mute",FALSE); - - childSetVisible("drop target",TRUE); - childSetEnabled("drop target",FALSE); - - childSetVisible("Find on Map",TRUE); - // Note: we don't always know online status, so always allow gods to try to track - BOOL enable_track = gAgent.isGodlike() || is_agent_mappable(mAvatarID); - childSetEnabled("Find on Map",enable_track); - if (!mIsFriend) - { - childSetToolTip("Find on Map",childGetValue("ShowOnMapNonFriend").asString()); - } - else if (ONLINE_STATUS_YES != online_status) - { - childSetToolTip("Find on Map",childGetValue("ShowOnMapFriendOffline").asString()); - } - else - { - childSetToolTip("Find on Map",childGetValue("ShowOnMapFriendOnline").asString()); - } - childSetVisible("Add Friend...", true); - childSetEnabled("Add Friend...", !avatar_is_friend); - childSetVisible("Pay...",TRUE); - childSetEnabled("Pay...",FALSE); - } - } - - BOOL is_god = FALSE; - if (gAgent.isGodlike()) is_god = TRUE; - - childSetVisible("Kick", is_god); - childSetEnabled("Kick", is_god); - childSetVisible("Freeze", is_god); - childSetEnabled("Freeze", is_god); - childSetVisible("Unfreeze", is_god); - childSetEnabled("Unfreeze", is_god); - childSetVisible("csr_btn", is_god); - childSetEnabled("csr_btn", is_god); -} - - -void LLPanelAvatar::resetGroupList() -{ - // only get these updates asynchronously via the group floater, which works on the agent only - if (mAvatarID != gAgent.getID()) - { - return; - } - - if (mPanelSecondLife) - { - LLScrollListCtrl* group_list = mPanelSecondLife->getChild("groups"); - if (group_list) - { - group_list->deleteAllItems(); - - S32 count = gAgent.mGroups.count(); - LLUUID id; - - for(S32 i = 0; i < count; ++i) - { - LLGroupData group_data = gAgent.mGroups.get(i); - id = group_data.mID; - std::string group_string; - /* Show group title? DUMMY_POWER for Don Grep - if(group_data.mOfficer) - { - group_string = "Officer of "; - } - else - { - group_string = "Member of "; - } - */ - - group_string += group_data.mName; - - LLSD row; - - row["id"] = id ; - row["columns"][0]["value"] = group_string; - row["columns"][0]["font"] = "SANSSERIF_SMALL"; - row["columns"][0]["width"] = 0; - group_list->addElement(row); - } - group_list->sortByColumnIndex(0, TRUE); - } - } -} - -// static -//----------------------------------------------------------------------------- -// onClickIM() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickIM(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - gIMMgr->setFloaterOpen(TRUE); - - std::string name; - LLNameEditor* nameedit = self->mPanelSecondLife->getChild("name"); - if (nameedit) name = nameedit->getText(); - gIMMgr->addSession(name, IM_NOTHING_SPECIAL, self->mAvatarID); -} - - -// static -//----------------------------------------------------------------------------- -// onClickTrack() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickTrack(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - if( gFloaterWorldMap ) - { - std::string name; - LLNameEditor* nameedit = self->mPanelSecondLife->getChild("name"); - if (nameedit) name = nameedit->getText(); - gFloaterWorldMap->trackAvatar(self->mAvatarID, name); - LLFloaterWorldMap::show(NULL, TRUE); - } -} - - -// static -void LLPanelAvatar::onClickAddFriend(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLNameEditor* name_edit = self->mPanelSecondLife->getChild("name"); - if (name_edit) - { - LLPanelFriends::requestFriendshipDialog(self->getAvatarID(), - name_edit->getText()); - } -} - -//----------------------------------------------------------------------------- -// onClickMute() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickMute(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - LLUUID agent_id = self->getAvatarID(); - LLNameEditor* name_edit = self->mPanelSecondLife->getChild("name"); - - if (name_edit) - { - std::string agent_name = name_edit->getText(); - LLFloaterMute::showInstance(); - - if (LLMuteList::getInstance()->isMuted(agent_id)) - { - LLFloaterMute::getInstance()->selectMute(agent_id); - } - else - { - LLMute mute(agent_id, agent_name, LLMute::AGENT); - LLMuteList::getInstance()->add(mute); - } - } -} - - -// static -void LLPanelAvatar::onClickOfferTeleport(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - handle_lure(self->mAvatarID); -} - - -// static -void LLPanelAvatar::onClickPay(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - handle_pay_by_id(self->mAvatarID); -} - - -// static -void LLPanelAvatar::onClickOK(void *userdata) -{ - LLPanelAvatar *self = (LLPanelAvatar *)userdata; - - // JC: Only save the data if we actually got the original - // properties. Otherwise we might save blanks into - // the database. - if (self - && self->mHaveProperties) - { - self->sendAvatarPropertiesUpdate(); - - LLTabContainer* tabs = self->getChild("tab"); - if ( tabs->getCurrentPanel() != self->mPanelClassified ) - { - self->mPanelClassified->apply(); - - LLFloaterAvatarInfo *infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID); - if (infop) - { - infop->close(); - } - } - else - { - if ( self->mPanelClassified->titleIsValid() ) - { - self->mPanelClassified->apply(); - - LLFloaterAvatarInfo *infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID); - if (infop) - { - infop->close(); - } - } - } - } -} - -// static -void LLPanelAvatar::onClickCancel(void *userdata) -{ - LLPanelAvatar *self = (LLPanelAvatar *)userdata; - - if (self) - { - LLFloaterAvatarInfo *infop; - if ((infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID))) - { - infop->close(); - } - else - { - // We're in the Search directory and are cancelling an edit - // to our own profile, so reset. - self->sendAvatarPropertiesRequest(); - } - } -} - - -void LLPanelAvatar::sendAvatarPropertiesRequest() -{ - lldebugs << "LLPanelAvatar::sendAvatarPropertiesRequest()" << llendl; - LLMessageSystem *msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_AvatarPropertiesRequest); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast( _PREHASH_AvatarID, mAvatarID); - gAgent.sendReliableMessage(); -} - -void LLPanelAvatar::sendAvatarNotesUpdate() -{ - std::string notes = mPanelNotes->childGetValue("notes edit").asString(); - - if (!mHaveNotes - && (notes.empty() || notes == getString("Loading"))) - { - // no notes from server and no user updates - return; - } - if (notes == mLastNotes) - { - // Avatar notes unchanged - return; - } - - LLMessageSystem *msg = gMessageSystem; - - msg->newMessage("AvatarNotesUpdate"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("TargetID", mAvatarID); - msg->addString("Notes", notes); - - gAgent.sendReliableMessage(); -} - - -// static -void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) -{ - LLUUID agent_id; // your id - LLUUID avatar_id; // target of this panel - LLUUID image_id; - LLUUID fl_image_id; - LLUUID partner_id; - std::string about_text; - std::string fl_about_text; - std::string born_on; - S32 charter_member_size = 0; - BOOL allow_publish = FALSE; - //BOOL mature = FALSE; - BOOL identified = FALSE; - BOOL transacted = FALSE; - BOOL age_verified = FALSE; - BOOL online = FALSE; - std::string profile_url; - - U32 flags = 0x0; - - //llinfos << "properties packet size " << msg->getReceiveSize() << llendl; - - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id ); - - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelAvatar* self = *iter; - if (self->mAvatarID != avatar_id) - { - continue; - } - self->childSetEnabled("Instant Message...",TRUE); - self->childSetEnabled("Pay...",TRUE); - self->childSetEnabled("Mute",TRUE); - - self->childSetEnabled("drop target",TRUE); - - self->mHaveProperties = TRUE; - self->enableOKIfReady(); - - msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, image_id ); - msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, fl_image_id ); - msg->getUUIDFast(_PREHASH_PropertiesData, _PREHASH_PartnerID, partner_id); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_AboutText, about_text ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_FLAboutText, fl_about_text ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_BornOn, born_on); - msg->getString("PropertiesData","ProfileURL", profile_url); - msg->getU32Fast(_PREHASH_PropertiesData, _PREHASH_Flags, flags); - - identified = (flags & AVATAR_IDENTIFIED); - transacted = (flags & AVATAR_TRANSACTED); - age_verified = (flags & AVATAR_AGEVERIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations - allow_publish = (flags & AVATAR_ALLOW_PUBLISH); - online = (flags & AVATAR_ONLINE); - - U8 caption_index = 0; - std::string caption_text; - charter_member_size = msg->getSize("PropertiesData", "CharterMember"); - if(1 == charter_member_size) - { - msg->getBinaryData("PropertiesData", "CharterMember", &caption_index, 1); - } - else if(1 < charter_member_size) - { - msg->getString("PropertiesData", "CharterMember", caption_text); - } - - - if(caption_text.empty()) - { - LLStringUtil::format_map_t args; - caption_text = self->mPanelSecondLife->getString("CaptionTextAcctInfo"); - - const char* ACCT_TYPE[] = { - "AcctTypeResident", - "AcctTypeTrial", - "AcctTypeCharterMember", - "AcctTypeEmployee" - }; - caption_index = llclamp(caption_index, (U8)0, (U8)(LL_ARRAY_SIZE(ACCT_TYPE)-1)); - args["[ACCTTYPE]"] = self->mPanelSecondLife->getString(ACCT_TYPE[caption_index]); - - std::string payment_text = " "; - const S32 DEFAULT_CAPTION_LINDEN_INDEX = 3; - if(caption_index != DEFAULT_CAPTION_LINDEN_INDEX) - { - if(transacted) - { - payment_text = "PaymentInfoUsed"; - } - else if (identified) - { - payment_text = "PaymentInfoOnFile"; - } - else - { - payment_text = "NoPaymentInfoOnFile"; - } - args["[PAYMENTINFO]"] = self->mPanelSecondLife->getString(payment_text); - std::string age_text = age_verified ? "AgeVerified" : "NotAgeVerified"; - // Do not display age verification status at this time - //args["[[AGEVERIFICATION]]"] = self->mPanelSecondLife->getString(age_text); - args["[AGEVERIFICATION]"] = " "; - } - else - { - args["[PAYMENTINFO]"] = " "; - args["[AGEVERIFICATION]"] = " "; - } - LLStringUtil::format(caption_text, args); - } - - self->mPanelSecondLife->childSetValue("acct", caption_text); - self->mPanelSecondLife->childSetValue("born", born_on); - - EOnlineStatus online_status = (online) ? ONLINE_STATUS_YES : ONLINE_STATUS_NO; - - self->setOnlineStatus(online_status); - - self->mPanelWeb->setWebURL(profile_url); - - LLTextureCtrl* image_ctrl = self->mPanelSecondLife->getChild("img"); - if(image_ctrl) - { - image_ctrl->setImageAssetID(image_id); - } - self->childSetValue("about", about_text); - - self->mPanelSecondLife->setPartnerID(partner_id); - self->mPanelSecondLife->updatePartnerName(); - - if (self->mPanelFirstLife) - { - // Teens don't get these - self->mPanelFirstLife->childSetValue("about", fl_about_text); - LLTextureCtrl* image_ctrl = self->mPanelFirstLife->getChild("img"); - if(image_ctrl) - { - image_ctrl->setImageAssetID(fl_image_id); - } - - self->mPanelSecondLife->childSetValue("allow_publish", allow_publish); - - } - } -} - -// static -void LLPanelAvatar::processAvatarInterestsReply(LLMessageSystem *msg, void**) -{ - LLUUID agent_id; // your id - LLUUID avatar_id; // target of this panel - - U32 want_to_mask; - std::string want_to_text; - U32 skills_mask; - std::string skills_text; - std::string languages_text; - - //llinfos << "properties packet size " << msg->getReceiveSize() << llendl; - - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id ); - - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelAvatar* self = *iter; - if (self->mAvatarID != avatar_id) - { - continue; - } - - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, want_to_mask ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_WantToText, want_to_text ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, skills_mask ); - msg->getStringFast(_PREHASH_PropertiesData, _PREHASH_SkillsText, skills_text ); - msg->getString(_PREHASH_PropertiesData, "LanguagesText", languages_text ); - - self->mPanelAdvanced->setWantSkills(want_to_mask, want_to_text, skills_mask, skills_text, languages_text); - } -} - -// Separate function because the groups list can be very long, almost -// filling a packet. JC -// static -void LLPanelAvatar::processAvatarGroupsReply(LLMessageSystem *msg, void**) -{ - LLUUID agent_id; // your id - LLUUID avatar_id; // target of this panel - U64 group_powers; - std::string group_title; - LLUUID group_id; - std::string group_name; - LLUUID group_insignia_id; - - llinfos << "groups packet size " << msg->getReceiveSize() << llendl; - - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id ); - - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelAvatar* self = *iter; - if (self->mAvatarID != avatar_id) - { - continue; - } - - LLScrollListCtrl* group_list = self->mPanelSecondLife->getChild("groups"); -// if(group_list) -// { -// group_list->deleteAllItems(); -// } - - S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); - if (0 == group_count) - { - if(group_list) group_list->addCommentText(std::string("None")); // *TODO: Translate - } - else - { - for(S32 i = 0; i < group_count; ++i) - { - msg->getU64( _PREHASH_GroupData, "GroupPowers", group_powers, i ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_title, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_id, i); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_name, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_insignia_id, i ); - - std::string group_string; - if (group_id.notNull()) - { - group_string.assign(group_name); - } - else - { - group_string.assign(""); - } - - // Is this really necessary? Remove existing entry if it exists. - // TODO: clear the whole list when a request for data is made - if (group_list) - { - S32 index = group_list->getItemIndex(group_id); - if ( index >= 0 ) - { - group_list->deleteSingleItem(index); - } - } - - LLSD row; - row["id"] = group_id; - row["columns"][0]["value"] = group_string; - row["columns"][0]["font"] = "SANSSERIF_SMALL"; - if (group_list) - { - group_list->addElement(row); - } - } - } - if(group_list) group_list->sortByColumnIndex(0, TRUE); - } -} - -// Don't enable the OK button until you actually have the data. -// Otherwise you will write blanks back into the database. -void LLPanelAvatar::enableOKIfReady() -{ - if(mHaveProperties && childIsVisible("OK")) - { - childSetEnabled("OK", TRUE); - } - else - { - childSetEnabled("OK", FALSE); - } -} - -void LLPanelAvatar::sendAvatarPropertiesUpdate() -{ - llinfos << "Sending avatarinfo update" << llendl; - BOOL allow_publish = FALSE; - BOOL mature = FALSE; - if (LLPanelAvatar::sAllowFirstLife) - { - allow_publish = childGetValue("allow_publish"); - //A profile should never be mature. - mature = FALSE; - } - U32 want_to_mask = 0x0; - U32 skills_mask = 0x0; - std::string want_to_text; - std::string skills_text; - std::string languages_text; - mPanelAdvanced->getWantSkills(&want_to_mask, want_to_text, &skills_mask, skills_text, languages_text); - - LLUUID first_life_image_id; - std::string first_life_about_text; - if (mPanelFirstLife) - { - first_life_about_text = mPanelFirstLife->childGetValue("about").asString(); - LLTextureCtrl* image_ctrl = mPanelFirstLife->getChild("img"); - if(image_ctrl) - { - first_life_image_id = image_ctrl->getImageAssetID(); - } - } - - std::string about_text = mPanelSecondLife->childGetValue("about").asString(); - - LLMessageSystem *msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_AvatarPropertiesUpdate); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - msg->nextBlockFast(_PREHASH_PropertiesData); - - LLTextureCtrl* image_ctrl = mPanelSecondLife->getChild("img"); - if(image_ctrl) - { - msg->addUUIDFast( _PREHASH_ImageID, image_ctrl->getImageAssetID()); - } - else - { - msg->addUUIDFast( _PREHASH_ImageID, LLUUID::null); - } -// msg->addUUIDFast( _PREHASH_ImageID, mPanelSecondLife->mimage_ctrl->getImageAssetID() ); - msg->addUUIDFast( _PREHASH_FLImageID, first_life_image_id); - msg->addStringFast( _PREHASH_AboutText, about_text); - msg->addStringFast( _PREHASH_FLAboutText, first_life_about_text); - - msg->addBOOL("AllowPublish", allow_publish); - msg->addBOOL("MaturePublish", mature); - msg->addString("ProfileURL", mPanelWeb->childGetText("url_edit")); - gAgent.sendReliableMessage(); - - msg->newMessage("AvatarInterestsUpdate"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); - msg->nextBlockFast(_PREHASH_PropertiesData); - msg->addU32Fast( _PREHASH_WantToMask, want_to_mask); - msg->addStringFast( _PREHASH_WantToText, want_to_text); - msg->addU32Fast( _PREHASH_SkillsMask, skills_mask); - msg->addStringFast( _PREHASH_SkillsText, skills_text); - msg->addString( "LanguagesText", languages_text); - gAgent.sendReliableMessage(); -} - -void LLPanelAvatar::selectTab(S32 tabnum) -{ - if(mTab) - { - mTab->selectTab(tabnum); - } -} - -void LLPanelAvatar::selectTabByName(std::string tab_name) -{ - if (mTab) - { - if (tab_name.empty()) - { - mTab->selectFirstTab(); - } - else - { - mTab->selectTabByName(tab_name); - } - } -} - - -void LLPanelAvatar::processAvatarNotesReply(LLMessageSystem *msg, void**) -{ - // extract the agent id - LLUUID agent_id; - msg->getUUID("AgentData", "AgentID", agent_id); - - LLUUID target_id; - msg->getUUID("Data", "TargetID", target_id); - - // look up all panels which have this avatar - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelAvatar* self = *iter; - if (self->mAvatarID != target_id) - { - continue; - } - - std::string text; - msg->getString("Data", "Notes", text); - self->childSetValue("notes edit", text); - self->childSetEnabled("notes edit", true); - self->mHaveNotes = true; - self->mLastNotes = text; - } -} - - -void LLPanelAvatar::processAvatarClassifiedReply(LLMessageSystem *msg, void** userdata) -{ - LLUUID agent_id; - LLUUID target_id; - - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TargetID, target_id); - - // look up all panels which have this avatar target - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelAvatar* self = *iter; - if (self->mAvatarID != target_id) - { - continue; - } - - self->mPanelClassified->processAvatarClassifiedReply(msg, userdata); - } -} - -void LLPanelAvatar::processAvatarPicksReply(LLMessageSystem *msg, void** userdata) -{ - LLUUID agent_id; - LLUUID target_id; - - msg->getUUID("AgentData", "AgentID", agent_id); - msg->getUUID("AgentData", "TargetID", target_id); - - // look up all panels which have this avatar target - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelAvatar* self = *iter; - if (self->mAvatarID != target_id) - { - continue; - } - - self->mPanelPicks->processAvatarPicksReply(msg, userdata); - } -} - -// static -void LLPanelAvatar::onClickKick(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect(left, top, left+400, top-300); - - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotifications::instance().add("KickUser", LLSD(), payload, finishKick); -} - -//static -bool LLPanelAvatar::finishKick(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); - msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickFreeze(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotifications::instance().add("FreezeUser", LLSD(), payload, LLPanelAvatar::finishFreeze); -} - -// static -bool LLPanelAvatar::finishFreeze(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); - msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickUnfreeze(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, LLPanelAvatar::finishUnfreeze); -} - -// static -bool LLPanelAvatar::finishUnfreeze(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - std::string text = response["message"].asString(); - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); - msg->addStringFast(_PREHASH_Reason, text ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickCSR(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*)userdata; - if (!self) return; - - LLNameEditor* name_edit = self->getChild("name"); - if (!name_edit) return; - - std::string name = name_edit->getText(); - if (name.empty()) return; - - std::string url = "http://csr.lindenlab.com/agent/"; - - // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) - { - if (name[i] == ' ') - { - url += "%20"; - } - else - { - url += name[i]; - } - } - - LLWeb::loadURL(url); -} - - -void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelSecondLife = new LLPanelAvatarSecondLife(std::string("2nd Life"),LLRect(),self); - return self->mPanelSecondLife; -} - -void* LLPanelAvatar::createPanelAvatarWeb(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelWeb = new LLPanelAvatarWeb(std::string("Web"),LLRect(),self); - return self->mPanelWeb; -} - -void* LLPanelAvatar::createPanelAvatarInterests(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelAdvanced = new LLPanelAvatarAdvanced(std::string("Interests"),LLRect(),self); - return self->mPanelAdvanced; -} - - -void* LLPanelAvatar::createPanelAvatarPicks(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelPicks = new LLPanelAvatarPicks(std::string("Picks"),LLRect(),self); - return self->mPanelPicks; -} - -void* LLPanelAvatar::createPanelAvatarClassified(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelClassified = new LLPanelAvatarClassified(std::string("Classified"),LLRect(),self); - return self->mPanelClassified; -} - -void* LLPanelAvatar::createPanelAvatarFirstLife(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelFirstLife = new LLPanelAvatarFirstLife(std::string("1st Life"), LLRect(), self); - return self->mPanelFirstLife; -} - -void* LLPanelAvatar::createPanelAvatarNotes(void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelNotes = new LLPanelAvatarNotes(std::string("My Notes"),LLRect(),self); - return self->mPanelNotes; } diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 12e1b99360..f72eb1990d 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -38,8 +38,11 @@ #include "lluuid.h" #include "llwebbrowserctrl.h" +#include "llavatarpropertiesprocessor.h" + class LLButton; class LLCheckBoxCtrl; +class LLComboBox; class LLDropTarget; class LLInventoryItem; class LLLineEditor; @@ -56,6 +59,12 @@ class LLViewerObject; class LLMessageSystem; class LLIconCtrl; class LLWebBrowserCtrl; +class LLVector3d; +class LLFloaterReg; + +class LLPanelMeProfile; +class LLPanelPick; +class LLAgent; enum EOnlineStatus { @@ -63,321 +72,127 @@ enum EOnlineStatus ONLINE_STATUS_YES = 1 }; -// Base class for all sub-tabs inside the avatar profile. Many of these -// panels need to keep track of the parent panel (to get the avatar id) -// and only request data from the database when they are first drawn. JC -class LLPanelAvatarTab : public LLPanel -{ -public: - LLPanelAvatarTab(const std::string& name, const LLRect &rect, - LLPanelAvatar* panel_avatar); - - // Calls refresh() once per frame when panel is visible - /*virtual*/ void draw(); - - LLPanelAvatar* getPanelAvatar() const { return mPanelAvatar; } - - void setDataRequested(bool requested) { mDataRequested = requested; } - bool isDataRequested() const { return mDataRequested; } - - // If the data for this tab has not yet been requested, - // send the request. Used by tabs that are filled in only - // when they are first displayed. - // type is one of "avatarnotesrequest", "avatarpicksrequest", - // or "avatarclassifiedsrequest" - void sendAvatarProfileRequestIfNeeded(const std::string& method); - -private: - LLPanelAvatar* mPanelAvatar; - bool mDataRequested; -}; - -class LLPanelAvatarFirstLife : public LLPanelAvatarTab +class LLPanelProfileTab + : public LLPanel + , public LLAvatarPropertiesObserver { public: - LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); + + LLPanelProfileTab(const LLUUID& avatar_id); + LLPanelProfileTab(const Params& params ); - void enableControls(BOOL own_avatar); -}; + void setAvatarId(const LLUUID& avatar_id); + const LLUUID& getAvatarId(){return mAvatarId;} -class LLPanelAvatarSecondLife -: public LLPanelAvatarTab -{ -public: - LLPanelAvatarSecondLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar ); - - /*virtual*/ BOOL postBuild(void); - /*virtual*/ void refresh(); - - static void onClickImage( void *userdata); - static void onClickFriends( void *userdata); - static void onDoubleClickGroup(void* userdata); - static void onClickPublishHelp(void *userdata); - static void onClickPartnerHelp(void *userdata); - static bool onClickPartnerHelpLoadURL(const LLSD& notification, const LLSD& response); - static void onClickPartnerInfo(void *userdata); - - // Clear out the controls anticipating new network data. - void clearControls(); - void enableControls(BOOL own_avatar); - void updateOnlineText(BOOL online, BOOL have_calling_card); - void updatePartnerName(); - - void setPartnerID(LLUUID id) { mPartnerID = id; } + virtual void updateData() = 0; -private: - LLUUID mPartnerID; -}; + virtual void onActivate(const LLUUID& id); + typedef enum e_profile_type + { + PT_UNKNOWN, + PT_OWN, + PT_OTHER + } EProfileType; -// WARNING! The order of the inheritance here matters!! Do not change. - KLW -class LLPanelAvatarWeb : - public LLPanelAvatarTab - , public LLWebBrowserCtrlObserver -{ -public: - LLPanelAvatarWeb(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - /*virtual*/ ~LLPanelAvatarWeb(); - /*virtual*/ BOOL postBuild(void); - - /*virtual*/ void refresh(); + virtual void onAddFriend(); - void enableControls(BOOL own_avatar); + virtual void onIM(); - void setWebURL(std::string url); + virtual void onTeleport(); - void load(std::string url); - static void onURLKeystroke(LLLineEditor* editor, void* data); - static void onCommitLoad(LLUICtrl* ctrl, void* data); - static void onCommitURL(LLUICtrl* ctrl, void* data); - static void onClickWebProfileHelp(void *); + virtual void clear(){}; - // browser observer impls - virtual void onStatusTextChange( const EventType& eventIn ); - virtual void onLocationChange( const EventType& eventIn ); +protected: + virtual ~LLPanelProfileTab(); + void setProfileType(); -private: - std::string mHome; - std::string mNavigateTo; - LLWebBrowserCtrl* mWebBrowser; +protected: + e_profile_type mProfileType; + LLUUID mAvatarId; }; - -class LLPanelAvatarAdvanced : public LLPanelAvatarTab +class LLPanelAvatarProfile + : public LLPanelProfileTab { public: - LLPanelAvatarAdvanced(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); - - void enableControls(BOOL own_avatar); - void setWantSkills(U32 want_to_mask, const std::string& want_to_text, - U32 skills_mask, const std::string& skills_text, - const std::string& languages_text); - void getWantSkills(U32* want_to_mask, std::string& want_to_text, - U32* skills_mask, std::string& skills_text, - std::string& languages_text); - -private: - S32 mWantToCount; - S32 mSkillsCount; - LLCheckBoxCtrl *mWantToCheck[8]; - LLLineEditor *mWantToEdit; - LLCheckBoxCtrl *mSkillsCheck[8]; - LLLineEditor *mSkillsEdit; -}; - - -class LLPanelAvatarNotes : public LLPanelAvatarTab -{ -public: - LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); + LLPanelAvatarProfile(const LLUUID& avatar_id = LLUUID::null); + LLPanelAvatarProfile(const Params& params ); + ~LLPanelAvatarProfile(); + + static void* create(void* data); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - /*virtual*/ void refresh(); + void updateData(); - void clearControls(); + void clear(); - static void onCommitNotes(LLUICtrl* field, void* userdata); -}; - - -class LLPanelAvatarClassified : public LLPanelAvatarTab -{ -public: - LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); + virtual void clearControls(); /*virtual*/ BOOL postBuild(void); + void onOpen(const LLSD& key); - /*virtual*/ void refresh(); + void onAddFriendButtonClick(); - // If can close, return TRUE. If cannot close, pop save/discard dialog - // and return FALSE. - BOOL canClose(); + void onIMButtonClick(); - void apply(); + void onCallButtonClick(); - BOOL titleIsValid(); + void onTeleportButtonClick(); - // Delete all the classified sub-panels from the tab container - void deleteClassifiedPanels(); - - // Unpack the outline of classified for this avatar (count, names, but not - // actual data). - void processAvatarClassifiedReply(LLMessageSystem* msg, void**); + void onShareButtonClick(); private: - static void onClickNew(void* data); - static void onClickDelete(void* data); + bool isOwnProfile(){return PT_OWN == mProfileType;} + bool isEditMode(){return mEditMode;} + void updateChildrenList(); + void onStatusChanged(); + void onStatusMessageChanged(); + void setCaptionText(const LLAvatarData* avatar_data); + void scrollToTop(); - bool callbackDelete(const LLSD& notification, const LLSD& response); - bool callbackNew(const LLSD& notification, const LLSD& response); -}; - -class LLPanelAvatarPicks : public LLPanelAvatarTab -{ -public: - LLPanelAvatarPicks(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - - /*virtual*/ BOOL postBuild(void); - - /*virtual*/ void refresh(); - - // Delete all the pick sub-panels from the tab container - void deletePickPanels(); - - // Unpack the outline of picks for this avatar (count, names, but not - // actual data). - void processAvatarPicksReply(LLMessageSystem* msg, void**); - void processAvatarClassifiedReply(LLMessageSystem* msg, void**); +protected: + bool mEditMode; private: - static void onClickNew(void* data); - static void onClickDelete(void* data); - - bool callbackDelete(const LLSD& notification, const LLSD& response); + bool mUpdated; + LLComboBox * mStatusCombobox; + LLLineEditor * mStatusMessage; }; -class LLPanelAvatar : public LLPanel +class LLPanelAvatarNotes + : public LLPanelProfileTab { public: - LLPanelAvatar(const std::string& name, const LLRect &rect, BOOL allow_edit); - /*virtual*/ ~LLPanelAvatar(); + LLPanelAvatarNotes(const LLUUID& id = LLUUID::null); + LLPanelAvatarNotes(const Params& params ); + ~LLPanelAvatarNotes(); - /*virtual*/ BOOL postBuild(void); + static void* create(void* data); - // If can close, return TRUE. If cannot close, pop save/discard dialog - // and return FALSE. - BOOL canClose(); + BOOL postBuild(void); - void setAvatar(LLViewerObject *avatarp); + void onCommitRights(); - // Fill in the avatar ID and handle some field fill-in, as well as - // button enablement. - // Pass one of the ONLINE_STATUS_foo constants above. - void setAvatarID(const LLUUID &avatar_id, const std::string &name, EOnlineStatus online_status); + void onCommitNotes(); - void setOnlineStatus(EOnlineStatus online_status); + void clear(); - const LLUUID& getAvatarID() const { return mAvatarID; } - - void resetGroupList(); - - void sendAvatarStatisticsRequest(); - - void sendAvatarPropertiesRequest(); - void sendAvatarPropertiesUpdate(); - - void sendAvatarNotesRequest(); - void sendAvatarNotesUpdate(); - - void sendAvatarPicksRequest(); + void processProperties(void* data, EAvatarProcessorType type); - void selectTab(S32 tabnum); - void selectTabByName(std::string tab_name); + void updateData(); - BOOL haveData() { return mHaveProperties && mHaveStatistics; } - BOOL isEditable() const { return mAllowEdit; } - - static void processAvatarPropertiesReply(LLMessageSystem *msg, void **); - static void processAvatarInterestsReply(LLMessageSystem *msg, void **); - static void processAvatarGroupsReply(LLMessageSystem* msg, void**); - static void processAvatarNotesReply(LLMessageSystem *msg, void **); - static void processAvatarPicksReply(LLMessageSystem *msg, void **); - static void processAvatarClassifiedReply(LLMessageSystem *msg, void **); - - static void onClickTrack( void *userdata); - static void onClickIM( void *userdata); - static void onClickOfferTeleport( void *userdata); - static void onClickPay( void *userdata); - static void onClickAddFriend(void* userdata); - static void onClickOK( void *userdata); - static void onClickCancel( void *userdata); - static void onClickKick( void *userdata); - static void onClickFreeze( void *userdata); - static void onClickUnfreeze(void *userdata); - static void onClickCSR( void *userdata); - static void onClickMute( void *userdata); - -private: - void enableOKIfReady(); - - static bool finishKick(const LLSD& notification, const LLSD& response); - static bool finishFreeze(const LLSD& notification, const LLSD& response); - static bool finishUnfreeze(const LLSD& notification, const LLSD& response); - - static void showProfileCallback(S32 option, void *userdata); +protected: +}; - static void* createPanelAvatar(void* data); - static void* createFloaterAvatarInfo(void* data); - static void* createPanelAvatarSecondLife(void* data); - static void* createPanelAvatarWeb(void* data); - static void* createPanelAvatarInterests(void* data); - static void* createPanelAvatarPicks(void* data); - static void* createPanelAvatarClassified(void* data); - static void* createPanelAvatarFirstLife(void* data); - static void* createPanelAvatarNotes(void* data); -public: - LLPanelAvatarSecondLife* mPanelSecondLife; - LLPanelAvatarAdvanced* mPanelAdvanced; - LLPanelAvatarClassified* mPanelClassified; - LLPanelAvatarPicks* mPanelPicks; - LLPanelAvatarNotes* mPanelNotes; - LLPanelAvatarFirstLife* mPanelFirstLife; - LLPanelAvatarWeb* mPanelWeb; - - LLDropTarget* mDropTarget; - - // Teen users are not allowed to see or enter data into the first life page, - // or their own about/interests text entry fields. - static BOOL sAllowFirstLife; - -private: - LLUUID mAvatarID; // for which avatar is this window? - BOOL mIsFriend; // Are we friends? - BOOL mHaveProperties; - BOOL mHaveStatistics; - // only update note if data received from database and - // note is changed from database version - bool mHaveNotes; - std::string mLastNotes; - LLTabContainer* mTab; - BOOL mAllowEdit; - - typedef std::list panel_list_t; - static panel_list_t sAllPanels; -}; // helper funcs void add_left_label(LLPanel *panel, const std::string& name, S32 y); - #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 9e4f9709a8..c328bcb7f9 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -40,6 +40,7 @@ #include "lldir.h" #include "lldispatcher.h" +#include "llfloaterreg.h" #include "llparcel.h" #include "message.h" @@ -54,7 +55,6 @@ #include "lllineeditor.h" #include "llfloateravatarinfo.h" #include "llfloaterclassified.h" -#include "lltabcontainervertical.h" #include "lltextbox.h" #include "llcombobox.h" #include "llviewertexteditor.h" @@ -70,6 +70,7 @@ #include "llviewerregion.h" #include "llviewerwindow.h" // for window width, height #include "llappviewer.h" // abortQuit() +#include "lltrans.h" const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ const S32 MATURE_UNDEFINED = -1; @@ -151,7 +152,7 @@ LLClassifiedTeleportHandler gClassifiedTeleportHandler; */ LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search) -: LLPanel(std::string("Classified Panel")), +: LLPanel(), mInFinder(in_finder), mFromSearch(from_search), mDirty(false), @@ -231,44 +232,37 @@ void LLPanelClassified::reset() BOOL LLPanelClassified::postBuild() { mSnapshotCtrl = getChild("snapshot_ctrl"); - mSnapshotCtrl->setCommitCallback(onCommitAny); - mSnapshotCtrl->setCallbackUserData(this); + mSnapshotCtrl->setCommitCallback(onCommitAny, this); mSnapshotSize = mSnapshotCtrl->getRect(); mNameEditor = getChild("given_name_editor"); mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN); mNameEditor->setCommitOnFocusLost(TRUE); mNameEditor->setFocusReceivedCallback(focusReceived, this); - mNameEditor->setCommitCallback(onCommitAny); - mNameEditor->setCallbackUserData(this); + mNameEditor->setCommitCallback(onCommitAny, this); mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII ); mDescEditor = getChild("desc_editor"); mDescEditor->setCommitOnFocusLost(TRUE); mDescEditor->setFocusReceivedCallback(focusReceived, this); - mDescEditor->setCommitCallback(onCommitAny); - mDescEditor->setCallbackUserData(this); + mDescEditor->setCommitCallback(onCommitAny, this); mDescEditor->setTabsToNextField(TRUE); mLocationEditor = getChild("location_editor"); mSetBtn = getChild( "set_location_btn"); - mSetBtn->setClickedCallback(onClickSet); - mSetBtn->setCallbackUserData(this); + mSetBtn->setClickedCallback(onClickSet, this); mTeleportBtn = getChild( "classified_teleport_btn"); - mTeleportBtn->setClickedCallback(onClickTeleport); - mTeleportBtn->setCallbackUserData(this); + mTeleportBtn->setClickedCallback(onClickTeleport, this); mMapBtn = getChild( "classified_map_btn"); - mMapBtn->setClickedCallback(onClickMap); - mMapBtn->setCallbackUserData(this); + mMapBtn->setClickedCallback(onClickMap, this); if(mInFinder) { mProfileBtn = getChild( "classified_profile_btn"); - mProfileBtn->setClickedCallback(onClickProfile); - mProfileBtn->setCallbackUserData(this); + mProfileBtn->setClickedCallback(onClickProfile, this); } mCategoryCombo = getChild( "classified_category_combo"); @@ -277,16 +271,14 @@ BOOL LLPanelClassified::postBuild() iter != LLClassifiedInfo::sCategories.end(); iter++) { - mCategoryCombo->add(iter->second, (void *)((intptr_t)iter->first), ADD_BOTTOM); + mCategoryCombo->add(LLTrans::getString(iter->second), (void *)((intptr_t)iter->first), ADD_BOTTOM); } mCategoryCombo->setCurrentByIndex(0); - mCategoryCombo->setCommitCallback(onCommitAny); - mCategoryCombo->setCallbackUserData(this); + mCategoryCombo->setCommitCallback(onCommitAny, this); mMatureCombo = getChild( "classified_mature_check"); mMatureCombo->setCurrentByIndex(0); - mMatureCombo->setCommitCallback(onCommitAny); - mMatureCombo->setCallbackUserData(this); + mMatureCombo->setCommitCallback(onCommitAny, this); if (gAgent.wantsPGOnly()) { // Teens don't get to set mature flag. JC @@ -297,13 +289,11 @@ BOOL LLPanelClassified::postBuild() if (!mInFinder) { mAutoRenewCheck = getChild( "auto_renew_check"); - mAutoRenewCheck->setCommitCallback(onCommitAny); - mAutoRenewCheck->setCallbackUserData(this); + mAutoRenewCheck->setCommitCallback(onCommitAny, this); } mUpdateBtn = getChild("classified_update_btn"); - mUpdateBtn->setClickedCallback(onClickUpdate); - mUpdateBtn->setCallbackUserData(this); + mUpdateBtn->setClickedCallback(onClickUpdate, this); if (!mInFinder) { @@ -360,7 +350,7 @@ bool LLPanelClassified::saveCallback(const LLSD& notification, const LLSD& respo LLFloater* parent_floater = gFloaterView->getParentFloater(this); if (parent_floater) { - parent_floater->close(); + parent_floater->closeFloater(); } } break; @@ -455,10 +445,11 @@ void LLPanelClassified::setClickThrough(const LLUUID& classified_id, if (self->mClickThroughText) { - std::string msg = llformat("Clicks: %d teleport, %d map, %d profile", - self->mTeleportClicksNew + self->mTeleportClicksOld, - self->mMapClicksNew + self->mMapClicksOld, - self->mProfileClicksNew + self->mProfileClicksOld); + LLStringUtil::format_map_t args; + args["[TELEPORT]"] = llformat ("%d", self->mTeleportClicksNew + self->mTeleportClicksOld); + args["[MAP]"] = llformat ("%d", self->mMapClicksNew + self->mMapClicksOld); + args["[PROFILE]"] = llformat ("%d", self->mProfileClicksNew + self->mProfileClicksOld); + std::string msg = LLTrans::getString ("ClassifiedClicksTxt", args); self->mClickThroughText->setText(msg); } } @@ -623,7 +614,6 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** U32 date = 0; msg->getU32Fast(_PREHASH_Data, _PREHASH_CreationDate, date); time_t tim = date; - tm *now=localtime(&tim); // future use U32 expiration_date = 0; @@ -674,9 +664,13 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void ** self->mAutoRenewCheck->set(auto_renew); } - std::string datestr = llformat("%02d/%02d/%d", now->tm_mon+1, now->tm_mday, now->tm_year+1900); + std::string dateStr = self->getString("dateStr"); + LLSD substitution; + substitution["datetime"] = (S32) tim; + LLStringUtil::format (dateStr, substitution); + LLStringUtil::format_map_t string_args; - string_args["[DATE]"] = datestr; + string_args["[DATE]"] = dateStr; string_args["[AMT]"] = llformat("%d", price_for_listing); self->childSetText("classified_info_text", self->getString("ad_placed_paid", string_args)); @@ -846,7 +840,7 @@ void LLPanelClassified::gotMature() if (mPaidFor) { LLNotification::Params params("PublishClassified"); - params.functor(boost::bind(&LLPanelClassified::confirmPublish, this, _1, _2)); + params.functor.function(boost::bind(&LLPanelClassified::confirmPublish, this, _1, _2)); LLNotifications::instance().forceResponse(params, 0); } else @@ -941,7 +935,7 @@ void LLPanelClassified::onClickTeleport(void* data) if (!self->mPosGlobal.isExactlyZero()) { gAgent.teleportViaLocation(self->mPosGlobal); - gFloaterWorldMap->trackLocation(self->mPosGlobal); + LLFloaterWorldMap::getInstance()->trackLocation(self->mPosGlobal); self->sendClassifiedClickMessage("teleport"); } @@ -952,8 +946,8 @@ void LLPanelClassified::onClickTeleport(void* data) void LLPanelClassified::onClickMap(void* data) { LLPanelClassified* self = (LLPanelClassified*)data; - gFloaterWorldMap->trackLocation(self->mPosGlobal); - LLFloaterWorldMap::show(NULL, TRUE); + LLFloaterWorldMap::getInstance()->trackLocation(self->mPosGlobal); + LLFloaterReg::showInstance("world_map", "center"); self->sendClassifiedClickMessage("map"); } @@ -984,7 +978,7 @@ void LLPanelClassified::onClickSet(void* data) self->mPosGlobal = gAgent.getPositionGlobal(); std::string location_text; - std::string regionName = "(will update after publish)"; + std::string regionName = LLTrans::getString("ClassifiedUpdateAfterPublish"); LLViewerRegion* pRegion = gAgent.getRegion(); if (pRegion) { @@ -1065,7 +1059,7 @@ void LLPanelClassified::sendClassifiedClickMessage(const std::string& type) //////////////////////////////////////////////////////////////////////////////////////////// LLFloaterPriceForListing::LLFloaterPriceForListing() -: LLFloater(std::string("PriceForListing")), +: LLFloater(), mCallback(NULL), mUserData(NULL) { } @@ -1129,7 +1123,7 @@ void LLFloaterPriceForListing::buttonCore(S32 button, void* data) { std::string text = self->childGetText("price_edit"); self->mCallback(button, text, self->mUserData); - self->close(); + self->closeFloater(); } } diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index a2f3d9e12c..b7ec485872 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -36,37 +36,33 @@ #include "llpanelcontents.h" // linden library includes +#include "lleconomy.h" #include "llerror.h" +#include "llfloaterreg.h" +#include "llfontgl.h" +#include "llmaterialtable.h" +#include "llpermissionsflags.h" #include "llrect.h" #include "llstring.h" -#include "llmaterialtable.h" -#include "llfontgl.h" +#include "llui.h" #include "m3math.h" -#include "llpermissionsflags.h" -#include "lleconomy.h" #include "material_codes.h" // project includes -#include "llui.h" -#include "llspinctrl.h" -#include "llcheckboxctrl.h" -#include "lltextbox.h" -#include "llbutton.h" -#include "llcombobox.h" -#include "llfloaterbulkpermission.h" - #include "llagent.h" -#include "llviewerwindow.h" -#include "llworld.h" -#include "llviewerobject.h" -#include "llviewerregion.h" +#include "llfloaterbulkpermission.h" +#include "llpanelinventory.h" +#include "llpreviewscript.h" #include "llresmgr.h" #include "llselectmgr.h" -#include "llpreviewscript.h" #include "lltool.h" -#include "lltoolmgr.h" #include "lltoolcomp.h" -#include "llpanelinventory.h" +#include "lltoolmgr.h" +#include "lltrans.h" +#include "llviewerobject.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" +#include "llworld.h" // // Imported globals @@ -86,11 +82,13 @@ BOOL LLPanelContents::postBuild() childSetAction("button new script",&LLPanelContents::onClickNewScript, this); childSetAction("button permissions",&LLPanelContents::onClickPermissions, this); + mPanelInventory = getChild("contents_inventory"); + return TRUE; } -LLPanelContents::LLPanelContents(const std::string& name) - : LLPanel(name), +LLPanelContents::LLPanelContents() + : LLPanel(), mPanelInventory(NULL) { } @@ -171,7 +169,7 @@ void LLPanelContents::onClickNewScript(void *userdata) LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, - std::string("New Script"), + LLTrans::getString("PanelContentsNewScript"), desc, LLSaleInfo::DEFAULT, LLViewerInventoryItem::II_FLAGS_NONE, @@ -185,21 +183,7 @@ void LLPanelContents::onClickNewScript(void *userdata) // viewer so the viewer can auto-open the script and start // editing ASAP. #if 0 - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewScriptRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - - LLLiveLSLEditor* editor; - editor = new LLLiveLSLEditor("script ed", - rect, - "Script: New Script", - object->mID, - LLUUID::null); - editor->open(); /*Flawfinder: ignore*/ - - // keep onscreen - gFloaterView->adjustToFitScreen(editor, FALSE); + LLFloaterReg::showInstance("preview_scriptedit", LLSD(inv_item->getUUID()), TAKE_FOCUS_YES); #endif } } diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h index ea06707494..de1914bff9 100644 --- a/indra/newview/llpanelcontents.h +++ b/indra/newview/llpanelcontents.h @@ -46,7 +46,7 @@ class LLPanelContents : public LLPanel { public: virtual BOOL postBuild(); - LLPanelContents(const std::string& name); + LLPanelContents(); virtual ~LLPanelContents(); void refresh(); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e93a5be8ed..2ff22416ec 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -87,11 +87,10 @@ BOOL LLPanelFace::postBuild() if(mTextureCtrl) { mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mTextureCtrl->setCommitCallback( LLPanelFace::onCommitTexture ); - mTextureCtrl->setOnCancelCallback( LLPanelFace::onCancelTexture ); - mTextureCtrl->setOnSelectCallback( LLPanelFace::onSelectTexture ); - mTextureCtrl->setDragCallback(LLPanelFace::onDragTexture); - mTextureCtrl->setCallbackUserData( this ); + mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) ); + mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) ); + mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) ); + mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, _2)); mTextureCtrl->setFollowsTop(); mTextureCtrl->setFollowsLeft(); // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode @@ -118,10 +117,9 @@ BOOL LLPanelFace::postBuild() mColorSwatch = getChild("colorswatch"); if(mColorSwatch) { - mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor); - mColorSwatch->setOnCancelCallback(LLPanelFace::onCancelColor); - mColorSwatch->setOnSelectCallback(LLPanelFace::onSelectColor); - mColorSwatch->setCallbackUserData( this ); + mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2)); + mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2)); + mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); mColorSwatch->setFollowsTop(); mColorSwatch->setFollowsLeft(); mColorSwatch->setCanApplyImmediately(TRUE); @@ -137,8 +135,7 @@ BOOL LLPanelFace::postBuild() mCtrlColorTransp = getChild("ColorTrans"); if(mCtrlColorTransp) { - mCtrlColorTransp->setCommitCallback(LLPanelFace::onCommitAlpha); - mCtrlColorTransp->setCallbackUserData(this); + mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2)); mCtrlColorTransp->setPrecision(0); mCtrlColorTransp->setFollowsTop(); mCtrlColorTransp->setFollowsLeft(); @@ -147,23 +144,20 @@ BOOL LLPanelFace::postBuild() mCheckFullbright = getChild("checkbox fullbright"); if (mCheckFullbright) { - mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright); - mCheckFullbright->setCallbackUserData( this ); + mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this); } mComboTexGen = getChild("combobox texgen"); if(mComboTexGen) { - mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen); + mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this); mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); - mComboTexGen->setCallbackUserData( this ); } mCtrlGlow = getChild("glow"); if(mCtrlGlow) { - mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow); - mCtrlGlow->setCallbackUserData(this); + mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this); } childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); @@ -183,8 +177,8 @@ BOOL LLPanelFace::postBuild() return TRUE; } -LLPanelFace::LLPanelFace(const std::string& name) -: LLPanel(name) +LLPanelFace::LLPanelFace() +: LLPanel() { } @@ -807,32 +801,25 @@ F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face) } -// static -void LLPanelFace::onCommitColor(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitColor(const LLSD& data) { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendColor(); + sendColor(); } -// static -void LLPanelFace::onCommitAlpha(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitAlpha(const LLSD& data) { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendAlpha(); + sendAlpha(); } -// static -void LLPanelFace::onCancelColor(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCancelColor(const LLSD& data) { LLSelectMgr::getInstance()->selectionRevertColors(); } -// static -void LLPanelFace::onSelectColor(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onSelectColor(const LLSD& data) { - LLPanelFace* self = (LLPanelFace*) userdata; LLSelectMgr::getInstance()->saveSelectedObjectColors(); - self->sendColor(); + sendColor(); } // static @@ -871,7 +858,7 @@ void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) } // static -BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*) +BOOL LLPanelFace::onDragTexture(LLInventoryItem* item) { BOOL accept = TRUE; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); @@ -888,28 +875,21 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*) return accept; } -// static -void LLPanelFace::onCommitTexture( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTexture( const LLSD& data ) { - LLPanelFace* self = (LLPanelFace*) userdata; - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); - - self->sendTexture(); + sendTexture(); } -// static -void LLPanelFace::onCancelTexture(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCancelTexture(const LLSD& data) { LLSelectMgr::getInstance()->selectionRevertTextures(); } -// static -void LLPanelFace::onSelectTexture(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onSelectTexture(const LLSD& data) { - LLPanelFace* self = (LLPanelFace*) userdata; LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - self->sendTexture(); + sendTexture(); } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index a2ead0c8a2..9600129696 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -52,7 +52,7 @@ class LLPanelFace : public LLPanel { public: virtual BOOL postBuild(); - LLPanelFace(const std::string& name); + LLPanelFace(); virtual ~LLPanelFace(); void refresh(); @@ -70,17 +70,18 @@ protected: void sendFullbright(); // applies and sends full bright void sendGlow(); - // this function is to return TRUE if the dra should succeed. - static BOOL onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item, void* ud); + // this function is to return TRUE if the drag should succeed. + static BOOL onDragTexture(LLInventoryItem* item); - static void onCommitTexture( LLUICtrl* ctrl, void* userdata); - static void onCancelTexture( LLUICtrl* ctrl, void* userdata); - static void onSelectTexture( LLUICtrl* ctrl, void* userdata); - static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); - static void onCommitColor( LLUICtrl* ctrl, void* userdata); - static void onCommitAlpha( LLUICtrl* ctrl, void* userdata); - static void onCancelColor( LLUICtrl* ctrl, void* userdata); - static void onSelectColor( LLUICtrl* ctrl, void* userdata); + void onCommitTexture(const LLSD& data); + void onCancelTexture(const LLSD& data); + void onSelectTexture(const LLSD& data); + void onCommitColor(const LLSD& data); + void onCommitAlpha(const LLSD& data); + void onCancelColor(const LLSD& data); + void onSelectColor(const LLSD& data); + + static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index d9d796fd9e..3acaa6b68e 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -46,12 +46,21 @@ #include "llviewerwindow.h" #include "llappviewer.h" #include "llnotifications.h" +#include "llfloater.h" // static void* LLPanelGroupTab::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupTab("panel group tab", *group_id); + return new LLPanelGroupTab(*group_id); +} + +LLPanelGroupTab::LLPanelGroupTab(const LLUUID& group_id) + : LLPanel(), + mGroupID(group_id), + mAllowEdit(TRUE), + mHasModal(FALSE) +{ } LLPanelGroupTab::~LLPanelGroupTab() @@ -68,13 +77,11 @@ BOOL LLPanelGroupTab::isVisibleByAgent(LLAgent* agentp) BOOL LLPanelGroupTab::postBuild() { // Hook up the help button callback. - LLButton* button = getChild("help_button"); + LLButton* button = findChild("help_button"); if (button) { - button->setClickedCallback(onClickHelp); - button->setCallbackUserData(this); + button->setCommitCallback(boost::bind(&LLPanelGroupTab::handleClickHelp, this)); } - mHelpText = getString("help_text"); return TRUE; } @@ -103,13 +110,6 @@ void LLPanelGroupTab::notifyObservers() } } -// static -void LLPanelGroupTab::onClickHelp(void* user_data) -{ - LLPanelGroupTab* self = static_cast(user_data); - self->handleClickHelp(); -} - void LLPanelGroupTab::handleClickHelp() { // Display the help text. @@ -125,67 +125,48 @@ void LLPanelGroupTab::handleClickHelp() } } -LLPanelGroup::LLPanelGroup(const std::string& filename, - const std::string& name, - const LLUUID& group_id, - const std::string& initial_tab_selected) -: LLPanel(name, LLRect(), FALSE), +LLPanelGroup::LLPanelGroup(const LLUUID& group_id) +: LLPanel(), LLGroupMgrObserver( group_id ), mCurrentTab( NULL ), mRequestedTab( NULL ), mTabContainer( NULL ), mIgnoreTransition( FALSE ), + mApplyBtn( NULL ), mForceClose( FALSE ), - mInitialTab(initial_tab_selected), mAllowEdit( TRUE ), mShowingNotifyDialog( FALSE ) { // Set up the factory callbacks. - mFactoryMap["general_tab"] = LLCallbackMap(LLPanelGroupGeneral::createTab, - &mID); - mFactoryMap["roles_tab"] = LLCallbackMap(LLPanelGroupRoles::createTab, - &mID); - mFactoryMap["notices_tab"] = LLCallbackMap(LLPanelGroupNotices::createTab, - &mID); - mFactoryMap["land_money_tab"]= LLCallbackMap(LLPanelGroupLandMoney::createTab, - &mID); + mFactoryMap["general_tab"] = LLCallbackMap(LLPanelGroupGeneral::createTab, &mID); + mFactoryMap["roles_tab"] = LLCallbackMap(LLPanelGroupRoles::createTab, &mID); + mFactoryMap["notices_tab"] = LLCallbackMap(LLPanelGroupNotices::createTab, &mID); + mFactoryMap["land_money_tab"]= LLCallbackMap(LLPanelGroupLandMoney::createTab, &mID); // Roles sub tabs mFactoryMap["members_sub_tab"] = LLCallbackMap(LLPanelGroupMembersSubTab::createTab, &mID); mFactoryMap["roles_sub_tab"] = LLCallbackMap(LLPanelGroupRolesSubTab::createTab, &mID); mFactoryMap["actions_sub_tab"] = LLCallbackMap(LLPanelGroupActionsSubTab::createTab, &mID); LLGroupMgr::getInstance()->addObserver(this); - - // Pass on construction of this panel to the control factory. - LLUICtrlFactory::getInstance()->buildPanel(this, filename, &getFactoryMap()); - mFilename = filename; } LLPanelGroup::~LLPanelGroup() { LLGroupMgr::getInstance()->removeObserver(this); - int i; - int tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (S32 i=mTabContainer->getTabCount() - 1; i >=0; --i) { - LLPanelGroupTab* panelp = - (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); - - if ( panelp ) panelp->removeObserver(this); + LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); + if ( panelp ) + panelp->removeObserver(this); } } void LLPanelGroup::updateTabVisibility() { - S32 i; - S32 tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (S32 i = mTabContainer->getTabCount() - 1; i >=0; --i) { - LLPanelGroupTab* panelp = - (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); + LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); BOOL visible = panelp->isVisibleByAgent(&gAgent) || gAgent.isGodlike(); mTabContainer->enableTabButton(i, visible); @@ -195,8 +176,7 @@ void LLPanelGroup::updateTabVisibility() //we are disabling the currently selected tab //select the previous one mTabContainer->selectPrevTab(); - mCurrentTab = - (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); + mCurrentTab = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); } } } @@ -209,49 +189,24 @@ BOOL LLPanelGroup::postBuild() if (mTabContainer) { - // Select the initial tab specified via constructor - const BOOL recurse = TRUE; - LLPanelGroupTab* tabp = - getChild(mInitialTab, recurse); - - if (!tabp) + mCurrentTab = dynamic_cast(mTabContainer->getCurrentPanel()); + llassert_always(mCurrentTab); + + // Add click callback. + mTabContainer->setCommitCallback(boost::bind(&LLPanelGroup::handleClickTab, this)); + + // Setup pabels + for (S32 i = mTabContainer->getTabCount() - 1; i >=0; --i) { - //our initial tab selection was invalid, just select the - //first tab then or default to selecting the initial - //selected tab specified in the layout file - tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); - - //no tab was initially selected through constructor - //or the XML, select the first tab - if (!tabp) + LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); + LLPanelGroupTab* panelp = dynamic_cast(tab_panel); + if (panelp) { - mTabContainer->selectFirstTab(); - tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); + // Pass on whether or not to allow edit to tabs. + panelp->setAllowEdit(mAllowEdit); + panelp->addObserver(this); } } - else - { - mTabContainer->selectTabPanel(tabp); - } - - mCurrentTab = tabp; - - // Add click callbacks. - S32 i; - S32 tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) - { - LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); - LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack - - // Pass on whether or not to allow edit to tabs. - panelp->setAllowEdit(mAllowEdit); - panelp->addObserver(this); - - mTabContainer->setTabChangeCallback(panelp, onClickTab); - mTabContainer->setTabUserData(panelp, this); - } updateTabVisibility(); // Act as though this tab was just activated. @@ -262,38 +217,22 @@ BOOL LLPanelGroup::postBuild() mWantApplyMesg = getString("want_apply_text"); LLButton* button = getChild("btn_ok"); - if (button) - { - button->setClickedCallback(onBtnOK); - button->setCallbackUserData(this); - button->setVisible(mAllowEdit); - } + button->setClickedCallback(onBtnOK, this); + button->setVisible(mAllowEdit); button = getChild("btn_cancel"); - if (button) - { - button->setClickedCallback(onBtnCancel); - button->setCallbackUserData(this); - button->setVisible(mAllowEdit); - } + button->setClickedCallback(onBtnCancel, this); + button->setVisible(mAllowEdit); button = getChild("btn_apply"); - if (button) - { - button->setClickedCallback(onBtnApply); - button->setVisible(mAllowEdit); - button->setEnabled(FALSE); - - mApplyBtn = button; - } + button->setClickedCallback(onBtnApply, this); + button->setVisible(mAllowEdit); + button->setEnabled(FALSE); + mApplyBtn = button; button = getChild("btn_refresh"); - if (button) - { - button->setClickedCallback(onBtnRefresh); - button->setCallbackUserData(this); - button->setVisible(mAllowEdit); - } + button->setClickedCallback(onBtnRefresh, this); + button->setVisible(mAllowEdit); return TRUE; } @@ -322,13 +261,6 @@ void LLPanelGroup::tabChanged() } } -// static -void LLPanelGroup::onClickTab(void* user_data, bool from_click) -{ - LLPanelGroup* self = static_cast(user_data); - self->handleClickTab(); -} - void LLPanelGroup::handleClickTab() { // If we are already handling a transition, @@ -357,7 +289,8 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) LLGroupMgr::getInstance()->removeObserver(this); mID = group_id; LLGroupMgr::getInstance()->addObserver(this); - //TODO: this is really bad, we should add a method + + //*TODO: this is really bad, we should add a method // where the panels can just update themselves // on a group id change. Similar to update() but with a group // id change. @@ -365,20 +298,19 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) // For now, rebuild panel //delete children and rebuild panel deleteAllChildren(); - LLUICtrlFactory::getInstance()->buildPanel(this, mFilename, &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml"); } void LLPanelGroup::selectTab(std::string tab_name) { const BOOL recurse = TRUE; - LLPanelGroupTab* tabp = - getChild(tab_name, recurse); + LLPanelGroupTab* tabp = findChild(tab_name, recurse); if ( tabp && mTabContainer ) { mTabContainer->selectTabPanel(tabp); - onClickTab(this, false); + handleClickTab(); } } @@ -455,7 +387,7 @@ void LLPanelGroup::transitionToTab() } else // NULL requested indicates a close action. { - close(); + closePanel(); } } @@ -507,7 +439,7 @@ void LLPanelGroup::onBtnOK(void* user_data) // If we are able to apply changes, then close. if(self->apply()) { - self->close(); + self->closePanel(); } } @@ -515,7 +447,7 @@ void LLPanelGroup::onBtnOK(void* user_data) void LLPanelGroup::onBtnCancel(void* user_data) { LLPanelGroup* self = static_cast(user_data); - self->close(); + self->closePanel(); } // static @@ -528,10 +460,12 @@ void LLPanelGroup::onBtnApply(void* user_data) bool LLPanelGroup::apply() { // Pass this along to the currently visible tab. - if (!mTabContainer) return false; + if (!mTabContainer) + return false; - LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); - if (!panelp) return false; + LLPanelGroupTab* panelp = dynamic_cast(mTabContainer->getCurrentPanel()); + if (!panelp) + return false; std::string mesg; if ( !panelp->needsApply(mesg) ) @@ -598,7 +532,7 @@ void LLPanelGroup::refreshData() mRefreshTimer.setTimerExpirySec(5); } -void LLPanelGroup::close() +void LLPanelGroup::closePanel() { // Pass this to the parent, if it is a floater. LLView* viewp = getParent(); @@ -609,7 +543,7 @@ void LLPanelGroup::close() // will be asking us whether it can close. mForceClose = TRUE; // Tell the parent floater to close. - floaterp->close(); + floaterp->closeFloater(); } } diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 445fb28502..55c7494a44 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -58,10 +58,7 @@ class LLPanelGroup : public LLPanel, public LLPanelGroupTabObserver { public: - LLPanelGroup(const std::string& filename, - const std::string& name, - const LLUUID& group_id, - const std::string& initial_tab_selected = std::string()); + LLPanelGroup(const LLUUID& group_id); virtual ~LLPanelGroup(); virtual BOOL postBuild(); @@ -70,7 +67,6 @@ public: static void onBtnCancel(void*); static void onBtnApply(void*); static void onBtnRefresh(void*); - static void onClickTab(void*,bool); void handleClickTab(); void setGroupID(const LLUUID& group_id); @@ -92,7 +88,7 @@ public: bool apply(); void refreshData(); - void close(); + void closePanel(); void draw(); // Group manager observer trigger. @@ -120,9 +116,6 @@ protected: BOOL mForceClose; - std::string mInitialTab; - std::string mFilename; - std::string mDefaultNeedsApplyMesg; std::string mWantApplyMesg; @@ -133,8 +126,7 @@ protected: class LLPanelGroupTab : public LLPanel { public: - LLPanelGroupTab(const std::string& name, const LLUUID& group_id) - : LLPanel(name), mGroupID(group_id), mAllowEdit(TRUE), mHasModal(FALSE) { } + LLPanelGroupTab(const LLUUID& group_id); virtual ~LLPanelGroupTab(); // Factory that returns a new LLPanelGroupFoo tab. @@ -167,7 +159,6 @@ public: virtual std::string getHelpText() const { return mHelpText; } // Display anything returned by getHelpText - static void onClickHelp(void* data); void handleClickHelp(); // This just connects the help button callback. diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 3dc5e032c5..d495373cc4 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -37,7 +37,6 @@ #include "lluictrlfactory.h" #include "llagent.h" #include "roles_constants.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" // UI elements @@ -45,14 +44,17 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldbstrings.h" +#include "llfriendactions.h" #include "lllineeditor.h" #include "llnamebox.h" #include "llnamelistctrl.h" +#include "llscrolllistitem.h" #include "llspinctrl.h" #include "llstatusbar.h" // can_afford_transaction() #include "lltextbox.h" #include "lltexteditor.h" #include "lltexturectrl.h" +#include "lltrans.h" #include "llviewerwindow.h" // consts @@ -64,13 +66,12 @@ const S32 DECLINE_TO_STATE = 0; void* LLPanelGroupGeneral::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupGeneral("panel group general", *group_id); + return new LLPanelGroupGeneral(*group_id); } -LLPanelGroupGeneral::LLPanelGroupGeneral(const std::string& name, - const LLUUID& group_id) -: LLPanelGroupTab(name, group_id), +LLPanelGroupGeneral::LLPanelGroupGeneral(const LLUUID& group_id) +: LLPanelGroupTab(group_id), mPendingMemberUpdate(FALSE), mChanged(FALSE), mFirstUse(TRUE), @@ -100,8 +101,6 @@ LLPanelGroupGeneral::~LLPanelGroupGeneral() BOOL LLPanelGroupGeneral::postBuild() { - llinfos << "LLPanelGroupGeneral::postBuild()" << llendl; - bool recurse = true; // General info @@ -111,63 +110,50 @@ BOOL LLPanelGroupGeneral::postBuild() mInsignia = getChild("insignia", recurse); if (mInsignia) { - mInsignia->setCommitCallback(onCommitAny); - mInsignia->setCallbackUserData(this); + mInsignia->setCommitCallback(onCommitAny, this); mDefaultIconID = mInsignia->getImageAssetID(); } mEditCharter = getChild("charter", recurse); if(mEditCharter) { - mEditCharter->setCommitCallback(onCommitAny); + mEditCharter->setCommitCallback(onCommitAny, this); mEditCharter->setFocusReceivedCallback(onFocusEdit, this); mEditCharter->setFocusChangedCallback(onFocusEdit, this); - mEditCharter->setCallbackUserData(this); } mBtnJoinGroup = getChild("join_button", recurse); if ( mBtnJoinGroup ) { - mBtnJoinGroup->setClickedCallback(onClickJoin); - mBtnJoinGroup->setCallbackUserData(this); + mBtnJoinGroup->setClickedCallback(onClickJoin, this); } mBtnInfo = getChild("info_button", recurse); if ( mBtnInfo ) { - mBtnInfo->setClickedCallback(onClickInfo); - mBtnInfo->setCallbackUserData(this); + mBtnInfo->setClickedCallback(onClickInfo, this); } - LLTextBox* founder = getChild("founder_name"); - if (founder) - { - mFounderName = new LLNameBox(founder->getName(),founder->getRect(),LLUUID::null,FALSE,founder->getFont(),founder->getMouseOpaque()); - removeChild(founder, TRUE); - addChild(mFounderName); - } + mFounderName = getChild("founder_name"); mListVisibleMembers = getChild("visible_members", recurse); if (mListVisibleMembers) { - mListVisibleMembers->setDoubleClickCallback(openProfile); - mListVisibleMembers->setCallbackUserData(this); + mListVisibleMembers->setDoubleClickCallback(openProfile, this); } // Options mCtrlShowInGroupList = getChild("show_in_group_list", recurse); if (mCtrlShowInGroupList) { - mCtrlShowInGroupList->setCommitCallback(onCommitAny); - mCtrlShowInGroupList->setCallbackUserData(this); + mCtrlShowInGroupList->setCommitCallback(onCommitAny, this); } mComboMature = getChild("group_mature_check", recurse); if(mComboMature) { mComboMature->setCurrentByIndex(0); - mComboMature->setCommitCallback(onCommitAny); - mComboMature->setCallbackUserData(this); + mComboMature->setCommitCallback(onCommitAny, this); if (gAgent.isTeen()) { // Teens don't get to set mature flag. JC @@ -178,22 +164,19 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlOpenEnrollment = getChild("open_enrollement", recurse); if (mCtrlOpenEnrollment) { - mCtrlOpenEnrollment->setCommitCallback(onCommitAny); - mCtrlOpenEnrollment->setCallbackUserData(this); + mCtrlOpenEnrollment->setCommitCallback(onCommitAny, this); } mCtrlEnrollmentFee = getChild("check_enrollment_fee", recurse); if (mCtrlEnrollmentFee) { - mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment); - mCtrlEnrollmentFee->setCallbackUserData(this); + mCtrlEnrollmentFee->setCommitCallback(onCommitEnrollment, this); } mSpinEnrollmentFee = getChild("spin_enrollment_fee", recurse); if (mSpinEnrollmentFee) { - mSpinEnrollmentFee->setCommitCallback(onCommitAny); - mSpinEnrollmentFee->setCallbackUserData(this); + mSpinEnrollmentFee->setCommitCallback(onCommitAny, this); mSpinEnrollmentFee->setPrecision(0); mSpinEnrollmentFee->resetDirty(); } @@ -209,8 +192,7 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlReceiveNotices = getChild("receive_notices", recurse); if (mCtrlReceiveNotices) { - mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly); - mCtrlReceiveNotices->setCallbackUserData(this); + mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly, this); mCtrlReceiveNotices->set(accept_notices); mCtrlReceiveNotices->setEnabled(data.mID.notNull()); } @@ -218,8 +200,7 @@ BOOL LLPanelGroupGeneral::postBuild() mCtrlListGroup = getChild("list_groups_in_profile", recurse); if (mCtrlListGroup) { - mCtrlListGroup->setCommitCallback(onCommitUserOnly); - mCtrlListGroup->setCallbackUserData(this); + mCtrlListGroup->setCommitCallback(onCommitUserOnly, this); mCtrlListGroup->set(list_in_profile); mCtrlListGroup->setEnabled(data.mID.notNull()); mCtrlListGroup->resetDirty(); @@ -230,8 +211,7 @@ BOOL LLPanelGroupGeneral::postBuild() mComboActiveTitle = getChild("active_title", recurse); if (mComboActiveTitle) { - mComboActiveTitle->setCommitCallback(onCommitTitle); - mComboActiveTitle->setCallbackUserData(this); + mComboActiveTitle->setCommitCallback(onCommitTitle, this); mComboActiveTitle->resetDirty(); } @@ -395,7 +375,7 @@ void LLPanelGroupGeneral::openProfile(void* data) LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected(); if (selected) { - LLFloaterAvatarInfo::showFromDirectory( selected->getUUID() ); + LLFriendActions::showProfile(selected->getUUID()); } } } @@ -480,8 +460,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - // *TODO: Translate - mesg = std::string("No group data found for group "); + mesg = LLTrans::getString("NoGroupDataFound"); mesg.append(mGroupID.asString()); return false; } @@ -730,7 +709,9 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) if ( visible ) { - fee_buff = llformat( "Join (L$%d)", gdatap->mMembershipFee); + LLStringUtil::format_map_t string_args; + string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee); + fee_buff = getString("group_join_btn", string_args); mBtnJoinGroup->setLabelSelected(fee_buff); mBtnJoinGroup->setLabelUnselected(fee_buff); } @@ -842,16 +823,16 @@ void LLPanelGroupGeneral::updateMembers() row["id"] = member->getID(); row["columns"][0]["column"] = "name"; - row["columns"][0]["font-style"] = style; + row["columns"][0]["font"]["style"] = style; // value is filled in by name list control row["columns"][1]["column"] = "title"; row["columns"][1]["value"] = member->getTitle(); - row["columns"][1]["font-style"] = style; + row["columns"][1]["font"]["style"] = style; row["columns"][2]["column"] = "online"; row["columns"][2]["value"] = member->getOnlineStatus(); - row["columns"][2]["font-style"] = style; + row["columns"][2]["font"]["style"] = style; sSDTime += sd_timer.getElapsedTimeF32(); diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 71356677fc..5d673d5219 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -49,7 +49,7 @@ class LLSpinCtrl; class LLPanelGroupGeneral : public LLPanelGroupTab { public: - LLPanelGroupGeneral(const std::string& name, const LLUUID& group_id); + LLPanelGroupGeneral(const LLUUID& group_id); virtual ~LLPanelGroupGeneral(); // LLPanelGroupTab diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index eedec9c8eb..1e6eb8ed44 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -39,6 +39,7 @@ #include "llcombobox.h" #include "llgroupmgr.h" #include "llnamelistctrl.h" +#include "llscrolllistitem.h" #include "llspinctrl.h" #include "lltextbox.h" #include "llviewerobject.h" @@ -351,18 +352,13 @@ void LLPanelGroupInvite::impl::callbackAddUsers(const std::vector& if ( selfp) selfp->addUsers(names, ids); } -LLPanelGroupInvite::LLPanelGroupInvite(const std::string& name, - const LLUUID& group_id) - : LLPanel(name) +LLPanelGroupInvite::LLPanelGroupInvite(const LLUUID& group_id) + : LLPanel(), + mImplementation(new impl(group_id)), + mPendingUpdate(FALSE) { - mImplementation = new impl(group_id); - mPendingUpdate = FALSE; - mStoreSelected = LLUUID::null; - - std::string panel_def_file; - // Pass on construction of this panel to the control factory. - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_invite.xml"); } LLPanelGroupInvite::~LLPanelGroupInvite() @@ -519,9 +515,8 @@ BOOL LLPanelGroupInvite::postBuild() getChild("invitee_list", recurse); if ( mImplementation->mInvitees ) { - mImplementation->mInvitees->setCallbackUserData(mImplementation); mImplementation->mInvitees->setCommitOnSelectionChange(TRUE); - mImplementation->mInvitees->setCommitCallback(impl::callbackSelect); + mImplementation->mInvitees->setCommitCallback(impl::callbackSelect, mImplementation); } LLButton* button = getChild("add_button", recurse); @@ -529,17 +524,14 @@ BOOL LLPanelGroupInvite::postBuild() { // default to opening avatarpicker automatically // (*impl::callbackClickAdd)((void*)this); - button->setClickedCallback(impl::callbackClickAdd); - button->setCallbackUserData(this); + button->setClickedCallback(impl::callbackClickAdd, this); } mImplementation->mRemoveButton = getChild("remove_button", recurse); if ( mImplementation->mRemoveButton ) { - mImplementation->mRemoveButton-> - setClickedCallback(impl::callbackClickRemove); - mImplementation->mRemoveButton->setCallbackUserData(mImplementation); + mImplementation->mRemoveButton->setClickedCallback(impl::callbackClickRemove, mImplementation); mImplementation->mRemoveButton->setEnabled(FALSE); } @@ -547,17 +539,14 @@ BOOL LLPanelGroupInvite::postBuild() getChild("ok_button", recurse); if ( mImplementation->mOKButton ) { - mImplementation->mOKButton-> - setClickedCallback(impl::callbackClickOK); - mImplementation->mOKButton->setCallbackUserData(mImplementation); + mImplementation->mOKButton->setClickedCallback(impl::callbackClickOK, mImplementation); mImplementation->mOKButton->setEnabled(FALSE); } button = getChild("cancel_button", recurse); if ( button ) { - button->setClickedCallback(impl::callbackClickCancel); - button->setCallbackUserData(mImplementation); + button->setClickedCallback(impl::callbackClickCancel, mImplementation); } mImplementation->mOwnerWarning = getString("confirm_invite_owner_str"); diff --git a/indra/newview/llpanelgroupinvite.h b/indra/newview/llpanelgroupinvite.h index 9117b83e7d..37135b488a 100644 --- a/indra/newview/llpanelgroupinvite.h +++ b/indra/newview/llpanelgroupinvite.h @@ -39,7 +39,7 @@ class LLPanelGroupInvite : public LLPanel { public: - LLPanelGroupInvite(const std::string& name, const LLUUID& group_id); + LLPanelGroupInvite(const LLUUID& group_id); ~LLPanelGroupInvite(); void addUsers(std::vector& agent_ids); diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 73a9868962..ea092645e7 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -42,13 +42,17 @@ #include "llagent.h" #include "lliconctrl.h" +#include "llfloaterreg.h" #include "lllineeditor.h" #include "llproductinforequest.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lltextbox.h" #include "lltabcontainer.h" #include "lltrans.h" #include "lltransactiontypes.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llstatusbar.h" @@ -80,7 +84,6 @@ public: static void clickEarlierCallback(void* data); static void clickLaterCallback(void* data); - static void clickTabCallback(void* user_data, bool from_click); static LLMap sInstanceIDs; static std::map sTabsToHandlers; @@ -244,9 +247,9 @@ void LLPanelGroupLandMoney::impl::onMapButton() F64 global_z = gAgent.getPositionGlobal().mdV[VZ]; LLVector3d pos_global(global_x, global_y, global_z); - gFloaterWorldMap->trackLocation(pos_global); + LLFloaterWorldMap::getInstance()->trackLocation(pos_global); - LLFloaterWorldMap::show(NULL, TRUE); + LLFloaterReg::showInstance("world_map", "center"); } bool LLPanelGroupLandMoney::impl::applyContribution() @@ -399,12 +402,6 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) //if ( !gAgent.hasPowerInGroup(mGroupID, GP_LAND_VIEW_OWNED) ) return; if (!gAgent.isInGroup(mGroupID)) return; - //we updated more than just the available area special block - if ( count > 1) - { - mMapButtonp->setEnabled(TRUE); - } - std::string name; std::string desc; S32 actual_area; @@ -460,15 +457,15 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) row["columns"][0]["column"] = "name"; row["columns"][0]["value"] = name; - row["columns"][0]["font"] = "SANSSERIFSMALL"; + row["columns"][0]["font"] = "SANSSERIF_SMALL"; row["columns"][1]["column"] = "location"; row["columns"][1]["value"] = location; - row["columns"][1]["font"] = "SANSSERIFSMALL"; + row["columns"][1]["font"] = "SANSSERIF_SMALL"; row["columns"][2]["column"] = "area"; row["columns"][2]["value"] = area; - row["columns"][2]["font"] = "SANSSERIFSMALL"; + row["columns"][2]["font"] = "SANSSERIF_SMALL"; row["columns"][3]["column"] = "type"; row["columns"][3]["value"] = land_type; @@ -491,15 +488,14 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) void* LLPanelGroupLandMoney::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupLandMoney("panel group land money", *group_id); + return new LLPanelGroupLandMoney(*group_id); } //static LLMap LLPanelGroupLandMoney::sGroupIDs; -LLPanelGroupLandMoney::LLPanelGroupLandMoney(const std::string& name, - const LLUUID& group_id) : - LLPanelGroupTab(name, group_id) +LLPanelGroupLandMoney::LLPanelGroupLandMoney(const LLUUID& group_id) : + LLPanelGroupTab(group_id) { mImplementationp = new impl(*this, group_id); @@ -553,6 +549,7 @@ void LLPanelGroupLandMoney::activate() mImplementationp->setYourMaxContributionTextBox(max_avail); } + mImplementationp->mMapButtonp->setEnabled(false); update(GC_ALL); } @@ -634,9 +631,8 @@ BOOL LLPanelGroupLandMoney::postBuild() { LLLineEditor* editor = mImplementationp->mYourContributionEditorp; - editor->setCommitCallback(mImplementationp->contributionCommitCallback); - editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback); - editor->setCallbackUserData(this); + editor->setCommitCallback(mImplementationp->contributionCommitCallback, this); + editor->setKeystrokeCallback(mImplementationp->contributionKeystrokeCallback, this); } mImplementationp->mMapButtonp = getChild("map_button"); @@ -644,6 +640,12 @@ BOOL LLPanelGroupLandMoney::postBuild() mImplementationp->mGroupParcelsp = getChild("group_parcel_list"); + if ( mImplementationp->mGroupParcelsp ) + { + mImplementationp->mGroupParcelsp->setCommitCallback(boost::bind(&LLButton::setEnabled, mImplementationp->mMapButtonp, true)); + mImplementationp->mGroupParcelsp->setCommitOnSelectionChange(true); + } + mImplementationp->mCantViewParcelsText = getString("cant_view_group_land_text"); mImplementationp->mCantViewAccountsText = getString("cant_view_group_accounting_text"); @@ -662,16 +664,11 @@ BOOL LLPanelGroupLandMoney::postBuild() mImplementationp->mGroupOverLimitIconp->setVisible(FALSE); } - if ( mImplementationp->mMapButtonp ) - { - mImplementationp->mMapButtonp->setEnabled(FALSE); - } - if ( !can_view ) { if ( mImplementationp->mGroupParcelsp ) { - mImplementationp->mGroupParcelsp->addCommentText( + mImplementationp->mGroupParcelsp->setCommentText( mImplementationp->mCantViewParcelsText); mImplementationp->mGroupParcelsp->setEnabled(FALSE); } @@ -917,8 +914,7 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto if ( tab_containerp && panelp ) { - tab_containerp->setTabChangeCallback(panelp, clickTabCallback); - tab_containerp->setTabUserData(panelp, this); + tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::onClickTab, this)); } sInstanceIDs.addData(mImplementationp->mPanelID, this); @@ -990,13 +986,6 @@ void LLGroupMoneyTabEventHandler::clickLaterCallback(void* data) if ( selfp ) selfp->onClickLater(); } -//static -void LLGroupMoneyTabEventHandler::clickTabCallback(void* data, bool from_click) -{ - LLGroupMoneyTabEventHandler* selfp = (LLGroupMoneyTabEventHandler*) data; - if ( selfp && from_click ) selfp->onClickTab(); -} - //************************************************** //** LLGroupMoneyDetailsTabEventHandler Functions ** //************************************************** @@ -1100,7 +1089,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, text.append(1, '\n'); - text.append(llformat("%-24s %6d\n", "Total", total_amount)); + text.append(llformat("%-24s %6d\n", LLTrans::getString("GroupMoneyTotal").c_str(), total_amount)); if ( mImplementationp->mTextEditorp ) { @@ -1220,7 +1209,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, S32 transactions = msg->getNumberOfBlocksFast(_PREHASH_HistoryData); if (transactions == 0) { - text.append("(none)"); + text.append(LLTrans::getString("none_text")); } else { @@ -1245,22 +1234,22 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, switch(type) { case TRANS_OBJECT_SALE: - verb = "bought"; + verb = LLTrans::getString("GroupMoneyBought").c_str(); break; case TRANS_GIFT: - verb = "paid you"; + verb = LLTrans::getString("GroupMoneyPaidYou").c_str(); break; case TRANS_PAY_OBJECT: - verb = "paid into"; + verb = LLTrans::getString("GroupMoneyPaidInto").c_str(); break; case TRANS_LAND_PASS_SALE: - verb = "bought pass to"; + verb = LLTrans::getString("GroupMoneyBoughtPassTo").c_str(); break; case TRANS_EVENT_FEE: - verb = "paid fee for event"; + verb = LLTrans::getString("GroupMoneyPaidFeeForEvent").c_str(); break; case TRANS_EVENT_PRIZE: - verb = "paid prize for event"; + verb = LLTrans::getString("GroupMoneyPaidPrizeForEvent").c_str(); break; default: verb = ""; @@ -1420,24 +1409,24 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, return; } - text.append("Summary for this week, beginning on "); + text.append(LLTrans::getString("SummaryForTheWeek")); text.append(start_date); if (current_interval == 0) { - text.append("The next stipend day is "); + text.append(LLTrans::getString("NextStipendDay")); text.append(next_stipend_date); text.append("\n\n"); - text.append(llformat("%-24sL$%6d\n", "Balance", balance )); + text.append(llformat("%-24sL$%6d\n", LLTrans::getString("GroupMoneyBalance").c_str(), balance )); text.append(1, '\n'); } // [DEV-29503] Hide the individual info since // non_exempt_member here is a wrong choice to calculate individual shares. - // text.append( " Group Individual Share\n"); - // text.append(llformat( "%-24s %6d %6d \n", "Credits", total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members))); - // text.append(llformat( "%-24s %6d %6d \n", "Debits", total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members))); - // text.append(llformat( "%-24s %6d %6d \n", "Total", total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members))); +// text.append( LLTrans::getString("GroupIndividualShare")); +// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyCredits").c_str(), total_credits, (S32)floor((F32)total_credits/(F32)non_exempt_members))); +// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyDebits").c_str(), total_debits, (S32)floor((F32)total_debits/(F32)non_exempt_members))); +// text.append(llformat( "%-24s %6d %6d \n", LLTrans::getString("GroupMoneyTotal").c_str(), total_credits + total_debits, (S32)floor((F32)(total_credits + total_debits)/(F32)non_exempt_members))); text.append( " Group\n"); text.append(llformat( "%-24s %6d\n", "Credits", total_credits)); diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h index 591511a5fb..748485745b 100644 --- a/indra/newview/llpanelgrouplandmoney.h +++ b/indra/newview/llpanelgrouplandmoney.h @@ -44,7 +44,7 @@ class LLPanelGroupLandMoney : public LLPanelGroupTab { public: - LLPanelGroupLandMoney(const std::string& name, const LLUUID& group_id); + LLPanelGroupLandMoney(const LLUUID& group_id); virtual ~LLPanelGroupLandMoney(); virtual BOOL postBuild(); virtual BOOL isVisibleByAgent(LLAgent* agentp); diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 5824df46e2..201cf5a023 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -49,7 +49,9 @@ #include "lliconctrl.h" #include "llcheckboxctrl.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" #include "lltextbox.h" +#include "lltrans.h" #include "roles_constants.h" #include "llviewerwindow.h" @@ -69,7 +71,21 @@ class LLGroupDropTarget : public LLView { public: - LLGroupDropTarget(const std::string& name, const LLRect& rect, LLPanelGroupNotices* panel, const LLUUID& group_id); + struct Params : public LLInitParam::Block + { + // *NOTE: These parameters logically Mandatory, but are not + // specified in XML files, hence Optional + Optional panel; + Optional group_id; + Params() + : panel("panel"), + group_id("group_id") + { + mouse_opaque(false); + follows.flags(FOLLOWS_ALL); + } + }; + LLGroupDropTarget(const Params&); ~LLGroupDropTarget() {}; void doDrop(EDragAndDropType cargo_type, void* cargo_data); @@ -81,18 +97,21 @@ public: void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); + void setPanel (LLPanelGroupNotices* panel) {mGroupNoticesPanel = panel;}; + void setGroup (LLUUID group) {mGroupID = group;}; + protected: LLPanelGroupNotices* mGroupNoticesPanel; LLUUID mGroupID; }; -LLGroupDropTarget::LLGroupDropTarget(const std::string& name, const LLRect& rect, - LLPanelGroupNotices* panel, const LLUUID& group_id) : - LLView(name, rect, NOT_MOUSE_OPAQUE, FOLLOWS_ALL), - mGroupNoticesPanel(panel), - mGroupID(group_id) -{ -} +static LLDefaultWidgetRegistry::Register r("group_drop_target"); + +LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p) +: LLView(p), + mGroupNoticesPanel(p.panel), + mGroupID(p.group_id) +{} void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { @@ -179,18 +198,17 @@ std::string build_notice_date(const U32& the_time) time(&t); } - tm* lt = localtime(&t); - - //for some reason, the month is off by 1. See other uses of - //"local" time in the code... - std::string buffer = llformat("%04i-%02i-%02i", lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday); - - return buffer; + std::string dateStr = "["+LLTrans::getString("LTimeMthNum")+"]/[" + +LLTrans::getString("LTimeDay")+"]/[" + +LLTrans::getString("LTimeYear")+"]"; + LLSD substitution; + substitution["datetime"] = (S32) t; + LLStringUtil::format (dateStr, substitution); + return dateStr; } -LLPanelGroupNotices::LLPanelGroupNotices(const std::string& name, - const LLUUID& group_id) : - LLPanelGroupTab(name,group_id), +LLPanelGroupNotices::LLPanelGroupNotices(const LLUUID& group_id) : + LLPanelGroupTab(group_id), mInventoryItem(NULL), mInventoryOffer(NULL) { @@ -214,7 +232,7 @@ LLPanelGroupNotices::~LLPanelGroupNotices() void* LLPanelGroupNotices::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupNotices("panel group notices", *group_id); + return new LLPanelGroupNotices(*group_id); } BOOL LLPanelGroupNotices::isVisibleByAgent(LLAgent* agentp) @@ -229,17 +247,14 @@ BOOL LLPanelGroupNotices::postBuild() mNoticesList = getChild("notice_list",recurse); mNoticesList->setCommitOnSelectionChange(TRUE); - mNoticesList->setCommitCallback(onSelectNotice); - mNoticesList->setCallbackUserData(this); + mNoticesList->setCommitCallback(onSelectNotice, this); mBtnNewMessage = getChild("create_new_notice",recurse); - mBtnNewMessage->setClickedCallback(onClickNewMessage); - mBtnNewMessage->setCallbackUserData(this); + mBtnNewMessage->setClickedCallback(onClickNewMessage, this); mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND)); mBtnGetPastNotices = getChild("refresh_notices",recurse); - mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices); - mBtnGetPastNotices->setCallbackUserData(this); + mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices, this); // Create mCreateSubject = getChild("create_subject",recurse); @@ -253,12 +268,10 @@ BOOL LLPanelGroupNotices::postBuild() mCreateInventoryIcon->setVisible(FALSE); mBtnSendMessage = getChild("send_notice",recurse); - mBtnSendMessage->setClickedCallback(onClickSendMessage); - mBtnSendMessage->setCallbackUserData(this); + mBtnSendMessage->setClickedCallback(onClickSendMessage, this); mBtnRemoveAttachment = getChild("remove_attachment",recurse); - mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment); - mBtnRemoveAttachment->setCallbackUserData(this); + mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment, this); mBtnRemoveAttachment->setEnabled(FALSE); // View @@ -273,24 +286,16 @@ BOOL LLPanelGroupNotices::postBuild() mViewInventoryIcon->setVisible(FALSE); mBtnOpenAttachment = getChild("open_attachment",recurse); - mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment); - mBtnOpenAttachment->setCallbackUserData(this); + mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment, this); mNoNoticesStr = getString("no_notices_text"); mPanelCreateNotice = getChild("panel_create_new_notice",recurse); mPanelViewNotice = getChild("panel_view_past_notice",recurse); - // Must be in front of all other UI elements. - LLPanel* dtv = getChild("drop_target",recurse); - LLGroupDropTarget* target = new LLGroupDropTarget("drop_target", - dtv->getRect(), - this, mGroupID); - target->setEnabled(TRUE); - target->setToolTip(dtv->getToolTip()); - - mPanelCreateNotice->addChild(target); - mPanelCreateNotice->removeChild(dtv, TRUE); + LLGroupDropTarget* target = getChild ("drop_target"); + target->setPanel (this); + target->setGroup (mGroupID); arrangeNoticeView(VIEW_PAST_NOTICE); @@ -331,7 +336,7 @@ void LLPanelGroupNotices::setItem(LLPointer inv_item) inv_item->getFlags(), item_is_multi ); - mCreateInventoryIcon->setImage(icon_name); + mCreateInventoryIcon->setValue(icon_name); mCreateInventoryIcon->setVisible(TRUE); std::stringstream ss; @@ -466,7 +471,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) if (1 == count && id.isNull()) { // Only one entry, the dummy entry. - mNoticesList->addCommentText(mNoNoticesStr); + mNoticesList->setCommentText(mNoNoticesStr); mNoticesList->setEnabled(FALSE); return; } @@ -554,7 +559,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject, LLInventoryType::IT_TEXTURE, 0, FALSE); - mViewInventoryIcon->setImage(icon_name); + mViewInventoryIcon->setValue(icon_name); mViewInventoryIcon->setVisible(TRUE); std::stringstream ss; diff --git a/indra/newview/llpanelgroupnotices.h b/indra/newview/llpanelgroupnotices.h index 916032c1b6..a0712f1770 100644 --- a/indra/newview/llpanelgroupnotices.h +++ b/indra/newview/llpanelgroupnotices.h @@ -34,7 +34,7 @@ #define LL_LLPANELGROUPNOTICES_H #include "llpanelgroup.h" -#include "llmemory.h" +#include "llpointer.h" #include "llinventory.h" class LLLineEditor; @@ -47,7 +47,7 @@ class LLScrollListCtrl; class LLPanelGroupNotices : public LLPanelGroupTab { public: - LLPanelGroupNotices(const std::string& name, const LLUUID& group_id); + LLPanelGroupNotices(const LLUUID& group_id); virtual ~LLPanelGroupNotices(); // LLPanelGroupTab diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 6e65181f99..9e537be425 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -36,14 +36,16 @@ #include "llagent.h" #include "llbutton.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinvite.h" +#include "llfriendactions.h" #include "lliconctrl.h" #include "lllineeditor.h" #include "llnamelistctrl.h" #include "llnotify.h" #include "llpanelgrouproles.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lltabcontainer.h" #include "lltextbox.h" #include "lltexteditor.h" @@ -109,11 +111,11 @@ bool agentCanAddToRole(const LLUUID& group_id, void* LLPanelGroupRoles::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupRoles("panel group roles", *group_id); + return new LLPanelGroupRoles(*group_id); } -LLPanelGroupRoles::LLPanelGroupRoles(const std::string& name, const LLUUID& group_id) -: LLPanelGroupTab(name, group_id), +LLPanelGroupRoles::LLPanelGroupRoles(const LLUUID& group_id) +: LLPanelGroupTab(group_id), mCurrentTab(NULL), mRequestedTab( NULL ), mSubTabContainer( NULL ), @@ -148,8 +150,7 @@ BOOL LLPanelGroupRoles::postBuild() LLPanelGroupSubTab* subtabp = (LLPanelGroupSubTab*) mSubTabContainer->getPanelByIndex(i); // Add click callbacks to all the tabs. - mSubTabContainer->setTabChangeCallback(subtabp, onClickSubTab); - mSubTabContainer->setTabUserData(subtabp, this); + mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab, this)); // Hand the subtab a pointer to this LLPanelGroupRoles, so that it can // look around for the widgets it is interested in. @@ -198,13 +199,6 @@ BOOL LLPanelGroupRoles::isVisibleByAgent(LLAgent* agentp) } -// static -void LLPanelGroupRoles::onClickSubTab(void* user_data, bool from_click) -{ - LLPanelGroupRoles* self = static_cast(user_data); - self->handleClickSubTab(); -} - void LLPanelGroupRoles::handleClickSubTab() { // If we are already handling a transition, @@ -474,8 +468,8 @@ void LLPanelGroupRoles::tabChanged() //////////////////////////// // LLPanelGroupSubTab //////////////////////////// -LLPanelGroupSubTab::LLPanelGroupSubTab(const std::string& name, const LLUUID& group_id) -: LLPanelGroupTab(name, group_id), +LLPanelGroupSubTab::LLPanelGroupSubTab(const LLUUID& group_id) +: LLPanelGroupTab(group_id), mHeader(NULL), mFooter(NULL), mSearchLineEditor(NULL), @@ -495,47 +489,36 @@ BOOL LLPanelGroupSubTab::postBuild() mSearchLineEditor = getChild("search_text", recurse); if (!mSearchLineEditor) return FALSE; - mSearchLineEditor->setKeystrokeCallback(onSearchKeystroke); - mSearchLineEditor->setCallbackUserData(this); + mSearchLineEditor->setKeystrokeCallback(onSearchKeystroke, this); mSearchButton = getChild("search_button", recurse); if (!mSearchButton) return FALSE; - mSearchButton->setClickedCallback(onClickSearch); - mSearchButton->setCallbackUserData(this); + mSearchButton->setClickedCallback(onClickSearch, this); mSearchButton->setEnabled(FALSE); mShowAllButton = getChild("show_all_button", recurse); if (!mShowAllButton) return FALSE; - mShowAllButton->setClickedCallback(onClickShowAll); - mShowAllButton->setCallbackUserData(this); + mShowAllButton->setClickedCallback(onClickShowAll, this); mShowAllButton->setEnabled(FALSE); // Get icons for later use. mActionIcons.clear(); - bool no_recurse = false; - - LLIconCtrl* icon = getChild("power_folder_icon",no_recurse); - if (icon && !icon->getImageName().empty()) + if (hasString("power_folder_icon")) { - mActionIcons["folder"] = icon->getImageName(); - removeChild(icon, TRUE); + mActionIcons["folder"] = getString("power_folder_icon"); } - icon = getChild("power_all_have_icon",no_recurse); - if (icon && !icon->getImageName().empty()) + if (hasString("power_all_have_icon")) { - mActionIcons["full"] = icon->getImageName(); - removeChild(icon, TRUE); + mActionIcons["full"] = getString("power_all_have_icon"); } - icon = getChild("power_partial_icon",no_recurse); - if (icon && !icon->getImageName().empty()) + if (hasString("power_partial_icon")) { - mActionIcons["partial"] = icon->getImageName(); - removeChild(icon, TRUE); + mActionIcons["partial"] = getString("power_partial_icon"); } return LLPanelGroupTab::postBuild(); @@ -663,7 +646,7 @@ void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl, U64 allowed_by_some, U64 allowed_by_all, icon_map_t& icons, - void (*commit_callback)(LLUICtrl*,void*), + LLUICtrl::commit_callback_t commit_callback, BOOL show_all, BOOL filter, BOOL is_owner_role) @@ -696,7 +679,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, U64 allowed_by_all, LLRoleActionSet* action_set, icon_map_t& icons, - void (*commit_callback)(LLUICtrl*,void*), + LLUICtrl::commit_callback_t commit_callback, BOOL show_all, BOOL filter, BOOL is_owner_role) @@ -718,7 +701,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, row["columns"][1]["column"] = "action"; row["columns"][1]["value"] = action_set->mActionSetData->mName; - row["columns"][1]["font-style"] = "BOLD"; + row["columns"][1]["font"]["style"] = "BOLD"; LLScrollListItem* title_row = ctrl->addElement(row, ADD_BOTTOM, action_set->mActionSetData); @@ -799,7 +782,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, row["columns"][column_index]["column"] = "action"; row["columns"][column_index]["value"] = (*ra_it)->mDescription; - row["columns"][column_index]["font"] = "SANSSERIFSMALL"; + row["columns"][column_index]["font"] = "SANSSERIF_SMALL"; LLScrollListItem* item = ctrl->addElement(row, ADD_BOTTOM, (*ra_it)); @@ -810,7 +793,6 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, LLCheckBoxCtrl* check = check_cell->getCheckBox(); check->setEnabled(can_change_actions); check->setCommitCallback(commit_callback); - check->setCallbackUserData(ctrl->getCallbackUserData()); check->setToolTip( check->getLabel() ); if (show_all) @@ -864,11 +846,11 @@ void LLPanelGroupSubTab::setFooterEnabled(BOOL enable) void* LLPanelGroupMembersSubTab::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupMembersSubTab("panel group members sub tab", *group_id); + return new LLPanelGroupMembersSubTab(*group_id); } -LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab(const std::string& name, const LLUUID& group_id) -: LLPanelGroupSubTab(name, group_id), +LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab(const LLUUID& group_id) +: LLPanelGroupSubTab(group_id), mMembersList(NULL), mAssignedRolesList(NULL), mAllowedActionsList(NULL), @@ -900,25 +882,22 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root) if (!mMembersList || !mAssignedRolesList || !mAllowedActionsList) return FALSE; // We want to be notified whenever a member is selected. - mMembersList->setCallbackUserData(this); mMembersList->setCommitOnSelectionChange(TRUE); - mMembersList->setCommitCallback(onMemberSelect); + mMembersList->setCommitCallback(onMemberSelect, this); // Show the member's profile on double click. - mMembersList->setDoubleClickCallback(onMemberDoubleClick); + mMembersList->setDoubleClickCallback(onMemberDoubleClick, this); LLButton* button = parent->getChild("member_invite", recurse); if ( button ) { - button->setClickedCallback(onInviteMember); - button->setCallbackUserData(this); + button->setClickedCallback(onInviteMember, this); button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE)); } mEjectBtn = parent->getChild("member_eject", recurse); if ( mEjectBtn ) { - mEjectBtn->setClickedCallback(onEjectMembers); - mEjectBtn->setCallbackUserData(this); + mEjectBtn->setClickedCallback(onEjectMembers, this); mEjectBtn->setEnabled(FALSE); } @@ -1097,8 +1076,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() // Extract the checkbox that was created. LLScrollListCheck* check_cell = (LLScrollListCheck*) item->getColumn(0); LLCheckBoxCtrl* check = check_cell->getCheckBox(); - check->setCommitCallback(onRoleCheck); - check->setCallbackUserData(this); + check->setCommitCallback(onRoleCheck, this); check->set( count > 0 ); check->setTentative( (0 != count) @@ -1311,7 +1289,7 @@ void LLPanelGroupMembersSubTab::handleMemberDoubleClick() LLScrollListItem* selected = mMembersList->getFirstSelected(); if (selected) { - LLFloaterAvatarInfo::showFromDirectory( selected->getUUID() ); + LLFriendActions::showProfile(selected->getUUID()); } } @@ -1628,7 +1606,7 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) retrieved << "Retrieving role member mappings..."; } mMembersList->setEnabled(FALSE); - mMembersList->addCommentText(retrieved.str()); + mMembersList->setCommentText(retrieved.str()); } } @@ -1691,7 +1669,7 @@ void LLPanelGroupMembersSubTab::updateMembers() row["columns"][2]["column"] = "online"; row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus(); - row["columns"][2]["font"] = "SANSSERIFSMALL"; + row["columns"][2]["font"] = "SANSSERIF_SMALL"; mMembersList->addElement(row);//, ADD_SORTED); mHasMatch = TRUE; @@ -1707,7 +1685,7 @@ void LLPanelGroupMembersSubTab::updateMembers() else { mMembersList->setEnabled(FALSE); - mMembersList->addCommentText(std::string("No match.")); + mMembersList->setCommentText(std::string("No match.")); } } else @@ -1729,11 +1707,11 @@ void LLPanelGroupMembersSubTab::updateMembers() void* LLPanelGroupRolesSubTab::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupRolesSubTab("panel group roles sub tab", *group_id); + return new LLPanelGroupRolesSubTab(*group_id); } -LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab(const std::string& name, const LLUUID& group_id) -: LLPanelGroupSubTab(name, group_id), mHasRoleChange(FALSE) +LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab(const LLUUID& group_id) +: LLPanelGroupSubTab(group_id), mHasRoleChange(FALSE) { } @@ -1775,8 +1753,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) parent->getChild("role_create", recurse); if ( mCreateRoleButton ) { - mCreateRoleButton->setCallbackUserData(this); - mCreateRoleButton->setClickedCallback(onCreateRole); + mCreateRoleButton->setClickedCallback(onCreateRole, this); mCreateRoleButton->setEnabled(FALSE); } @@ -1784,32 +1761,25 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) parent->getChild("role_delete", recurse); if ( mDeleteRoleButton ) { - mDeleteRoleButton->setCallbackUserData(this); - mDeleteRoleButton->setClickedCallback(onDeleteRole); + mDeleteRoleButton->setClickedCallback(onDeleteRole, this); mDeleteRoleButton->setEnabled(FALSE); } mRolesList->setCommitOnSelectionChange(TRUE); - mRolesList->setCallbackUserData(this); - mRolesList->setCommitCallback(onRoleSelect); + mRolesList->setCommitCallback(onRoleSelect, this); - mMemberVisibleCheck->setCallbackUserData(this); - mMemberVisibleCheck->setCommitCallback(onMemberVisibilityChange); + mMemberVisibleCheck->setCommitCallback(onMemberVisibilityChange, this); mAllowedActionsList->setCommitOnSelectionChange(TRUE); - mAllowedActionsList->setCallbackUserData(this); mRoleName->setCommitOnFocusLost(TRUE); - mRoleName->setCallbackUserData(this); - mRoleName->setKeystrokeCallback(onPropertiesKey); + mRoleName->setKeystrokeCallback(onPropertiesKey, this); mRoleTitle->setCommitOnFocusLost(TRUE); - mRoleTitle->setCallbackUserData(this); - mRoleTitle->setKeystrokeCallback(onPropertiesKey); + mRoleTitle->setKeystrokeCallback(onPropertiesKey, this); mRoleDescription->setCommitOnFocusLost(TRUE); - mRoleDescription->setCallbackUserData(this); - mRoleDescription->setCommitCallback(onDescriptionCommit); + mRoleDescription->setCommitCallback(onDescriptionCommit, this); mRoleDescription->setFocusReceivedCallback(onDescriptionFocus, this); setFooterEnabled(FALSE); @@ -2060,7 +2030,7 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() rd.mRolePowers, 0LL, mActionIcons, - onActionCheck, + boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false), TRUE, FALSE, is_owner_role); @@ -2157,24 +2127,18 @@ void LLPanelGroupRolesSubTab::buildMembersList() } } -// static -void LLPanelGroupRolesSubTab::onActionCheck(LLUICtrl* ctrl, void* user_data) -{ - LLPanelGroupRolesSubTab* self = static_cast(user_data); - LLCheckBoxCtrl* check = static_cast(ctrl); - if (!check || !self) return; - - self->handleActionCheck(check); -} - struct ActionCBData { LLPanelGroupRolesSubTab* mSelf; LLCheckBoxCtrl* mCheck; }; -void LLPanelGroupRolesSubTab::handleActionCheck(LLCheckBoxCtrl* check, bool force) +void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) { + LLCheckBoxCtrl* check = dynamic_cast(ctrl); + if (!check) + return; + lldebugs << "LLPanelGroupRolesSubTab::handleActionSelect()" << llendl; LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); @@ -2442,11 +2406,11 @@ void LLPanelGroupRolesSubTab::saveRoleChanges() void* LLPanelGroupActionsSubTab::createTab(void* data) { LLUUID* group_id = static_cast(data); - return new LLPanelGroupActionsSubTab("panel group actions sub tab", *group_id); + return new LLPanelGroupActionsSubTab(*group_id); } -LLPanelGroupActionsSubTab::LLPanelGroupActionsSubTab(const std::string& name, const LLUUID& group_id) -: LLPanelGroupSubTab(name, group_id) +LLPanelGroupActionsSubTab::LLPanelGroupActionsSubTab(const LLUUID& group_id) +: LLPanelGroupSubTab(group_id) { } @@ -2472,12 +2436,8 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root) if (!mActionList || !mActionDescription || !mActionRoles || !mActionMembers) return FALSE; - mActionList->setCallbackUserData(this); mActionList->setCommitOnSelectionChange(TRUE); - mActionList->setCommitCallback(onActionSelect); - - mActionMembers->setCallbackUserData(this); - mActionRoles->setCallbackUserData(this); + mActionList->setCommitCallback(boost::bind(&LLPanelGroupActionsSubTab::handleActionSelect, this)); update(GC_ALL); @@ -2537,13 +2497,6 @@ void LLPanelGroupActionsSubTab::update(LLGroupChange gc) FALSE); } -// static -void LLPanelGroupActionsSubTab::onActionSelect(LLUICtrl* scroll, void* data) -{ - LLPanelGroupActionsSubTab* self = static_cast(data); - self->handleActionSelect(); -} - void LLPanelGroupActionsSubTab::handleActionSelect() { mActionMembers->deleteAllItems(); diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 95057bbfaf..3ceaae1313 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -42,6 +42,7 @@ class LLPanelGroupRolesSubTab; class LLPanelGroupActionsSubTab; class LLScrollListCtrl; class LLScrollListItem; +class LLTextEditor; // Forward declare for friend usage. //virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*); @@ -52,7 +53,7 @@ class LLPanelGroupRoles : public LLPanelGroupTab, public LLPanelGroupTabObserver { public: - LLPanelGroupRoles(const std::string& name, const LLUUID& group_id); + LLPanelGroupRoles(const LLUUID& group_id); virtual ~LLPanelGroupRoles(); // Allow sub tabs to ask for sibling controls. @@ -64,7 +65,6 @@ public: virtual BOOL isVisibleByAgent(LLAgent* agentp); static void* createTab(void* data); - static void onClickSubTab(void*,bool); void handleClickSubTab(); // Checks if the current tab needs to be applied, and tries to switch to the requested tab. @@ -104,7 +104,7 @@ protected: class LLPanelGroupSubTab : public LLPanelGroupTab { public: - LLPanelGroupSubTab(const std::string& name, const LLUUID& group_id); + LLPanelGroupSubTab(const LLUUID& group_id); virtual ~LLPanelGroupSubTab(); virtual BOOL postBuild(); @@ -131,7 +131,7 @@ public: U64 allowed_by_some, U64 allowed_by_all, icon_map_t& icons, - void (*commit_callback)(LLUICtrl*,void*), + LLUICtrl::commit_callback_t commit_callback, BOOL show_all, BOOL filter, BOOL is_owner_role); @@ -140,7 +140,7 @@ public: U64 allowed_by_all, LLRoleActionSet* action_set, icon_map_t& icons, - void (*commit_callback)(LLUICtrl*,void*), + LLUICtrl::commit_callback_t commit_callback, BOOL show_all, BOOL filter, BOOL is_owner_role); @@ -164,7 +164,7 @@ protected: class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab { public: - LLPanelGroupMembersSubTab(const std::string& name, const LLUUID& group_id); + LLPanelGroupMembersSubTab(const LLUUID& group_id); virtual ~LLPanelGroupMembersSubTab(); virtual BOOL postBuildSubTab(LLView* root); @@ -229,7 +229,7 @@ protected: class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab { public: - LLPanelGroupRolesSubTab(const std::string& name, const LLUUID& group_id); + LLPanelGroupRolesSubTab(const LLUUID& group_id); virtual ~LLPanelGroupRolesSubTab(); virtual BOOL postBuildSubTab(LLView* root); @@ -249,7 +249,6 @@ public: void buildMembersList(); static void onActionCheck(LLUICtrl*, void*); - void handleActionCheck(LLCheckBoxCtrl*, bool force=false); bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check); static void onPropertiesKey(LLLineEditor*, void*); @@ -268,10 +267,8 @@ public: void saveRoleChanges(); protected: - LLSD createRoleItem(const LLUUID& role_id, - std::string name, - std::string title, - S32 members); + void handleActionCheck(LLUICtrl* ctrl, bool force); + LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members); LLScrollListCtrl* mRolesList; LLNameListCtrl* mAssignedMembersList; @@ -293,7 +290,7 @@ protected: class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab { public: - LLPanelGroupActionsSubTab(const std::string& name, const LLUUID& group_id); + LLPanelGroupActionsSubTab(const LLUUID& group_id); virtual ~LLPanelGroupActionsSubTab(); virtual BOOL postBuildSubTab(LLView* root); @@ -306,7 +303,6 @@ public: virtual bool apply(std::string& mesg); virtual void update(LLGroupChange gc); - static void onActionSelect(LLUICtrl*, void*); void handleActionSelect(); protected: LLScrollListCtrl* mActionList; diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 8bb100d335..92fe082ef2 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -79,8 +79,8 @@ BOOL LLPanelLandInfo::postBuild() // // Methods // -LLPanelLandInfo::LLPanelLandInfo(const std::string& name) -: LLPanel(name), +LLPanelLandInfo::LLPanelLandInfo() +: LLPanel(), mCheckShowOwners(NULL) { if (!sInstance) diff --git a/indra/newview/llpanelland.h b/indra/newview/llpanelland.h index 9a7e977711..92fe313405 100644 --- a/indra/newview/llpanelland.h +++ b/indra/newview/llpanelland.h @@ -46,7 +46,7 @@ class LLPanelLandInfo : public LLPanel { public: - LLPanelLandInfo(const std::string& name); + LLPanelLandInfo(); virtual ~LLPanelLandInfo(); void refresh(); diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp new file mode 100644 index 0000000000..24b4082630 --- /dev/null +++ b/indra/newview/llpanellandmarks.cpp @@ -0,0 +1,252 @@ +/** + * @file llpanellandmarks.cpp + * @brief Landmarks tab for Side Bar "Places" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" +#include "lllandmark.h" + +#include "llfloaterworldmap.h" +#include "lllandmarklist.h" +#include "llpanellandmarks.h" +#include "llsidetray.h" +#include "lltabcontainer.h" +#include "llworldmap.h" + +// Not yet implemented; need to remove buildPanel() from constructor when we switch +//static LLRegisterPanelClassWrapper t_landmarks("panel_landmarks"); + +LLLandmarksPanel::LLLandmarksPanel() + : LLPanelPlacesTab(), + mInventoryPanel(NULL) +{ + mSavedFolderState = new LLSaveFolderState(); + mSavedFolderState->setApply(FALSE); + + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml"); +} + +LLLandmarksPanel::~LLLandmarksPanel() +{ + delete mSavedFolderState; +} + +BOOL LLLandmarksPanel::postBuild() +{ + if (!gInventory.isInventoryUsable()) + return FALSE; + + mInventoryPanel = getChild("landmarks_list"); + mInventoryPanel->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK); + mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_LANDMARK); + mInventoryPanel->setSelectCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, _1, _2)); + + LLFolderView* root_folder = mInventoryPanel->getRootFolder(); + root_folder->setReshapeCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, _1, _2)); + + mActionBtn = getChild("selector"); + root_folder->addChild(mActionBtn); + mActionBtn->setEnabled(TRUE); + childSetAction("selector", boost::bind(&LLLandmarksPanel::onSelectorButtonClicked, this), this); + + return TRUE; +} + +// virtual +void LLLandmarksPanel::onSearchEdit(const std::string& string) +{ + if (string == "") + { + mInventoryPanel->setFilterSubString(LLStringUtil::null); + + // re-open folders that were initially open + mSavedFolderState->setApply(TRUE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + LLOpenFoldersWithSelection opener; + mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); + mInventoryPanel->getRootFolder()->scrollToShowSelection(); + } + + gInventory.startBackgroundFetch(); + + if (mInventoryPanel->getFilterSubString().empty() && string.empty()) + { + // current filter and new filter empty, do nothing + return; + } + + // save current folder open state if no filter currently applied + if (mInventoryPanel->getRootFolder()->getFilterSubString().empty()) + { + mSavedFolderState->setApply(FALSE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + } + + // set new filter string + mInventoryPanel->setFilterSubString(string); +} + +// virtual +void LLLandmarksPanel::onShowOnMap() +{ + LLFolderViewItem* current_item = mInventoryPanel->getRootFolder()->getCurSelectedItem(); + if (!current_item) + return; + + LLFolderViewEventListener* listenerp = current_item->getListener(); + if (listenerp->getInventoryType() != LLInventoryType::IT_LANDMARK) + return; + + LLInventoryItem* inventory_item = gInventory.getItem(listenerp->getUUID()); + if (!inventory_item) + return; + + LLLandmark* landmark = gLandmarkList.getAsset(inventory_item->getAssetUUID()); + if (!landmark) + return; + + LLVector3d landmark_global_pos; + if (!landmark->getGlobalPos(landmark_global_pos)) + return; + + if (!landmark_global_pos.isExactlyZero()) + { + LLFloaterWorldMap::getInstance()->trackLocation(landmark_global_pos); + LLFloaterReg::showInstance("world_map", "center"); + } +} + +// virtual +void LLLandmarksPanel::onTeleport() +{ + LLFolderViewItem* current_item = mInventoryPanel->getRootFolder()->getCurSelectedItem(); + if (!current_item) + return; + + LLFolderViewEventListener* listenerp = current_item->getListener(); + if (listenerp->getInventoryType() == LLInventoryType::IT_LANDMARK) + { + listenerp->openItem(); + } + + togglePanelPlacesButtons(TRUE); +} + +/* +// virtual +void LLLandmarksPanel::onCopySLURL() +{ + LLFolderViewItem* current_item = mInventoryPanel->getRootFolder()->getCurSelectedItem(); + if (!current_item) + return; + + LLFolderViewEventListener* listenerp = current_item->getListener(); + if (listenerp->getInventoryType() != LLInventoryType::IT_LANDMARK) + return; + + LLInventoryItem* inventory_item = gInventory.getItem(listenerp->getUUID()); + if (!inventory_item) + return; + + LLLandmark* landmark = gLandmarkList.getAsset(inventory_item->getAssetUUID()); + if (!landmark) + return; + + LLVector3d landmark_global_pos; + if (!landmark->getGlobalPos(landmark_global_pos)) + return; + + U64 new_region_handle = to_region_handle(landmark_global_pos); + + LLWorldMap::url_callback_t cb = boost::bind( + &LLPanelPlacesTab::onRegionResponse, this, + landmark_global_pos, _1, _2, _3, _4); + + LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, cb, std::string("unused"), false); +} +*/ + +void LLLandmarksPanel::onSelectionChange(const std::deque &items, BOOL user_action) +{ + LLFolderViewItem* current_item = mInventoryPanel->getRootFolder()->getCurSelectedItem(); + if (!current_item) + return; + + LLFolderViewEventListener* listenerp = current_item->getListener(); + if (listenerp->getInventoryType() == LLInventoryType::IT_LANDMARK) + { + S32 bottom = 0; + LLFolderViewItem* folder = current_item->getParentFolder(); + + while ( folder->getParentFolder() != NULL ) + { + bottom += folder->getRect().mBottom; + folder = folder->getParentFolder(); + } + + LLRect rect = current_item->getRect(); + LLRect btn_rect( + rect.mRight - mActionBtn->getRect().getWidth(), + bottom + rect.mTop, + rect.mRight, + bottom + rect.mBottom); + + mActionBtn->setRect(btn_rect); + + if (!mActionBtn->getVisible()) + mActionBtn->setVisible(TRUE); + + togglePanelPlacesButtons(TRUE); + } + else + { + if (mActionBtn->getVisible()) + mActionBtn->setVisible(FALSE); + + togglePanelPlacesButtons(FALSE); + } +} + +void LLLandmarksPanel::onSelectorButtonClicked() +{ + LLFolderViewItem* cur_item = mInventoryPanel->getRootFolder()->getCurSelectedItem(); + + LLFolderViewEventListener* listenerp = cur_item->getListener(); + if (listenerp->getInventoryType() == LLInventoryType::IT_LANDMARK) + { + LLSD key; + key["type"] = LLPanelPlaces::LANDMARK; + key["id"] = listenerp->getUUID(); + + LLSideTray::getInstance()->showPanel("panel_places", key); + } +} diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h new file mode 100644 index 0000000000..0f400a722e --- /dev/null +++ b/indra/newview/llpanellandmarks.h @@ -0,0 +1,61 @@ +/** + * @file llpanellandmarks.h + * @brief Landmarks tab for Side Bar "Places" panel + * class definition + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELLANDMARKS_H +#define LL_LLPANELLANDMARKS_H + +#include "llinventoryview.h" +#include "llinventorymodel.h" +#include "llpanelplacestab.h" + +class LLLandmarksPanel : public LLPanelPlacesTab +{ +public: + LLLandmarksPanel(); + virtual ~LLLandmarksPanel(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onSearchEdit(const std::string& string); + /*virtual*/ void onShowOnMap(); + /*virtual*/ void onTeleport(); + ///*virtual*/ void onCopySLURL(); + + void onSelectionChange(const std::deque &items, BOOL user_action); + void onSelectorButtonClicked(); + +private: + LLInventoryPanel* mInventoryPanel; + LLSaveFolderState* mSavedFolderState; + LLButton* mActionBtn; +}; + +#endif //LL_LLPANELLANDMARKS_H diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index b8886c9493..d1ab3510cd 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -60,8 +60,7 @@ //--------------------------------------------------------------------------- LLPanelLandMedia::LLPanelLandMedia(LLParcelSelectionHandle& parcel) -: LLPanel(std::string("land_media_panel")), - +: LLPanel(), mParcel(parcel), mCheckSoundLocal(NULL), mSoundHelpButton(NULL), @@ -118,8 +117,7 @@ BOOL LLPanelLandMedia::postBuild() childSetCommitCallback("music_url", onCommitAny, this); mMediaTextureCtrl = getChild("media texture"); - mMediaTextureCtrl->setCommitCallback( onCommitAny ); - mMediaTextureCtrl->setCallbackUserData( this ); + mMediaTextureCtrl->setCommitCallback( onCommitAny, this ); mMediaTextureCtrl->setAllowNoTexture ( TRUE ); mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index bc5e8f2482..75df49e5e3 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -34,9 +34,8 @@ #include "llpanellogin.h" -#include "llpanelgeneral.h" - #include "indra_constants.h" // for key and mask constants +#include "llfloaterreg.h" #include "llfontgl.h" #include "llmd5.h" #include "llsecondlifeurls.h" @@ -49,8 +48,6 @@ #include "llcombobox.h" #include "llcurl.h" #include "llviewercontrol.h" -#include "llfloaterabout.h" -#include "llfloatertest.h" #include "llfloaterpreference.h" #include "llfocusmgr.h" #include "lllineeditor.h" @@ -70,12 +67,12 @@ #include "llhttpclient.h" #include "llweb.h" #include "llwebbrowserctrl.h" - #include "llfloaterhtml.h" +#include "llrootview.h" #include "llfloaterhtmlhelp.h" #include "llfloatertos.h" - +#include "lltrans.h" #include "llglheaders.h" #define USE_VIEWER_AUTH 0 @@ -166,7 +163,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, BOOL show_server, void (*callback)(S32 option, void* user_data), void *cb_data) -: LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered +: LLPanel(), mLogoImage(), mCallback(callback), mCallbackData(cb_data), @@ -190,7 +187,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child - gViewerWindow->getRootView()->addChildAtEnd(this); + gViewerWindow->getRootView()->addChildInBack(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); @@ -207,9 +204,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace); childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); - childSetCommitCallback("password_edit", mungePassword); - childSetKeystrokeCallback("password_edit", onPassKey, this); - childSetUserData("password_edit", this); + childSetCommitCallback("password_edit", mungePassword, this); + getChild("password_edit")->setKeystrokeCallback(onPassKey, this); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); @@ -219,14 +215,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, if (edit) edit->setDrawAsterixes(TRUE); LLComboBox* combo = getChild("start_location_combo"); - combo->setAllowTextEntry(TRUE, 128, FALSE); - // The XML file loads the combo with the following labels: - // 0 - "My Home" - // 1 - "My Last Location" - // 2 - "" - - BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { @@ -236,19 +225,11 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, combo->setTextEntry(sim_string); combo->setCurrentByIndex( 2 ); } - else if (login_last) - { - combo->setCurrentByIndex( 1 ); - } - else - { - combo->setCurrentByIndex( 0 ); - } - combo->setCommitCallback( &set_start_location ); + combo->setCommitCallback( &set_start_location, NULL ); LLComboBox* server_choice_combo = sInstance->getChild("server_combo"); - server_choice_combo->setCommitCallback(onSelectServer); + server_choice_combo->setCommitCallback(onSelectServer, NULL); server_choice_combo->setFocusLostCallback(onServerComboLostFocus); childSetAction("connect_btn", onClickConnect, this); @@ -266,14 +247,13 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLTextBox* channel_text = getChild("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); - channel_text->setClickedCallback(onClickVersion); - channel_text->setCallbackUserData(this); + channel_text->setClickedCallback(onClickVersion, this); LLTextBox* forgot_password_text = getChild("forgot_password_text"); - forgot_password_text->setClickedCallback(onClickForgotPassword); + forgot_password_text->setClickedCallback(onClickForgotPassword, NULL); LLTextBox* create_new_account_text = getChild("create_new_account_text"); - create_new_account_text->setClickedCallback(onClickNewAccount); + create_new_account_text->setClickedCallback(onClickNewAccount, NULL); #endif // get the web browser control @@ -432,16 +412,13 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) return TRUE; } - if (('P' == key) && (MASK_CONTROL == mask)) - { - LLFloaterPreference::show(NULL); - return TRUE; - } - if (('T' == key) && (MASK_CONTROL == mask)) - { - new LLFloaterSimple("floater_test.xml"); - return TRUE; + { // previously was "Test Floater" + if(gSavedSettings.getBOOL("QAMode")) + { + LLFloaterReg::showInstance("ui_preview", LLSD(), TRUE); + return TRUE; + } } if ( KEY_F1 == key ) @@ -656,19 +633,6 @@ void LLPanelLogin::refreshLocation( bool force_visible ) #if USE_VIEWER_AUTH loadLoginPage(); #else - LLComboBox* combo = sInstance->getChild("start_location_combo"); - - if (LLURLSimString::parse()) - { - combo->setCurrentByIndex( 3 ); // BUG? Maybe 2? - combo->setTextEntry(LLURLSimString::sInstance.mSimString); - } - else - { - BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); - combo->setCurrentByIndex( login_last ? 1 : 0 ); - } - BOOL show_start = TRUE; if ( ! force_visible ) @@ -688,7 +652,7 @@ void LLPanelLogin::refreshLocation( bool force_visible ) } // static -void LLPanelLogin::close() +void LLPanelLogin::closePanel() { if (sInstance) { @@ -787,14 +751,7 @@ void LLPanelLogin::loadLoginPage() } else { - if (gSavedSettings.getBOOL("LoginLastLocation")) - { - location = "last"; - } - else - { - location = "home"; - } + location = gSavedSettings.getString("LoginLocation"); } std::string firstname, lastname; @@ -899,13 +856,12 @@ void LLPanelLogin::onClickConnect(void *) } else { - LLNotifications::instance().add("MustHaveAccountToLogIn", LLSD(), LLSD(), - LLPanelLogin::newAccountAlertCallback); + LLNotifications::instance().add("MustHaveAccountToLogIn"); } } } - +/* // static bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& response) { @@ -913,7 +869,7 @@ bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& if (0 == option) { llinfos << "Going to account creation URL" << llendl; - LLWeb::loadURLExternal( CREATE_ACCOUNT_URL ); + LLWeb::loadURLExternal( LLNotifications::instance().getGlobalString("CREATE_ACCOUNT_URL")); } else { @@ -921,12 +877,12 @@ bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& } return false; } - +*/ // static void LLPanelLogin::onClickNewAccount(void*) { - LLWeb::loadURLExternal( CREATE_ACCOUNT_URL ); + LLWeb::loadURLExternal(sInstance->getString("create_account_url")); } @@ -949,7 +905,7 @@ void LLPanelLogin::onClickQuit(void*) // static void LLPanelLogin::onClickVersion(void*) { - LLFloaterAbout::show(NULL); + LLFloaterReg::showInstance("sl_about"); } //static @@ -1023,6 +979,8 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) { + if (!sInstance) return; + LLComboBox* combo = sInstance->getChild("server_combo"); if(fe == combo) { diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 47d42da7f1..540f938053 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -34,7 +34,7 @@ #define LL_LLPANELLOGIN_H #include "llpanel.h" -#include "llmemory.h" // LLPointer<> +#include "llpointer.h" // LLPointer<> #include "llwebbrowserctrl.h" // LLWebBrowserCtrlObserver class LLUIImage; @@ -72,7 +72,7 @@ public: static BOOL isGridComboDirty(); static void getLocation(std::string &location); - static void close(); + static void closePanel(); void setSiteIsAlive( bool alive ); @@ -84,7 +84,7 @@ public: private: static void onClickConnect(void*); static void onClickNewAccount(void*); - static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response); +// static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response); static void onClickQuit(void*); static void onClickVersion(void*); virtual void onNavigateComplete( const EventType& eventIn ); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 75f479c16f..9ec9874384 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -52,7 +52,6 @@ #include "llcombobox.h" #include "llfocusmgr.h" #include "llmanipscale.h" -#include "llpanelinventory.h" #include "llpreviewscript.h" #include "llresmgr.h" #include "llselectmgr.h" @@ -62,6 +61,7 @@ #include "lltool.h" #include "lltoolcomp.h" #include "lltoolmgr.h" +#include "lltrans.h" #include "llui.h" #include "llviewerobject.h" #include "llviewerregion.h" @@ -99,13 +99,23 @@ enum { MI_HOLE_COUNT }; -//*TODO:translate (depricated, so very low priority) -static const std::string LEGACY_FULLBRIGHT_DESC("Fullbright (Legacy)"); +//static const std::string LEGACY_FULLBRIGHT_DESC =LLTrans::getString("Fullbright"); BOOL LLPanelObject::postBuild() { setMouseOpaque(FALSE); - + + std::map material_name_map; + material_name_map["Stone"]= LLTrans::getString("Stone"); + material_name_map["Metal"]= LLTrans::getString("Metal"); + material_name_map["Glass"]= LLTrans::getString("Glass"); + material_name_map["Wood"]= LLTrans::getString("Wood"); + material_name_map["Flesh"]= LLTrans::getString("Flesh"); + material_name_map["Plastic"]= LLTrans::getString("Plastic"); + material_name_map["Rubber"]= LLTrans::getString("Rubber"); + material_name_map["Light"]= LLTrans::getString("Light"); + + LLMaterialTable::basic.initTableTransNames(material_name_map); //-------------------------------------------------------- // Top //-------------------------------------------------------- @@ -164,14 +174,14 @@ BOOL LLPanelObject::postBuild() mComboMaterial = getChild("material"); childSetCommitCallback("material",onCommitMaterial,this); mComboMaterial->removeall(); - // *TODO:translate + for (LLMaterialTable::info_list_t::iterator iter = LLMaterialTable::basic.mMaterialInfoList.begin(); iter != LLMaterialTable::basic.mMaterialInfoList.end(); ++iter) { LLMaterialInfo* minfop = *iter; if (minfop->mMCode != LL_MCODE_LIGHT) { - mComboMaterial->add(minfop->mName); + mComboMaterial->add(minfop->mName); } } mComboMaterialItemCount = mComboMaterial->getItemCount(); @@ -263,11 +273,10 @@ BOOL LLPanelObject::postBuild() if (mCtrlSculptTexture) { mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE)); - mCtrlSculptTexture->setCommitCallback( LLPanelObject::onCommitSculpt ); - mCtrlSculptTexture->setOnCancelCallback( LLPanelObject::onCancelSculpt ); - mCtrlSculptTexture->setOnSelectCallback( LLPanelObject::onSelectSculpt ); - mCtrlSculptTexture->setDropCallback(LLPanelObject::onDropSculpt); - mCtrlSculptTexture->setCallbackUserData( this ); + mCtrlSculptTexture->setCommitCallback( boost::bind(&LLPanelObject::onCommitSculpt, this, _2 )); + mCtrlSculptTexture->setOnCancelCallback( boost::bind(&LLPanelObject::onCancelSculpt, this, _2 )); + mCtrlSculptTexture->setOnSelectCallback( boost::bind(&LLPanelObject::onSelectSculpt, this, _2 )); + mCtrlSculptTexture->setDropCallback( boost::bind(&LLPanelObject::onDropSculpt, this, _2 )); // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); // Allow any texture to be used during non-immediate mode. @@ -303,8 +312,8 @@ BOOL LLPanelObject::postBuild() return TRUE; } -LLPanelObject::LLPanelObject(const std::string& name) -: LLPanel(name), +LLPanelObject::LLPanelObject() +: LLPanel(), mIsPhysical(FALSE), mIsTemporary(FALSE), mIsPhantom(FALSE), @@ -530,7 +539,7 @@ void LLPanelObject::getState( ) } } func; bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_code ); - + std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright"); if (editable && single_volume && material_same) { mComboMaterial->setEnabled( TRUE ); @@ -549,7 +558,7 @@ void LLPanelObject::getState( ) { mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC); } - // *TODO:Translate + mComboMaterial->setSimple(std::string(LLMaterialTable::basic.getName(material_code))); } } @@ -1163,7 +1172,7 @@ void LLPanelObject::getState( ) } // static -BOOL LLPanelObject::precommitValidate( LLUICtrl* ctrl, void* userdata ) +bool LLPanelObject::precommitValidate( const LLSD& data ) { // TODO: Richard will fill this in later. return TRUE; // FALSE means that validation failed and new value should not be commited. @@ -1244,6 +1253,7 @@ void LLPanelObject::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) { // apply the currently selected material to the object const std::string& material_name = box->getSimple(); + std::string LEGACY_FULLBRIGHT_DESC = LLTrans::getString("Fullbright"); if (material_name != LEGACY_FULLBRIGHT_DESC) { U8 material_code = LLMaterialTable::basic.getMCode(material_name); @@ -1992,60 +2002,49 @@ void LLPanelObject::onCommitCastShadows( LLUICtrl* ctrl, void* userdata ) } -// static -void LLPanelObject::onSelectSculpt(LLUICtrl* ctrl, void* userdata) +void LLPanelObject::onSelectSculpt(const LLSD& data) { - LLPanelObject* self = (LLPanelObject*) userdata; - - LLTextureCtrl* mTextureCtrl = self->getChild("sculpt texture control"); + LLTextureCtrl* mTextureCtrl = getChild("sculpt texture control"); if (mTextureCtrl) { - self->mSculptTextureRevert = mTextureCtrl->getImageAssetID(); + mSculptTextureRevert = mTextureCtrl->getImageAssetID(); } - self->sendSculpt(); + sendSculpt(); } -void LLPanelObject::onCommitSculpt( LLUICtrl* ctrl, void* userdata ) +void LLPanelObject::onCommitSculpt( const LLSD& data ) { - LLPanelObject* self = (LLPanelObject*) userdata; - - self->sendSculpt(); + sendSculpt(); } -// static -BOOL LLPanelObject::onDropSculpt(LLUICtrl*, LLInventoryItem* item, void* userdata) +BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item) { - LLPanelObject* self = (LLPanelObject*) userdata; - - LLTextureCtrl* mTextureCtrl = self->getChild("sculpt texture control"); + LLTextureCtrl* mTextureCtrl = getChild("sculpt texture control"); if (mTextureCtrl) { LLUUID asset = item->getAssetUUID(); mTextureCtrl->setImageAssetID(asset); - self->mSculptTextureRevert = asset; + mSculptTextureRevert = asset; } return TRUE; } -// static -void LLPanelObject::onCancelSculpt(LLUICtrl* ctrl, void* userdata) +void LLPanelObject::onCancelSculpt(const LLSD& data) { - LLPanelObject* self = (LLPanelObject*) userdata; - - LLTextureCtrl* mTextureCtrl = self->getChild("sculpt texture control"); + LLTextureCtrl* mTextureCtrl = getChild("sculpt texture control"); if(!mTextureCtrl) return; - mTextureCtrl->setImageAssetID(self->mSculptTextureRevert); + mTextureCtrl->setImageAssetID(mSculptTextureRevert); - self->sendSculpt(); + sendSculpt(); } // static diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 9ed091ed5f..1ab4ff581e 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -35,7 +35,7 @@ #include "v3math.h" #include "llpanel.h" -#include "llmemory.h" +#include "llpointer.h" #include "llvolume.h" class LLSpinCtrl; @@ -54,7 +54,7 @@ class LLUUID; class LLPanelObject : public LLPanel { public: - LLPanelObject(const std::string& name); + LLPanelObject(); virtual ~LLPanelObject(); virtual BOOL postBuild(); @@ -63,7 +63,7 @@ public: void refresh(); - static BOOL precommitValidate(LLUICtrl* ctrl,void* userdata); + static bool precommitValidate(const LLSD& data); static void onCommitLock(LLUICtrl *ctrl, void *data); static void onCommitPosition( LLUICtrl* ctrl, void* userdata); @@ -78,10 +78,10 @@ public: static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); - static void onCommitSculpt( LLUICtrl* ctrl, void* userdata); - static void onCancelSculpt( LLUICtrl* ctrl, void* userdata); - static void onSelectSculpt( LLUICtrl* ctrl, void* userdata); - static BOOL onDropSculpt( LLUICtrl* ctrl, LLInventoryItem* item, void* ud); + void onCommitSculpt(const LLSD& data); + void onCancelSculpt(const LLSD& data); + void onSelectSculpt(const LLSD& data); + BOOL onDropSculpt(LLInventoryItem* item); static void onCommitSculptType( LLUICtrl *ctrl, void* userdata); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp new file mode 100644 index 0000000000..1d7a2748cc --- /dev/null +++ b/indra/newview/llpanelpeople.cpp @@ -0,0 +1,729 @@ +/** + * @file llpanelpeople.cpp + * @brief Side tray "People" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +// libs +#include "llfloaterreg.h" +#include "llmenugl.h" +#include "llsearcheditor.h" +#include "lltabcontainer.h" +#include "lluictrlfactory.h" + +#include "llpanelpeople.h" + +// newview +#include "llagent.h" +#include "llavatarlist.h" +#include "llcallingcard.h" // for LLAvatarTracker +#include "llfloateravatarpicker.h" +#include "llfloaterminiinspector.h" +#include "llfriendactions.h" +#include "llgroupactions.h" +#include "llgrouplist.h" +#include "llrecentpeople.h" +#include "llviewercontrol.h" // for gSavedSettings +#include "llviewermenu.h" // for gMenuHolder +#include "llvoiceclient.h" +#include "llworld.h" + +using namespace LLOldEvents; + +#define FRIEND_LIST_UPDATE_TIMEOUT 0.5 +#define NEARBY_LIST_UPDATE_INTERVAL 1 +#define RECENT_LIST_UPDATE_DELAY 1 + +static LLRegisterPanelClassWrapper t_people("panel_people"); + +//============================================================================= + +class LLPanelPeople::Updater +{ +public: + typedef boost::function callback_t; + Updater(callback_t cb) + : mCallback(cb) + { + } + virtual ~Updater() + { + } + virtual void setActive(bool) {} +protected: + bool updateList(U32 mask = 0) + { + return mCallback(mask); + } + callback_t mCallback; +}; + +class LLAvatarListUpdater : public LLPanelPeople::Updater, public LLEventTimer +{ +public: + LLAvatarListUpdater(callback_t cb, F32 period) + : LLEventTimer(period), + LLPanelPeople::Updater(cb) + { + mEventTimer.stop(); + } +}; + +/** + * Updates the friends list. + */ +class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver +{ + LOG_CLASS(LLFriendListUpdater); +public: + LLFriendListUpdater(callback_t cb) + : LLAvatarListUpdater(cb, FRIEND_LIST_UPDATE_TIMEOUT) + { + LLAvatarTracker::instance().addObserver(this); + // For notification when SIP online status changes. + LLVoiceClient::getInstance()->addObserver(this); + } + ~LLFriendListUpdater() + { + LLVoiceClient::getInstance()->removeObserver(this); + LLAvatarTracker::instance().removeObserver(this); + } + /*virtual*/ void setActive(bool val) + { + if (!val) + return; + + // Perform updates until all names are loaded. + if (!updateList(LLFriendObserver::ADD)) + changed(LLFriendObserver::ADD); + } + /*virtual*/ void changed(U32 mask) + { + // events can arrive quickly in bulk - we need not process EVERY one of them - + // so we wait a short while to let others pile-in, and process them in aggregate. + mEventTimer.start(); + + // save-up all the mask-bits which have come-in + mMask |= mask; + } + /*virtual*/ BOOL tick() + { + if (updateList(mMask)) + { + // Got all names, stop updates. + mEventTimer.stop(); + mMask = 0; + } + + return FALSE; + } +private: + U32 mMask; +}; + +/** + * Periodically updates the nearby people list while the Nearby tab is active. + */ +class LLNearbyListUpdater : public LLAvatarListUpdater +{ + LOG_CLASS(LLNearbyListUpdater); +public: + LLNearbyListUpdater(callback_t cb) + : LLAvatarListUpdater(cb, NEARBY_LIST_UPDATE_INTERVAL) + { + setActive(false); + } + /*virtual*/ BOOL tick() + { + updateList(); + return FALSE; + } + /*virtual*/ void setActive(bool val) + { + if (val) + { + // update immediately and start regular updates + tick(); + mEventTimer.start(); + } + else + { + // stop regular updates + mEventTimer.stop(); + } + } +private: +}; + +/** + * Updates the recent people list (those the agent has recently interacted with). + */ +class LLRecentListUpdater : public LLAvatarListUpdater +{ + LOG_CLASS(LLRecentListUpdater); +public: + LLRecentListUpdater(callback_t cb) + : LLAvatarListUpdater(cb, RECENT_LIST_UPDATE_DELAY) + { + LLRecentPeople::instance().setChangedCallback(boost::bind(&LLRecentListUpdater::onRecentPeopleChanged, this)); + } +private: + /*virtual*/ BOOL tick() + { + // Update the list until we get all the names. + if (updateList()) + { + // Got all names, stop updates. + mEventTimer.stop(); + } + + return FALSE; + } + void onRecentPeopleChanged() + { + if (!updateList()) + { + // Some names are incomplete, schedule another update. + mEventTimer.start(); + } + } +}; + +/** + * Updates the group list on events from LLAgent. + */ +class LLGroupListUpdater : public LLPanelPeople::Updater, public LLSimpleListener +{ + LOG_CLASS(LLGroupListUpdater); +public: + LLGroupListUpdater(callback_t cb) + : LLPanelPeople::Updater(cb) + { + gAgent.addListener(this, "new group"); + } + ~LLGroupListUpdater() + { + gAgent.removeListener(this); + } + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata) + { + // Why is "new group" sufficient? + if (event->desc() == "new group") + { + updateList(); + return true; + } + + return false; + } +}; + +//============================================================================= + +LLPanelPeople::LLPanelPeople() + : LLPanel(), + mFilterSubString(LLStringUtil::null), + mSearchEditor(NULL), + mTabContainer(NULL), + mFriendList(NULL), + mNearbyList(NULL), + mRecentList(NULL) +{ + mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::onFriendListUpdate,this, _1)); + mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this)); + mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this)); + mGroupListUpdater = new LLGroupListUpdater (boost::bind(&LLPanelPeople::updateGroupList, this)); +} + +LLPanelPeople::~LLPanelPeople() +{ + delete mNearbyListUpdater; + delete mFriendListUpdater; + delete mRecentListUpdater; + delete mGroupListUpdater; + + LLView::deleteViewByHandle(mGroupPlusMenuHandle); + LLView::deleteViewByHandle(mGroupMinusMenuHandle); +} + +BOOL LLPanelPeople::postBuild() +{ + mSearchEditor = getChild("filter_input"); + + mTabContainer = getChild("tabs"); + mTabContainer->setCommitCallback(boost::bind(&LLPanelPeople::onTabSelected, this, _2)); + mTabContainer->selectTabByName("friends_panel"); // must go after setting commit callback + + mFriendList = getChild("friends_panel")->getChild("avatar_list"); + mNearbyList = getChild("nearby_panel")->getChild("avatar_list"); + mRecentList = getChild("recent_panel")->getChild("avatar_list"); + mGroupList = getChild("group_list"); + + LLPanel* groups_panel = getChild("groups_panel"); + groups_panel->childSetAction("activate_btn", boost::bind(&LLPanelPeople::onActivateButtonClicked, this)); + groups_panel->childSetAction("plus_btn", boost::bind(&LLPanelPeople::onGroupPlusButtonClicked, this)); + groups_panel->childSetAction("minus_btn", boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this)); + + LLPanel* friends_panel = getChild("friends_panel"); + friends_panel->childSetAction("add_btn", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this)); + friends_panel->childSetAction("del_btn", boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this)); + + mFriendList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mFriendList)); + mNearbyList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mNearbyList)); + mRecentList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mRecentList)); + mFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mFriendList)); + mNearbyList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mNearbyList)); + mRecentList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mRecentList)); + + mGroupList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onGroupInfoButtonClicked, this)); + mGroupList->setCommitCallback(boost::bind(&LLPanelPeople::updateButtons, this)); + + buttonSetAction("view_profile_btn", boost::bind(&LLPanelPeople::onViewProfileButtonClicked, this)); + buttonSetAction("add_friend_btn", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this)); + buttonSetAction("group_info_btn", boost::bind(&LLPanelPeople::onGroupInfoButtonClicked, this)); + buttonSetAction("chat_btn", boost::bind(&LLPanelPeople::onChatButtonClicked, this)); + buttonSetAction("im_btn", boost::bind(&LLPanelPeople::onImButtonClicked, this)); + buttonSetAction("call_btn", boost::bind(&LLPanelPeople::onCallButtonClicked, this)); + buttonSetAction("teleport_btn", boost::bind(&LLPanelPeople::onTeleportButtonClicked, this)); + buttonSetAction("share_btn", boost::bind(&LLPanelPeople::onShareButtonClicked, this)); + buttonSetAction("more_btn", boost::bind(&LLPanelPeople::onMoreButtonClicked, this)); + + // Create menus. + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + registrar.add("People.Group.Plus.Action", boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2)); + LLMenuGL* plus_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_group_plus.xml", gMenuHolder); + mGroupPlusMenuHandle = plus_menu->getHandle(); + registrar.add("People.Group.Minus.Action", boost::bind(&LLPanelPeople::onGroupMinusMenuItemClicked, this, _2)); + LLMenuGL* minus_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_group_minus.xml", gMenuHolder); + mGroupMinusMenuHandle = minus_menu->getHandle(); + + // Perform initial update. + mFriendListUpdater->setActive(true); + updateGroupList(); + updateRecentList(); + + return TRUE; +} + +bool LLPanelPeople::refreshFriendNames(U32 changed_mask) +{ + // get all buddies we know about + LLAvatarTracker::buddy_map_t all_buddies; + LLAvatarTracker::instance().copyBuddyList(all_buddies); + + bool have_names = true; + + if (changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) + { + // *TODO: it's suboptimal to rebuild the whole list on online status change. + + // convert the buddy map to vector + std::vector avatar_ids; + LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin(); + for (; buddy_it != all_buddies.end(); ++buddy_it) + avatar_ids.push_back(buddy_it->first); + + // do refresh the friend list + if (avatar_ids.size() > 0) + have_names = mFriendList->updateList(avatar_ids); + else + mFriendList->setCommentText(getString("no_friends")); + } + + return have_names; +} + +bool LLPanelPeople::updateFriendList(U32 changed_mask) +{ + // Refresh names. + if (changed_mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE)) + { + return refreshFriendNames(changed_mask); + } + + return true; +} + +bool LLPanelPeople::updateNearbyList() +{ + std::vector avatar_ids; + + LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); + + mNearbyList->updateList(avatar_ids); + + if (avatar_ids.size() == 0) + mNearbyList->setCommentText(getString("no_one_near")); + + return true; +} + +bool LLPanelPeople::updateRecentList() +{ + std::vector avatar_ids; + + LLRecentPeople::instance().get(avatar_ids); + + if (avatar_ids.size() > 0) + return mRecentList->updateList(avatar_ids); + + mRecentList->setCommentText(getString("no_people")); + return true; +} + +bool LLPanelPeople::updateGroupList() +{ + return mGroupList->updateList(); +} + +void LLPanelPeople::buttonSetVisible(std::string btn_name, BOOL visible) +{ + // Currently all bottom buttons are wrapped with layout panels. + // Hiding a button has no effect: the panel still occupies its space. + // So we have to hide the whole panel (along with its button) + // to free some space up. + LLButton* btn = getChild("button_bar")->getChild(btn_name); + LLPanel* btn_parent = dynamic_cast(btn->getParent()); + if (btn_parent) + btn_parent->setVisible(visible); +} + +void LLPanelPeople::buttonSetEnabled(const std::string& btn_name, bool enabled) +{ + // To make sure we're referencing the right widget (a child of the button bar). + LLButton* button = getChild("button_bar")->getChild(btn_name); + button->setEnabled(enabled); +} + +void LLPanelPeople::buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb) +{ + // To make sure we're referencing the right widget (a child of the button bar). + LLButton* button = getChild("button_bar")->getChild(btn_name); + button->setClickedCallback(cb); +} + +void LLPanelPeople::updateButtons() +{ + std::string cur_tab = mTabContainer->getCurrentPanel()->getName(); + bool nearby_tab_active = (cur_tab == "nearby_panel"); + bool friends_tab_active = (cur_tab == "friends_panel"); + bool group_tab_active = (cur_tab == "groups_panel"); + bool recent_tab_active = (cur_tab == "recent_panel"); + LLUUID selected_id; + + buttonSetVisible("group_info_btn", group_tab_active); + buttonSetVisible("chat_btn", group_tab_active); + buttonSetVisible("add_friend_btn", nearby_tab_active || recent_tab_active); + buttonSetVisible("view_profile_btn", !group_tab_active); + buttonSetVisible("im_btn", !group_tab_active); + buttonSetVisible("teleport_btn", friends_tab_active || group_tab_active); + buttonSetVisible("share_btn", !recent_tab_active && false); // not implemented yet + + if (group_tab_active) + { + bool cur_group_active = true; + + selected_id = mGroupList->getCurrentID(); + if (selected_id.notNull()) + cur_group_active = (gAgent.getGroupID() == selected_id); + + bool item_selected = selected_id.notNull(); + LLPanel* groups_panel = mTabContainer->getCurrentPanel(); + groups_panel->childSetEnabled("activate_btn", !item_selected || !cur_group_active); // "none" or a non-active group selected + groups_panel->childSetEnabled("plus_btn", item_selected); + groups_panel->childSetEnabled("minus_btn", item_selected); + } + else + { + bool is_friend = true; + LLAvatarList* list; + + // Check whether selected avatar is our friend. + if ((list = getActiveAvatarList()) && (selected_id = list->getCurrentID()).notNull()) + { + is_friend = LLAvatarTracker::instance().getBuddyInfo(selected_id) != NULL; + } + + childSetEnabled("add_friend_btn", !is_friend); + } + + bool item_selected = selected_id.notNull(); + buttonSetEnabled("teleport_btn", friends_tab_active && item_selected); + buttonSetEnabled("view_profile_btn", item_selected); + buttonSetEnabled("im_btn", item_selected); + buttonSetEnabled("call_btn", item_selected && false); // not implemented yet + buttonSetEnabled("share_btn", item_selected && false); // not implemented yet + buttonSetEnabled("group_info_btn", item_selected); + buttonSetEnabled("chat_btn", item_selected); +} + +LLAvatarList* LLPanelPeople::getActiveAvatarList() const +{ + std::string cur_tab = mTabContainer->getCurrentPanel()->getName(); + + if (cur_tab == "friends_panel") + return mFriendList; + if (cur_tab == "nearby_panel") + return mNearbyList; + if (cur_tab == "recent_panel") + return mRecentList; + + return NULL; +} + +LLUUID LLPanelPeople::getCurrentItemID() const +{ + LLAvatarList* alist = getActiveAvatarList(); + if (alist) + return alist->getCurrentID(); + return mGroupList->getCurrentID(); +} + +void LLPanelPeople::showGroupMenu(LLMenuGL* menu) +{ + // Shows the menu at the top of the button bar. + + // Calculate its coordinates. + // (assumes that groups panel is the current tab) + LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild("bottom_panel"); + LLPanel* parent_panel = mTabContainer->getCurrentPanel(); + menu->arrangeAndClear(); + S32 menu_height = menu->getRect().getHeight(); + S32 menu_x = -2; // *HACK: compensates HPAD in showPopup() + S32 menu_y = bottom_panel->getRect().mTop + menu_height; + + // Actually show the menu. + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y); +} + +void LLPanelPeople::onVisibilityChange(BOOL new_visibility) +{ + if (new_visibility == FALSE) + { + // Don't update anything while we're invisible. + mNearbyListUpdater->setActive(FALSE); + } + else + { + // Make the tab-container re-select current tab + // for onTabSelected() callback to get called. + // (currently this is needed to reactivate nearby list updates + // when we get visible) + mTabContainer->selectTab(mTabContainer->getCurrentPanelIndex()); + } +} + +void LLPanelPeople::onSearchEdit(const std::string& search_string) +{ + if (mFilterSubString == search_string) + return; + + mFilterSubString = search_string; + + LLStringUtil::toUpper(mFilterSubString); + LLStringUtil::trimHead(mFilterSubString); + mSearchEditor->setText(mFilterSubString); +} + +void LLPanelPeople::onTabSelected(const LLSD& param) +{ + std::string tab_name = getChild(param.asString())->getName(); + mNearbyListUpdater->setActive(tab_name == "nearby_panel"); + updateButtons(); +} + +void LLPanelPeople::onAvatarListDoubleClicked(LLAvatarList* list) +{ + LLUUID clicked_id = list->getCurrentID(); + + if (clicked_id.isNull()) + return; + + // Open mini-inspector for the avatar being clicked + LLFloaterReg::showInstance("mini_inspector", clicked_id); + // inspector will delete itself on close +} + +void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list) +{ + (void) list; + updateButtons(); +} + +void LLPanelPeople::onViewProfileButtonClicked() +{ + LLUUID id = getCurrentItemID(); + LLFriendActions::showProfile(id); +} + +void LLPanelPeople::onAddFriendButtonClicked() +{ + LLUUID id = getCurrentItemID(); + if (id.notNull()) + { + std::string name; + gCacheName->getFullName(id, name); + LLFriendActions::requestFriendshipDialog(id, name); + } +} + +void LLPanelPeople::onAddFriendWizButtonClicked() +{ + // Show add friend wizard. + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(onAvatarPicked, NULL, FALSE, TRUE); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) + { + root_floater->addDependentFloater(picker); + } +} + +void LLPanelPeople::onDeleteFriendButtonClicked() +{ + LLFriendActions::removeFriendDialog(getCurrentItemID()); +} + +void LLPanelPeople::onGroupInfoButtonClicked() +{ + LLUUID group_id = getCurrentItemID(); + if (group_id.notNull()) + LLGroupActions::info(group_id); +} + +void LLPanelPeople::onChatButtonClicked() +{ + LLUUID group_id = getCurrentItemID(); + if (group_id.notNull()) + LLGroupActions::startChat(group_id); +} + +void LLPanelPeople::onImButtonClicked() +{ + LLUUID id = getCurrentItemID(); + if (id.notNull()) + { + LLFriendActions::startIM(id); + } +} + +void LLPanelPeople::onActivateButtonClicked() +{ + LLGroupActions::activate(mGroupList->getCurrentID()); +} + +// static +void LLPanelPeople::onAvatarPicked( + const std::vector& names, + const std::vector& ids, + void*) +{ + if (!names.empty() && !ids.empty()) + LLFriendActions::requestFriendshipDialog(ids[0], names[0]); +} + +bool LLPanelPeople::onFriendListUpdate(U32 changed_mask) +{ + bool have_names = updateFriendList(changed_mask); + + // Update online status in the Recent tab. + // *TODO: isn't it too much to update the whole list? + updateRecentList(); + + return have_names; +} + +void LLPanelPeople::onGroupPlusButtonClicked() +{ + LLMenuGL* plus_menu = (LLMenuGL*)mGroupPlusMenuHandle.get(); + if (!plus_menu) + return; + + showGroupMenu(plus_menu); +} + +void LLPanelPeople::onGroupMinusButtonClicked() +{ + LLMenuGL* minus_menu = (LLMenuGL*)mGroupMinusMenuHandle.get(); + if (!minus_menu) + return; + + showGroupMenu(minus_menu); +} + +void LLPanelPeople::onGroupPlusMenuItemClicked(const LLSD& userdata) +{ + std::string chosen_item = userdata.asString(); + + if (chosen_item == "join_group") + LLGroupActions::search(); + else if (chosen_item == "new_group") + LLGroupActions::create(); +} + +void LLPanelPeople::onGroupMinusMenuItemClicked(const LLSD& userdata) +{ + std::string chosen_item = userdata.asString(); + + LLUUID group_id = getCurrentItemID(); + if (chosen_item == "leave_group") + LLGroupActions::leave(group_id); + /* + else if (chosen_item == "delete_group") + ; // *TODO: how to delete a group? + */ +} + +void LLPanelPeople::onCallButtonClicked() +{ + // *TODO: not implemented yet +} + +void LLPanelPeople::onTeleportButtonClicked() +{ + LLFriendActions::offerTeleport(getCurrentItemID()); +} + +void LLPanelPeople::onShareButtonClicked() +{ + // *TODO: not implemented yet +} + +void LLPanelPeople::onMoreButtonClicked() +{ + // *TODO: not implemented yet +} + +void LLPanelPeople::onOpen(const LLSD& key) +{ + mTabContainer->selectTab(key.asInteger()); +} diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h new file mode 100644 index 0000000000..4d535f287c --- /dev/null +++ b/indra/newview/llpanelpeople.h @@ -0,0 +1,122 @@ +/** + * @file llpanelpeople.h + * @brief Side tray "People" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELPEOPLE_H +#define LL_LLPANELPEOPLE_H + +#include + +#include "llcallingcard.h" // for avatar tracker + +class LLSearchEditor; +class LLTabContainer; +class LLAvatarList; +class LLGroupList; + +class LLPanelPeople : public LLPanel +{ + LOG_CLASS(LLPanelPeople); +public: + LLPanelPeople(); + virtual ~LLPanelPeople(); + + /*virtual*/ BOOL postBuild(); + + virtual void onOpen(const LLSD& key); + + // internals + class Updater; + +private: + bool updateFriendList(U32 changed_mask); + bool updateNearbyList(); + bool updateRecentList(); + bool updateGroupList(); + void updateButtons(); + bool refreshFriendNames(U32 changed_mask); + LLAvatarList* getActiveAvatarList() const; + LLUUID getCurrentItemID() const; + void buttonSetVisible(std::string btn_name, BOOL visible); + void buttonSetEnabled(const std::string& btn_name, bool enabled); + void buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb); + void showGroupMenu(LLMenuGL* menu); + + /*virtual*/ void onVisibilityChange(BOOL new_visibility); + + // UI callbacks + void onSearchEdit(const std::string& search_string); + void onTabSelected(const LLSD& param); + void onViewProfileButtonClicked(); + void onAddFriendButtonClicked(); + void onAddFriendWizButtonClicked(); + void onDeleteFriendButtonClicked(); + void onGroupInfoButtonClicked(); + void onChatButtonClicked(); + void onImButtonClicked(); + void onCallButtonClicked(); + void onTeleportButtonClicked(); + void onShareButtonClicked(); + void onMoreButtonClicked(); + void onActivateButtonClicked(); + void onAvatarListDoubleClicked(LLAvatarList* list); + void onAvatarListCommitted(LLAvatarList* list); + void onGroupPlusButtonClicked(); + void onGroupMinusButtonClicked(); + void onGroupPlusMenuItemClicked(const LLSD& userdata); + void onGroupMinusMenuItemClicked(const LLSD& userdata); + + // misc callbacks + bool onFriendListUpdate(U32 changed_mask); + static void onAvatarPicked( + const std::vector& names, + const std::vector& ids, + void*); + + LLSearchEditor* mSearchEditor; + LLTabContainer* mTabContainer; + LLAvatarList* mFriendList; + LLAvatarList* mNearbyList; + LLAvatarList* mRecentList; + LLGroupList* mGroupList; + + LLHandle mGroupPlusMenuHandle; + LLHandle mGroupMinusMenuHandle; + + Updater* mFriendListUpdater; + Updater* mNearbyListUpdater; + Updater* mRecentListUpdater; + Updater* mGroupListUpdater; + + std::string mFilterSubString; +}; + +#endif //LL_LLPANELPEOPLE_H diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 389f06f355..9fdde9e757 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -55,11 +55,11 @@ #include "lllineeditor.h" #include "llradiogroup.h" #include "llcombobox.h" -#include "llfloateravatarinfo.h" #include "lluiconstants.h" #include "lldbstrings.h" #include "llfloatergroupinfo.h" #include "llfloatergroups.h" +#include "llfriendactions.h" #include "llnamebox.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" @@ -70,56 +70,44 @@ ///---------------------------------------------------------------------------- // Default constructor -LLPanelPermissions::LLPanelPermissions(const std::string& title) : - LLPanel(title) +LLPanelPermissions::LLPanelPermissions() : + LLPanel() { setMouseOpaque(FALSE); } BOOL LLPanelPermissions::postBuild() { - this->childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); - this->childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); - this->childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this); - this->childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe); + childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); + childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); + childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this); + childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe); - this->childSetAction("button owner profile",LLPanelPermissions::onClickOwner,this); - this->childSetAction("button creator profile",LLPanelPermissions::onClickCreator,this); + childSetAction("button owner profile",LLPanelPermissions::onClickOwner,this); + childSetAction("button creator profile",LLPanelPermissions::onClickCreator,this); - this->childSetAction("button set group",LLPanelPermissions::onClickGroup,this); + getChild("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this)); - this->childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this); + childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this); - this->childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this); + childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this); - this->childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this); + childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this); - this->childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this); + childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this); - this->childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); + childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); - this->childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this); - this->childSetPrevalidate("Edit Cost",LLLineEditor::prevalidateNonNegativeS32); - - this->childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); + childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); - this->childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this); - this->childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); - this->childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); - this->childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); - this->childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); + childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this); + childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); + childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); + childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); + childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); - LLTextBox* group_rect_proxy = getChild("Group Name Proxy"); - if(group_rect_proxy ) - { - mLabelGroupName = new LLNameBox("Group Name", group_rect_proxy->getRect()); - addChild(mLabelGroupName); - } - else - { - mLabelGroupName = NULL; - } + mLabelGroupName = getChild("Group Name Proxy"); return TRUE; } @@ -137,7 +125,7 @@ void LLPanelPermissions::refresh() if(BtnDeedToGroup) { std::string deedText; - if (gSavedSettings.getWarning("DeedObject")) + if (gWarningSettings.getBOOL("DeedObject")) { deedText = getString("text deed continued"); } @@ -823,7 +811,7 @@ void LLPanelPermissions::onClickCreator(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - LLFloaterAvatarInfo::showFromObject(self->mCreatorID); + LLFriendActions::showProfile(self->mCreatorID); } // static @@ -839,23 +827,22 @@ void LLPanelPermissions::onClickOwner(void *data) } else { - LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + LLFriendActions::showProfile(self->mOwnerID); } } -void LLPanelPermissions::onClickGroup(void* data) +void LLPanelPermissions::onClickGroup() { - LLPanelPermissions* panelp = (LLPanelPermissions*)data; LLUUID owner_id; std::string name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); if(owners_identical && (owner_id == gAgent.getID())) { LLFloaterGroupPicker* fg; fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - fg->setSelectCallback( cbGroupID, data ); + fg->setSelectGroupCallback( boost::bind(&LLPanelPermissions::cbGroupID, this, _1) ); if (parent_floater) { @@ -866,13 +853,11 @@ void LLPanelPermissions::onClickGroup(void* data) } } -// static -void LLPanelPermissions::cbGroupID(LLUUID group_id, void* userdata) +void LLPanelPermissions::cbGroupID(LLUUID group_id) { - LLPanelPermissions* self = (LLPanelPermissions*)userdata; - if(self->mLabelGroupName) + if(mLabelGroupName) { - self->mLabelGroupName->setNameID(group_id, TRUE); + mLabelGroupName->setNameID(group_id, TRUE); } LLSelectMgr::getInstance()->sendGroup(group_id); } diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index bb816acd07..481efe178e 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -53,24 +53,22 @@ class LLNameBox; class LLPanelPermissions : public LLPanel { public: - LLPanelPermissions(const std::string& title); + LLPanelPermissions(); virtual ~LLPanelPermissions(); virtual BOOL postBuild(); // MANIPULATORS void refresh(); // refresh all labels as needed -// void setPermCheckboxes(U32 mask_on, U32 mask_off, -// LLCheckBoxCtrl* move, LLCheckboxCtrl* edit, -// LLCheckBoxCtrl* copy); + protected: // statics static void onClickClaim(void*); static void onClickRelease(void*); static void onClickCreator(void*); static void onClickOwner(void*); - static void onClickGroup(void*); - static void cbGroupID(LLUUID group_id, void* userdata); + void onClickGroup(); + void cbGroupID(LLUUID group_id); static void onClickDeedToGroup(void*); static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm); @@ -101,10 +99,6 @@ protected: protected: LLNameBox* mLabelGroupName; // group name - //LLTextBox* mBuyerLabel; - //LLCheckBoxCtrl* mCheckBuyerModify; - //LLCheckBoxCtrl* mCheckBuyerCopy; - LLUUID mCreatorID; LLUUID mOwnerID; LLUUID mLastOwnerID; diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 43ecd273c2..65be4718ef 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -35,481 +35,358 @@ // profile. #include "llviewerprecompiledheaders.h" - -#include "llpanelpick.h" - -#include "lldir.h" -#include "llparcel.h" +#include "llpanel.h" #include "message.h" - #include "llagent.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llviewercontrol.h" -#include "lllineeditor.h" -#include "lltabcontainervertical.h" -#include "lltextbox.h" -#include "llviewertexteditor.h" +#include "llparcel.h" +#include "llviewerparcelmgr.h" #include "lltexturectrl.h" #include "lluiconstants.h" -#include "llviewergenericmessage.h" -#include "lluictrlfactory.h" -#include "llviewerparcelmgr.h" -#include "llworldmap.h" -#include "llfloaterworldmap.h" -#include "llviewerregion.h" -#include "llviewerwindow.h" +#include "llavatarpropertiesprocessor.h" +#include "llpanelpick.h" +#include "llpanelmeprofile.h" -//static -std::list LLPanelPick::sAllPanels; - -LLPanelPick::LLPanelPick(BOOL top_pick) -: LLPanel(std::string("Top Picks Panel")), - mTopPick(top_pick), - mPickID(), - mCreatorID(), - mParcelID(), - mDataRequested(FALSE), - mDataReceived(FALSE), - mPosGlobal(), - mSnapshotCtrl(NULL), - mNameEditor(NULL), - mDescEditor(NULL), - mLocationEditor(NULL), - mTeleportBtn(NULL), - mMapBtn(NULL), - //mLandmarkBtn(NULL), - mSortOrderText(NULL), - mSortOrderEditor(NULL), - mEnabledCheck(NULL), - mSetBtn(NULL) -{ - sAllPanels.push_back(this); - std::string pick_def_file; - if (top_pick) +#define XML_PANEL_EDIT_PICK "panel_edit_pick.xml" +#define XML_PANEL_PICK_INFO "panel_pick_info.xml" + +#define XML_NAME "pick_name" +#define XML_DESC "pick_desc" +#define XML_SNAPSHOT "pick_snapshot" +#define XML_LOCATION "pick_location" + + +LLPanelPick::LLPanelPick(BOOL edit_mode/* = FALSE */) +: LLPanel(), LLAvatarPropertiesObserver(), + mEditMode(edit_mode), + mSnapshotCtrl(NULL), + mPickId(LLUUID::null), + mCreatorId(LLUUID::null), + mDataReceived(FALSE) +{ + if (edit_mode) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_top_pick.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_EDIT_PICK); + LLAvatarPropertiesProcessor::instance().addObserver(gAgentID, this); } else { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_pick.xml"); - } -} + LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_PICK_INFO); + } +} LLPanelPick::~LLPanelPick() { - sAllPanels.remove(this); + if (!mCreatorId.isNull()) LLAvatarPropertiesProcessor::instance().removeObserver(mCreatorId, this); } - void LLPanelPick::reset() { - mPickID.setNull(); - mCreatorID.setNull(); - mParcelID.setNull(); - - // Don't request data, this isn't valid - mDataRequested = TRUE; + mPickId.setNull(); + mCreatorId.setNull(); + mParcelId.setNull(); + mDataReceived = FALSE; mPosGlobal.clearVec(); - - clearCtrls(); } - BOOL LLPanelPick::postBuild() { - mSnapshotCtrl = getChild("snapshot_ctrl"); - mSnapshotCtrl->setCommitCallback(onCommitAny); - mSnapshotCtrl->setCallbackUserData(this); - - mNameEditor = getChild("given_name_editor"); - mNameEditor->setCommitOnFocusLost(TRUE); - mNameEditor->setCommitCallback(onCommitAny); - mNameEditor->setCallbackUserData(this); - - mDescEditor = getChild("desc_editor"); - mDescEditor->setCommitOnFocusLost(TRUE); - mDescEditor->setCommitCallback(onCommitAny); - mDescEditor->setCallbackUserData(this); - mDescEditor->setTabsToNextField(TRUE); + mSnapshotCtrl = getChild(XML_SNAPSHOT); - mLocationEditor = getChild("location_editor"); + if (mEditMode) + { + childSetAction("cancel_btn", onClickCancel, this); + childSetAction("set_to_curr_location_btn", onClickSet, this); + childSetAction("save_changes_btn", onClickSave, this); + } + else + { + childSetAction("edit_btn", onClickEdit, this); + childSetAction("teleport_btn", onClickTeleport, this); + childSetAction("show_on_map_btn", onClickMap, this); + childSetAction("back_btn", onClickBack, this); + //*TODO set on menu + } - mSetBtn = getChild( "set_location_btn"); - mSetBtn->setClickedCallback(onClickSet); - mSetBtn->setCallbackUserData(this); + return TRUE; +} - mTeleportBtn = getChild( "pick_teleport_btn"); - mTeleportBtn->setClickedCallback(onClickTeleport); - mTeleportBtn->setCallbackUserData(this); +void LLPanelPick::init(LLUUID creator_id, LLUUID pick_id) +{ + mCreatorId = creator_id; + mPickId = pick_id; - mMapBtn = getChild( "pick_map_btn"); - mMapBtn->setClickedCallback(onClickMap); - mMapBtn->setCallbackUserData(this); + // on Pick Info panel (for non-Agent picks) edit_btn should be invisible + if (!mEditMode) + { + if (mCreatorId != gAgentID) + { + childSetEnabled("edit_btn", FALSE); + childSetVisible("edit_btn", FALSE); + } + else + { + childSetEnabled("edit_btn", TRUE); + childSetVisible("edit_btn", TRUE); + } + } - mSortOrderText = getChild("sort_order_text"); + LLAvatarPropertiesProcessor::instance().addObserver(mCreatorId, this); + LLAvatarPropertiesProcessor::instance().sendDataRequest(mCreatorId, APT_PICK_INFO, &mPickId); +} - mSortOrderEditor = getChild("sort_order_editor"); - mSortOrderEditor->setPrevalidate(LLLineEditor::prevalidateInt); - mSortOrderEditor->setCommitOnFocusLost(TRUE); - mSortOrderEditor->setCommitCallback(onCommitAny); - mSortOrderEditor->setCallbackUserData(this); +void LLPanelPick::init(LLPickData *pick_data) +{ + mPickId = pick_data->pick_id; + mCreatorId = pick_data->creator_id; - mEnabledCheck = getChild( "enabled_check"); - mEnabledCheck->setCommitCallback(onCommitAny); - mEnabledCheck->setCallbackUserData(this); + setName(pick_data->name); + setDesc(pick_data->desc); + setLocation(pick_data->location_text); + mSnapshotCtrl->setImageAssetID(pick_data->snapshot_id); - return TRUE; + mPosGlobal = pick_data->pos_global; + mSimName = pick_data->sim_name; + mParcelId = pick_data->parcel_id; } - // Fill in some reasonable defaults for a new pick. -void LLPanelPick::initNewPick() +void LLPanelPick::createNewPick() { - mPickID.generate(); - - mCreatorID = gAgent.getID(); - + mPickId.generate(); + mCreatorId = gAgent.getID(); mPosGlobal = gAgent.getPositionGlobal(); // Try to fill in the current parcel LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { - mNameEditor->setText(parcel->getName()); - mDescEditor->setText(parcel->getDesc()); + setName(parcel->getName()); + setDesc(parcel->getDesc()); mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID()); } - // Commit to the database, since we've got "new" values. - sendPickInfoUpdate(); + sendUpdate(); } - -void LLPanelPick::setPickID(const LLUUID& pick_id, const LLUUID& creator_id) +/*virtual*/ void LLPanelPick::processProperties(void* data, EAvatarProcessorType type) { - mPickID = pick_id; - mCreatorID = creator_id; -} + if (APT_PICK_INFO != type) return; + if (!data) return; + LLPickData* pick_data = static_cast(data); + if (!pick_data) return; + if (mPickId != pick_data->pick_id) return; -// Schedules the panel to request data -// from the server next time it is drawn. -void LLPanelPick::markForServerRequest() -{ - mDataRequested = FALSE; - mDataReceived = FALSE; + init(pick_data); + mDataReceived = TRUE; + LLAvatarPropertiesProcessor::instance().removeObserver(gAgentID, this); } -std::string LLPanelPick::getPickName() +void LLPanelPick::setEditMode( BOOL edit_mode ) { - return mNameEditor->getText(); -} + if (mEditMode == edit_mode) return; + mEditMode = edit_mode; + if (edit_mode) + { + // preserve data before killing controls + std::string name = getName(); + std::string desc = getDesc(); + std::string location = getLocation(); + LLUUID snapshot_id = mSnapshotCtrl->getImageAssetID(); + LLRect old_rect = getRect(); + + deleteAllChildren(); + + LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_EDIT_PICK); + + //*NOTE this code is from LLPanelMeProfile.togglePanel()... doubt this is a right way to do things + reshape(old_rect.getWidth(), old_rect.getHeight()); + old_rect.setLeftTopAndSize(0, old_rect.getHeight(), old_rect.getWidth(), old_rect.getHeight()); + setRect(old_rect); + + // time to restore data + setName(name); + setDesc(desc); + setLocation(location); + mSnapshotCtrl->setImageAssetID(snapshot_id); + } + else + { + // returning to VIEW mode - need to perform cleanup + // this is the case when that panel is reused between viewing/editing different picks + deleteAllChildren(); + reset(); + LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_PICK_INFO); + } +} -void LLPanelPick::sendPickInfoRequest() +//*HACK need to be redone - control panel toggling from parent (Me Panel/Avatar Profile Panel) +void LLPanelPick::setPanelMeProfile(LLPanelMeProfile* meProfilePanel) { - // Must ask for a pick based on the creator id because - // the pick database is distributed to the inventory cluster. JC - std::vector strings; - strings.push_back( mCreatorID.asString() ); - strings.push_back( mPickID.asString() ); - send_generic_message("pickinforequest", strings); - - mDataRequested = TRUE; + mMeProfilePanel = meProfilePanel; } - -void LLPanelPick::sendPickInfoUpdate() +void LLPanelPick::setName(std::string name) { - // If we don't have a pick id yet, we'll need to generate one, - // otherwise we'll keep overwriting pick_id 00000 in the database. - if (mPickID.isNull()) + if (mEditMode) { - mPickID.generate(); - } - - LLMessageSystem* msg = gMessageSystem; - - msg->newMessage("PickInfoUpdate"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("PickID", mPickID); - msg->addUUID("CreatorID", mCreatorID); - msg->addBOOL("TopPick", mTopPick); - // fills in on simulator if null - msg->addUUID("ParcelID", mParcelID); - msg->addString("Name", mNameEditor->getText()); - msg->addString("Desc", mDescEditor->getText()); - msg->addUUID("SnapshotID", mSnapshotCtrl->getImageAssetID()); - msg->addVector3d("PosGlobal", mPosGlobal); - - // Only top picks have a sort order - S32 sort_order; - if (mTopPick) - { - sort_order = atoi(mSortOrderEditor->getText().c_str()); + childSetValue(XML_NAME, name); } else { - sort_order = 0; + childSetWrappedText(XML_NAME, name); } - msg->addS32("SortOrder", sort_order); - msg->addBOOL("Enabled", mEnabledCheck->get()); - gAgent.sendReliableMessage(); } - -//static -void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **) +void LLPanelPick::setDesc(std::string desc) { - // Extract the agent id and verify the message is for this - // client. - LLUUID agent_id; - msg->getUUID("AgentData", "AgentID", agent_id ); - if (agent_id != gAgent.getID()) - { - llwarns << "Agent ID mismatch in processPickInfoReply" - << llendl; - return; - } - - LLUUID pick_id; - msg->getUUID("Data", "PickID", pick_id); - - LLUUID creator_id; - msg->getUUID("Data", "CreatorID", creator_id); - - BOOL top_pick; - msg->getBOOL("Data", "TopPick", top_pick); - - LLUUID parcel_id; - msg->getUUID("Data", "ParcelID", parcel_id); - - std::string name; - msg->getString("Data", "Name", name); - - std::string desc; - msg->getString("Data", "Desc", desc); - - LLUUID snapshot_id; - msg->getUUID("Data", "SnapshotID", snapshot_id); - - // "Location text" is actually the owner name, the original - // name that owner gave the parcel, and the location. - std::string location_text; - msg->getString("Data", "User", location_text); - location_text.append(", "); - - std::string original_name; - msg->getString("Data", "OriginalName", original_name); - if (!original_name.empty()) + if (mEditMode) { - location_text.append(original_name); - location_text.append(", "); + childSetValue(XML_DESC, desc); } - - std::string sim_name; - msg->getString("Data", "SimName", sim_name); - location_text.append(sim_name); - location_text.append(" "); - - LLVector3d pos_global; - msg->getVector3d("Data", "PosGlobal", pos_global); - - S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS; - S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS; - S32 region_z = llround((F32)pos_global.mdV[VZ]); - - location_text.append(llformat("(%d, %d, %d)", region_x, region_y, region_z)); - - S32 sort_order; - msg->getS32("Data", "SortOrder", sort_order); - - BOOL enabled; - msg->getBOOL("Data", "Enabled", enabled); - - // Look up the panel to fill in - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) + else { - LLPanelPick* self = *iter; - // For top picks, must match pick id - if (self->mPickID != pick_id) - { - continue; - } - - self->mDataReceived = TRUE; - - // Found the panel, now fill in the information - self->mPickID = pick_id; - self->mCreatorID = creator_id; - self->mParcelID = parcel_id; - self->mSimName.assign(sim_name); - self->mPosGlobal = pos_global; - - // Update UI controls - self->mNameEditor->setText(std::string(name)); - self->mDescEditor->setText(std::string(desc)); - self->mSnapshotCtrl->setImageAssetID(snapshot_id); - self->mLocationEditor->setText(location_text); - self->mEnabledCheck->set(enabled); - - self->mSortOrderEditor->setText(llformat("%d", sort_order)); - } + childSetWrappedText(XML_DESC, desc); + } } -void LLPanelPick::draw() +void LLPanelPick::setLocation(std::string location) { - refresh(); - - LLPanel::draw(); + childSetWrappedText(XML_LOCATION, location); } - -void LLPanelPick::refresh() +std::string LLPanelPick::getName() { - if (!mDataRequested) - { - sendPickInfoRequest(); - } - - // Check for god mode - BOOL godlike = gAgent.isGodlike(); - BOOL is_self = (gAgent.getID() == mCreatorID); - - // Set button visibility/enablement appropriately - if (mTopPick) - { - mSnapshotCtrl->setEnabled(godlike); - mNameEditor->setEnabled(godlike); - mDescEditor->setEnabled(godlike); + return childGetValue(XML_NAME).asString(); +} - mSortOrderText->setVisible(godlike); +std::string LLPanelPick::getDesc() +{ + return childGetValue(XML_DESC).asString(); +} - mSortOrderEditor->setVisible(godlike); - mSortOrderEditor->setEnabled(godlike); +std::string LLPanelPick::getLocation() +{ + return childGetValue(XML_LOCATION).asString(); +} - mEnabledCheck->setVisible(godlike); - mEnabledCheck->setEnabled(godlike); +void LLPanelPick::sendUpdate() +{ + LLPickData pick_data; - mSetBtn->setVisible(godlike); - mSetBtn->setEnabled(godlike); - } - else - { - mSnapshotCtrl->setEnabled(is_self); - mNameEditor->setEnabled(is_self); - mDescEditor->setEnabled(is_self); + // If we don't have a pick id yet, we'll need to generate one, + // otherwise we'll keep overwriting pick_id 00000 in the database. + if (mPickId.isNull()) mPickId.generate(); + + pick_data.agent_id = gAgent.getID(); + pick_data.session_id = gAgent.getSessionID(); + pick_data.pick_id = mPickId; + pick_data.creator_id = gAgentID; + + //legacy var need to be deleted + pick_data.top_pick = FALSE; + pick_data.parcel_id = mParcelId; + pick_data.name = getName(); + pick_data.desc = getDesc(); + pick_data.snapshot_id = mSnapshotCtrl->getImageAssetID(); + pick_data.pos_global = mPosGlobal; + pick_data.sort_order = 0; + pick_data.enabled = TRUE; + + LLAvatarPropertiesProcessor::instance().sendDataUpdate(&pick_data, APT_PICK_INFO); +} - mSortOrderText->setVisible(FALSE); - mSortOrderEditor->setVisible(FALSE); - mSortOrderEditor->setEnabled(FALSE); +//----------------------------------------- +// "PICK INFO" (VIEW MODE) BUTTON HANDLERS +//----------------------------------------- - mEnabledCheck->setVisible(FALSE); - mEnabledCheck->setEnabled(FALSE); +//static +void LLPanelPick::onClickEdit(void* data) +{ + LLPanelPick* self = (LLPanelPick*)data; + if (!self) return; + if (self->mEditMode) return; + if (!self->mDataReceived) return; - mSetBtn->setVisible(is_self); - mSetBtn->setEnabled(is_self); - } + self->setEditMode(TRUE); } - -// static +//static void LLPanelPick::onClickTeleport(void* data) { - LLPanelPick* self = (LLPanelPick*)data; - - if (!self->mPosGlobal.isExactlyZero()) - { - gAgent.teleportViaLocation(self->mPosGlobal); - gFloaterWorldMap->trackLocation(self->mPosGlobal); - } + //LLPanelPick* self = (LLPanelPick*)data; + //*TODO implement } - -// static +//static void LLPanelPick::onClickMap(void* data) +{ + //LLPanelPick* self = (LLPanelPick*)data; + //*TODO implement +} + +//*HACK need to move panel toggling to parent panels +//static +void LLPanelPick::onClickBack(void* data) { LLPanelPick* self = (LLPanelPick*)data; - gFloaterWorldMap->trackLocation(self->mPosGlobal); - LLFloaterWorldMap::show(NULL, TRUE); + if (!self) return; + self->mMeProfilePanel->togglePanel(self); } -// static -/* -void LLPanelPick::onClickLandmark(void* data) + + +//----------------------------------------- +// "EDIT PICK" (EDIT MODE) BUTTON HANDLERS +//----------------------------------------- + +//static +void LLPanelPick::onClickCancel(void* data) { - LLPanelPick* self = (LLPanelPick*)data; - create_landmark(self->mNameEditor->getText(), "", self->mPosGlobal); + LLPanelPick* self = (LLPanelPick*) data; + if (!self) return; + if (!self->mEditMode) return; + self->mMeProfilePanel->togglePanel(self); } -*/ // static void LLPanelPick::onClickSet(void* data) { - LLPanelPick* self = (LLPanelPick*)data; + //TODO check whether pick data was received before + + LLPanelPick* self = (LLPanelPick*) data; + if (!self) return; + if (!self->mEditMode) return; // Save location for later. self->mPosGlobal = gAgent.getPositionGlobal(); - std::string location_text; - location_text.assign("(will update after save)"); - location_text.append(", "); - - S32 region_x = llround((F32)self->mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS; - S32 region_y = llround((F32)self->mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_x = llround((F32)self->mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = llround((F32)self->mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS; S32 region_z = llround((F32)self->mPosGlobal.mdV[VZ]); + std::string location_text = "(will update after save), "; location_text.append(self->mSimName); - location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z)); - - // if sim name in pick is different from current sim name - // make sure it's clear that all that's being changed - // is the location and nothing else - if ( gAgent.getRegion ()->getName () != self->mSimName ) - { - LLNotifications::instance().add("SetPickLocation"); - }; - - self->mLocationEditor->setText(location_text); + location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z)); - onCommitAny(NULL, data); + self->setLocation(location_text); } - // static -void LLPanelPick::onCommitAny(LLUICtrl* ctrl, void* data) +void LLPanelPick::onClickSave(void* data) { LLPanelPick* self = (LLPanelPick*)data; + if (!self->mEditMode) return; + if (!self->mDataReceived) return; - // have we received up to date data for this pick? - if (self->mDataReceived) - { - self->sendPickInfoUpdate(); - - // Big hack - assume that top picks are always in a browser, - // and non-top-picks are always in a tab container. - /*if (self->mTopPick) - { - LLPanelDirPicks* panel = (LLPanelDirPicks*)self->getParent(); - panel->renamePick(self->mPickID, self->mNameEditor->getText()); - } - else - {*/ - LLTabContainer* tab = (LLTabContainer*)self->getParent(); - if (tab) - { - if(tab) tab->setCurrentTabName(self->mNameEditor->getText()); - } - //} - } + //*TODO check if data was received before + self->sendUpdate(); + self->mMeProfilePanel->togglePanel(self); } diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h index 450fa78801..8ada1a39fb 100644 --- a/indra/newview/llpanelpick.h +++ b/indra/newview/llpanelpick.h @@ -38,90 +38,78 @@ #define LL_LLPANELPICK_H #include "llpanel.h" -#include "v3dmath.h" -#include "lluuid.h" - -class LLButton; -class LLCheckBoxCtrl; -class LLIconCtrl; -class LLLineEditor; -class LLTextBox; -class LLTextEditor; + class LLTextureCtrl; -class LLUICtrl; class LLMessageSystem; +class LLPanelMeProfile; +class LLAvatarPropertiesObserver; -class LLPanelPick : public LLPanel +class LLPanelPick : public LLPanel, public LLAvatarPropertiesObserver { + LOG_CLASS(LLPanelPick); public: - LLPanelPick(BOOL top_pick); - /*virtual*/ ~LLPanelPick(); + LLPanelPick(BOOL edit_mode = FALSE); + /*virtual*/ ~LLPanelPick(); void reset(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL postBuild(); - /*virtual*/ void draw(); + // Create a new pick, including creating an id, giving a sane + // initial position, etc. + void createNewPick(); - /*virtual*/ void refresh(); + void init(LLUUID creator_id, LLUUID pick_id); - // Setup a new pick, including creating an id, giving a sane - // initial position, etc. - void initNewPick(); + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - // We need to know the creator id so the database knows which partition - // to query for the pick data. - void setPickID(const LLUUID& pick_id, const LLUUID& creator_id); + void setEditMode(BOOL edit_mode); - // Schedules the panel to request data - // from the server next time it is drawn. - void markForServerRequest(); + //TODO redo panel toggling + void setPanelMeProfile(LLPanelMeProfile* meProfilePanel); - std::string getPickName(); - const LLUUID& getPickID() const { return mPickID; } - const LLUUID& getPickCreatorID() const { return mCreatorID; } +protected: - void sendPickInfoRequest(); - void sendPickInfoUpdate(); + void setName(std::string name); + void setDesc(std::string desc); + void setLocation(std::string location); - static void processPickInfoReply(LLMessageSystem* msg, void**); + std::string getName(); + std::string getDesc(); + std::string getLocation(); -protected: - static void onClickTeleport(void* data); - static void onClickMap(void* data); - //static void onClickLandmark(void* data); - static void onClickSet(void* data); + void sendUpdate(); + void init(LLPickData *pick_data); - static void onCommitAny(LLUICtrl* ctrl, void* data); + //----------------------------------------- + // "PICK INFO" (VIEW MODE) BUTTON HANDLERS + //----------------------------------------- + static void onClickEdit(void* data); + static void onClickTeleport(void* data); + static void onClickMap(void* data); + static void onClickBack(void* data); -protected: - BOOL mTopPick; - LLUUID mPickID; - LLUUID mCreatorID; - LLUUID mParcelID; + //----------------------------------------- + // "EDIT PICK" (EDIT MODE) BUTTON HANDLERS + //----------------------------------------- + static void onClickSet(void* data); + static void onClickSave(void* data); + static void onClickCancel(void* data); - // Data will be requested on first draw +protected: + BOOL mEditMode; + LLTextureCtrl* mSnapshotCtrl; BOOL mDataRequested; BOOL mDataReceived; + LLUUID mPickId; + LLUUID mCreatorId; + LLVector3d mPosGlobal; + LLUUID mParcelId; std::string mSimName; - LLVector3d mPosGlobal; - - LLTextureCtrl* mSnapshotCtrl; - LLLineEditor* mNameEditor; - LLTextEditor* mDescEditor; - LLLineEditor* mLocationEditor; - - LLButton* mTeleportBtn; - LLButton* mMapBtn; - - LLTextBox* mSortOrderText; - LLLineEditor* mSortOrderEditor; - LLCheckBoxCtrl* mEnabledCheck; - LLButton* mSetBtn; - typedef std::list panel_list_t; - static panel_list_t sAllPanels; + //TODO redo panel toggling + LLPanelMeProfile* mMeProfilePanel; }; #endif // LL_LLPANELPICK_H diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp new file mode 100644 index 0000000000..1a3aa8a33a --- /dev/null +++ b/indra/newview/llpanelpicks.cpp @@ -0,0 +1,469 @@ +/** + * @file llpanelpicks.cpp + * @brief LLPanelPicks and related class implementations + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llagent.h" +#include "llavatarconstants.h" +#include "lltexturectrl.h" +#include "llviewergenericmessage.h" // send_generic_message +#include "llworldmap.h" +#include "llfloaterworldmap.h" +#include "llpanelmeprofile.h" +#include "llfloaterreg.h" +#include "llpanelpicks.h" +#include "llavatarpropertiesprocessor.h" +#include "llpanelpick.h" + +#define XML_BTN_NEW "new_btn" +#define XML_BTN_DELETE "trash_btn" +#define XML_BTN_INFO "info_btn" + + +//----------------------------------------------------------------------------- +// LLPanelPicks +//----------------------------------------------------------------------------- +LLPanelPicks::LLPanelPicks(const LLUUID& avatar_id /* = LLUUID::null */) +:LLPanelProfileTab(avatar_id), mMeProfilePanel(NULL) +{ + updateData(); +} + +LLPanelPicks::LLPanelPicks(const Params& params) +:LLPanelProfileTab(params), mMeProfilePanel(NULL) +{ + +} + +LLPanelPicks::~LLPanelPicks() +{ + if(!getAvatarId().isNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + } +} + +void* LLPanelPicks::create(void* data /* = NULL */) +{ + LLSD* id = NULL; + if(data) + { + id = static_cast(data); + return new LLPanelPicks(LLUUID(id->asUUID())); + } + return new LLPanelPicks(); +} + +void LLPanelPicks::updateData() +{ + LLAvatarPropertiesProcessor::getInstance()->sendDataRequest(getAvatarId(),APT_PICKS); +} + +void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) +{ + if(APT_PICKS == type) + { + LLAvatarPicks* avatar_picks = static_cast(data); + if(avatar_picks && getAvatarId() == avatar_picks->target_id) + { + std::string name, second_name; + gCacheName->getName(getAvatarId(),name,second_name); + childSetTextArg("pick_title", "[NAME]",name); + + LLView* picks_list = getChild("back_panel",TRUE,FALSE); + if(!picks_list) return; + clear(); + + //*TODO move it somewhere else? + picks_list->setEnabled(FALSE); + childSetEnabled(XML_BTN_NEW, false); + childSetEnabled(XML_BTN_DELETE, false); + childSetEnabled(XML_BTN_INFO, false); + + S32 height = avatar_picks->picks_list.size() * 85; + LLRect rc = picks_list->getRect(); + rc.setLeftTopAndSize(rc.mLeft,rc.mTop,rc.getWidth(),height); + picks_list->setRect(rc); + picks_list->reshape(rc.getWidth(),rc.getHeight()); + + LLAvatarPicks::picks_list_t::const_iterator it = avatar_picks->picks_list.begin(); + for(; avatar_picks->picks_list.end() != it; ++it) + { + LLUUID pick_id = it->first; + std::string pick_name = it->second; + + LLPickItem* picture = LLPickItem::create(); + picks_list->addChild(picture); + + picture->setPictureName(pick_name); + picture->setPictureId(pick_id); + picture->setCreatorId(getAvatarId()); + + S32 last_bottom = picks_list->getRect().getHeight(); + if(mPickItemList.size() > 0) + { + last_bottom = mPickItemList[mPickItemList.size()-1]->getRect().mBottom; + last_bottom -= 5; + } + LLRect rc = picture->getRect(); + rc.mBottom = last_bottom - rc.getHeight(); + rc.mTop = last_bottom; + picture->reshape(rc.getWidth(),rc.getHeight()); + picture->setRect(rc); + + + LLAvatarPropertiesProcessor::instance().addObserver(mAvatarId, picture); + picture->update(); + mPickItemList.push_back(picture); + } + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + + updateButtons(); + picks_list->setEnabled(TRUE); + + } + } +} + +void LLPanelPicks::clear() +{ + LLView* scroll = getChild("back_panel",TRUE,FALSE); + if(scroll) + { + picture_list_t::const_iterator it = mPickItemList.begin(); + for(; mPickItemList.end() != it; ++it) + { + scroll->removeChild(*it); + delete *it; + } + } + mPickItemList.clear(); +} + +BOOL LLPanelPicks::postBuild(void) +{ + childSetAction(XML_BTN_INFO, onClickInfo, this); + childSetAction(XML_BTN_NEW, onClickNew, this); + childSetAction(XML_BTN_DELETE, onClickDelete, this); + + childSetAction("teleport_btn", onClickTeleport, this); + childSetAction("show_on_map_btn", onClickMap, this); + return TRUE; +} + +void LLPanelPicks::onActivate(const LLUUID& id) +{ + BOOL self = (gAgent.getID() == id); + + // only agent can edit her picks + childSetEnabled("edit_panel", self); + childSetVisible("edit_panel", self); + + // and see a special title - set as invisible by default in xml file + if (self) + { + childSetVisible("pick_title", !self); + childSetVisible("pick_title_agent", self); + } + + LLPanelProfileTab::onActivate(id); +} + + +//static +void LLPanelPicks::onClickInfo(void *data) +{ + LLPanelPicks* self = (LLPanelPicks*) data; + if (self) + { + LLPanelPick* panel_pick_info = new LLPanelPick(); + + //*TODO redo, use the selected pick from List View, but not the first (last) one + LLView* scroll = self->getChild("back_panel", TRUE, FALSE); + LLPickItem* pick = static_cast(scroll->getFirstChild()); + if (!pick) return; + + panel_pick_info->init(pick->getCreatorId(), pick->getPickId()); + + //*HACK redo toggling of panels (should work on both "profiles") + if (self->mMeProfilePanel) + { + panel_pick_info->setPanelMeProfile(self->mMeProfilePanel); + //self->mMeProfilePanel->addChildInBack(panel_pick_info); + self->mMeProfilePanel->togglePanel(panel_pick_info); + } + } +} + +//static +void LLPanelPicks::onClickNew(void *data) +{ + LLPanelPicks* self = (LLPanelPicks*) data; + if(self && self->mMeProfilePanel) + { + if (self->mPickItemList.size() >= MAX_AVATAR_PICKS) + { + //*TODO show warning message + return; + } + + //in edit mode + LLPanelPick* panel_edit_pick = new LLPanelPick(TRUE); + panel_edit_pick->createNewPick(); + + //*HACK redo toggling of panels + panel_edit_pick->setPanelMeProfile(self->mMeProfilePanel); + self->mMeProfilePanel->togglePanel(panel_edit_pick); + } +} + +//static +void LLPanelPicks::onClickDelete(void *data) +{ + LLPanelPicks* self = (LLPanelPicks*) data; + if(self && self->mMeProfilePanel) + { + //*TODO redo, use the selected pick from List View, but not the first (last) one + LLView* scroll = self->getChild("back_panel", TRUE, FALSE); + LLPickItem* first_pick = static_cast(scroll->getFirstChild()); + if (!first_pick) return; + + LLSD args; + args["PICK"] = first_pick->getPickName(); + LLNotifications::instance().add("DeleteAvatarPick", args, LLSD(), boost::bind(&LLPanelPicks::callbackDelete, self, _1, _2)); + } +} + +bool LLPanelPicks::callbackDelete(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + //*TODO redo, use the selected pick from List View, but not the first (last) one + LLView* scroll = getChild("back_panel",TRUE,FALSE); + LLPickItem* first_pick = static_cast(scroll->getFirstChild()); + if (!first_pick) return false; + + if (0 == option) + { + LLAvatarPropertiesProcessor::instance().sendPickDelete(first_pick->getPickId()); + + scroll->removeChild(first_pick); + mPickItemList.pop_back(); + first_pick = NULL; + } + updateButtons(); + return false; +} + +void LLPanelPicks::setPanelMeProfile(LLPanelMeProfile* meProfilePanel) +{ + mMeProfilePanel = meProfilePanel; +} + +//static +void LLPanelPicks::teleport(const LLVector3d& position) +{ + if (!position.isExactlyZero()) + { + gAgent.teleportViaLocation(position); + LLFloaterWorldMap::getInstance()->trackLocation(position); + } +} + +//static +void LLPanelPicks::onClickTeleport(void* data) +{ + LLPanelPicks* self = (LLPanelPicks*)data; + + if (!self->mPickItemList.size()) return; + + //*TODO use the selected Pick instead of the last one in the list of Picks + LLPickItem* last_pick = self->mPickItemList.back(); + if (!last_pick) return; + + teleport(last_pick->getPosGlobal()); +} + +//static +void LLPanelPicks::onClickMap(void* data) +{ + LLPanelPicks* self = (LLPanelPicks*)data; + + if (!self->mPickItemList.size()) return; + + //*TODO use the selected Pick instead of the last one in the list of Picks + LLPickItem* last_pick = self->mPickItemList.back(); + if (!last_pick) return; + + showOnMap(last_pick->getPosGlobal()); + +} + +//static +void LLPanelPicks::showOnMap(const LLVector3d& position) +{ + LLFloaterWorldMap::getInstance()->trackLocation(position); + LLFloaterReg::showInstance("world_map", "center"); +} + +void LLPanelPicks::updateButtons() +{ + int picks_num = mPickItemList.size(); + childSetEnabled(XML_BTN_INFO, picks_num > 0); + + if (mAvatarId == gAgentID) + { + childSetEnabled(XML_BTN_NEW, picks_num < MAX_AVATAR_PICKS); + childSetEnabled(XML_BTN_DELETE, picks_num > 0); + } +} + + +//----------------------------------------------------------------------------- +// LLPanelPicks +//----------------------------------------------------------------------------- +LLPickItem::LLPickItem() +: LLPanel() +, mPicID(LLUUID::null) +, mCreatorID(LLUUID::null) +, mParcelID(LLUUID::null) +, mSnapshotID(LLUUID::null) +, mNeedData(true) +{ + LLUICtrlFactory::getInstance()->buildPanel(this,"panel_pic_list_item.xml"); +} + +LLPickItem::~LLPickItem() +{ + if (!mCreatorID.isNull()) + { + LLAvatarPropertiesProcessor::instance().removeObserver(mCreatorID, this); + } + +} + +LLPickItem* LLPickItem::create() +{ + return new LLPickItem(); +} + +void LLPickItem::init(LLPickData* pick_data) +{ + setPictureDescription(pick_data->desc); + setSnapshotId(pick_data->snapshot_id); + mPosGlobal = pick_data->pos_global; + mLocation = pick_data->location_text; + + LLTextureCtrl* picture = getChild("picture", TRUE, FALSE); + if (picture) + { + picture->setImageAssetID(pick_data->snapshot_id); + } +} + +void LLPickItem::setPicture() +{ + +} + +void LLPickItem::setPictureName(const std::string& name) +{ + mPickName = name; + childSetValue("picture_name",name); + +} + +const std::string& LLPickItem::getPickName() +{ + return mPickName; +} + +const LLUUID& LLPickItem::getCreatorId() +{ + return mCreatorID; +} + +const LLUUID& LLPickItem::getSnapshotId() +{ + return mSnapshotID; +} + +void LLPickItem::setPictureDescription(const std::string& descr) +{ + childSetValue("picture_descr",descr); +} + +void LLPickItem::setPictureId(const LLUUID& id) +{ + mPicID = id; +} + +const LLUUID& LLPickItem::getPickId() +{ + return mPicID; +} + +const LLVector3d& LLPickItem::getPosGlobal() +{ + return mPosGlobal; +} + +const std::string& LLPickItem::getLocation() +{ + return mLocation; +} + +const std::string LLPickItem::getDescription() +{ + return childGetValue("picture_descr").asString(); +} + +void LLPickItem::update() +{ + mNeedData = true; + LLAvatarPropertiesProcessor::instance().sendDataRequest(mCreatorID, APT_PICK_INFO, &mPicID); + mNeedData = false; +} + +void LLPickItem::processProperties(void *data, EAvatarProcessorType type) +{ + if (APT_PICK_INFO != type) return; + if (!data) return; + + LLPickData* pick_data = static_cast(data); + if (!pick_data) return; + if (mPicID != pick_data->pick_id) return; + + init(pick_data); + LLAvatarPropertiesProcessor::instance().removeObserver(pick_data->agent_id, this); +} + diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h new file mode 100644 index 0000000000..bb1ee06780 --- /dev/null +++ b/indra/newview/llpanelpicks.h @@ -0,0 +1,153 @@ +/** + * @file llpanelpicks.h + * @brief LLPanelPicks and related class definitions + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELPICKS_H +#define LL_LLPANELPICKS_H + +#include "llpanel.h" +#include "v3dmath.h" +#include "lluuid.h" +#include "llavatarpropertiesprocessor.h" + +class LLMessageSystem; +class LLVector3d; +class LLPanelProfileTab; +class LLPanelMeProfile; +class LLPanelPick; +class LLAgent; +class LLPickItem; + + +class LLPanelPicks + : public LLPanelProfileTab +{ +public: + LLPanelPicks(const LLUUID& avatar_id = LLUUID::null); + LLPanelPicks(const Params& params ); + ~LLPanelPicks(); + + static void* create(void* data); + + static void teleport(const LLVector3d& position); + + static void showOnMap(const LLVector3d& position); + + /*virtual*/ BOOL postBuild(void); + + /*virtual*/ void onActivate(const LLUUID& id); + + void processProperties(void* data, EAvatarProcessorType type); + + void updateData(); + + void setPanelMeProfile(LLPanelMeProfile*); + + void clear(); + + //*TODO implement + //LLPickItem& getSelectedPick(); + +private: + static void onClickInfo(void* data); + static void onClickNew(void* data); + static void onClickDelete(void* data); + static void onClickTeleport(void* data); + static void onClickMap(void* data); + + bool callbackDelete(const LLSD& notification, const LLSD& response); + + void updateButtons(); + + typedef std::vector picture_list_t; + picture_list_t mPickItemList; + LLPanelMeProfile* mMeProfilePanel; + +}; + +class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver +{ +public: + + LLPickItem(); + + static LLPickItem* create(); + + void init(LLPickData* pick_data); + + void setPictureName(const std::string& name); + + void setPictureDescription(const std::string& descr); + + void setPicture(); + + void setPictureId(const LLUUID& id); + + void setCreatorId(const LLUUID& id) {mCreatorID = id;}; + + void setSnapshotId(const LLUUID& id) {mSnapshotID = id;}; + + void setNeedData(bool need){mNeedData = need;}; + + const LLUUID& getPickId(); + + const std::string& getPickName(); + + const LLUUID& getCreatorId(); + + const LLUUID& getSnapshotId(); + + const LLVector3d& getPosGlobal(); + + const std::string& getLocation(); + + const std::string getDescription(); + + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + + void update(); + + ~LLPickItem(); + +protected: + + LLUUID mPicID; + LLUUID mCreatorID; + LLUUID mParcelID; + LLUUID mSnapshotID; + LLVector3d mPosGlobal; + bool mNeedData; + + std::string mPickName; + std::string mLocation; +}; + +#endif // LL_LLPANELPICKS_H diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index 7ca3622634..d4c2f4b6b2 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -36,11 +36,10 @@ #include "llviewercontrol.h" #include "llqueryflags.h" -#include "message.h" #include "llui.h" #include "llsecondlifeurls.h" -#include "llremoteparcelrequest.h" #include "llfloater.h" +#include "llfloaterreg.h" #include "llagent.h" #include "llviewerwindow.h" @@ -51,18 +50,17 @@ #include "lltextbox.h" #include "llviewertexteditor.h" #include "lltexturectrl.h" +#include "lltrans.h" #include "llworldmap.h" #include "llviewerregion.h" +#include "llvoavatarself.h" #include "lluictrlfactory.h" //#include "llviewermenu.h" // create_landmark() #include "llweb.h" #include "llsdutil.h" -//static -std::list LLPanelPlace::sAllPanels; - LLPanelPlace::LLPanelPlace() -: LLPanel(std::string("Places Panel")), +: LLPanel(), mParcelID(), mRequestedID(), mRegionID(), @@ -70,17 +68,16 @@ LLPanelPlace::LLPanelPlace() mPosRegion(), mAuctionID(0), mLandmarkAssetID() -{ - sAllPanels.push_back(this); -} - +{} LLPanelPlace::~LLPanelPlace() { - sAllPanels.remove(this); + if (mParcelID.notNull()) + { + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this); + } } - BOOL LLPanelPlace::postBuild() { // Since this is only used in the directory browser, always @@ -102,20 +99,16 @@ BOOL LLPanelPlace::postBuild() mLocationDisplay = getChild("location_editor"); mTeleportBtn = getChild( "teleport_btn"); - mTeleportBtn->setClickedCallback(onClickTeleport); - mTeleportBtn->setCallbackUserData(this); + mTeleportBtn->setClickedCallback(onClickTeleport, this); mMapBtn = getChild( "map_btn"); - mMapBtn->setClickedCallback(onClickMap); - mMapBtn->setCallbackUserData(this); + mMapBtn->setClickedCallback(onClickMap, this); //mLandmarkBtn = getChild( "landmark_btn"); - //mLandmarkBtn->setClickedCallback(onClickLandmark); - //mLandmarkBtn->setCallbackUserData(this); + //mLandmarkBtn->setClickedCallback(onClickLandmark, this); mAuctionBtn = getChild( "auction_btn"); - mAuctionBtn->setClickedCallback(onClickAuction); - mAuctionBtn->setCallbackUserData(this); + mAuctionBtn->setClickedCallback(onClickAuction, this); // Default to no auction button. We'll show it if we get an auction id mAuctionBtn->setVisible(FALSE); @@ -128,8 +121,11 @@ BOOL LLPanelPlace::postBuild() void LLPanelPlace::displayItemInfo(const LLInventoryItem* pItem) { - mNameEditor->setText(pItem->getName()); - mDescEditor->setText(pItem->getDescription()); + if (pItem) + { + mNameEditor->setText(pItem->getName()); + mDescEditor->setText(pItem->getDescription()); + } } // Use this for search directory clicks, because we are totally @@ -177,6 +173,7 @@ void LLPanelPlace::resetName(const std::string& name) } } +//virtual void LLPanelPlace::setParcelID(const LLUUID& parcel_id) { mParcelID = parcel_id; @@ -188,7 +185,6 @@ void LLPanelPlace::setSnapshot(const LLUUID& snapshot_id) mSnapshotCtrl->setImageAssetID(snapshot_id); } - void LLPanelPlace::setLocationString(const std::string& location) { mLocationDisplay->setText(location); @@ -201,27 +197,22 @@ void LLPanelPlace::setLandTypeString(const std::string& land_type) void LLPanelPlace::sendParcelInfoRequest() { - LLMessageSystem *msg = gMessageSystem; - if (mParcelID != mRequestedID) { - msg->newMessage("ParcelInfoRequest"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("ParcelID", mParcelID); - gAgent.sendReliableMessage(); + LLRemoteParcelInfoProcessor::getInstance()->addObserver(mParcelID, this); + LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(mParcelID); + mRequestedID = mParcelID; } } +//virtual void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason) { // We only really handle 404 and 499 errors std::string error_text; if(status == 404) - { + { error_text = getString("server_error_text"); } else if(status == 499) @@ -231,140 +222,91 @@ void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason) mDescEditor->setText(error_text); } -//static -void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **) +//virtual +void LLPanelPlace::processParcelInfo(const LLParcelData& parcel_data) { - LLUUID agent_id; - LLUUID parcel_id; - LLUUID owner_id; - std::string name; - std::string desc; - S32 actual_area; - S32 billable_area; - U8 flags; - F32 global_x; - F32 global_y; - F32 global_z; - std::string sim_name; - LLUUID snapshot_id; - F32 dwell; - S32 sale_price; - S32 auction_id; - - msg->getUUID("AgentData", "AgentID", agent_id ); - msg->getUUID("Data", "ParcelID", parcel_id); - - // look up all panels which have this avatar - for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) - { - LLPanelPlace* self = *iter; - if (self->mParcelID != parcel_id) - { - continue; - } - - msg->getUUID ("Data", "OwnerID", owner_id); - msg->getString ("Data", "Name", name); - msg->getString ("Data", "Desc", desc); - msg->getS32 ("Data", "ActualArea", actual_area); - msg->getS32 ("Data", "BillableArea", billable_area); - msg->getU8 ("Data", "Flags", flags); - msg->getF32 ("Data", "GlobalX", global_x); - msg->getF32 ("Data", "GlobalY", global_y); - msg->getF32 ("Data", "GlobalZ", global_z); - msg->getString ("Data", "SimName", sim_name); - msg->getUUID ("Data", "SnapshotID", snapshot_id); - msg->getF32 ("Data", "Dwell", dwell); - msg->getS32 ("Data", "SalePrice", sale_price); - msg->getS32 ("Data", "AuctionID", auction_id); - - - self->mAuctionID = auction_id; - - if(snapshot_id.notNull()) - { - self->mSnapshotCtrl->setImageAssetID(snapshot_id); - } - - // Only assign the name and description if they are not empty and there is not a - // value present (passed in from a landmark, e.g.) + mAuctionID = parcel_data.auction_id; - if( !name.empty() - && self->mNameEditor && self->mNameEditor->getText().empty()) - { - self->mNameEditor->setText(name); - } + if(parcel_data.snapshot_id.notNull()) + { + mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id); + } - if( !desc.empty() - && self->mDescEditor && self->mDescEditor->getText().empty()) - { - self->mDescEditor->setText(desc); - } + if( !parcel_data.name.empty() + && mNameEditor && mNameEditor->getText().empty()) + { + mNameEditor->setText(parcel_data.name); + } - std::string info_text; - LLUIString traffic = self->getString("traffic_text"); - traffic.setArg("[TRAFFIC]", llformat("%d ", (int)dwell)); - info_text = traffic; - LLUIString area = self->getString("area_text"); - area.setArg("[AREA]", llformat("%d", actual_area)); - info_text += area; - if (flags & DFQ_FOR_SALE) - { - LLUIString forsale = self->getString("forsale_text"); - forsale.setArg("[PRICE]", llformat("%d", sale_price)); - info_text += forsale; - } - if (auction_id != 0) - { - LLUIString auction = self->getString("auction_text"); - auction.setArg("[ID]", llformat("%010d ", auction_id)); - info_text += auction; - } - if (self->mInfoEditor) - { - self->mInfoEditor->setText(info_text); - } + if( !parcel_data.desc.empty() + && mDescEditor && mDescEditor->getText().empty()) + { + mDescEditor->setText(parcel_data.desc); + } - // HACK: Flag 0x2 == adult region, - // Flag 0x1 == mature region, otherwise assume PG - std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); - if (flags & 0x2) - { - rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT); - } - else if (flags & 0x1) - { - rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); - } + std::string info_text; + LLUIString traffic = getString("traffic_text"); + traffic.setArg("[TRAFFIC]", llformat("%d ", (int)parcel_data.dwell)); + info_text = traffic; + LLUIString area = getString("area_text"); + area.setArg("[AREA]", llformat("%d", parcel_data.actual_area)); + info_text += area; + if (parcel_data.flags & DFQ_FOR_SALE) + { + LLUIString forsale = getString("forsale_text"); + forsale.setArg("[PRICE]", llformat("%d", parcel_data.sale_price)); + info_text += forsale; + } + if (parcel_data.auction_id != 0) + { + LLUIString auction = getString("auction_text"); + auction.setArg("[ID]", llformat("%010d ", parcel_data.auction_id)); + info_text += auction; + } + if (mInfoEditor) + { + mInfoEditor->setText(info_text); + } - // Just use given region position for display - S32 region_x = llround(self->mPosRegion.mV[0]); - S32 region_y = llround(self->mPosRegion.mV[1]); - S32 region_z = llround(self->mPosRegion.mV[2]); + // HACK: Flag 0x2 == adult region, + // Flag 0x1 == mature region, otherwise assume PG + std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); + if (parcel_data.flags & 0x2) + { + rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT); + } + else if (parcel_data.flags & 0x1) + { + rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); + } - // If the region position is zero, grab position from the global - if(self->mPosRegion.isExactlyZero()) - { - region_x = llround(global_x) % REGION_WIDTH_UNITS; - region_y = llround(global_y) % REGION_WIDTH_UNITS; - region_z = llround(global_z); - } + // Just use given region position for display + S32 region_x = llround(mPosRegion.mV[0]); + S32 region_y = llround(mPosRegion.mV[1]); + S32 region_z = llround(mPosRegion.mV[2]); - if(self->mPosGlobal.isExactlyZero()) - { - self->mPosGlobal.setVec(global_x, global_y, global_z); - } + // If the region position is zero, grab position from the global + if(mPosRegion.isExactlyZero()) + { + region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS; + region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS; + region_z = llround(parcel_data.global_z); + } - std::string location = llformat("%s %d, %d, %d (%s)", - sim_name.c_str(), region_x, region_y, region_z, rating.c_str()); - if (self->mLocationDisplay) - { - self->mLocationDisplay->setText(location); - } + if(mPosGlobal.isExactlyZero()) + { + mPosGlobal.setVec(parcel_data.global_x, parcel_data.global_y, parcel_data.global_z); + } - BOOL show_auction = (auction_id > 0); - self->mAuctionBtn->setVisible(show_auction); + std::string location = llformat("%s %d, %d, %d (%s)", + parcel_data.sim_name.c_str(), region_x, region_y, region_z, rating.c_str()); + if (mLocationDisplay) + { + mLocationDisplay->setText(location); } + + BOOL show_auction = (parcel_data.auction_id > 0); + mAuctionBtn->setVisible(show_auction); } @@ -390,7 +332,7 @@ void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region, U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } - LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(this->getHandle())); + LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { @@ -400,7 +342,6 @@ void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region, mSnapshotCtrl->setFallbackImageName("default_land_picture.j2c"); } - // static void LLPanelPlace::onClickTeleport(void* data) { @@ -410,20 +351,20 @@ void LLPanelPlace::onClickTeleport(void* data) LLFloater* parent_floaterp = dynamic_cast(parent_viewp); if (parent_floaterp) { - parent_floaterp->close(); + parent_floaterp->closeFloater(); } // LLFloater* parent_floaterp = (LLFloater*)self->getParent(); parent_viewp->setVisible(false); if(self->mLandmarkAssetID.notNull()) { gAgent.teleportViaLandmark(self->mLandmarkAssetID); - gFloaterWorldMap->trackLandmark(self->mLandmarkAssetID); + LLFloaterWorldMap::getInstance()->trackLandmark(self->mLandmarkAssetID); } else if (!self->mPosGlobal.isExactlyZero()) { gAgent.teleportViaLocation(self->mPosGlobal); - gFloaterWorldMap->trackLocation(self->mPosGlobal); + LLFloaterWorldMap::getInstance()->trackLocation(self->mPosGlobal); } } @@ -433,8 +374,8 @@ void LLPanelPlace::onClickMap(void* data) LLPanelPlace* self = (LLPanelPlace*)data; if (!self->mPosGlobal.isExactlyZero()) { - gFloaterWorldMap->trackLocation(self->mPosGlobal); - LLFloaterWorldMap::show(NULL, TRUE); + LLFloaterWorldMap::getInstance()->trackLocation(self->mPosGlobal); + LLFloaterReg::showInstance("world_map", "center"); } } @@ -453,12 +394,12 @@ void LLPanelPlace::onClickLandmark(void* data) void LLPanelPlace::onClickAuction(void* data) { LLPanelPlace* self = (LLPanelPlace*)data; - LLSD payload; - payload["auction_id"] = self->mAuctionID; + LLSD args; + args["AUCTION_ID"] = self->mAuctionID; - LLNotifications::instance().add("GoToAuctionPage", LLSD(), payload, callbackAuctionWebPage); + LLNotifications::instance().add("GoToAuctionPage", args); } - +/* // static bool LLPanelPlace::callbackAuctionWebPage(const LLSD& notification, const LLSD& response) { @@ -466,8 +407,7 @@ bool LLPanelPlace::callbackAuctionWebPage(const LLSD& notification, const LLSD& if (0 == option) { std::string url; - S32 auction_id = notification["payload"]["auction_id"].asInteger(); - url = AUCTION_URL + llformat("%010d", auction_id ); + url = LLNotifications::instance().getGlobalString("AUCTION_URL") + llformat("%010d", response["auction_id"].asInteger()); llinfos << "Loading auction page " << url << llendl; @@ -475,3 +415,5 @@ bool LLPanelPlace::callbackAuctionWebPage(const LLSD& notification, const LLSD& } return false; } +*/ + diff --git a/indra/newview/llpanelplace.h b/indra/newview/llpanelplace.h index b11290493a..f90a1b0567 100644 --- a/indra/newview/llpanelplace.h +++ b/indra/newview/llpanelplace.h @@ -38,6 +38,8 @@ #include "v3dmath.h" #include "lluuid.h" +#include "llremoteparcelrequest.h" + class LLButton; class LLTextBox; class LLLineEditor; @@ -46,7 +48,7 @@ class LLTextureCtrl; class LLMessageSystem; class LLInventoryItem; -class LLPanelPlace : public LLPanel +class LLPanelPlace : public LLPanel, LLRemoteParcelInfoObserver { public: LLPanelPlace(); @@ -58,7 +60,7 @@ public: // Ignore all old location information, useful if you are // recycling an existing dialog and need to clear it. - void setParcelID(const LLUUID& parcel_id); + /*virtual*/ void setParcelID(const LLUUID& parcel_id); // Sends a request for data about the given parcel, which will // only update the location if there is none already available. @@ -67,7 +69,7 @@ public: void setSnapshot(const LLUUID& snapshot_id); void setLocationString(const std::string& location); void setLandTypeString(const std::string& land_type); - void setErrorStatus(U32 status, const std::string& reason); + /*virtual*/ void setErrorStatus(U32 status, const std::string& reason); void resetName(const std::string& name); void sendParcelInfoRequest(); @@ -75,7 +77,7 @@ public: const LLUUID& landmark_asset_id, const LLUUID& region_id, const LLVector3d& pos_global); - static void processParcelInfoReply(LLMessageSystem* msg, void**); + /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data); LLTextureCtrl *getSnapshotCtrl() const { return mSnapshotCtrl; } @@ -113,9 +115,6 @@ protected: LLButton* mMapBtn; //LLButton* mLandmarkBtn; LLButton* mAuctionBtn; - - typedef std::list panel_list_t; - static panel_list_t sAllPanels; }; #endif // LL_LLPANELPLACE_H diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp new file mode 100644 index 0000000000..3ed93e5598 --- /dev/null +++ b/indra/newview/llpanelplaceinfo.cpp @@ -0,0 +1,382 @@ +/** + * @file llpanelplaceinfo.cpp + * @brief Displays place information in Side Tray. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelplaceinfo.h" + +// *TODO: reorder includes to match the coding standard +#include "llinventory.h" +#include "llviewercontrol.h" +#include "llqueryflags.h" +#include "llui.h" +#include "llsecondlifeurls.h" +#include "llfloater.h" +#include "llfloaterreg.h" + +#include "llagent.h" +#include "llviewerwindow.h" +#include "llviewerinventory.h" +#include "llbutton.h" +#include "llfloaterworldmap.h" +#include "lllineeditor.h" +#include "llinventorymodel.h" +#include "lluiconstants.h" +#include "roles_constants.h" +#include "lltextbox.h" +#include "llviewertexteditor.h" +#include "lltexturectrl.h" +#include "lltrans.h" +#include "llworldmap.h" +#include "llviewerregion.h" +#include "lluictrlfactory.h" +#include "llweb.h" +#include "llsdutil.h" + +static LLRegisterPanelClassWrapper t_places("panel_landmark_info"); + +LLPanelPlaceInfo::LLPanelPlaceInfo() +: LLPanel(), + mParcelID(), + mRequestedID(), + mPosRegion(), + mLandmarkID() +{} + +LLPanelPlaceInfo::~LLPanelPlaceInfo() +{ + if (mParcelID.notNull()) + { + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this); + } +} + +BOOL LLPanelPlaceInfo::postBuild() +{ + // Since this is only used in the directory browser, always + // disable the snapshot control. Otherwise clicking on it will + // open a texture picker. + mSnapshotCtrl = getChild("logo"); + mSnapshotCtrl->setEnabled(FALSE); + + mRegionName = getChild("region_name"); + mParcelName = getChild("parcel_name"); + mDescEditor = getChild("description"); + mRating = getChild("maturity"); + + mOwner = getChild("owner"); + mCreator = getChild("creator"); + mCreated = getChild("created"); + + mTitleEditor = getChild("title_editor"); + mTitleEditor->setCommitCallback(boost::bind(&LLPanelPlaceInfo::onCommitTitleOrNote, this, TITLE)); + + mNotesEditor = getChild("notes_editor"); + mNotesEditor->setCommitCallback(boost::bind(&LLPanelPlaceInfo::onCommitTitleOrNote, this, NOTE)); + mNotesEditor->setCommitOnFocusLost(true); + + mInfoPanel = getChild("info_panel"); + + return TRUE; +} + +void LLPanelPlaceInfo::displayItemInfo(const LLInventoryItem* pItem) +{ + if (!pItem) + return; + + mLandmarkID = pItem->getUUID(); + + if(!gCacheName) + return; + + const LLPermissions& perm = pItem->getPermissions(); + + ////////////////// + // CREATOR NAME // + ////////////////// + if (pItem->getCreatorUUID().notNull()) + { + std::string name; + LLUUID creator_id = pItem->getCreatorUUID(); + if (!gCacheName->getFullName(creator_id, name)) + { + gCacheName->get(creator_id, FALSE, + boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mCreator, _2, _3)); + } + mCreator->setText(name); + } + else + { + mCreator->setText(getString("unknown")); + } + + //////////////// + // OWNER NAME // + //////////////// + if(perm.isOwned()) + { + std::string name; + if (perm.isGroupOwned()) + { + LLUUID group_id = perm.getGroup(); + if (!gCacheName->getGroupName(group_id, name)) + { + gCacheName->get(group_id, TRUE, + boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mOwner, _2, _3)); + } + } + else + { + LLUUID owner_id = perm.getOwner(); + if (!gCacheName->getFullName(owner_id, name)) + { + gCacheName->get(owner_id, FALSE, + boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mOwner, _2, _3)); + } + } + mOwner->setText(name); + } + else + { + mOwner->setText(getString("public")); + } + + ////////////////// + // ACQUIRE DATE // + ////////////////// + time_t time_utc = pItem->getCreationDate(); + if (0 == time_utc) + { + mCreated->setText(getString("unknown")); + } + else + { + std::string timeStr = getString("acquired_date"); + LLSD substitution; + substitution["datetime"] = (S32) time_utc; + LLStringUtil::format (timeStr, substitution); + mCreated->setText(timeStr); + } + + mTitleEditor->setText(pItem->getName()); + mNotesEditor->setText(pItem->getDescription()); +} + +void LLPanelPlaceInfo::nameUpdatedCallback( + LLTextBox* text, + const std::string& first, + const std::string& last) +{ + text->setText(first + " " + last); +} + +void LLPanelPlaceInfo::resetLocation() +{ + mParcelID.setNull(); + mRequestedID.setNull(); + mLandmarkID.setNull(); + mPosRegion.clearVec(); + std::string not_available = getString("not_available"); + mRating->setValue(not_available); + mRegionName->setText(not_available); + mParcelName->setText(not_available); + mDescEditor->setText(not_available); + mCreator->setText(not_available); + mOwner->setText(not_available); + mCreated->setText(not_available); + mTitleEditor->setText(LLStringUtil::null); + mNotesEditor->setText(LLStringUtil::null); +} + +//virtual +void LLPanelPlaceInfo::setParcelID(const LLUUID& parcel_id) +{ + mParcelID = parcel_id; + sendParcelInfoRequest(); +} + +void LLPanelPlaceInfo::sendParcelInfoRequest() +{ + if (mParcelID != mRequestedID) + { + LLRemoteParcelInfoProcessor::getInstance()->addObserver(mParcelID, this); + LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(mParcelID); + + mRequestedID = mParcelID; + } +} + +// virtual +void LLPanelPlaceInfo::setErrorStatus(U32 status, const std::string& reason) +{ + // We only really handle 404 and 499 errors + std::string error_text; + if(status == 404) + { + error_text = getString("server_error_text"); + } + else if(status == 499) + { + error_text = getString("server_forbidden_text"); + } + mDescEditor->setText(error_text); +} + +// virtual +void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data) +{ + if(parcel_data.snapshot_id.notNull()) + { + mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id); + } + + if( !parcel_data.name.empty()) + { + mParcelName->setText(parcel_data.name); + } + + if( !parcel_data.desc.empty()) + { + mDescEditor->setText(parcel_data.desc); + } + + // HACK: Flag 0x2 == adult region, + // Flag 0x1 == mature region, otherwise assume PG + std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG); + std::string rating_icon = "icon_event.tga"; + if (parcel_data.flags & 0x2) + { + rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT); + rating_icon = "icon_event_adult.tga"; + } + else if (parcel_data.flags & 0x1) + { + rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE); + rating_icon = "icon_event_mature.tga"; + } + mRating->setValue(rating_icon); + + // Just use given region position for display + S32 region_x = llround(mPosRegion.mV[0]); + S32 region_y = llround(mPosRegion.mV[1]); + S32 region_z = llround(mPosRegion.mV[2]); + + // If the region position is zero, grab position from the global + if(mPosRegion.isExactlyZero()) + { + region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS; + region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS; + region_z = llround(parcel_data.global_z); + } + + if (!parcel_data.sim_name.empty()) + { + std::string name = llformat("%s (%d, %d, %d)", + parcel_data.sim_name.c_str(), region_x, region_y, region_z); + mRegionName->setText(name); + } +} + +void LLPanelPlaceInfo::displayParcelInfo(const LLVector3& pos_region, + const LLUUID& region_id, + const LLVector3d& pos_global) +{ + LLSD body; + mPosRegion = pos_region; + std::string url = gAgent.getRegion()->getCapability("RemoteParcelRequest"); + if (!url.empty()) + { + body["location"] = ll_sd_from_vector3(pos_region); + if (!region_id.isNull()) + { + body["region_id"] = region_id; + } + if (!pos_global.isExactlyZero()) + { + U64 region_handle = to_region_handle(pos_global); + body["region_handle"] = ll_sd_from_U64(region_handle); + } + LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); + } + else + { + mDescEditor->setText(getString("server_update_text")); + } + mSnapshotCtrl->setImageAssetID(LLUUID::null); + mSnapshotCtrl->setFallbackImageName("default_land_picture.j2c"); +} + +void LLPanelPlaceInfo::onCommitTitleOrNote(LANDMARK_INFO_TYPE type) +{ + LLInventoryItem* item = gInventory.getItem(mLandmarkID); + if (!item) + return; + + std::string current_value; + std::string item_value; + if (type == TITLE) + { + if (mTitleEditor) + { + current_value = mTitleEditor->getText(); + item_value = item->getName(); + } + } + else + { + if (mNotesEditor) + { + current_value = mNotesEditor->getText(); + item_value = item->getDescription(); + } + } + + if (item_value != current_value && + gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) + { + LLPointer new_item = new LLViewerInventoryItem(item); + + if (type == TITLE) + { + new_item->rename(current_value); + } + else + { + new_item->setDescription(current_value); + } + + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } +} diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h new file mode 100644 index 0000000000..f88e29bc91 --- /dev/null +++ b/indra/newview/llpanelplaceinfo.h @@ -0,0 +1,109 @@ +/** + * @file llpanelplace.h + * @brief Displays place information in Side Tray. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELPLACEINFO_H +#define LL_LLPANELPLACEINFO_H + +#include "llpanel.h" + +#include "v3dmath.h" +#include "lluuid.h" + +#include "lliconctrl.h" + +#include "llremoteparcelrequest.h" + +class LLButton; +class LLTextBox; +class LLLineEditor; +class LLTextEditor; +class LLTextureCtrl; +class LLInventoryItem; + +class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver +{ +public: + LLPanelPlaceInfo(); + /*virtual*/ ~LLPanelPlaceInfo(); + + /*virtual*/ BOOL postBuild(); + + void resetLocation(); + // Ignore all old location information, useful if you are + // recycling an existing dialog and need to clear it. + + /*virtual*/ void setParcelID(const LLUUID& parcel_id); + // Sends a request for data about the given parcel, which will + // only update the location if there is none already available. + + void displayItemInfo(const LLInventoryItem* pItem); + /*virtual*/ void setErrorStatus(U32 status, const std::string& reason); + + void sendParcelInfoRequest(); + void displayParcelInfo(const LLVector3& pos_region, + const LLUUID& region_id, + const LLVector3d& pos_global); + void nameUpdatedCallback(LLTextBox* text, + const std::string& first, + const std::string& last); + + /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data); + +private: + enum LANDMARK_INFO_TYPE + { + TITLE, + NOTE + }; + + void onCommitTitleOrNote(LANDMARK_INFO_TYPE type); + + LLUUID mParcelID; + LLUUID mRequestedID; + LLUUID mLandmarkID; + LLVector3 mPosRegion; + + LLTextureCtrl* mSnapshotCtrl; + LLTextBox* mRegionName; + LLTextBox* mParcelName; + LLTextEditor* mDescEditor; + LLIconCtrl* mRating; + LLTextBox* mOwner; + LLTextBox* mCreator; + LLTextBox* mCreated; + LLLineEditor* mTitleEditor; + LLTextEditor* mNotesEditor; + LLTextBox* mLocationEditor; + LLPanel* mInfoPanel; +}; + +#endif // LL_LLPANELPLACEINFO_H diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp new file mode 100644 index 0000000000..d18cac9f42 --- /dev/null +++ b/indra/newview/llpanelplaces.cpp @@ -0,0 +1,293 @@ +/** + * @file llpanelplaces.cpp + * @brief Side Bar "Places" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" +#include "llsearcheditor.h" +#include "lltabcontainer.h" +#include "lluictrlfactory.h" + +#include "lllandmark.h" + +#include "llagent.h" +#include "lllandmarklist.h" +#include "llfloaterworldmap.h" +#include "llpanelplaces.h" +#include "llpanellandmarks.h" +#include "llpanelteleporthistory.h" +#include "llviewerregion.h" + +static LLRegisterPanelClassWrapper t_places("panel_places"); + +LLPanelPlaces::LLPanelPlaces() + : LLPanel(), + mFilterSubString(LLStringUtil::null), + mActivePanel(NULL), + mSearchEditor(NULL), + mPlaceInfo(NULL) +{ + gInventory.addObserver(this); + + //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() +} + +LLPanelPlaces::~LLPanelPlaces() +{ + if (gInventory.containsObserver(this)) + gInventory.removeObserver(this); +} + +BOOL LLPanelPlaces::postBuild() +{ + mTabContainer = getChild("Places Tabs"); + if (mTabContainer) + { + mTabContainer->setCommitCallback(boost::bind(&LLPanelPlaces::onTabSelected, this)); + } + + mSearchEditor = getChild("Filter"); + if (mSearchEditor) + { + mSearchEditor->setSearchCallback(boost::bind(&LLPanelPlaces::onSearchEdit, this, _1)); + } + + mPlaceInfo = dynamic_cast(getChild("panel_landmark_info")); + if (mPlaceInfo) + { + LLButton* back_btn = mPlaceInfo->getChild("back_btn"); + if (back_btn) + { + back_btn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this)); + } + } + + //childSetAction("share_btn", boost::bind(&LLPanelPlaces::onShareButtonClicked, this), this); + childSetAction("teleport_btn", boost::bind(&LLPanelPlaces::onTeleportButtonClicked, this), this); + childSetAction("map_btn", boost::bind(&LLPanelPlaces::onShowOnMapButtonClicked, this), this); + + return TRUE; +} + +void LLPanelPlaces::draw() +{ + LLPanel::draw(); +} + +void LLPanelPlaces::onOpen(const LLSD& key) +{ + if(key.size() == 0) + return; + + togglePlaceInfoPanel(TRUE); + + mPlaceInfoType = key["type"].asInteger(); + + if (mPlaceInfoType == AGENT) + { + // We don't need to teleport to the current location so disable the button + getChild("teleport_btn")->setEnabled(FALSE); + + mPlaceInfo->displayParcelInfo(gAgent.getPositionAgent(), + gAgent.getRegion()->getRegionID(), + gAgent.getPositionGlobal()); + } + else if (mPlaceInfoType == LANDMARK) + { + LLInventoryItem* item = gInventory.getItem(key["id"].asUUID()); + if (!item) + return; + + mPlaceInfo->displayItemInfo(item); + + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID()); + if (!landmark) + return; + + LLUUID region_id; + landmark->getRegionID(region_id); + LLVector3d pos_global; + landmark->getGlobalPos(pos_global); + mPlaceInfo->displayParcelInfo(landmark->getRegionPos(), + region_id, + pos_global); + + } + else if (mPlaceInfoType == TELEPORT_HISTORY) + { + S32 index = key["id"].asInteger(); + + const LLTeleportHistory::slurl_list_t& hist_items = + LLTeleportHistory::getInstance()->getItems(); + + LLVector3d pos_global = hist_items[index].mGlobalPos; + + F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); + F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); + + LLVector3 pos_local(region_x, region_y, (F32)pos_global.mdV[VZ]); + + mPlaceInfo->displayParcelInfo(pos_local, + hist_items[index].mRegionID, + pos_global); + } +} + +void LLPanelPlaces::onSearchEdit(const std::string& search_string) +{ + if (mFilterSubString != search_string) + { + mFilterSubString = search_string; + + LLStringUtil::toUpper(mFilterSubString); + LLStringUtil::trimHead(mFilterSubString); + + mSearchEditor->setText(mFilterSubString); + + mActivePanel->onSearchEdit(mFilterSubString); + } +} + +void LLPanelPlaces::onTabSelected() +{ + if (!mActivePanel) + return; + + mActivePanel = dynamic_cast(mTabContainer->getCurrentPanel()); + + if (mActivePanel) + { + mActivePanel->onSearchEdit(mFilterSubString); + mActivePanel->onTabSelected(); + } +} + +void LLPanelPlaces::onShareButtonClicked() +{ + // TODO: Launch the "Things" Share wizard +} + +/* +void LLPanelPlaces::onAddLandmarkButtonClicked() +{ + LLFloaterReg::showInstance("add_landmark"); +} + +void LLPanelPlaces::onCopySLURLButtonClicked() +{ + mActivePanel->onCopySLURL(); +} +*/ + +void LLPanelPlaces::onTeleportButtonClicked() +{ + mActivePanel->onTeleport(); +} + +void LLPanelPlaces::onShowOnMapButtonClicked() +{ + if (!mPlaceInfoType) + { + LLVector3d global_pos = gAgent.getPositionGlobal(); + if (!global_pos.isExactlyZero()) + { + LLFloaterWorldMap::getInstance()->trackLocation(global_pos); + LLFloaterReg::showInstance("world_map", "center"); + } + } + else + { + mActivePanel->onShowOnMap(); + } +} + +void LLPanelPlaces::onBackButtonClicked() +{ + togglePlaceInfoPanel(FALSE); +} + +void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) +{ + if (!mPlaceInfo) + return; + + mPlaceInfo->setVisible(visible); + mSearchEditor->setVisible(!visible); + mTabContainer->setVisible(!visible); + + if (visible) + { + mPlaceInfo->resetLocation(); + + LLRect rect = getRect(); + LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom); + mPlaceInfo->reshape(new_rect.getWidth(),new_rect.getHeight()); + } +} + +//virtual +void LLPanelPlaces::changed(U32 mask) +{ + if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance())) + return; + + LLLandmarksPanel* landmarks_panel = new LLLandmarksPanel(); + if (landmarks_panel) + { + landmarks_panel->setPanelPlacesButtons(this); + + mTabContainer->addTabPanel( + LLTabContainer::TabPanelParams(). + panel(landmarks_panel). + label("Landmarks"). + insert_at(LLTabContainer::END)); + } + + LLTeleportHistoryPanel* teleport_history_panel = new LLTeleportHistoryPanel(); + if (teleport_history_panel) + { + teleport_history_panel->setPanelPlacesButtons(this); + + mTabContainer->addTabPanel( + LLTabContainer::TabPanelParams(). + panel(teleport_history_panel). + label("Teleport History"). + insert_at(LLTabContainer::END)); + } + + mTabContainer->selectFirstTab(); + + mActivePanel = dynamic_cast(mTabContainer->getCurrentPanel()); + + // we don't need to monitor inventory changes anymore, + // so remove the observer + gInventory.removeObserver(this); +} diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h new file mode 100644 index 0000000000..533fb8dd82 --- /dev/null +++ b/indra/newview/llpanelplaces.h @@ -0,0 +1,85 @@ +/** + * @file llpanelplaces.h + * @brief Side Bar "Places" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELPLACES_H +#define LL_LLPANELPLACES_H + +#include "llpanel.h" + +#include "llinventory.h" + +#include "llinventorymodel.h" +#include "llpanelplaceinfo.h" + +class LLPanelPlacesTab; +class LLSearchEditor; +class LLTabContainer; + +class LLPanelPlaces : public LLPanel, LLInventoryObserver +{ +public: + enum PLACE_INFO_TYPE + { + AGENT, + LANDMARK, + TELEPORT_HISTORY + }; + + LLPanelPlaces(); + virtual ~LLPanelPlaces(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + /*virtual*/ void changed(U32 mask); + /*virtual*/ void onOpen(const LLSD& key); + + void onSearchEdit(const std::string& search_string); + void onTabSelected(); + //void onAddLandmarkButtonClicked(); + //void onCopySLURLButtonClicked(); + void onShareButtonClicked(); + void onTeleportButtonClicked(); + void onShowOnMapButtonClicked(); + void onBackButtonClicked(); + void togglePlaceInfoPanel(BOOL visible); + +private: + LLSearchEditor* mSearchEditor; + LLPanelPlacesTab* mActivePanel; + LLTabContainer* mTabContainer; + LLPanelPlaceInfo* mPlaceInfo; + std::string mFilterSubString; + + // Place information type currently shown in Information panel + S32 mPlaceInfoType; +}; + +#endif //LL_LLPANELPLACES_H diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp new file mode 100644 index 0000000000..2b38aa0890 --- /dev/null +++ b/indra/newview/llpanelplacestab.cpp @@ -0,0 +1,98 @@ +/** + * @file llpanelplacestab.cpp + * @brief Tabs interface for Side Bar "Places" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llwindow.h" + +#include "llnotifications.h" + +#include "llslurl.h" +#include "llpanelplacestab.h" +#include "llworldmap.h" + +void LLPanelPlacesTab::setPanelPlacesButtons(LLPanelPlaces* panel) +{ + //mShareBtn = panel->getChild("share_btn"); + mTeleportBtn = panel->getChild("teleport_btn"); + mShowOnMapBtn = panel->getChild("map_btn"); +} + +void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos, + U64 region_handle, + const std::string& url, + const LLUUID& snapshot_id, + bool teleport) +{ + std::string sim_name; + bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( landmark_global_pos, sim_name ); + + std::string sl_url; + if ( gotSimName ) + { + F32 region_x = (F32)fmod( landmark_global_pos.mdV[VX], (F64)REGION_WIDTH_METERS ); + F32 region_y = (F32)fmod( landmark_global_pos.mdV[VY], (F64)REGION_WIDTH_METERS ); + + sl_url = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)landmark_global_pos.mdV[VZ])); + } + else + { + sl_url = ""; + } + + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(sl_url)); + + LLSD args; + args["SLURL"] = sl_url; + + LLNotifications::instance().add("CopySLURL", args); +} + +void LLPanelPlacesTab::onTabSelected() +{ + togglePanelPlacesButtons(TRUE); +} + +void LLPanelPlacesTab::togglePanelPlacesButtons(BOOL enabled) +{ + if (enabled) + { + //mShareBtn->setEnabled(TRUE); + mTeleportBtn->setEnabled(TRUE); + mShowOnMapBtn->setEnabled(TRUE); + } + else + { + //mShareBtn->setEnabled(FALSE); + mTeleportBtn->setEnabled(FALSE); + mShowOnMapBtn->setEnabled(FALSE); + } +} diff --git a/indra/newview/llpanelplacestab.h b/indra/newview/llpanelplacestab.h new file mode 100644 index 0000000000..5d6b7d1090 --- /dev/null +++ b/indra/newview/llpanelplacestab.h @@ -0,0 +1,68 @@ +/** + * @file llpanelplacestab.h + * @brief Tabs interface for Side Bar "Places" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELPLACESTAB_H +#define LL_LLPANELPLACESTAB_H + +#include "llpanel.h" + +#include "llpanelplaces.h" + +class LLPanelPlacesTab : public LLPanel +{ +public: + LLPanelPlacesTab() : LLPanel() {} + virtual ~LLPanelPlacesTab() {} + + virtual void onSearchEdit(const std::string& string) = 0; + //virtual void onShare() = 0; + virtual void onShowOnMap() = 0; + virtual void onTeleport() = 0; + //virtual void onCopySLURL() = 0; + + void setPanelPlacesButtons(LLPanelPlaces* panel); + void onRegionResponse(const LLVector3d& landmark_global_pos, + U64 region_handle, + const std::string& url, + const LLUUID& snapshot_id, + bool teleport); + void onTabSelected(); + +protected: + void togglePanelPlacesButtons(BOOL enabled); + +private: + //LLButton* mShareBtn; + LLButton* mTeleportBtn; + LLButton* mShowOnMapBtn; +}; + +#endif //LL_LLPANELPLACESTAB_H diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp new file mode 100644 index 0000000000..457397a379 --- /dev/null +++ b/indra/newview/llpanelprofileview.cpp @@ -0,0 +1,112 @@ +/** +* @file llpanelprofileview.cpp +* @brief Side tray "Profile View" panel +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llpanelprofileview.h" +#include +#include +#include +#include "llpanelavatar.h" +#include "llpanelpicks.h" + +static LLRegisterPanelClassWrapper t_panel_target_profile("panel_profile_view"); +static LLRegisterPanelClassWrapper t_panel_notes("panel_notes"); + +static std::string PANEL_PROFILE = "panel_profile"; +static std::string PANEL_PICKS = "panel_picks"; +static std::string PANEL_NOTES = "panel_notes"; + +LLPanelProfileView::LLPanelProfileView(const LLPanel::Params& p) +: LLPanel(p) +{ +} + +LLPanelProfileView::~LLPanelProfileView(void) +{ +} + +/*virtual*/ +void LLPanelProfileView::onOpen(const LLSD& key) +{ + if (!getVisible()) + setVisible(TRUE); + + LLUUID id(key.asUUID()); + if(id.notNull() && mProfileId.notNull() && mProfileId != id) + { + mTabs[PANEL_PROFILE]->clear(); + mTabs[PANEL_PICKS]->clear(); + mTabs[PANEL_NOTES]->clear(); + } + + mProfileId = id; + mTabs[PANEL_PROFILE]->onOpen(mProfileId); + mTabs[PANEL_PICKS]->setAvatarId(mProfileId); + mTabs[PANEL_PICKS]->updateData(); + mTabs[PANEL_NOTES]->setAvatarId(mProfileId); + mTabs[PANEL_NOTES]->updateData(); + + std::string full_name; + gCacheName->getFullName(key,full_name); + childSetValue("user_name",full_name); +} + + +BOOL LLPanelProfileView::postBuild() +{ + mTabContainer = getChild("profile_tabs"); + mTabContainer->setCommitCallback(boost::bind(&LLPanelProfileView::onTabSelected, this, _2)); + + mTabs[PANEL_PROFILE] = (getChild(PANEL_PROFILE)); + mTabs[PANEL_PICKS] = (getChild(PANEL_PICKS)); + mTabs[PANEL_NOTES] = (getChild(PANEL_NOTES)); + + childSetCommitCallback("back",boost::bind(&LLPanelProfileView::onBackBtnClick,this),NULL); + + return TRUE; +} + + +//private + +void LLPanelProfileView::initTabs(const LLSD& key) +{ +} + +void LLPanelProfileView::onTabSelected(const LLSD& param) +{ +} + +void LLPanelProfileView::onBackBtnClick() +{ + setVisible(FALSE); +} diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h new file mode 100644 index 0000000000..4d81704522 --- /dev/null +++ b/indra/newview/llpanelprofileview.h @@ -0,0 +1,69 @@ +/** +* @file llpanelprofileview.h +* @brief Side tray "Profile View" panel +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#ifndef LL_LLPANELPROFILEVIEW_H +#define LL_LLPANELPROFILEVIEW_H + +#include + +class LLPanelProfileTab; +class LLTabContainer; + +class LLPanelProfileView : public LLPanel +{ + LOG_CLASS(LLPanelProfileView); + friend class LLUICtrlFactory; + +public: + LLPanelProfileView(const LLPanel::Params& p = defaultParams()); + + ~LLPanelProfileView(void); + + void onTabSelected(const LLSD& param); + + void onOpen(const LLSD& key); + + BOOL postBuild(); + + void initTabs(const LLSD& key); + + void onBackBtnClick(); + +private: + LLTabContainer* mTabContainer; + + typedef std::map profile_tabs_t; + profile_tabs_t mTabs; + LLUUID mProfileId; +}; + +#endif //LL_LLPANELPROFILEVIEW_H diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp new file mode 100644 index 0000000000..22e8ada2ea --- /dev/null +++ b/indra/newview/llpanelteleporthistory.cpp @@ -0,0 +1,218 @@ +/** + * @file llpanelteleporthistory.cpp + * @brief Teleport history represented by a scrolling list + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" + +#include "llfloaterworldmap.h" +#include "llpanelteleporthistory.h" +#include "llsidetray.h" +#include "llworldmap.h" + +// Not yet implemented; need to remove buildPanel() from constructor when we switch +//static LLRegisterPanelClassWrapper t_teleport_history("panel_teleport_history"); + +LLTeleportHistoryPanel::LLTeleportHistoryPanel() + : LLPanelPlacesTab(), + mFilterSubString(LLStringUtil::null), + mTeleportHistory(NULL), + mHistoryItems(NULL) +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml"); +} + +LLTeleportHistoryPanel::~LLTeleportHistoryPanel() +{ +} + +BOOL LLTeleportHistoryPanel::postBuild() +{ + mTeleportHistory = LLTeleportHistory::getInstance(); + if (mTeleportHistory) + { + mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::showTeleportHistory, this)); + } + + mHistoryItems = getChild("history_items"); + if (mHistoryItems) + { + mHistoryItems->setDoubleClickCallback(onDoubleClickItem, this); + mHistoryItems->setCommitOnSelectionChange(FALSE); + mHistoryItems->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, _2)); + } + + return TRUE; +} + +// virtual +void LLTeleportHistoryPanel::onSearchEdit(const std::string& string) +{ + if (mFilterSubString != string) + { + mFilterSubString = string; + showTeleportHistory(); + } +} + +// virtual +void LLTeleportHistoryPanel::onShowOnMap() +{ + LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); + if(!itemp) + return; + + S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); + + const LLTeleportHistory::slurl_list_t& hist_items = mTeleportHistory->getItems(); + + LLVector3d global_pos = hist_items[index].mGlobalPos; + + if (!global_pos.isExactlyZero()) + { + LLFloaterWorldMap::getInstance()->trackLocation(global_pos); + LLFloaterReg::showInstance("world_map", "center"); + } +} + +// virtual +void LLTeleportHistoryPanel::onTeleport() +{ + LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); + if(!itemp) + return; + + S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); + + mTeleportHistory->goToItem(index); +} + +/* +// virtual +void LLTeleportHistoryPanel::onCopySLURL() +{ + LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); + if(!itemp) + return; + + S32 index = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); + + const LLTeleportHistory::slurl_list_t& hist_items = mTeleportHistory->getItems(); + + LLVector3d global_pos = hist_items[index].mGlobalPos; + + U64 new_region_handle = to_region_handle(global_pos); + + LLWorldMap::url_callback_t cb = boost::bind( + &LLPanelPlacesTab::onRegionResponse, this, + global_pos, _1, _2, _3, _4); + + LLWorldMap::getInstance()->sendHandleRegionRequest(new_region_handle, cb, std::string("unused"), false); +} +*/ + +void LLTeleportHistoryPanel::showTeleportHistory() +{ + const LLTeleportHistory::slurl_list_t& hist_items = mTeleportHistory->getItems(); + + mHistoryItems->deleteAllItems(); + + S32 cur_item = mTeleportHistory->getCurrentItemIndex(); + + for (LLTeleportHistory::slurl_list_t::const_iterator iter = hist_items.begin(); + iter != hist_items.end(); ++iter) + { + std::string landmark_title = (*iter).mTitle; + LLStringUtil::toUpper(landmark_title); + + std::string::size_type match_offset = mFilterSubString.size() ? landmark_title.find(mFilterSubString) : std::string::npos; + bool passed = mFilterSubString.size() == 0 || match_offset != std::string::npos; + + if (!passed) + continue; + + S32 index = iter - hist_items.begin(); + + LLSD row; + row["id"] = index; + + LLSD& icon_column = row["columns"][LIST_ICON]; + icon_column["column"] = "landmark_icon"; + icon_column["type"] = "icon"; + icon_column["value"] = "inv_item_landmark.tga"; + + LLSD& region_column = row["columns"][LIST_ITEM_TITLE]; + region_column["column"] = "region"; + region_column["type"] = "text"; + region_column["value"] = (*iter).mTitle; + + LLSD& index_column = row["columns"][LIST_INDEX]; + index_column["column"] = "index"; + index_column["type"] = "text"; + index_column["value"] = index; + + mHistoryItems->addElement(row); + + if (cur_item == index) + { + LLScrollListItem* itemp = mHistoryItems->getItem(index); + ((LLScrollListText*)itemp->getColumn(LIST_ITEM_TITLE))->setFontStyle(LLFontGL::BOLD); + } + } + + togglePanelPlacesButtons(mHistoryItems->getFirstSelected() != NULL); +} + +void LLTeleportHistoryPanel::handleItemSelect(const LLSD& data) +{ + LLScrollListItem* itemp = mHistoryItems->getFirstSelected(); + + if (!itemp) + return; + + togglePanelPlacesButtons(TRUE); +} + +//static +void LLTeleportHistoryPanel::onDoubleClickItem(void* user_data) +{ + LLTeleportHistoryPanel* self = (LLTeleportHistoryPanel*)user_data; + + LLScrollListItem* itemp = self->mHistoryItems->getFirstSelected(); + if(!itemp) + return; + + LLSD key; + key["type"] = LLPanelPlaces::TELEPORT_HISTORY; + key["id"] = itemp->getColumn(LIST_INDEX)->getValue().asInteger(); + + LLSideTray::getInstance()->showPanel("panel_places", key); +} diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h new file mode 100644 index 0000000000..6f41c97eec --- /dev/null +++ b/indra/newview/llpanelteleporthistory.h @@ -0,0 +1,72 @@ +/** + * @file llpanelteleporthistory.h + * @brief Teleport history represented by a scrolling list + * class definition + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELTELEPORTHISTORY_H +#define LL_LLPANELTELEPORTHISTORY_H + +#include "lluictrlfactory.h" +#include "llscrolllistctrl.h" + +#include "llpanelplacestab.h" +#include "llteleporthistory.h" + +class LLTeleportHistoryPanel : public LLPanelPlacesTab +{ +public: + LLTeleportHistoryPanel(); + virtual ~LLTeleportHistoryPanel(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onSearchEdit(const std::string& string); + /*virtual*/ void onShowOnMap(); + /*virtual*/ void onTeleport(); + ///*virtual*/ void onCopySLURL(); + + void showTeleportHistory(); + void handleItemSelect(const LLSD& data); + + static void onDoubleClickItem(void* user_data); + +private: + enum TELEPORT_HISTORY_COLUMN_ORDER + { + LIST_ICON, + LIST_ITEM_TITLE, + LIST_INDEX + }; + + LLTeleportHistory* mTeleportHistory; + LLScrollListCtrl* mHistoryItems; + std::string mFilterSubString; +}; + +#endif //LL_LLPANELTELEPORTHISTORY_H diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 6d014a23de..1e44a294b0 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -107,8 +107,8 @@ BOOL LLPanelVolume::postBuild() childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this); LLColorSwatchCtrl* LightColorSwatch = getChild("colorswatch"); if(LightColorSwatch){ - LightColorSwatch->setOnCancelCallback(onLightCancelColor); - LightColorSwatch->setOnSelectCallback(onLightSelectColor); + LightColorSwatch->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelColor, this, _2)); + LightColorSwatch->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectColor, this, _2)); childSetCommitCallback("colorswatch",onCommitLight,this); } childSetCommitCallback("Light Intensity",onCommitLight,this); @@ -125,8 +125,8 @@ BOOL LLPanelVolume::postBuild() return TRUE; } -LLPanelVolume::LLPanelVolume(const std::string& name) - : LLPanel(name) +LLPanelVolume::LLPanelVolume() + : LLPanel() { setMouseOpaque(FALSE); @@ -317,7 +317,7 @@ void LLPanelVolume::getState( ) } // static -BOOL LLPanelVolume::precommitValidate( LLUICtrl* ctrl, void* userdata ) +bool LLPanelVolume::precommitValidate( const LLSD& data ) { // TODO: Richard will fill this in later. return TRUE; // FALSE means that validation failed and new value should not be commited. @@ -427,21 +427,19 @@ void LLPanelVolume::sendIsFlexible() llinfos << "update flexible sent" << llendl; } -void LLPanelVolume::onLightCancelColor(LLUICtrl* ctrl, void* userdata) +void LLPanelVolume::onLightCancelColor(const LLSD& data) { - LLPanelVolume* self = (LLPanelVolume*) userdata; - LLColorSwatchCtrl* LightColorSwatch = self->getChild("colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = getChild("colorswatch"); if(LightColorSwatch) { - LightColorSwatch->setColor(self->mLightSavedColor); + LightColorSwatch->setColor(mLightSavedColor); } - onLightSelectColor(NULL, userdata); + onLightSelectColor(data); } -void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) +void LLPanelVolume::onLightSelectColor(const LLSD& data) { - LLPanelVolume* self = (LLPanelVolume*) userdata; - LLViewerObject* objectp = self->mObject; + LLViewerObject* objectp = mObject; if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) { return; @@ -449,13 +447,13 @@ void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) LLVOVolume *volobjp = (LLVOVolume *)objectp; - LLColorSwatchCtrl* LightColorSwatch = self->getChild("colorswatch"); + LLColorSwatchCtrl* LightColorSwatch = getChild("colorswatch"); if(LightColorSwatch) { LLColor4 clr = LightColorSwatch->get(); LLColor3 clr3( clr ); volobjp->setLightColor(clr3); - self->mLightSavedColor = clr; + mLightSavedColor = clr; } } diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 841880b147..f285141bbe 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -35,7 +35,7 @@ #include "v3math.h" #include "llpanel.h" -#include "llmemory.h" +#include "llpointer.h" #include "llvolume.h" class LLSpinCtrl; @@ -51,7 +51,7 @@ class LLColorSwatchCtrl; class LLPanelVolume : public LLPanel { public: - LLPanelVolume(const std::string& name); + LLPanelVolume(); virtual ~LLPanelVolume(); virtual void draw(); @@ -64,15 +64,15 @@ public: void sendIsLight(); void sendIsFlexible(); - static BOOL precommitValidate(LLUICtrl* ctrl,void* userdata); + static bool precommitValidate(const LLSD& data); static void onCommitIsLight( LLUICtrl* ctrl, void* userdata); static void onCommitLight( LLUICtrl* ctrl, void* userdata); static void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata); static void onCommitFlexible( LLUICtrl* ctrl, void* userdata); - static void onLightCancelColor(LLUICtrl* ctrl, void* userdata); - static void onLightSelectColor(LLUICtrl* ctrl, void* userdata); + void onLightCancelColor(const LLSD& data); + void onLightSelectColor(const LLSD& data); protected: void getState(); diff --git a/indra/newview/llparcelselection.h b/indra/newview/llparcelselection.h index 5f26fafc33..0481bea6f7 100644 --- a/indra/newview/llparcelselection.h +++ b/indra/newview/llparcelselection.h @@ -33,7 +33,8 @@ #ifndef LLPARCELSELECTION_H #define LLPARCELSELECTION_H -#include "llmemory.h" +#include "llrefcount.h" +#include "llsafehandle.h" class LLParcel; diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 6d7082bf9a..64713108af 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -34,11 +34,13 @@ #include "stdenums.h" #include "llpreview.h" + #include "lllineeditor.h" #include "llinventory.h" #include "llinventorymodel.h" #include "llresmgr.h" #include "lltextbox.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "lltooldraganddrop.h" #include "llradiogroup.h" @@ -47,129 +49,72 @@ #include "llviewerobjectlist.h" #include "lldbstrings.h" #include "llagent.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llselectmgr.h" #include "llinventoryview.h" #include "llviewerinventory.h" +#include "llviewerwindow.h" +#include "lltrans.h" // Constants -// Globals and statics -LLPreview::preview_multimap_t LLPreview::sPreviewsBySource; -LLPreview::preview_map_t LLPreview::sInstances; -std::map > LLMultiPreview::sAutoOpenPreviewHandles; - -// Functions -LLPreview::LLPreview(const std::string& name) : - LLFloater(name), - mCopyToInvBtn(NULL), +LLPreview::LLPreview(const LLSD& key) +: LLFloater(key), + mItemUUID(key.asUUID()), + mCopyToInvBtn( NULL ), mForceClose(FALSE), mUserResized(FALSE), mCloseAfterSave(FALSE), mAssetStatus(PREVIEW_ASSET_UNLOADED), - mItem(NULL), mDirty(TRUE) { - // don't add to instance list, since ItemID is null - mAuxItem = new LLInventoryItem; // (LLPointer is auto-deleted) + mAuxItem = new LLInventoryItem; // don't necessarily steal focus on creation -- sometimes these guys pop up without user action setAutoFocus(FALSE); + gInventory.addObserver(this); + + refreshFromItem(); } -LLPreview::LLPreview(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid, BOOL allow_resize, S32 min_width, S32 min_height, LLPointer inv_item ) -: LLFloater(name, rect, title, allow_resize, min_width, min_height ), - mItemUUID(item_uuid), - mSourceID(LLUUID::null), - mObjectUUID(object_uuid), - mCopyToInvBtn( NULL ), - mForceClose( FALSE ), - mUserResized(FALSE), - mCloseAfterSave(FALSE), - mAssetStatus(PREVIEW_ASSET_UNLOADED), - mItem(inv_item), - mDirty(TRUE) +BOOL LLPreview::postBuild() { - mAuxItem = new LLInventoryItem; - // don't necessarily steal focus on creation -- sometimes these guys pop up without user action - setAutoFocus(FALSE); - - if (mItemUUID.notNull()) - { - sInstances[mItemUUID] = this; - } - gInventory.addObserver(this); + refreshFromItem(); + return TRUE; } LLPreview::~LLPreview() { gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() - - if (mItemUUID.notNull()) - { - sInstances.erase( mItemUUID ); - } - - if (mSourceID.notNull()) - { - preview_multimap_t::iterator found_it = sPreviewsBySource.find(mSourceID); - for (; found_it != sPreviewsBySource.end(); ++found_it) - { - if (found_it->second == getHandle()) - { - sPreviewsBySource.erase(found_it); - break; - } - } - } gInventory.removeObserver(this); } -void LLPreview::setItemID(const LLUUID& item_id) -{ - if (mItemUUID.notNull()) - { - sInstances.erase(mItemUUID); - } - - mItemUUID = item_id; - - if (mItemUUID.notNull()) - { - sInstances[mItemUUID] = this; - } -} - void LLPreview::setObjectID(const LLUUID& object_id) { mObjectUUID = object_id; + if (getAssetStatus() == PREVIEW_ASSET_UNLOADED) + { + loadAsset(); + } } -void LLPreview::setSourceID(const LLUUID& source_id) +void LLPreview::setItem( LLInventoryItem* item ) { - if (mSourceID.notNull()) + mItem = item; + if (mItem && getAssetStatus() == PREVIEW_ASSET_UNLOADED) { - // erase old one - preview_multimap_t::iterator found_it = sPreviewsBySource.find(mSourceID); - for (; found_it != sPreviewsBySource.end(); ++found_it) - { - if (found_it->second == getHandle()) - { - sPreviewsBySource.erase(found_it); - break; - } - } + loadAsset(); } - mSourceID = source_id; - sPreviewsBySource.insert(preview_multimap_t::value_type(mSourceID, getHandle())); } -const LLViewerInventoryItem *LLPreview::getItem() const +const LLInventoryItem *LLPreview::getItem() const { - if(mItem) - return mItem; - const LLViewerInventoryItem *item = NULL; - if(mObjectUUID.isNull()) + const LLInventoryItem *item = NULL; + if (mItem.notNull()) + { + item = mItem; + } + else if (mObjectUUID.isNull()) { // it's an inventory item, so get the item. item = gInventory.getItem(mItemUUID); @@ -180,7 +125,7 @@ const LLViewerInventoryItem *LLPreview::getItem() const LLViewerObject* object = gObjectList.findObject(mObjectUUID); if(object) { - item = (LLViewerInventoryItem*)object->getInventoryObject(mItemUUID); + item = dynamic_cast(object->getInventoryObject(mItemUUID)); } } return item; @@ -189,7 +134,7 @@ const LLViewerInventoryItem *LLPreview::getItem() const // Sub-classes should override this function if they allow editing void LLPreview::onCommit() { - const LLViewerInventoryItem *item = getItem(); + const LLViewerInventoryItem *item = dynamic_cast(getItem()); if(item) { if (!item->isComplete()) @@ -226,7 +171,7 @@ void LLPreview::onCommit() // update the object itself. if( item->getType() == LLAssetType::AT_OBJECT ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if( avatar ) { LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); @@ -255,17 +200,24 @@ void LLPreview::draw() if (mDirty) { mDirty = FALSE; - const LLViewerInventoryItem *item = getItem(); - if (item) - { - refreshFromItem(item); - } + refreshFromItem(); } } -void LLPreview::refreshFromItem(const LLInventoryItem* item) +void LLPreview::refreshFromItem() { - setTitle(llformat("%s: %s",getTitleName(),item->getName().c_str())); + const LLInventoryItem* item = getItem(); + if (!item) + { + return; + } + if (hasString("Title")) + { + LLStringUtil::format_map_t args; + args["[NAME]"] = item->getName(); + LLUIString title = getString("Title", args); + setTitle(title.getString()); + } childSetText("desc",item->getDescription()); BOOL can_agent_manipulate = item->getPermissions().allowModifyBy(gAgent.getID()); @@ -286,81 +238,33 @@ void LLPreview::onRadio(LLUICtrl*, void* userdata) self->onCommit(); } -// static -LLPreview* LLPreview::find(const LLUUID& item_uuid) -{ - LLPreview* instance = NULL; - preview_map_t::iterator found_it = LLPreview::sInstances.find(item_uuid); - if(found_it != LLPreview::sInstances.end()) - { - instance = found_it->second; - } - return instance; -} - -// static -LLPreview* LLPreview::show( const LLUUID& item_uuid, BOOL take_focus ) -{ - LLPreview* instance = LLPreview::find(item_uuid); - if(instance) - { - if (LLFloater::getFloaterHost() && LLFloater::getFloaterHost() != instance->getHost()) - { - // this preview window is being opened in a new context - // needs to be rehosted - LLFloater::getFloaterHost()->addFloater(instance, TRUE); - } - instance->open(); /*Flawfinder: ignore*/ - if (take_focus) - { - instance->setFocus(TRUE); - } - } - - return instance; -} - -// static -bool LLPreview::save( const LLUUID& item_uuid, LLPointer* itemptr ) -{ - bool res = false; - LLPreview* instance = LLPreview::find(item_uuid); - if(instance) - { - res = instance->saveItem(itemptr); - } - if (!res) - { - delete itemptr; - } - return res; -} - // static void LLPreview::hide(const LLUUID& item_uuid, BOOL no_saving /* = FALSE */ ) { - preview_map_t::iterator found_it = LLPreview::sInstances.find(item_uuid); - if(found_it != LLPreview::sInstances.end()) + LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid)); + if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid)); + + LLPreview* preview = dynamic_cast(floater); + if (preview) { - LLPreview* instance = found_it->second; - if ( no_saving ) { - instance->mForceClose = TRUE; + preview->mForceClose = TRUE; } - - instance->close(); + preview->closeFloater(); } } // static -void LLPreview::rename(const LLUUID& item_uuid, const std::string& new_name) +void LLPreview::dirty(const LLUUID& item_uuid) { - preview_map_t::iterator found_it = LLPreview::sInstances.find(item_uuid); - if(found_it != LLPreview::sInstances.end()) + LLFloater* floater = LLFloaterReg::findInstance("preview", LLSD(item_uuid)); + if (!floater) floater = LLFloaterReg::findInstance("preview_avatar", LLSD(item_uuid)); + + LLPreview* preview = dynamic_cast(floater); + if(preview) { - LLPreview* instance = found_it->second; - instance->setTitle( new_name ); + preview->mDirty = TRUE; } } @@ -397,7 +301,7 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) { S32 screen_x; S32 screen_y; - const LLViewerInventoryItem *item = getItem(); + const LLInventoryItem *item = getItem(); localPointToScreen(x, y, &screen_x, &screen_y ); if(item @@ -426,22 +330,14 @@ BOOL LLPreview::handleHover(S32 x, S32 y, MASK mask) return LLFloater::handleHover(x,y,mask); } -void LLPreview::open() /*Flawfinder: ignore*/ +void LLPreview::onOpen(const LLSD& key) { if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED) { loadAsset(); } - LLFloater::open(); /*Flawfinder: ignore*/ -} - -// virtual -bool LLPreview::saveItem(LLPointer* itemptr) -{ - return false; } - // static void LLPreview::onBtnCopyToInv(void* userdata) { @@ -468,14 +364,14 @@ void LLPreview::onBtnCopyToInv(void* userdata) cb); } } - self->close(); + self->closeFloater(); } // static void LLPreview::onKeepBtn(void* data) { LLPreview* self = (LLPreview*)data; - self->close(); + self->closeFloater(); } // static @@ -483,11 +379,11 @@ void LLPreview::onDiscardBtn(void* data) { LLPreview* self = (LLPreview*)data; - const LLViewerInventoryItem* item = self->getItem(); + const LLInventoryItem* item = self->getItem(); if (!item) return; self->mForceClose = TRUE; - self->close(); + self->closeFloater(); // Delete the item entirely /* @@ -517,55 +413,60 @@ void LLPreview::onDiscardBtn(void* data) } } -//static -LLPreview* LLPreview::getFirstPreviewForSource(const LLUUID& source_id) +void LLPreview::handleReshape(const LLRect& new_rect, bool by_user) { - preview_multimap_t::iterator found_it = sPreviewsBySource.find(source_id); - if (found_it != sPreviewsBySource.end()) - { - // just return first one - return (LLPreview*)found_it->second.get(); - } - return NULL; -} - -void LLPreview::userSetShape(const LLRect& new_rect) -{ - if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) + if(by_user + && (new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())) { userResized(); } - LLFloater::userSetShape(new_rect); + LLFloater::handleReshape(new_rect, by_user); } // // LLMultiPreview // -LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(std::string("Preview"), rect) +LLMultiPreview::LLMultiPreview() + : LLMultiFloater() { + // *TODO: There should be a .xml file for this + const LLRect& nextrect = LLFloaterReg::getFloaterRect("preview"); // place where the next preview should show up + if (nextrect.getWidth() > 0) + { + setRect(nextrect); + } + else + { + // start with a rect in the top-left corner ; will get resized + LLRect rect; + rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 200, 200); + setRect(rect); + } + setTitle(LLTrans::getString("MultiPreviewTitle")); + buildTabContainer(); setCanResize(TRUE); } -void LLMultiPreview::open() /*Flawfinder: ignore*/ +void LLMultiPreview::onOpen(const LLSD& key) { - LLMultiFloater::open(); /*Flawfinder: ignore*/ LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); if (frontmost_preview && frontmost_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED) { frontmost_preview->loadAsset(); } + LLMultiFloater::onOpen(key); } -void LLMultiPreview::userSetShape(const LLRect& new_rect) +void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user) { if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) { LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); if (frontmost_preview) frontmost_preview->userResized(); } - LLFloater::userSetShape(new_rect); + LLFloater::handleReshape(new_rect, by_user); } @@ -578,22 +479,3 @@ void LLMultiPreview::tabOpen(LLFloater* opened_floater, bool from_click) } } -//static -LLMultiPreview* LLMultiPreview::getAutoOpenInstance(const LLUUID& id) -{ - handle_map_t::iterator found_it = sAutoOpenPreviewHandles.find(id); - if (found_it != sAutoOpenPreviewHandles.end()) - { - return (LLMultiPreview*)found_it->second.get(); - } - return NULL; -} - -//static -void LLMultiPreview::setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id) -{ - if (previewp) - { - sAutoOpenPreviewHandles[id] = previewp->getHandle(); - } -} diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h index ff084bea27..f6042f065b 100644 --- a/indra/newview/llpreview.h +++ b/indra/newview/llpreview.h @@ -33,7 +33,7 @@ #ifndef LL_LLPREVIEW_H #define LL_LLPREVIEW_H -#include "llfloater.h" +#include "llmultifloater.h" #include "llresizehandle.h" #include "llmap.h" #include "lluuid.h" @@ -49,18 +49,12 @@ class LLPreview; class LLMultiPreview : public LLMultiFloater { public: - LLMultiPreview(const LLRect& rect); + LLMultiPreview(); - /*virtual*/void open(); /*Flawfinder: ignore*/ + /*virtual*/void onOpen(const LLSD& key); /*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click); - /*virtual*/ void userSetShape(const LLRect& new_rect); + /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); - static LLMultiPreview* getAutoOpenInstance(const LLUUID& id); - static void setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id); - -protected: - typedef std::map > handle_map_t; - static handle_map_t sAutoOpenPreviewHandles; }; // https://wiki.lindenlab.com/mediawiki/index.php?title=LLPreview&oldid=81373 @@ -76,28 +70,24 @@ public: PREVIEW_ASSET_LOADED } EAssetStatus; public: - // Used for XML-based construction. - LLPreview(const std::string& name); - LLPreview(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid, BOOL allow_resize = FALSE, S32 min_width = 0, S32 min_height = 0, LLPointer inv_item = NULL ); + LLPreview(const LLSD& key ); virtual ~LLPreview(); - - void setItemID(const LLUUID& item_id); + + /*virtual*/ BOOL postBuild(); + void setObjectID(const LLUUID& object_id); - void setSourceID(const LLUUID& source_id); - const LLViewerInventoryItem *getItem() const; // searches if not constructed with it - - static LLPreview* find(const LLUUID& item_uuid); - static LLPreview* show(const LLUUID& item_uuid, BOOL take_focus = TRUE ); - static void hide(const LLUUID& item_uuid, BOOL no_saving = FALSE ); - static void rename(const LLUUID& item_uuid, const std::string& new_name); - static bool save(const LLUUID& item_uuid, LLPointer* itemptr); + void setItem( LLInventoryItem* item ); + + const LLInventoryItem* getItem() const; // searches if not constructed with it + static void hide(const LLUUID& item_uuid, BOOL no_saving = FALSE ); + static void dirty(const LLUUID& item_uuid); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual void open(); /*Flawfinder: ignore*/ - virtual bool saveItem(LLPointer* itemptr); - + virtual void onOpen(const LLSD& key); + void setAuxItem( const LLInventoryItem* item ) { if ( mAuxItem ) @@ -109,7 +99,7 @@ public: void addKeepDiscardButtons(); static void onKeepBtn(void* data); static void onDiscardBtn(void* data); - /*virtual*/ void userSetShape(const LLRect& new_rect); + /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); void userResized() { mUserResized = TRUE; }; @@ -122,7 +112,7 @@ public: // llview virtual void draw(); - void refreshFromItem(const LLInventoryItem* item); + void refreshFromItem(); protected: virtual void onCommit(); @@ -135,11 +125,9 @@ protected: // for LLInventoryObserver virtual void changed(U32 mask); BOOL mDirty; - virtual const char *getTitleName() const { return "Preview"; } protected: LLUUID mItemUUID; - LLUUID mSourceID; // mObjectID will have a value if it is associated with a task in // the world, and will be == LLUUID::null if it's in the agent @@ -149,6 +137,7 @@ protected: LLRect mClientRect; LLPointer mAuxItem; // HACK! + LLPointer mItem; // For embedded items (Landmarks) LLButton* mCopyToInvBtn; // Close without saving changes @@ -162,27 +151,18 @@ protected: EAssetStatus mAssetStatus; - typedef std::map preview_map_t; - typedef std::multimap > preview_multimap_t; - - static preview_multimap_t sPreviewsBySource; - static preview_map_t sInstances; LLUUID mNotecardInventoryID; LLUUID mObjectID; - LLPointer mItem; }; const S32 PREVIEW_BORDER = 4; const S32 PREVIEW_PAD = 5; -const S32 PREVIEW_BUTTON_WIDTH = 100; const S32 PREVIEW_LINE_HEIGHT = 19; -const S32 PREVIEW_CLOSE_BOX_SIZE = 16; const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_VPAD = 2; -const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; const S32 PREVIEW_HEADER_SIZE = 2*PREVIEW_LINE_HEIGHT + 2 * PREVIEW_VPAD; #endif // LL_LLPREVIEW_H diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 3212de0639..6857d14fff 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -37,7 +37,7 @@ #include "llresmgr.h" #include "llinventory.h" #include "llinventoryview.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llagent.h" // gAgent #include "llkeyframemotion.h" #include "llfilepicker.h" @@ -47,42 +47,54 @@ extern LLAgent gAgent; -LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const S32& activate, const LLUUID& object_uuid ) : - LLPreview( name, rect, title, item_uuid, object_uuid) +LLPreviewAnim::LLPreviewAnim(const LLSD& key) + : LLPreview( key ) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml"); - - childSetAction("Anim play btn",playAnim,this); - childSetAction("Anim audition btn",auditionAnim,this); - - const LLInventoryItem* item = getItem(); - - childSetCommitCallback("desc", LLPreview::onText, this); - childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - - setTitle(title); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml", FALSE); +} - if (!getHost()) +// static +void LLPreviewAnim::endAnimCallback( void *userdata ) +{ + LLHandle* handlep = ((LLHandle*)userdata); + LLFloater* self = handlep->get(); + delete handlep; // done with the handle + if (self) { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); + self->childSetValue("Anim play btn", FALSE); + self->childSetValue("Anim audition btn", FALSE); } +} - // preload the animation +// virtual +BOOL LLPreviewAnim::postBuild() +{ + const LLInventoryItem* item = getItem(); if(item) { - gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); + gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); // preload the animation + childSetText("desc", item->getDescription()); } + + childSetAction("Anim play btn",playAnim, this); + childSetAction("Anim audition btn",auditionAnim, this); + + childSetCommitCallback("desc", LLPreview::onText, this); + childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - switch ( activate ) + return LLPreview::postBuild(); +} + +void LLPreviewAnim::activate(e_activation_type type) +{ + switch ( type ) { - case 1: + case PLAY: { playAnim( (void *) this ); break; } - case 2: + case AUDITION: { auditionAnim( (void *) this ); break; @@ -94,19 +106,6 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const } } -// static -void LLPreviewAnim::endAnimCallback( void *userdata ) -{ - LLHandle* handlep = ((LLHandle*)userdata); - LLFloater* self = handlep->get(); - delete handlep; // done with the handle - if (self) - { - self->childSetValue("Anim play btn", FALSE); - self->childSetValue("Anim audition btn", FALSE); - } -} - // static void LLPreviewAnim::playAnim( void *userdata ) { diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index fe794d4283..ca42b7e731 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -39,18 +39,17 @@ class LLPreviewAnim : public LLPreview { public: - LLPreviewAnim(const std::string& name, const LLRect& rect, const std::string& title, - const LLUUID& item_uuid, - const S32& activate, - const LLUUID& object_uuid = LLUUID::null); + enum e_activation_type { NONE = 0, PLAY = 1, AUDITION = 2 }; + LLPreviewAnim(const LLSD& key); static void playAnim( void* userdata ); static void auditionAnim( void* userdata ); static void endAnimCallback( void *userdata ); - + /*virtual*/ BOOL postBuild(); + void activate(e_activation_type type); + protected: virtual void onClose(bool app_quitting); - virtual const char *getTitleName() const { return "Animation"; } LLAnimPauseRequest mPauseRequest; LLUUID mItemID; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 76a9b80645..dc6ee44936 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -41,11 +41,13 @@ #include "lldarray.h" #include "llstring.h" #include "lldir.h" +#include "llfloaterreg.h" #include "llmultigesture.h" #include "llvfile.h" // newview #include "llagent.h" // todo: remove +#include "llanimationstates.h" #include "llassetuploadresponders.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -59,6 +61,8 @@ #include "llnotify.h" #include "llradiogroup.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "lltextbox.h" #include "lluictrlfactory.h" #include "llviewerinventory.h" @@ -67,15 +71,16 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerwindow.h" // busycount +#include "llvoavatarself.h" #include "llappviewer.h" // gVFS #include "llanimstatelabels.h" #include "llresmgr.h" +#include "lltrans.h" -// *TODO: Translate? -const std::string NONE_LABEL = "---"; -const std::string SHIFT_LABEL = "Shift"; -const std::string CTRL_LABEL = "Ctrl"; +std::string NONE_LABEL; +std::string SHIFT_LABEL; +std::string CTRL_LABEL; void dialog_refresh_all(); @@ -92,12 +97,9 @@ protected: void LLInventoryGestureAvailable::done() { - LLPreview* preview = NULL; - item_ref_t::iterator it = mComplete.begin(); - item_ref_t::iterator end = mComplete.end(); - for(; it < end; ++it) + for(item_ref_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it) { - preview = LLPreview::find((*it)); + LLPreviewGesture* preview = LLFloaterReg::findTypedInstance("preview_gesture", *it); if(preview) { preview->refresh(); @@ -117,43 +119,16 @@ struct SortItemPtrsByName }; // static -LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus) +LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& object_id) { - LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id); - if (previewp) + LLPreviewGesture* preview = LLFloaterReg::showTypedInstance("preview_gesture", LLSD(item_id), TAKE_FOCUS_YES); + if (!preview) { - previewp->open(); /*Flawfinder: ignore*/ - if (take_focus) - { - previewp->setFocus(TRUE); - } - return previewp; - } - - LLPreviewGesture* self = new LLPreviewGesture(); - - // Finish internal construction - self->init(item_id, object_id); - - // Builds and adds to gFloaterView - LLUICtrlFactory::getInstance()->buildFloater(self, "floater_preview_gesture.xml"); - self->setTitle(title); - - // Move window to top-left of screen - LLMultiFloater* hostp = self->getHost(); - if (hostp == NULL) - { - LLRect r = self->getRect(); - LLRect screen = gFloaterView->getRect(); - r.setLeftTopAndSize(0, screen.getHeight(), r.getWidth(), r.getHeight()); - self->setRect(r); - } - else - { - // re-add to host to update title - hostp->addFloater(self, TRUE); + return NULL; } - + + preview->setObjectID(object_id); + // Start speculative download of sounds and animations LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_ANIMATION); gInventory.startBackgroundFetch(animation_folder_id); @@ -162,8 +137,8 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& gInventory.startBackgroundFetch(sound_folder_id); // this will call refresh when we have everything. - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); - if(item && !item->isComplete()) + LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem(); + if (item && !item->isComplete()) { LLInventoryGestureAvailable* observer; observer = new LLInventoryGestureAvailable(); @@ -174,18 +149,12 @@ LLPreviewGesture* LLPreviewGesture::show(const std::string& title, const LLUUID& else { // not sure this is necessary. - self->refresh(); - } - - if (take_focus) - { - self->setFocus(TRUE); + preview->refresh(); } - return self; + return preview; } - // virtual BOOL LLPreviewGesture::handleKeyHere(KEY key, MASK mask) { @@ -334,7 +303,7 @@ bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const L case 1: // "No" gGestureManager.stopGesture(mPreviewGesture); mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog... - close(); + closeFloater(); break; case 2: // "Cancel" @@ -347,8 +316,8 @@ bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const L } -LLPreviewGesture::LLPreviewGesture() -: LLPreview("Gesture Preview"), +LLPreviewGesture::LLPreviewGesture(const LLSD& key) +: LLPreview(key), mTriggerEditor(NULL), mModifierCombo(NULL), mKeyCombo(NULL), @@ -368,6 +337,12 @@ LLPreviewGesture::LLPreviewGesture() mPreviewGesture(NULL), mDirty(FALSE) { + NONE_LABEL = LLTrans::getString("---"); + SHIFT_LABEL = LLTrans::getString("KBShift"); + CTRL_LABEL = LLTrans::getString("KBCtrl"); + + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_gesture.xml", FALSE); + } @@ -396,10 +371,9 @@ BOOL LLPreviewGesture::postBuild() LLCheckBoxCtrl* check; edit = getChild("trigger_editor"); - edit->setKeystrokeCallback(onKeystrokeCommit); - edit->setCommitCallback(onCommitSetDirty); + edit->setKeystrokeCallback(onKeystrokeCommit, this); + edit->setCommitCallback(onCommitSetDirty, this); edit->setCommitOnFocusLost(TRUE); - edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mTriggerEditor = edit; @@ -409,56 +383,47 @@ BOOL LLPreviewGesture::postBuild() edit = getChild("replace_editor"); edit->setEnabled(FALSE); - edit->setKeystrokeCallback(onKeystrokeCommit); - edit->setCommitCallback(onCommitSetDirty); + edit->setKeystrokeCallback(onKeystrokeCommit, this); + edit->setCommitCallback(onCommitSetDirty, this); edit->setCommitOnFocusLost(TRUE); - edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mReplaceEditor = edit; combo = getChild( "modifier_combo"); - combo->setCommitCallback(onCommitSetDirty); - combo->setCallbackUserData(this); + combo->setCommitCallback(onCommitSetDirty, this); mModifierCombo = combo; combo = getChild( "key_combo"); - combo->setCommitCallback(onCommitSetDirty); - combo->setCallbackUserData(this); + combo->setCommitCallback(onCommitSetDirty, this); mKeyCombo = combo; list = getChild("library_list"); - list->setCommitCallback(onCommitLibrary); - list->setDoubleClickCallback(onClickAdd); - list->setCallbackUserData(this); + list->setCommitCallback(onCommitLibrary, this); + list->setDoubleClickCallback(onClickAdd, this); mLibraryList = list; btn = getChild( "add_btn"); - btn->setClickedCallback(onClickAdd); - btn->setCallbackUserData(this); + btn->setClickedCallback(onClickAdd, this); btn->setEnabled(FALSE); mAddBtn = btn; btn = getChild( "up_btn"); - btn->setClickedCallback(onClickUp); - btn->setCallbackUserData(this); + btn->setClickedCallback(onClickUp, this); btn->setEnabled(FALSE); mUpBtn = btn; btn = getChild( "down_btn"); - btn->setClickedCallback(onClickDown); - btn->setCallbackUserData(this); + btn->setClickedCallback(onClickDown, this); btn->setEnabled(FALSE); mDownBtn = btn; btn = getChild( "delete_btn"); - btn->setClickedCallback(onClickDelete); - btn->setCallbackUserData(this); + btn->setClickedCallback(onClickDelete, this); btn->setEnabled(FALSE); mDeleteBtn = btn; list = getChild("step_list"); - list->setCommitCallback(onCommitStep); - list->setCallbackUserData(this); + list->setCommitCallback(onCommitStep, this); mStepList = list; // Options @@ -468,69 +433,59 @@ BOOL LLPreviewGesture::postBuild() combo = getChild( "animation_list"); combo->setVisible(FALSE); - combo->setCommitCallback(onCommitAnimation); - combo->setCallbackUserData(this); + combo->setCommitCallback(onCommitAnimation, this); mAnimationCombo = combo; LLRadioGroup* group; group = getChild("animation_trigger_type"); group->setVisible(FALSE); - group->setCommitCallback(onCommitAnimationTrigger); - group->setCallbackUserData(this); + group->setCommitCallback(onCommitAnimationTrigger, this); mAnimationRadio = group; combo = getChild( "sound_list"); combo->setVisible(FALSE); - combo->setCommitCallback(onCommitSound); - combo->setCallbackUserData(this); + combo->setCommitCallback(onCommitSound, this); mSoundCombo = combo; edit = getChild("chat_editor"); edit->setVisible(FALSE); - edit->setCommitCallback(onCommitChat); - //edit->setKeystrokeCallback(onKeystrokeCommit); + edit->setCommitCallback(onCommitChat, this); + //edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitOnFocusLost(TRUE); - edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mChatEditor = edit; check = getChild( "wait_anim_check"); check->setVisible(FALSE); - check->setCommitCallback(onCommitWait); - check->setCallbackUserData(this); + check->setCommitCallback(onCommitWait, this); mWaitAnimCheck = check; check = getChild( "wait_time_check"); check->setVisible(FALSE); - check->setCommitCallback(onCommitWait); - check->setCallbackUserData(this); + check->setCommitCallback(onCommitWait, this); mWaitTimeCheck = check; edit = getChild("wait_time_editor"); edit->setEnabled(FALSE); edit->setVisible(FALSE); edit->setPrevalidate(LLLineEditor::prevalidateFloat); -// edit->setKeystrokeCallback(onKeystrokeCommit); +// edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitOnFocusLost(TRUE); - edit->setCommitCallback(onCommitWaitTime); - edit->setCallbackUserData(this); + edit->setCommitCallback(onCommitWaitTime, this); edit->setIgnoreTab(TRUE); mWaitTimeEditor = edit; // Buttons at the bottom check = getChild( "active_check"); - check->setCommitCallback(onCommitActive); - check->setCallbackUserData(this); + check->setCommitCallback(onCommitActive, this); mActiveCheck = check; btn = getChild( "save_btn"); - btn->setClickedCallback(onClickSave); - btn->setCallbackUserData(this); + btn->setClickedCallback(onClickSave, this); mSaveBtn = btn; btn = getChild( "preview_btn"); - btn->setClickedCallback(onClickPreview); - btn->setCallbackUserData(this); + btn->setClickedCallback(onClickPreview, this); mPreviewBtn = btn; @@ -540,7 +495,6 @@ BOOL LLPreviewGesture::postBuild() addAnimations(); addSounds(); - const LLInventoryItem* item = getItem(); if (item) @@ -550,7 +504,7 @@ BOOL LLPreviewGesture::postBuild() childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); } - return TRUE; + return LLPreview::postBuild(); } @@ -680,16 +634,9 @@ void LLPreviewGesture::addSounds() } -void LLPreviewGesture::init(const LLUUID& item_id, const LLUUID& object_id) -{ - // Sets ID and adds to instance list - setItemID(item_id); - setObjectID(object_id); -} - - void LLPreviewGesture::refresh() { + LLPreview::refresh(); // If previewing or item is incomplete, all controls are disabled LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); bool is_complete = (item && item->isComplete()) ? true : false; @@ -850,7 +797,7 @@ void LLPreviewGesture::initDefaultGesture() item = addStep( STEP_ANIMATION ); LLGestureStepAnimation* anim = (LLGestureStepAnimation*)item->getUserdata(); anim->mAnimAssetID = ANIM_AGENT_HELLO; - anim->mAnimName = "Wave"; + anim->mAnimName = LLTrans::getString("Wave"); updateLabel(item); item = addStep( STEP_WAIT ); @@ -860,7 +807,7 @@ void LLPreviewGesture::initDefaultGesture() item = addStep( STEP_CHAT ); LLGestureStepChat* chat_step = (LLGestureStepChat*)item->getUserdata(); - chat_step->mChatText = "Hello, avatar!"; + chat_step->mChatText = LLTrans::getString("HelloAvatar"); updateLabel(item); // Start with item list selected @@ -874,7 +821,11 @@ void LLPreviewGesture::initDefaultGesture() void LLPreviewGesture::loadAsset() { const LLInventoryItem* item = getItem(); - if (!item) return; + if (!item) + { + mAssetStatus = PREVIEW_ASSET_ERROR; + return; + } LLUUID asset_id = item->getAssetUUID(); if (asset_id.isNull()) @@ -883,6 +834,7 @@ void LLPreviewGesture::loadAsset() // Blank gesture will be fine. initDefaultGesture(); refresh(); + mAssetStatus = PREVIEW_ASSET_LOADED; return; } @@ -910,11 +862,10 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, void* user_data, S32 status, LLExtStat ext_status) { LLUUID* item_idp = (LLUUID*)user_data; - LLPreview* preview = LLPreview::find(*item_idp); - if (preview) - { - LLPreviewGesture* self = (LLPreviewGesture*)preview; + LLPreviewGesture* self = LLFloaterReg::findTypedInstance("preview_gesture", *item_idp); + if (self) + { if (0 == status) { LLVFile file(vfs, asset_uuid, type, LLVFile::READ); @@ -1016,7 +967,7 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) LLGestureStep* step = gesture->mSteps[i]; LLGestureStep* new_step = NULL; - + switch(step->getType()) { case STEP_ANIMATION: @@ -1061,7 +1012,7 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) // Create an enabled item with this step LLSD row; - row["columns"][0]["value"] = new_step->getLabel(); + row["columns"][0]["value"] = getLabel( new_step->getLabel()); row["columns"][0]["font"] = "SANSSERIF_SMALL"; LLScrollListItem* item = mStepList->addElement(row); item->setUserdata(new_step); @@ -1262,10 +1213,10 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, } // Find our window and close it if requested. - LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(info->mItemUUID); + LLPreviewGesture* previewp = LLFloaterReg::findTypedInstance("preview_gesture", info->mItemUUID); if (previewp && previewp->mCloseAfterSave) { - previewp->close(); + previewp->closeFloater(); } } else @@ -1374,7 +1325,7 @@ void LLPreviewGesture::updateLabel(LLScrollListItem* item) LLScrollListCell* cell = item->getColumn(0); LLScrollListText* text_cell = (LLScrollListText*)cell; - std::string label = step->getLabel(); + std::string label = getLabel( step->getLabel()); text_cell->setText(label); } @@ -1619,24 +1570,26 @@ LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type ) { case STEP_ANIMATION: step = new LLGestureStepAnimation(); + break; case STEP_SOUND: step = new LLGestureStepSound(); break; case STEP_CHAT: - step = new LLGestureStepChat(); + step = new LLGestureStepChat(); break; case STEP_WAIT: - step = new LLGestureStepWait(); + step = new LLGestureStepWait(); break; default: llerrs << "Unknown step type: " << (S32)step_type << llendl; return NULL; } + // Create an enabled item with this step LLSD row; - row["columns"][0]["value"] = step->getLabel(); + row["columns"][0]["value"] = getLabel(step->getLabel()); row["columns"][0]["font"] = "SANSSERIF_SMALL"; LLScrollListItem* step_item = mStepList->addElement(row); step_item->setUserdata(step); @@ -1650,6 +1603,42 @@ LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type ) return step_item; } +// static +std::string LLPreviewGesture::getLabel(std::vector labels) +{ + std::vector v_labels = labels ; + std::string result(""); + + if( v_labels.size() != 2) + { + return result; + } + + if(v_labels[0]=="Chat") + { + result=LLTrans::getString("Chat"); + } + else if(v_labels[0]=="Sound") + { + result=LLTrans::getString("Sound"); + } + else if(v_labels[0]=="Wait") + { + result=LLTrans::getString("Wait"); + } + else if(v_labels[0]=="AnimFlagStop") + { + result=LLTrans::getString("AnimFlagStop"); + } + else if(v_labels[0]=="AnimFlagStart") + { + result=LLTrans::getString("AnimFlagStart"); + } + + result.append(v_labels[1]); + return result; + +} // static void LLPreviewGesture::onClickUp(void* data) { diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index c245c0e8da..d3e9c77789 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -52,40 +52,38 @@ class LLPreviewGesture : public LLPreview public: // Pass an object_id if this gesture is inside an object in the world, // otherwise use LLUUID::null. - static LLPreviewGesture* show(const std::string& title, const LLUUID& item_id, const LLUUID& object_id, BOOL take_focus = TRUE); + static LLPreviewGesture* show(const LLUUID& item_id, const LLUUID& object_id); + + LLPreviewGesture(const LLSD& key); + virtual ~LLPreviewGesture(); // LLView - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); // LLPanel - virtual BOOL postBuild(); + /*virtual*/ BOOL postBuild(); // LLFloater - virtual BOOL canClose(); - virtual void setMinimized(BOOL minimize); - virtual void onClose(bool app_quitting); - virtual void onUpdateSucceeded(); + /*virtual*/ BOOL canClose(); + /*virtual*/ void setMinimized(BOOL minimize); + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ void onUpdateSucceeded(); + /*virtual*/ void refresh(); + protected: - LLPreviewGesture(); - virtual ~LLPreviewGesture(); - - void init(const LLUUID& item_id, const LLUUID& object_id); - // Populate various comboboxes void addModifiers(); void addKeys(); void addAnimations(); void addSounds(); - void refresh(); - void initDefaultGesture(); void loadAsset(); @@ -112,6 +110,7 @@ protected: // "Sound", "Chat", or "Wait" LLScrollListItem* addStep(const enum EStepType step_type); + static std::string getLabel(std::vector labels); static void updateLabel(LLScrollListItem* item); static void onCommitSetDirty(LLUICtrl* ctrl, void* data); @@ -139,8 +138,6 @@ protected: static void onDonePreview(LLMultiGesture* gesture, void* data); - virtual const char *getTitleName() const { return "Gesture"; } - protected: // LLPreview contains mDescEditor LLLineEditor* mTriggerEditor; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 4abe390bc5..f3d0dc538d 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -40,6 +40,7 @@ #include "llassetuploadresponders.h" #include "llviewerwindow.h" #include "llbutton.h" +#include "llfloaterreg.h" #include "llinventorymodel.h" #include "lllineeditor.h" #include "llnotify.h" @@ -61,122 +62,71 @@ #include "lllineeditor.h" #include "lluictrlfactory.h" -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - -const S32 PREVIEW_MIN_WIDTH = - 2 * PREVIEW_BORDER + - 2 * PREVIEW_BUTTON_WIDTH + - PREVIEW_PAD + RESIZE_HANDLE_WIDTH + - PREVIEW_PAD; -const S32 PREVIEW_MIN_HEIGHT = - 2 * PREVIEW_BORDER + - 3*(20 + PREVIEW_PAD) + - 2 * SCROLLBAR_SIZE + 128; - ///---------------------------------------------------------------------------- /// Class LLPreviewNotecard ///---------------------------------------------------------------------------- // Default constructor -LLPreviewNotecard::LLPreviewNotecard(const std::string& name, - const LLRect& rect, - const std::string& title, - const LLUUID& item_id, - const LLUUID& object_id, - const LLUUID& asset_id, - BOOL show_keep_discard, - LLPointer inv_item) : - LLPreview(name, rect, title, item_id, object_id, TRUE, - PREVIEW_MIN_WIDTH, - PREVIEW_MIN_HEIGHT, - inv_item), - mAssetID( asset_id ), - mNotecardItemID(item_id), - mObjectID(object_id) +LLPreviewNotecard::LLPreviewNotecard(const LLSD& key) //const LLUUID& item_id, + : LLPreview( key ) +{ + const LLInventoryItem *item = getItem(); + if (item) + { + mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID(); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml", FALSE); + mAssetID = item->getAssetUUID(); + } +} + +LLPreviewNotecard::~LLPreviewNotecard() { - LLRect curRect = rect; +} - if (show_keep_discard) +BOOL LLPreviewNotecard::postBuild() +{ + LLViewerTextEditor *ed = getChild("Notecard Editor"); + if (ed) + { + ed->setNotecardInfo(mItemUUID, mObjectID, getKey()); + ed->makePristine(); + } + if (mShowKeepDiscard) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard_keep_discard.xml"); childSetAction("Keep",onKeepBtn,this); childSetAction("Discard",onDiscardBtn,this); } else { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml"); - childSetAction("Save",onClickSave,this); - - if( mAssetID.isNull() ) - { - const LLInventoryItem* item = getItem(); - if( item ) - { - mAssetID = item->getAssetUUID(); - } - } - } - - // only assert shape if not hosted in a multifloater - if (!getHost()) - { - reshape(curRect.getWidth(), curRect.getHeight(), TRUE); - setRect(curRect); + getChild("Keep")->setLabel(getString("Save")); + childSetAction("Keep",onClickSave,this); + childSetVisible("Discard", false); } - + childSetVisible("lock", FALSE); - + const LLInventoryItem* item = getItem(); - + childSetCommitCallback("desc", LLPreview::onText, this); if (item) childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - setTitle(title); - LLViewerTextEditor* editor = getChild("Notecard Editor"); if (editor) { editor->setWordWrap(TRUE); - editor->setSourceID(item_id); editor->setHandleEditKeysDirectly(TRUE); } - - gAgent.changeCameraToDefault(); -} - -LLPreviewNotecard::~LLPreviewNotecard() -{ -} - -BOOL LLPreviewNotecard::postBuild() -{ - LLViewerTextEditor *ed = getChild("Notecard Editor"); - if (ed) - { - ed->setNotecardInfo(mNotecardItemID, mObjectID); - ed->makePristine(); - } - return TRUE; + + return LLPreview::postBuild(); } -bool LLPreviewNotecard::saveItem(LLPointer* itemptr) +bool LLPreviewNotecard::saveItem() { - LLInventoryItem* item = NULL; - if (itemptr && itemptr->notNull()) - { - item = (LLInventoryItem*)(*itemptr); - } - bool res = saveIfNeeded(item); - if (res) - { - delete itemptr; - } - return res; + LLInventoryItem* item = gInventory.getItem(mItemUUID); + return saveIfNeeded(item); } void LLPreviewNotecard::setEnabled( BOOL enabled ) @@ -187,7 +137,7 @@ void LLPreviewNotecard::setEnabled( BOOL enabled ) childSetEnabled("Notecard Editor", enabled); childSetVisible("lock", !enabled); childSetEnabled("desc", enabled); - childSetEnabled("Save", enabled && editor && (!editor->isPristine())); + childSetEnabled("Keep", enabled && editor && (!editor->isPristine())); } @@ -195,13 +145,10 @@ void LLPreviewNotecard::setEnabled( BOOL enabled ) void LLPreviewNotecard::draw() { - - //childSetFocus("Save", FALSE); - LLViewerTextEditor* editor = getChild("Notecard Editor"); BOOL script_changed = !editor->isPristine(); - childSetEnabled("Save", script_changed && getEnabled()); + childSetEnabled("Keep", script_changed && getEnabled()); LLPreview::draw(); } @@ -255,8 +202,13 @@ bool LLPreviewNotecard::hasEmbeddedInventory() return editor->hasEmbeddedInventory(); } -void LLPreviewNotecard::refreshFromInventory() +void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) { + if (new_item_id.notNull()) + { + mItemUUID = new_item_id; + setKey(LLSD(new_item_id)); + } lldebugs << "LLPreviewNotecard::refreshFromInventory()" << llendl; loadAsset(); } @@ -287,7 +239,6 @@ void LLPreviewNotecard::loadAsset() } else { - LLUUID* new_uuid = new LLUUID(mItemUUID); LLHost source_sim = LLHost::invalid; if (mObjectUUID.notNull()) { @@ -305,7 +256,6 @@ void LLPreviewNotecard::loadAsset() editor->makePristine(); editor->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; - delete new_uuid; return; } } @@ -318,7 +268,7 @@ void LLPreviewNotecard::loadAsset() item->getAssetUUID(), item->getType(), &onLoadComplete, - (void*)new_uuid, + (void*)new LLUUID(mItemUUID), TRUE); mAssetStatus = PREVIEW_ASSET_LOADING; } @@ -355,7 +305,8 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, { llinfos << "LLPreviewNotecard::onLoadComplete()" << llendl; LLUUID* item_id = (LLUUID*)user_data; - LLPreviewNotecard* preview = LLPreviewNotecard::getInstance(*item_id); + + LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance("preview_notecard", LLSD(*item_id)); if( preview ) { if(0 == status) @@ -419,18 +370,6 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, delete item_id; } -// static -LLPreviewNotecard* LLPreviewNotecard::getInstance(const LLUUID& item_id) -{ - LLPreview* instance = NULL; - preview_map_t::iterator found_it = LLPreview::sInstances.find(item_id); - if(found_it != LLPreview::sInstances.end()) - { - instance = found_it->second; - } - return (LLPreviewNotecard*)instance; -} - // static void LLPreviewNotecard::onClickSave(void* user_data) { @@ -590,10 +529,11 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data } // Find our window and close it if requested. - LLPreviewNotecard* previewp = (LLPreviewNotecard*)LLPreview::find(info->mItemUUID); + + LLPreviewNotecard* previewp = LLFloaterReg::findTypedInstance("preview_notecard", info->mItemUUID); if (previewp && previewp->mCloseAfterSave) { - previewp->close(); + previewp->closeFloater(); } } else @@ -624,7 +564,7 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const case 1: // "No" mForceClose = TRUE; - close(); + closeFloater(); break; case 2: // "Cancel" @@ -636,16 +576,4 @@ bool LLPreviewNotecard::handleSaveChangesDialog(const LLSD& notification, const return false; } -void LLPreviewNotecard::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLPreview::reshape( width, height, called_from_parent ); - - if( !isMinimized() ) - { - // So that next time you open a script it will have the same height and width - // (although not the same position). - gSavedSettings.setRect("NotecardEditorRect", getRect()); - } -} - // EOF diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index f5cd2bb2a9..2a008be1e6 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -49,28 +49,21 @@ class LLButton; class LLPreviewNotecard : public LLPreview { public: - LLPreviewNotecard(const std::string& name, const LLRect& rect, const std::string& title, - const LLUUID& item_id, - const LLUUID& object_id = LLUUID::null, - const LLUUID& asset_id = LLUUID::null, - BOOL show_keep_discard = FALSE, - LLPointer inv_item = NULL); + LLPreviewNotecard(const LLSD& key); virtual ~LLPreviewNotecard(); - // llpreview - virtual bool saveItem(LLPointer* itemptr); + bool saveItem(); // llview virtual void draw(); virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void setEnabled( BOOL enabled ); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); // llfloater virtual BOOL canClose(); // llpanel - virtual BOOL postBuild(); + virtual BOOL postBuild(); // reach into the text editor, and grab the drag item const LLInventoryItem* getDragItem(); @@ -82,15 +75,13 @@ public: // After saving a notecard, the tcp based upload system will // change the asset, therefore, we need to re-fetch it from the // asset system. :( - void refreshFromInventory(); + void refreshFromInventory(const LLUUID& item_id = LLUUID::null); protected: virtual void loadAsset(); bool saveIfNeeded(LLInventoryItem* copyitem = NULL); - static LLPreviewNotecard* getInstance(const LLUUID& uuid); - static void onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, @@ -104,16 +95,14 @@ protected: bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); - virtual const char *getTitleName() const { return "Note"; } - protected: LLViewerTextEditor* mEditor; LLButton* mSaveBtn; LLUUID mAssetID; - LLUUID mNotecardItemID; LLUUID mObjectID; + BOOL mShowKeepDiscard; }; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 0bacb95d2d..9de2f38aff 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -40,6 +40,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldir.h" +#include "llfloaterreg.h" #include "llinventorymodel.h" #include "llkeyboard.h" #include "lllineeditor.h" @@ -48,6 +49,8 @@ #include "llscrollbar.h" #include "llscrollcontainer.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "llslider.h" #include "lscript_rt_interface.h" #include "lscript_export.h" @@ -87,7 +90,7 @@ #include "llappviewer.h" #include "llpanelinventory.h" - +#include "lltrans.h" const std::string HELLO_LSL = "default\n" @@ -109,34 +112,8 @@ const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate? // Description and header information -const S32 SCRIPT_BORDER = 4; -const S32 SCRIPT_PAD = 5; -const S32 SCRIPT_BUTTON_WIDTH = 128; -const S32 SCRIPT_BUTTON_HEIGHT = 24; // HACK: Use BTN_HEIGHT where possible. -const S32 LINE_COLUMN_HEIGHT = 14; -const S32 BTN_PAD = 8; - -const S32 SCRIPT_EDITOR_MIN_HEIGHT = 2 * SCROLLBAR_SIZE + 2 * LLPANEL_BORDER_WIDTH + 128; - -const S32 SCRIPT_MIN_WIDTH = - 2 * SCRIPT_BORDER + - 2 * SCRIPT_BUTTON_WIDTH + - SCRIPT_PAD + RESIZE_HANDLE_WIDTH + - SCRIPT_PAD; - -const S32 SCRIPT_MIN_HEIGHT = - 2 * SCRIPT_BORDER + - 3*(SCRIPT_BUTTON_HEIGHT + SCRIPT_PAD) + - LINE_COLUMN_HEIGHT + - SCRIPT_EDITOR_MIN_HEIGHT; - const S32 MAX_EXPORT_SIZE = 1000; -const S32 SCRIPT_SEARCH_WIDTH = 300; -const S32 SCRIPT_SEARCH_HEIGHT = 120; -const S32 SCRIPT_SEARCH_LABEL_WIDTH = 50; -const S32 SCRIPT_SEARCH_BUTTON_WIDTH = 80; -const S32 TEXT_EDIT_COLUMN_HEIGHT = 16; const S32 MAX_HISTORY_COUNT = 10; const F32 LIVE_HELP_REFRESH_TIME = 1.f; @@ -152,9 +129,10 @@ static bool have_script_upload_cap(LLUUID& object_id) class LLFloaterScriptSearch : public LLFloater { public: - LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core); + LLFloaterScriptSearch(LLScriptEdCore* editor_core); ~LLFloaterScriptSearch(); + /*virtual*/ BOOL postBuild(); static void show(LLScriptEdCore* editor_core); static void onBtnSearch(void* userdata); void handleBtnSearch(); @@ -168,8 +146,6 @@ public: LLScriptEdCore* getEditorCore() { return mEditorCore; } static LLFloaterScriptSearch* getInstance() { return sInstance; } - void open(); /*Flawfinder: ignore*/ - private: LLScriptEdCore* mEditorCore; @@ -179,28 +155,14 @@ private: LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL; -LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core) - : LLFloater("script search",rect,title), mEditorCore(editor_core) +LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core) +: LLFloater(), + mEditorCore(editor_core) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); - childSetAction("search_btn", onBtnSearch,this); - childSetAction("replace_btn", onBtnReplace,this); - childSetAction("replace_all_btn", onBtnReplaceAll,this); - - setDefaultBtn("search_btn"); - - if (!getHost()) - { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - } - sInstance = this; - - childSetFocus("search_text", TRUE); - + // find floater in which script panel is embedded LLView* viewp = (LLView*)editor_core; while(viewp) @@ -215,26 +177,33 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLS } } +BOOL LLFloaterScriptSearch::postBuild() +{ + childSetAction("search_btn", onBtnSearch,this); + childSetAction("replace_btn", onBtnReplace,this); + childSetAction("replace_all_btn", onBtnReplaceAll,this); + + setDefaultBtn("search_btn"); + + return TRUE; +} + //static void LLFloaterScriptSearch::show(LLScriptEdCore* editor_core) { if (sInstance && sInstance->mEditorCore && sInstance->mEditorCore != editor_core) { - sInstance->close(); + sInstance->closeFloater(); delete sInstance; } if (!sInstance) { - S32 left = 0; - S32 top = 0; - gFloaterView->getNewFloaterPosition(&left,&top); - // sInstance will be assigned in the constructor. - new LLFloaterScriptSearch("Script Search",LLRect(left,top,left + SCRIPT_SEARCH_WIDTH,top - SCRIPT_SEARCH_HEIGHT),editor_core); + new LLFloaterScriptSearch(editor_core); } - sInstance->open(); /*Flawfinder: ignore*/ + sInstance->openFloater(); } LLFloaterScriptSearch::~LLFloaterScriptSearch() @@ -281,19 +250,11 @@ void LLFloaterScriptSearch::handleBtnReplaceAll() mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); } -void LLFloaterScriptSearch::open() /*Flawfinder: ignore*/ -{ - LLFloater::open(); /*Flawfinder: ignore*/ - childSetFocus("search_text", TRUE); -} - /// --------------------------------------------------------------------------- /// LLScriptEdCore /// --------------------------------------------------------------------------- LLScriptEdCore::LLScriptEdCore( - const std::string& name, - const LLRect& rect, const std::string& sample, const std::string& help_url, const LLHandle& floater_handle, @@ -303,7 +264,7 @@ LLScriptEdCore::LLScriptEdCore( void* userdata, S32 bottom_pad) : - LLPanel( std::string("name"), rect ), + LLPanel(), mSampleText(sample), mHelpURL(help_url), mEditor( NULL ), @@ -321,19 +282,7 @@ LLScriptEdCore::LLScriptEdCore( setBorderVisible(FALSE); - LLUICtrlFactory::getInstance()->buildPanel(this, "floater_script_ed_panel.xml"); - - mErrorList = getChild("lsl errors"); - - mFunctions = getChild( "Insert..."); - - childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); - - mEditor = getChild("Script Editor"); - mEditor->setFollowsAll(); - mEditor->setHandleEditKeysDirectly(TRUE); - mEditor->setEnabled(TRUE); - mEditor->setWordWrap(TRUE); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_script_ed.xml"); std::vector funcs; std::vector tooltips; @@ -366,20 +315,6 @@ LLScriptEdCore::LLScriptEdCore( if (token->getColor() != color) mFunctions->add(wstring_to_utf8str(token->getToken())); } - - - childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); - childSetAction("Save_btn", onBtnSave,this); - - initMenu(); - - // Do the work that addTabPanel() normally does. - //LLRect tab_panel_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); - //tab_panel_rect.stretch( -LLPANEL_BORDER_WIDTH ); - //mCodePanel->setFollowsAll(); - //mCodePanel->translate( tab_panel_rect.mLeft - mCodePanel->getRect().mLeft, tab_panel_rect.mBottom - mCodePanel->getRect().mBottom); - //mCodePanel->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE ); - } LLScriptEdCore::~LLScriptEdCore() @@ -390,57 +325,78 @@ LLScriptEdCore::~LLScriptEdCore() LLFloaterScriptSearch* script_search = LLFloaterScriptSearch::getInstance(); if (script_search && script_search->getEditorCore() == this) { - script_search->close(); + script_search->closeFloater(); delete script_search; } } -void LLScriptEdCore::initMenu() +BOOL LLScriptEdCore::postBuild() { - LLMenuItemCallGL* menuItem = getChild("Save"); - menuItem->setMenuCallback(onBtnSave, this); - menuItem->setEnabledCallback(hasChanged); + mErrorList = getChild("lsl errors"); + + mFunctions = getChild( "Insert..."); + + childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); + + mEditor = getChild("Script Editor"); + mEditor->setFollowsAll(); + mEditor->setHandleEditKeysDirectly(TRUE); + mEditor->setEnabled(TRUE); + mEditor->setWordWrap(TRUE); + + childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this); + childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE)); + + initMenu(); + return TRUE; +} + +void LLScriptEdCore::initMenu() +{ + // *TODO: Skinning - make these callbacks data driven + LLMenuItemCallGL* menuItem; + + menuItem = getChild("Save"); + menuItem->setClickCallback(boost::bind(&LLScriptEdCore::doSave, this, FALSE)); + menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this)); menuItem = getChild("Revert All Changes"); - menuItem->setMenuCallback(onBtnUndoChanges, this); - menuItem->setEnabledCallback(hasChanged); + menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnUndoChanges, this)); + menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::hasChanged, this)); menuItem = getChild("Undo"); - menuItem->setMenuCallback(onUndoMenu, this); - menuItem->setEnabledCallback(enableUndoMenu); + menuItem->setClickCallback(boost::bind(&LLTextEditor::undo, mEditor)); + menuItem->setEnableCallback(boost::bind(&LLTextEditor::canUndo, mEditor)); menuItem = getChild("Redo"); - menuItem->setMenuCallback(onRedoMenu, this); - menuItem->setEnabledCallback(enableRedoMenu); + menuItem->setClickCallback(boost::bind(&LLTextEditor::redo, mEditor)); + menuItem->setEnableCallback(boost::bind(&LLTextEditor::canRedo, mEditor)); menuItem = getChild("Cut"); - menuItem->setMenuCallback(onCutMenu, this); - menuItem->setEnabledCallback(enableCutMenu); + menuItem->setClickCallback(boost::bind(&LLTextEditor::cut, mEditor)); + menuItem->setEnableCallback(boost::bind(&LLTextEditor::canCut, mEditor)); menuItem = getChild("Copy"); - menuItem->setMenuCallback(onCopyMenu, this); - menuItem->setEnabledCallback(enableCopyMenu); + menuItem->setClickCallback(boost::bind(&LLTextEditor::copy, mEditor)); + menuItem->setEnableCallback(boost::bind(&LLTextEditor::canCopy, mEditor)); menuItem = getChild("Paste"); - menuItem->setMenuCallback(onPasteMenu, this); - menuItem->setEnabledCallback(enablePasteMenu); + menuItem->setClickCallback(boost::bind(&LLTextEditor::paste, mEditor)); + menuItem->setEnableCallback(boost::bind(&LLTextEditor::canPaste, mEditor)); menuItem = getChild("Select All"); - menuItem->setMenuCallback(onSelectAllMenu, this); - menuItem->setEnabledCallback(enableSelectAllMenu); + menuItem->setClickCallback(boost::bind(&LLTextEditor::selectAll, mEditor)); + menuItem->setEnableCallback(boost::bind(&LLTextEditor::canSelectAll, mEditor)); menuItem = getChild("Search / Replace..."); - menuItem->setMenuCallback(onSearchMenu, this); - menuItem->setEnabledCallback(NULL); + menuItem->setClickCallback(boost::bind(&LLFloaterScriptSearch::show, this)); menuItem = getChild("Help..."); - menuItem->setMenuCallback(onBtnHelp, this); - menuItem->setEnabledCallback(NULL); + menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnHelp, this)); menuItem = getChild("LSL Wiki Help..."); - menuItem->setMenuCallback(onBtnDynamicHelp, this); - menuItem->setEnabledCallback(NULL); + menuItem->setClickCallback(boost::bind(&LLScriptEdCore::onBtnDynamicHelp, this)); } void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid) @@ -452,17 +408,16 @@ void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid) } } -BOOL LLScriptEdCore::hasChanged(void* userdata) +bool LLScriptEdCore::hasChanged() { - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; + if (!mEditor) return false; - return ((!self->mEditor->isPristine() || self->mEnableSave) && self->mHasScriptData); + return !mEditor->isPristine(); } void LLScriptEdCore::draw() { - BOOL script_changed = hasChanged(this); + BOOL script_changed = hasChanged(); childSetEnabled("Save_btn", script_changed); if( mEditor->hasFocus() ) @@ -470,8 +425,11 @@ void LLScriptEdCore::draw() S32 line = 0; S32 column = 0; mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap + LLStringUtil::format_map_t args; std::string cursor_pos; - cursor_pos = llformat("Line %d, Column %d", line, column ); + args["[LINE]"] = llformat ("%d", line); + args["[COLUMN]"] = llformat ("%d", column); + cursor_pos = LLTrans::getString("CursorPos", args); childSetText("line_col", cursor_pos); } else @@ -580,9 +538,7 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) // separate history items from full item list if (mLiveHelpHistorySize == 0) { - LLSD row; - row["columns"][0]["type"] = "separator"; - history_combo->addElement(row, ADD_TOP); + history_combo->addSeparator(ADD_TOP); } // delete all history items over history limit while(mLiveHelpHistorySize > MAX_HISTORY_COUNT - 1) @@ -612,7 +568,7 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) BOOL LLScriptEdCore::canClose() { - if(mForceClose || !hasChanged(this)) + if(mForceClose || !hasChanged()) { return TRUE; } @@ -631,14 +587,14 @@ bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLS { case 0: // "Yes" // close after saving - LLScriptEdCore::doSave( this, TRUE ); + doSave( TRUE ); break; case 1: // "No" mForceClose = TRUE; // This will close immediately because mForceClose is true, so we won't // infinite loop with these dialogs. JC - ((LLFloater*) getParent())->close(); + ((LLFloater*) getParent())->closeFloater(); break; case 2: // "Cancel" @@ -666,37 +622,33 @@ bool LLScriptEdCore::onHelpWebDialog(const LLSD& notification, const LLSD& respo return false; } -// static -void LLScriptEdCore::onBtnHelp(void* userdata) +void LLScriptEdCore::onBtnHelp() { - LLScriptEdCore* corep = (LLScriptEdCore*)userdata; LLSD payload; - payload["help_url"] = corep->mHelpURL; + payload["help_url"] = mHelpURL; LLNotifications::instance().add("WebLaunchLSLGuide", LLSD(), payload, onHelpWebDialog); } -// static -void LLScriptEdCore::onBtnDynamicHelp(void* userdata) +void LLScriptEdCore::onBtnDynamicHelp() { - LLScriptEdCore* corep = (LLScriptEdCore*)userdata; - - LLFloater* live_help_floater = corep->mLiveHelpHandle.get(); + LLFloater* live_help_floater = mLiveHelpHandle.get(); if (live_help_floater) { live_help_floater->setFocus(TRUE); - corep->updateDynamicHelp(TRUE); + updateDynamicHelp(TRUE); return; } - live_help_floater = new LLFloater(std::string("lsl_help")); + live_help_floater = new LLFloater(); LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml"); - ((LLFloater*)corep->getParent())->addDependentFloater(live_help_floater, TRUE); - live_help_floater->childSetCommitCallback("lock_check", onCheckLock, userdata); + LLFloater* parent = dynamic_cast(getParent()); + parent->addDependentFloater(live_help_floater, TRUE); + live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this); live_help_floater->childSetValue("lock_check", gSavedSettings.getBOOL("ScriptHelpFollowsCursor")); - live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, userdata); - live_help_floater->childSetAction("back_btn", onClickBack, userdata); - live_help_floater->childSetAction("fwd_btn", onClickForward, userdata); + live_help_floater->childSetCommitCallback("history_combo", onHelpComboCommit, this); + live_help_floater->childSetAction("back_btn", onClickBack, this); + live_help_floater->childSetAction("fwd_btn", onClickForward, this); LLWebBrowserCtrl* browser = live_help_floater->getChild("lsl_guide_html"); browser->setAlwaysRefresh(TRUE); @@ -704,8 +656,8 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) LLComboBox* help_combo = live_help_floater->getChild("history_combo"); LLKeywordToken *token; LLKeywords::keyword_iterator_t token_it; - for (token_it = corep->mEditor->keywordsBegin(); - token_it != corep->mEditor->keywordsEnd(); + for (token_it = mEditor->keywordsBegin(); + token_it != mEditor->keywordsEnd(); ++token_it) { token = token_it->second; @@ -714,10 +666,10 @@ void LLScriptEdCore::onBtnDynamicHelp(void* userdata) help_combo->sortByName(); // re-initialize help variables - corep->mLastHelpToken = NULL; - corep->mLiveHelpHandle = live_help_floater->getHandle(); - corep->mLiveHelpHistorySize = 0; - corep->updateDynamicHelp(TRUE); + mLastHelpToken = NULL; + mLiveHelpHandle = live_help_floater->getHandle(); + mLiveHelpHistorySize = 0; + updateDynamicHelp(TRUE); } //static @@ -805,154 +757,25 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) self->setHelpPage(self->mFunctions->getSimple()); } -// static -void LLScriptEdCore::doSave( void* userdata, BOOL close_after_save ) +void LLScriptEdCore::doSave( BOOL close_after_save ) { LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); - LLScriptEdCore* self = (LLScriptEdCore*) userdata; - - if( self->mSaveCallback ) + if( mSaveCallback ) { - self->mSaveCallback( self->mUserdata, close_after_save ); + mSaveCallback( mUserdata, close_after_save ); } } -// static -void LLScriptEdCore::onBtnSave(void* data) -{ - // do the save, but don't close afterwards - doSave(data, FALSE); -} -// static -void LLScriptEdCore::onBtnUndoChanges( void* userdata ) +void LLScriptEdCore::onBtnUndoChanges() { - LLScriptEdCore* self = (LLScriptEdCore*) userdata; - if( !self->mEditor->tryToRevertToPristineState() ) + if( !mEditor->tryToRevertToPristineState() ) { - LLNotifications::instance().add("ScriptCannotUndo", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleReloadFromServerDialog, self, _1, _2)); + LLNotifications::instance().add("ScriptCannotUndo", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleReloadFromServerDialog, this, _1, _2)); } } -void LLScriptEdCore::onSearchMenu(void* userdata) -{ - LLScriptEdCore* sec = (LLScriptEdCore*)userdata; - LLFloaterScriptSearch::show(sec); -} - -// static -void LLScriptEdCore::onUndoMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->undo(); -} - -// static -void LLScriptEdCore::onRedoMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->redo(); -} - -// static -void LLScriptEdCore::onCutMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->cut(); -} - -// static -void LLScriptEdCore::onCopyMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->copy(); -} - -// static -void LLScriptEdCore::onPasteMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->paste(); -} - -// static -void LLScriptEdCore::onSelectAllMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->selectAll(); -} - -// static -void LLScriptEdCore::onDeselectMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return; - self->mEditor->deselect(); -} - -// static -BOOL LLScriptEdCore::enableUndoMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canUndo(); -} - -// static -BOOL LLScriptEdCore::enableRedoMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canRedo(); -} - -// static -BOOL LLScriptEdCore::enableCutMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canCut(); -} - -// static -BOOL LLScriptEdCore::enableCopyMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canCopy(); -} - -// static -BOOL LLScriptEdCore::enablePasteMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canPaste(); -} - -// static -BOOL LLScriptEdCore::enableSelectAllMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canSelectAll(); -} - -// static -BOOL LLScriptEdCore::enableDeselectMenu(void* userdata) -{ - LLScriptEdCore* self = (LLScriptEdCore*)userdata; - if (!self || !self->mEditor) return FALSE; - return self->mEditor->canDeselect(); -} - // static void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) { @@ -960,8 +783,7 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) LLScrollListItem* item = self->mErrorList->getFirstSelected(); if(item) { - // *FIX: This fucked up little hack is here because we don't - // have a grep library. This is very brittle code. + // *FIX: replace with boost grep S32 row = 0; S32 column = 0; const LLScrollListCell* cell = item->getColumn(0); @@ -1080,8 +902,7 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata) LLPreviewLSL *self = (LLPreviewLSL*)userdata; - self->mScriptEd = new LLScriptEdCore("script panel", - LLRect(), + self->mScriptEd = new LLScriptEdCore( HELLO_LSL, HELP_LSL_URL, self->getHandle(), @@ -1095,49 +916,32 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata) } -LLPreviewLSL::LLPreviewLSL(const std::string& name, const LLRect& rect, - const std::string& title, const LLUUID& item_id ) -: LLPreview( name, rect, title, item_id, LLUUID::null, TRUE, - SCRIPT_MIN_WIDTH, SCRIPT_MIN_HEIGHT ), - mPendingUploads(0) +LLPreviewLSL::LLPreviewLSL(const LLSD& key ) + : LLPreview( key ), + mPendingUploads(0) { + mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_preview.xml", FALSE); +} - LLRect curRect = rect; - - - LLCallbackMap::map_t factory_map; - factory_map["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this); - - - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_preview.xml", &factory_map); - +// virtual +BOOL LLPreviewLSL::postBuild() +{ const LLInventoryItem* item = getItem(); childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - if (!getFloaterHost() && !getHost() && getAssetStatus() == PREVIEW_ASSET_UNLOADED) - { - loadAsset(); - } - - setTitle(title); - - if (!getHost()) - { - reshape(curRect.getWidth(), curRect.getHeight(), TRUE); - setRect(curRect); - } + return LLPreview::postBuild(); } // virtual void LLPreviewLSL::callbackLSLCompileSucceeded() { llinfos << "LSL Bytecode saved" << llendl; - // *TODO: Translate - mScriptEd->mErrorList->addCommentText(std::string("Compile successful!")); - mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); + mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful")); + mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); closeIfNeeded(); } @@ -1228,16 +1032,10 @@ void LLPreviewLSL::closeIfNeeded() mPendingUploads--; if (mPendingUploads <= 0 && mCloseAfterSave) { - close(); + closeFloater(); } } -//override the llpreview open which attempts to load asset, load after xml ui made -void LLPreviewLSL::open() /*Flawfinder: ignore*/ -{ - LLFloater::open(); /*Flawfinder: ignore*/ -} - void LLPreviewLSL::onSearchReplace(void* userdata) { LLPreviewLSL* self = (LLPreviewLSL*)userdata; @@ -1267,7 +1065,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) void LLPreviewLSL::saveIfNeeded() { // llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl; - if(!LLScriptEdCore::hasChanged(mScriptEd)) + if(!mScriptEd->hasChanged()) { return; } @@ -1440,7 +1238,7 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 } // Find our window and close it if requested. - LLPreviewLSL* self = (LLPreviewLSL*)LLPreview::find(info->mItemUUID); + LLPreviewLSL* self = LLFloaterReg::findTypedInstance("preview_script", info->mItemUUID); if (self) { getWindow()->decBusyCount(); @@ -1448,7 +1246,7 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 if (self->mPendingUploads <= 0 && self->mCloseAfterSave) { - self->close(); + self->closeFloater(); } } } @@ -1470,7 +1268,7 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d LLPreviewLSL* self = NULL; if(instance_uuid) { - self = LLPreviewLSL::getInstance(*instance_uuid); + self = LLFloaterReg::findTypedInstance("preview_script", *instance_uuid); } if (0 == status) { @@ -1487,7 +1285,7 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d if (self->mPendingUploads <= 0 && self->mCloseAfterSave) { - self->close(); + self->closeFloater(); } } } @@ -1508,7 +1306,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset lldebugs << "LLPreviewLSL::onLoadComplete: got uuid " << asset_uuid << llendl; LLUUID* item_uuid = (LLUUID*)user_data; - LLPreviewLSL* preview = LLPreviewLSL::getInstance(*item_uuid); + LLPreviewLSL* preview = LLFloaterReg::findTypedInstance("preview_script", *item_uuid); if( preview ) { if(0 == status) @@ -1559,37 +1357,10 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset delete item_uuid; } -// static -LLPreviewLSL* LLPreviewLSL::getInstance( const LLUUID& item_uuid ) -{ - LLPreview* instance = NULL; - preview_map_t::iterator found_it = LLPreview::sInstances.find(item_uuid); - if(found_it != LLPreview::sInstances.end()) - { - instance = found_it->second; - } - return (LLPreviewLSL*)instance; -} - -void LLPreviewLSL::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLPreview::reshape( width, height, called_from_parent ); - - if( !isMinimized() ) - { - // So that next time you open a script it will have the same height and width - // (although not the same position). - gSavedSettings.setRect("PreviewScriptRect", getRect()); - } -} - /// --------------------------------------------------------------------------- /// LLLiveLSLEditor /// --------------------------------------------------------------------------- -LLMap LLLiveLSLEditor::sInstances; - - //static void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) @@ -1597,8 +1368,7 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) LLLiveLSLEditor *self = (LLLiveLSLEditor*)userdata; - self->mScriptEd = new LLScriptEdCore("script ed panel", - LLRect(), + self->mScriptEd = new LLScriptEdCore( HELLO_LSL, HELP_LSL_URL, self->getHandle(), @@ -1612,72 +1382,40 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata) } -LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name, - const LLRect& rect, - const std::string& title, - const LLUUID& object_id, - const LLUUID& item_id) : - LLPreview(name, rect, title, item_id, object_id, TRUE, SCRIPT_MIN_WIDTH, SCRIPT_MIN_HEIGHT), - mObjectID(object_id), - mItemID(item_id), +LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) : + LLPreview(key), mScriptEd(NULL), mAskedForRunningInfo(FALSE), mHaveRunningInfo(FALSE), mCloseAfterSave(FALSE), mPendingUploads(0), - mIsModifiable(FALSE) + mIsModifiable(FALSE), + mIsNew(false) { + mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", FALSE); +} - - BOOL is_new = FALSE; - if(mItemID.isNull()) - { - mItemID.generate(); - is_new = TRUE; - } - - - LLLiveLSLEditor::sInstances.addData(mItemID ^ mObjectID, this); - - LLCallbackMap::map_t factory_map; - factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); - - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); - - mMonoCheckbox = getChild("mono"); - childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this); - childSetEnabled("mono", FALSE); - +BOOL LLLiveLSLEditor::postBuild() +{ childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this); childSetEnabled("running", FALSE); childSetAction("Reset",&LLLiveLSLEditor::onReset,this); childSetEnabled("Reset", TRUE); + mMonoCheckbox = getChild("mono"); + childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this); + childSetEnabled("mono", FALSE); mScriptEd->mEditor->makePristine(); - loadAsset(is_new); mScriptEd->mEditor->setFocus(TRUE); - - if (!getHost()) - { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - } - - setTitle(title); + return LLPreview::postBuild(); } LLLiveLSLEditor::~LLLiveLSLEditor() { - LLLiveLSLEditor::sInstances.removeData(mItemID ^ mObjectID); -} - -// this is called via LLPreview::loadAsset() virtual method -void LLLiveLSLEditor::loadAsset() -{ - loadAsset(FALSE); } // virtual @@ -1686,9 +1424,8 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, bool is_script_running) { lldebugs << "LSL Bytecode saved" << llendl; - // *TODO: Translate - mScriptEd->mErrorList->addCommentText(std::string("Compile successful!")); - mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); + mScriptEd->mErrorList->setCommentText(LLTrans::getString("Compilesuccessful")); + mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); closeIfNeeded(); } @@ -1711,16 +1448,15 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) closeIfNeeded(); } -void LLLiveLSLEditor::loadAsset(BOOL is_new) +void LLLiveLSLEditor::loadAsset() { //llinfos << "LLLiveLSLEditor::loadAsset()" << llendl; - if(!is_new) + if(!mIsNew) { - LLViewerObject* object = gObjectList.findObject(mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectUUID); if(object) { - // HACK! we "know" that mItemID refers to a LLViewerInventoryItem... - LLViewerInventoryItem* item = (LLViewerInventoryItem*)object->getInventoryObject(mItemID); + LLViewerInventoryItem* item = dynamic_cast(object->getInventoryObject(mItemUUID)); if(item && (gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE) || gAgent.isGodlike())) @@ -1744,23 +1480,23 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) else if(item && mItem.notNull()) { // request the text from the object - LLUUID* user_data = new LLUUID(mItemID ^ mObjectID); + LLUUID* user_data = new LLUUID(mItemUUID); // ^ mObjectUUID gAssetStorage->getInvItemAsset(object->getRegion()->getHost(), - gAgent.getID(), - gAgent.getSessionID(), - item->getPermissions().getOwner(), - object->getID(), - item->getUUID(), - item->getAssetUUID(), - item->getType(), - &LLLiveLSLEditor::onLoadComplete, - (void*)user_data, - TRUE); + gAgent.getID(), + gAgent.getSessionID(), + item->getPermissions().getOwner(), + object->getID(), + item->getUUID(), + item->getAssetUUID(), + item->getType(), + &LLLiveLSLEditor::onLoadComplete, + (void*)user_data, + TRUE); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_GetScriptRunning); msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, mObjectID); - msg->addUUIDFast(_PREHASH_ItemID, mItemID); + msg->addUUIDFast(_PREHASH_ObjectID, mObjectUUID); + msg->addUUIDFast(_PREHASH_ItemID, mItemUUID); msg->sendReliable(object->getRegion()->getHost()); mAskedForRunningInfo = TRUE; mAssetStatus = PREVIEW_ASSET_LOADING; @@ -1789,26 +1525,12 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) gMessageSystem->addUUID("AgentID", gAgent.getID()); U32 local_id = object->getLocalID(); gMessageSystem->addData("LocalID", &local_id); - gMessageSystem->addUUID("ItemID", mItemID); + gMessageSystem->addUUID("ItemID", mItemUUID); LLHost host(object->getRegion()->getIP(), object->getRegion()->getPort()); gMessageSystem->sendReliable(host); */ } - - // Initialization of the asset failed. Probably the result - // of a bug somewhere else. Set up this editor in a no-go mode. - if(mItem.isNull()) - { - // Set the inventory item to an incomplete item. - // This may be better than having a accessible null pointer around, - // though this newly allocated object will most likely be replaced. - mItem = new LLViewerInventoryItem(); - mScriptEd->setScriptText(LLStringUtil::null, FALSE); - mScriptEd->mEditor->makePristine(); - mScriptEd->mEditor->setEnabled(FALSE); - mAssetStatus = PREVIEW_ASSET_LOADED; - } } else { @@ -1817,17 +1539,17 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); - mItem = new LLViewerInventoryItem(mItemID, - mObjectID, - perm, - LLUUID::null, - LLAssetType::AT_LSL_TEXT, - LLInventoryType::IT_LSL, - DEFAULT_SCRIPT_NAME, - DEFAULT_SCRIPT_DESC, - LLSaleInfo::DEFAULT, - LLInventoryItem::II_FLAGS_NONE, - time_corrected()); + mItem = new LLViewerInventoryItem(mItemUUID, + mObjectUUID, + perm, + LLUUID::null, + LLAssetType::AT_LSL_TEXT, + LLInventoryType::IT_LSL, + DEFAULT_SCRIPT_NAME, + DEFAULT_SCRIPT_DESC, + LLSaleInfo::DEFAULT, + LLInventoryItem::II_FLAGS_NONE, + time_corrected()); mAssetStatus = PREVIEW_ASSET_LOADED; } } @@ -1839,12 +1561,12 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, { lldebugs << "LLLiveLSLEditor::onLoadComplete: got uuid " << asset_id << llendl; - LLLiveLSLEditor* instance = NULL; LLUUID* xored_id = (LLUUID*)user_data; - - if( LLLiveLSLEditor::sInstances.checkData(*xored_id) ) + + LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance("preview_scriptedit", *xored_id); + + if(instance ) { - instance = LLLiveLSLEditor::sInstances[*xored_id]; if( LL_ERR_NOERR == status ) { instance->loadScriptText(vfs, asset_id, type); @@ -1930,7 +1652,7 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) { LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; - LLViewerObject* object = gObjectList.findObject( self->mObjectID ); + LLViewerObject* object = gObjectList.findObject( self->mObjectUUID ); LLCheckBoxCtrl* runningCheckbox = self->getChild("running"); BOOL running = runningCheckbox->get(); //self->mRunningCheckbox->get(); @@ -1942,8 +1664,8 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata ) msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectID); - msg->addUUIDFast(_PREHASH_ItemID, self->mItemID); + msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectUUID); + msg->addUUIDFast(_PREHASH_ItemID, self->mItemUUID); msg->addBOOLFast(_PREHASH_Running, running); msg->sendReliable(object->getRegion()->getHost()); } @@ -1958,7 +1680,7 @@ void LLLiveLSLEditor::onReset(void *userdata) { LLLiveLSLEditor* self = (LLLiveLSLEditor*) userdata; - LLViewerObject* object = gObjectList.findObject( self->mObjectID ); + LLViewerObject* object = gObjectList.findObject( self->mObjectUUID ); if(object) { LLMessageSystem* msg = gMessageSystem; @@ -1967,8 +1689,8 @@ void LLLiveLSLEditor::onReset(void *userdata) msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Script); - msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectID); - msg->addUUIDFast(_PREHASH_ItemID, self->mItemID); + msg->addUUIDFast(_PREHASH_ObjectID, self->mObjectUUID); + msg->addUUIDFast(_PREHASH_ItemID, self->mItemUUID); msg->sendReliable(object->getRegion()->getHost()); } else @@ -1979,7 +1701,7 @@ void LLLiveLSLEditor::onReset(void *userdata) void LLLiveLSLEditor::draw() { - LLViewerObject* object = gObjectList.findObject(mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectUUID); LLCheckBoxCtrl* runningCheckbox = getChild( "running"); if(object && mAskedForRunningInfo && mHaveRunningInfo) { @@ -2024,14 +1746,13 @@ void LLLiveLSLEditor::draw() { // HACK: Display this information in the title bar. // Really ought to put in main window. - // *TODO: Translate - setTitle(std::string("Script (object out of range)")); + setTitle(LLTrans::getString("ObjectOutOfRange")); runningCheckbox->setEnabled(FALSE); // object may have fallen out of range. mHaveRunningInfo = FALSE; } - LLFloater::draw(); + LLPreview::draw(); } @@ -2083,15 +1804,14 @@ void LLLiveLSLEditor::saveIfNeeded() // name on save, because the viewer object version of the item, // and the editor version would get out of synch. Here's a good // place to synch them back up. - // HACK! we "know" that mItemID refers to a LLInventoryItem... - LLInventoryItem* inv_item = (LLInventoryItem*)object->getInventoryObject(mItemID); + LLInventoryItem* inv_item = dynamic_cast(object->getInventoryObject(mItemUUID)); if(inv_item) { mItem->copyItem(inv_item); } // Don't need to save if we're pristine - if(!LLScriptEdCore::hasChanged(mScriptEd)) + if(!mScriptEd->hasChanged()) { return; } @@ -2145,8 +1865,7 @@ void LLLiveLSLEditor::saveIfNeeded() BOOL is_running = getChild( "running")->get(); if (!url.empty()) { - uploadAssetViaCaps(url, filename, mObjectID, - mItemID, is_running); + uploadAssetViaCaps(url, filename, mObjectID, mItemUUID, is_running); } else if (gAssetStorage) { @@ -2238,8 +1957,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, else { llinfos << "Compile worked!" << llendl; - // *TODO: Translate - mScriptEd->mErrorList->addCommentText(std::string("Compile successful, saving...")); + mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessfulSaving")); if(gAssetStorage) { llinfos << "LLLiveLSLEditor::saveAsset " @@ -2283,7 +2001,7 @@ void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_da } else { - LLLiveLSLEditor* self = sInstances.getIfThere(data->mItem->getUUID() ^ data->mObjectID); + LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance("preview_scriptedit", data->mItem->getUUID()); // ^ data->mObjectID if (self) { self->getWindow()->decBusyCount(); @@ -2291,7 +2009,7 @@ void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_da if (self->mPendingUploads <= 0 && self->mCloseAfterSave) { - self->close(); + self->closeFloater(); } } } @@ -2308,20 +2026,18 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use if(0 ==status) { llinfos << "LSL Bytecode saved" << llendl; - LLUUID xor_id = data->mItem->getUUID() ^ data->mObjectID; - LLLiveLSLEditor* self = sInstances.getIfThere(xor_id); - if(self) + LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance("preview_scriptedit", data->mItem->getUUID()); // ^ data->mObjectID + if (self) { // Tell the user that the compile worked. - // *TODO: Translate - self->mScriptEd->mErrorList->addCommentText(std::string("Save complete.")); + self->mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); // close the window if this completes both uploads self->getWindow()->decBusyCount(); self->mPendingUploads--; if (self->mPendingUploads <= 0 && self->mCloseAfterSave) { - self->close(); + self->closeFloater(); } } LLViewerObject* object = gObjectList.findObject(data->mObjectID); @@ -2349,11 +2065,6 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use delete data; } -void LLLiveLSLEditor::open() -{ - LLFloater::open(); /*Flawfinder: ignore*/ -} - BOOL LLLiveLSLEditor::canClose() { return (mScriptEd->canClose()); @@ -2365,7 +2076,7 @@ void LLLiveLSLEditor::closeIfNeeded() mPendingUploads--; if (mPendingUploads <= 0 && mCloseAfterSave) { - close(); + closeFloater(); } } @@ -2384,42 +2095,6 @@ void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save) self->saveIfNeeded(); } -// static -LLLiveLSLEditor* LLLiveLSLEditor::show(const LLUUID& script_id, const LLUUID& object_id) -{ - LLLiveLSLEditor* instance = NULL; - LLUUID xored_id = script_id ^ object_id; - if(LLLiveLSLEditor::sInstances.checkData(xored_id)) - { - // Move the existing view to the front - instance = LLLiveLSLEditor::sInstances[xored_id]; - instance->open(); /*Flawfinder: ignore*/ - } - return instance; -} - -// static -void LLLiveLSLEditor::hide(const LLUUID& script_id, const LLUUID& object_id) -{ - LLUUID xored_id = script_id ^ object_id; - if( LLLiveLSLEditor::sInstances.checkData( xored_id ) ) - { - LLLiveLSLEditor* instance = LLLiveLSLEditor::sInstances[xored_id]; - if(instance->getParent()) - { - instance->getParent()->removeChild(instance); - } - delete instance; - } -} -// static -LLLiveLSLEditor* LLLiveLSLEditor::find(const LLUUID& script_id, const LLUUID& object_id) -{ - LLUUID xored_id = script_id ^ object_id; - return sInstances.getIfThere(xored_id); -} - - // static void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) { @@ -2427,10 +2102,10 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) LLUUID object_id; msg->getUUIDFast(_PREHASH_Script, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_Script, _PREHASH_ItemID, item_id); - LLUUID xored_id = item_id ^ object_id; - if(LLLiveLSLEditor::sInstances.checkData(xored_id)) + + LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance("preview_scriptedit", item_id); // ^ object_id + if(instance) { - LLLiveLSLEditor* instance = LLLiveLSLEditor::sInstances[xored_id]; instance->mHaveRunningInfo = TRUE; BOOL running; msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); @@ -2444,18 +2119,6 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) } } -void LLLiveLSLEditor::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLFloater::reshape( width, height, called_from_parent ); - - if( !isMinimized() ) - { - // So that next time you open a script it will have the same height and width - // (although not the same position). - gSavedSettings.setRect("PreviewScriptRect", getRect()); - } -} - void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) { LLLiveLSLEditor* self = static_cast(userdata); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index eb8b414709..623886101a 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -63,8 +63,6 @@ class LLScriptEdCore : public LLPanel public: LLScriptEdCore( - const std::string& name, - const LLRect& rect, const std::string& sample, const std::string& help_url, const LLHandle& floater_handle, @@ -78,45 +76,30 @@ public: void initMenu(); virtual void draw(); - + /*virtual*/ BOOL postBuild(); BOOL canClose(); void setScriptText(const std::string& text, BOOL is_valid); + + void doSave( BOOL close_after_save ); bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response); bool handleReloadFromServerDialog(const LLSD& notification, const LLSD& response); static bool onHelpWebDialog(const LLSD& notification, const LLSD& response); - static void onBtnHelp(void* userdata); - static void onBtnDynamicHelp(void* userdata); static void onCheckLock(LLUICtrl*, void*); static void onHelpComboCommit(LLUICtrl* ctrl, void* userdata); static void onClickBack(void* userdata); static void onClickForward(void* userdata); static void onBtnInsertSample(void*); static void onBtnInsertFunction(LLUICtrl*, void*); - static void doSave( void* userdata, BOOL close_after_save ); - static void onBtnSave(void*); - static void onBtnUndoChanges(void*); - static void onSearchMenu(void* userdata); - - static void onUndoMenu(void* userdata); - static void onRedoMenu(void* userdata); - static void onCutMenu(void* userdata); - static void onCopyMenu(void* userdata); - static void onPasteMenu(void* userdata); - static void onSelectAllMenu(void* userdata); - static void onDeselectMenu(void* userdata); - - static BOOL enableUndoMenu(void* userdata); - static BOOL enableRedoMenu(void* userdata); - static BOOL enableCutMenu(void* userdata); - static BOOL enableCopyMenu(void* userdata); - static BOOL enablePasteMenu(void* userdata); - static BOOL enableSelectAllMenu(void* userdata); - static BOOL enableDeselectMenu(void* userdata); - - static BOOL hasChanged(void* userdata); + +private: + void onBtnHelp(); + void onBtnDynamicHelp(); + void onBtnUndoChanges(); + + bool hasChanged(); void selectFirstError(); @@ -131,8 +114,6 @@ protected: void addHelpItemToHistory(const std::string& help_string); static void onErrorList(LLUICtrl*, void* user_data); - virtual const char *getTitleName() const { return "Script"; } - private: std::string mSampleText; std::string mHelpURL; @@ -160,17 +141,15 @@ private: class LLPreviewLSL : public LLPreview { public: - LLPreviewLSL(const std::string& name, const LLRect& rect, const std::string& title, - const LLUUID& item_uuid ); + LLPreviewLSL(const LLSD& key ); virtual void callbackLSLCompileSucceeded(); virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - /*virtual*/ void open(); /*Flawfinder: ignore*/ + /*virtual*/ BOOL postBuild(); protected: virtual BOOL canClose(); void closeIfNeeded(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void loadAsset(); void saveIfNeeded(); @@ -190,15 +169,13 @@ protected: void* user_data, S32 status, LLExtStat ext_status); static void onSaveComplete(const LLUUID& uuid, void* user_data, S32 status, LLExtStat ext_status); static void onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); -public: - static LLPreviewLSL* getInstance(const LLUUID& uuid); + protected: static void* createScriptEdPanel(void* userdata); protected: - virtual const char *getTitleName() const { return "Script"; } LLScriptEdCore* mScriptEd; // Can safely close only after both text and bytecode are uploaded S32 mPendingUploads; @@ -210,16 +187,10 @@ protected: class LLLiveLSLEditor : public LLPreview { public: - LLLiveLSLEditor(const std::string& name, const LLRect& rect, - const std::string& title, - const LLUUID& object_id, const LLUUID& item_id); + LLLiveLSLEditor(const LLSD& key); ~LLLiveLSLEditor(); - static LLLiveLSLEditor* show(const LLUUID& item_id, const LLUUID& object_id); - static void hide(const LLUUID& item_id, const LLUUID& object_id); - static LLLiveLSLEditor* find(const LLUUID& item_id, const LLUUID& object_id); - static void processScriptRunningReply(LLMessageSystem* msg, void**); virtual void callbackLSLCompileSucceeded(const LLUUID& task_id, @@ -227,14 +198,14 @@ public: bool is_script_running); virtual void callbackLSLCompileFailed(const LLSD& compile_errors); - // Overide LLPreview::open() to avoid calling loadAsset twice. - /*virtual*/ void open(); /*Flawfinder: ignore*/ - -protected: + /*virtual*/ BOOL postBuild(); + + void setIsNew() { mIsNew = TRUE; } + +private: virtual BOOL canClose(); void closeIfNeeded(); virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void loadAsset(); void loadAsset(BOOL is_new); @@ -248,6 +219,8 @@ protected: LLViewerObject* object, const LLTransactionID& tid, BOOL is_running); + BOOL monoChecked() const; + static void onSearchReplace(void* userdata); static void onLoad(void* userdata); @@ -268,30 +241,23 @@ protected: static void* createScriptEdPanel(void* userdata); + static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); -protected: - LLUUID mObjectID; - LLUUID mItemID; // The inventory item this script is associated with - BOOL mIsNew; - LLScriptEdCore* mScriptEd; +private: + bool mIsNew; + LLScriptEdCore* mScriptEd; //LLUUID mTransmitID; - LLCheckBoxCtrl *mRunningCheckbox; - BOOL mAskedForRunningInfo; - BOOL mHaveRunningInfo; - LLButton *mResetButton; + LLCheckBoxCtrl* mRunningCheckbox; + BOOL mAskedForRunningInfo; + BOOL mHaveRunningInfo; + LLButton* mResetButton; LLPointer mItem; - BOOL mCloseAfterSave; + BOOL mCloseAfterSave; // need to save both text and script, so need to decide when done - S32 mPendingUploads; + S32 mPendingUploads; - static LLMap sInstances; BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert -private: - - static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); - BOOL monoChecked() const; - LLCheckBoxCtrl* mMonoCheckbox; BOOL mIsModifiable; }; diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index 26d8da5a6b..7e7be5b2c6 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -49,12 +49,23 @@ extern LLAgent gAgent; const F32 SOUND_GAIN = 1.0f; -LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid) : - LLPreview( name, rect, title, item_uuid, object_uuid) +LLPreviewSound::LLPreviewSound(const LLSD& key) + : LLPreview( key ) { - - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml"); + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml", FALSE); +} +// virtual +BOOL LLPreviewSound::postBuild() +{ + const LLInventoryItem* item = getItem(); + if (item) + { + childSetText("desc", item->getDescription()); + if (gAudiop) + gAudiop->preloadSound(item->getAssetUUID()); // preload the sound + } + childSetAction("Sound play btn",&LLPreviewSound::playSound,this); childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this); @@ -64,26 +75,10 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons button = getChild("Sound audition btn"); button->setSoundFlags(LLView::SILENT); - const LLInventoryItem* item = getItem(); - childSetCommitCallback("desc", LLPreview::onText, this); - childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); - - // preload the sound - if(item && gAudiop) - { - gAudiop->preloadSound(item->getAssetUUID()); - } - - setTitle(title); - - if (!getHost()) - { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - } + return LLPreview::postBuild(); } // static diff --git a/indra/newview/llpreviewsound.h b/indra/newview/llpreviewsound.h index 061fbdf685..c4bf8c9a30 100644 --- a/indra/newview/llpreviewsound.h +++ b/indra/newview/llpreviewsound.h @@ -38,16 +38,13 @@ class LLPreviewSound : public LLPreview { public: - LLPreviewSound(const std::string& name, const LLRect& rect, const std::string& title, - const LLUUID& item_uuid, - const LLUUID& object_uuid = LLUUID::null); + LLPreviewSound(const LLSD& key); static void playSound( void* userdata ); static void auditionSound( void* userdata ); protected: - virtual const char *getTitleName() const { return "Sound"; } - + /* virtual */ BOOL postBuild(); }; #endif // LL_LLPREVIEWSOUND_H diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 13e7cca464..3204006e43 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -37,10 +37,12 @@ #include "llagent.h" #include "llbutton.h" #include "llfilepicker.h" +#include "llfloaterreg.h" #include "llimagetga.h" #include "llinventoryview.h" #include "llinventory.h" #include "llresmgr.h" +#include "lltrans.h" #include "lltextbox.h" #include "lltextureview.h" #include "llui.h" @@ -50,30 +52,24 @@ #include "llviewerwindow.h" #include "lllineeditor.h" -const S32 PREVIEW_TEXTURE_MIN_WIDTH = 300; -const S32 PREVIEW_TEXTURE_MIN_HEIGHT = 120; - const S32 CLIENT_RECT_VPAD = 4; const F32 SECONDS_TO_SHOW_FILE_SAVED_MSG = 8.f; -LLPreviewTexture::LLPreviewTexture(const std::string& name, - const LLRect& rect, - const std::string& title, - const LLUUID& item_uuid, - const LLUUID& object_id, - BOOL show_keep_discard) -: LLPreview(name, rect, title, item_uuid, object_id, TRUE, PREVIEW_TEXTURE_MIN_WIDTH, PREVIEW_TEXTURE_MIN_HEIGHT ), - mLoadingFullImage( FALSE ), - mShowKeepDiscard(show_keep_discard), - mCopyToInv(FALSE), - mIsCopyable(FALSE), - mLastHeight(0), - mLastWidth(0) +LLPreviewTexture::LLPreviewTexture(const LLSD& key) + : LLPreview( key ), + mLoadingFullImage( FALSE ), + mShowKeepDiscard(FALSE), + mCopyToInv(FALSE), + mIsCopyable(FALSE), + mUpdateDimensions(TRUE), + mLastHeight(0), + mLastWidth(0) { const LLInventoryItem *item = getItem(); if(item) { + mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID(); mImageID = item->getAssetUUID(); const LLPermissions& perm = item->getPermissions(); U32 mask = PERM_NONE; @@ -94,52 +90,14 @@ LLPreviewTexture::LLPreviewTexture(const std::string& name, mIsCopyable = TRUE; } } - - init(); - - setTitle(title); - - if (!getHost()) + else // not an item, assume it's an asset id { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); + mImageID = mItemUUID; + mCopyToInv = TRUE; + mIsCopyable = TRUE; } -} - - -// Note: uses asset_id as a dummy item id. -LLPreviewTexture::LLPreviewTexture( - const std::string& name, - const LLRect& rect, - const std::string& title, - const LLUUID& asset_id, - BOOL copy_to_inv) - : - LLPreview( - name, - rect, - title, - asset_id, - LLUUID::null, - TRUE, - PREVIEW_TEXTURE_MIN_WIDTH, - PREVIEW_TEXTURE_MIN_HEIGHT ), - mImageID(asset_id), - mLoadingFullImage( FALSE ), - mShowKeepDiscard(FALSE), - mCopyToInv(copy_to_inv), - mIsCopyable(TRUE), - mLastHeight(0), - mLastWidth(0) -{ - init(); - - setTitle(title); - - LLRect curRect = getRect(); - translate(curRect.mLeft - rect.mLeft, curRect.mTop - rect.mTop); - + //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_texture.xml", FALSE); } @@ -153,32 +111,26 @@ LLPreviewTexture::~LLPreviewTexture() mImage = NULL; } - -void LLPreviewTexture::init() +// virtual +BOOL LLPreviewTexture::postBuild() { - - if (mCopyToInv) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_embedded_texture.xml"); - - childSetAction("Copy To Inventory",LLPreview::onBtnCopyToInv,this); + getChild("Keep")->setLabel(getString("Copy")); + childSetAction("Keep",LLPreview::onBtnCopyToInv,this); + childSetVisible("Discard", false); } - else if (mShowKeepDiscard) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_texture_keep_discard.xml"); - childSetAction("Keep",onKeepBtn,this); childSetAction("Discard",onDiscardBtn,this); } - - else + else { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_texture.xml"); + childSetVisible("Keep", false); + childSetVisible("Discard", false); } - - + if (!mCopyToInv) { const LLInventoryItem* item = getItem(); @@ -190,12 +142,17 @@ void LLPreviewTexture::init() childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); } } + + return LLPreview::postBuild(); } void LLPreviewTexture::draw() { - updateDimensions(); - + if (mUpdateDimensions) + { + updateDimensions(); + } + LLPreview::draw(); if (!isMinimized()) @@ -241,11 +198,11 @@ void LLPreviewTexture::draw() if( mLoadingFullImage ) { - // *TODO: Translate - LLFontGL::getFontSansSerif()->renderUTF8(std::string("Receiving:"), 0, + LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving:"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, + LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); F32 data_progress = mImage->mDownloadProgress; @@ -278,11 +235,11 @@ void LLPreviewTexture::draw() else if( !mSavedFileTimer.hasExpired() ) { - // *TODO: Translate - LLFontGL::getFontSansSerif()->renderUTF8(std::string("File Saved"), 0, + LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("FileSaved"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, + LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); } } @@ -300,10 +257,11 @@ BOOL LLPreviewTexture::canSaveAs() const // virtual void LLPreviewTexture::saveAs() { - if( mLoadingFullImage ) return; + if( mLoadingFullImage ) + return; LLFilePicker& file_picker = LLFilePicker::instance(); - const LLViewerInventoryItem* item = getItem() ; + const LLInventoryItem* item = getItem() ; if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TGA, item ? LLDir::getScrubbedFileName(item->getName()) : LLStringUtil::null) ) { // User canceled or we failed to acquire save file. @@ -317,6 +275,23 @@ void LLPreviewTexture::saveAs() 0, TRUE, FALSE, new LLUUID( mItemUUID ) ); } +// virtual +void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent) +{ +// mLastHeight = 0; +// mLastWidth = 0; + mUpdateDimensions = TRUE; + LLPreview::reshape(width, height, called_from_parent); +} + +// virtual +void LLPreviewTexture::onFocusReceived() +{ + mLastHeight = 0; + mLastWidth = 0; + mUpdateDimensions = TRUE; + LLPreview::onFocusReceived(); +} // static void LLPreviewTexture::onFileLoadedForSave(BOOL success, @@ -328,12 +303,8 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, void* userdata) { LLUUID* item_uuid = (LLUUID*) userdata; - LLPreviewTexture* self = NULL; - preview_map_t::iterator found_it = LLPreview::sInstances.find(*item_uuid); - if(found_it != LLPreview::sInstances.end()) - { - self = (LLPreviewTexture*) found_it->second; - } + + LLPreviewTexture* self = LLFloaterReg::findTypedInstance("preview_texture", *item_uuid); if( final || !success ) { @@ -381,8 +352,11 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, // When we receive it, reshape the window accordingly. void LLPreviewTexture::updateDimensions() { - if (!mImage) return; - + if (!mImage) + return; + + mUpdateDimensions = FALSE; + S32 image_height = llmax(1, mImage->getHeight(0)); S32 image_width = llmax(1, mImage->getWidth(0)); // Attempt to make the image 1:1 on screen. @@ -400,7 +374,7 @@ void LLPreviewTexture::updateDimensions() client_width /= 2; client_height /= 2; } - + S32 view_width = client_width + horiz_pad; S32 view_height = client_height + vert_pad; @@ -427,27 +401,36 @@ void LLPreviewTexture::updateDimensions() view_width = llmax(view_width, getMinWidth()); view_height = llmax(view_height, getMinHeight()); - if (client_height != mLastHeight || client_width != mLastWidth) + if (view_height != mLastHeight || view_width != mLastWidth) { - mLastWidth = client_width; - mLastHeight = client_height; - - S32 old_top = getRect().mTop; - S32 old_left = getRect().mLeft; if (getHost()) { getHost()->growToFit(view_width, view_height); + reshape( view_width, view_height ); + setOrigin( 0, getHost()->getRect().getHeight() - (view_height + PREVIEW_HEADER_SIZE) ); } else { + S32 old_top = getRect().mTop; + S32 old_left = getRect().mLeft; reshape( view_width, view_height ); S32 new_bottom = old_top - getRect().getHeight(); setOrigin( old_left, new_bottom ); - // Try to keep whole view onscreen, don't allow partial offscreen. + } + + // Try to keep whole view onscreen, don't allow partial offscreen. + if (getHost()) + gFloaterView->adjustToFitScreen(getHost(), FALSE); + else gFloaterView->adjustToFitScreen(this, FALSE); + + if (image_height > 1 && image_width > 1) + { + // Resize until we know the image's height + mLastWidth = view_width; + mLastHeight = view_height; } } - if (!mUserResized) { @@ -484,6 +467,7 @@ void LLPreviewTexture::loadAsset() mImage = gImageList.getImage(mImageID, MIPMAP_TRUE, FALSE); mImage->setBoostLevel(LLViewerImage::BOOST_PREVIEW); mAssetStatus = PREVIEW_ASSET_LOADING; + updateDimensions(); } LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus() diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 75fd39eab0..45b173e7bf 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -43,19 +43,7 @@ class LLImageRaw; class LLPreviewTexture : public LLPreview { public: - LLPreviewTexture( - const std::string& name, - const LLRect& rect, - const std::string& title, - const LLUUID& item_uuid, - const LLUUID& object_id, - BOOL show_keep_discard = FALSE); - LLPreviewTexture( - const std::string& name, - const LLRect& rect, - const std::string& title, - const LLUUID& asset_id, - BOOL copy_to_inv = FALSE); + LLPreviewTexture(const LLSD& key); ~LLPreviewTexture(); virtual void draw(); @@ -65,7 +53,10 @@ public: virtual void loadAsset(); virtual EAssetStatus getAssetStatus(); - + + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void onFocusReceived(); + static void saveToFile(void* userdata); static void onFileLoadedForSave( BOOL success, @@ -79,9 +70,8 @@ public: protected: void init(); + /* virtual */ BOOL postBuild(); - virtual const char *getTitleName() const { return "Texture"; } - private: void updateDimensions(); LLUUID mImageID; @@ -91,13 +81,14 @@ private: LLFrameTimer mSavedFileTimer; BOOL mShowKeepDiscard; BOOL mCopyToInv; - + // This is stored off in a member variable, because the save-as // button and drag and drop functionality need to know. BOOL mIsCopyable; S32 mLastHeight; S32 mLastWidth; + BOOL mUpdateDimensions; }; diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index bfd14f709a..38d617e468 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -42,6 +42,7 @@ #include "llfontgl.h" #include "llimagegl.h" #include "lltimer.h" +#include "lltextbox.h" #include "llglheaders.h" #include "llagent.h" @@ -68,9 +69,9 @@ const F32 TOTAL_LOGIN_TIME = 10.f; // seconds, wild guess at time from GL contex S32 gLastStartAnimationFrame = 0; // human-style indexing, first image = 1 const S32 ANIMATION_FRAMES = 1; //13; -// XUI:translate -LLProgressView::LLProgressView(const std::string& name, const LLRect &rect) -: LLPanel(name, rect, FALSE), +// XUI: Translate +LLProgressView::LLProgressView(const LLRect &rect) +: LLPanel(), mPercentDone( 0.f ), mURLInMessage(false), mMouseDownInActiveArea( false ) @@ -84,7 +85,7 @@ BOOL LLProgressView::postBuild() mProgressBar = getChild("login_progress_bar"); mCancelBtn = getChild("cancel_btn"); - mCancelBtn->setClickedCallback( LLProgressView::onCancelButtonClicked ); + mCancelBtn->setClickedCallback( LLProgressView::onCancelButtonClicked, NULL ); mFadeTimer.stop(); getChild("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle())); diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 9517ee1321..83574ff52a 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -43,7 +43,7 @@ class LLProgressBar; class LLProgressView : public LLPanel { public: - LLProgressView(const std::string& name, const LLRect& rect); + LLProgressView(const LLRect& rect); virtual ~LLProgressView(); BOOL postBuild(); diff --git a/indra/newview/llrecentpeople.cpp b/indra/newview/llrecentpeople.cpp new file mode 100644 index 0000000000..0c16cea004 --- /dev/null +++ b/indra/newview/llrecentpeople.cpp @@ -0,0 +1,69 @@ +/** + * @file llrecentpeople.cpp + * @brief List of people with which the user has recently interacted. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llrecentpeople.h" + +#include "llagent.h" + +using namespace LLOldEvents; + +bool LLRecentPeople::add(const LLUUID& id) +{ + if (contains(id) || id == gAgent.getID()) + return false; + + mList.insert(id); + mChangedSignal(); + return true; +} + +bool LLRecentPeople::contains(const LLUUID& id) const +{ + return mList.find(id) != mList.end(); +} + +void LLRecentPeople::get(std::vector& result) const +{ + result.clear(); + for (std::set::const_iterator pos = mList.begin(); pos != mList.end(); ++pos) + result.push_back(*pos); +} + +// virtual +bool LLRecentPeople::handleEvent(LLPointer event, const LLSD& userdata) +{ + (void) userdata; + add(event->getValue().asUUID()); + return true; +} diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h new file mode 100644 index 0000000000..fce4b8d42b --- /dev/null +++ b/indra/newview/llrecentpeople.h @@ -0,0 +1,101 @@ +/** + * @file llrecentpeople.h + * @brief List of people with which the user has recently interacted. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLRECENTPEOPLE_H +#define LL_LLRECENTPEOPLE_H + +#include "llevent.h" +#include "llsingleton.h" +#include "lluuid.h" + +#include +#include +#include + +/** + * List of people the agent recently interacted with. + * + * Includes: anyone with whom the user IM'd or called + * (1:1 and ad-hoc but not SL Group chat), + * anyone with whom the user has had a transaction + * (inventory offer, friend request, etc), + * and anyone that has chatted within chat range of the user in-world. + * + *TODO: purge least recently added items? + */ +class LLRecentPeople: public LLSingleton, public LLOldEvents::LLSimpleListener +{ + LOG_CLASS(LLRecentPeople); +public: + typedef boost::signal signal_t; + + /** + * Add specified avatar to the list if it's not there already. + * + * @param id avatar to add. + * @return false if the avatar is in the list already, true otherwisr + */ + bool add(const LLUUID& id); + + /** + * @param id avatar to search. + * @return true if the avatar is in the list, false otherwise. + */ + bool contains(const LLUUID& id) const; + + /** + * Get the whole list. + * + * @param result where to put the result. + */ + void get(std::vector& result) const; + + /** + * Set callback to be called when the list changed. + * + * Multiple callbacks can be set. + * + * @return no connection; use boost::bind + boost::signal::trackable to disconnect slots. + */ + void setChangedCallback(const signal_t::slot_type& cb) { mChangedSignal.connect(cb); } + + /** + * LLSimpleListener interface. + */ + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + +private: + std::set mList; + signal_t mChangedSignal; +}; + +#endif // LL_LLRECENTPEOPLE_H diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index 8ff4dea2b1..fe4e8b5d0c 100644 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -34,8 +34,7 @@ #include "llviewerprecompiledheaders.h" -#include "llagent.h" -#include "llremoteparcelrequest.h" +#include "message.h" #include "llpanelplace.h" #include "llpanel.h" @@ -43,37 +42,120 @@ #include "llsdserialize.h" #include "llviewerregion.h" #include "llview.h" -#include "message.h" -LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle place_panel_handle) -{ - mPlacePanelHandle = place_panel_handle; -} -/*virtual*/ +#include "llagent.h" +#include "llremoteparcelrequest.h" + + +LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle observer_handle) + : mObserverHandle(observer_handle) +{} + +//If we get back a normal response, handle it here +//virtual void LLRemoteParcelRequestResponder::result(const LLSD& content) { LLUUID parcel_id = content["parcel_id"]; - LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get(); + mObserverHandle.get()->setParcelID(parcel_id); +} + +//If we get back an error (not found, etc...), handle it here +//virtual +void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason) +{ + llinfos << "LLRemoteParcelRequest::error(" + << status << ": " << reason << ")" << llendl; + + mObserverHandle.get()->setErrorStatus(status, reason); +} - if(place_panelp) +void LLRemoteParcelInfoProcessor::addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer) +{ + // Check if the observer is alredy in observsrs list for this UUID + observer_multimap_t::iterator it; + + it = mObservers.find(parcel_id); + while (it != mObservers.end()) { - place_panelp->setParcelID(parcel_id); + if (it->second == observer) + { + return; + } + else + { + ++it; + } } + mObservers.insert(std::pair(parcel_id, observer)); } -/*virtual*/ -void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason) +void LLRemoteParcelInfoProcessor::removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer) { - llinfos << "LLRemoteParcelRequest::error(" - << status << ": " << reason << ")" << llendl; - LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get(); + if (!observer) + { + return; + } - if(place_panelp) + observer_multimap_t::iterator it; + + it = mObservers.find(parcel_id); + while (it != mObservers.end()) { - place_panelp->setErrorStatus(status, reason); + if (it->second == observer) + { + mObservers.erase(it); + break; + } + else + { + ++it; + } } +} +//static +void LLRemoteParcelInfoProcessor::processParcelInfoReply(LLMessageSystem* msg, void**) +{ + LLParcelData parcel_data; + + msg->getUUID ("Data", "ParcelID", parcel_data.parcel_id); + msg->getUUID ("Data", "OwnerID", parcel_data.owner_id); + msg->getString ("Data", "Name", parcel_data.name); + msg->getString ("Data", "Desc", parcel_data.desc); + msg->getS32 ("Data", "ActualArea", parcel_data.actual_area); + msg->getS32 ("Data", "BillableArea", parcel_data.billable_area); + msg->getU8 ("Data", "Flags", parcel_data.flags); + msg->getF32 ("Data", "GlobalX", parcel_data.global_x); + msg->getF32 ("Data", "GlobalY", parcel_data.global_y); + msg->getF32 ("Data", "GlobalZ", parcel_data.global_z); + msg->getString ("Data", "SimName", parcel_data.sim_name); + msg->getUUID ("Data", "SnapshotID", parcel_data.snapshot_id); + msg->getF32 ("Data", "Dwell", parcel_data.dwell); + msg->getS32 ("Data", "SalePrice", parcel_data.sale_price); + msg->getS32 ("Data", "AuctionID", parcel_data.auction_id); + + LLRemoteParcelInfoProcessor::observer_multimap_t observers = LLRemoteParcelInfoProcessor::getInstance()->mObservers; + + observer_multimap_t::iterator oi = observers.find(parcel_data.parcel_id); + observer_multimap_t::iterator end = observers.upper_bound(parcel_data.parcel_id); + for (; oi != end; ++oi) + { + oi->second->processParcelInfo(parcel_data); + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_data.parcel_id, oi->second); + } } +void LLRemoteParcelInfoProcessor::sendParcelInfoRequest(const LLUUID& parcel_id) +{ + LLMessageSystem *msg = gMessageSystem; + + msg->newMessage("ParcelInfoRequest"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("Data"); + msg->addUUID("ParcelID", parcel_id); + gAgent.sendReliableMessage(); +} diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index c92ee3ff3a..3a16e25ef6 100644 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -38,17 +38,73 @@ #include "llhttpclient.h" #include "llpanel.h" +class LLRemoteParcelInfoObserver; + class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder { public: - LLRemoteParcelRequestResponder(LLHandle place_panel_handle); + LLRemoteParcelRequestResponder(LLHandle observer_handle); + //If we get back a normal response, handle it here - virtual void result(const LLSD& content); + /*virtual*/ void result(const LLSD& content); + //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason); + /*virtual*/ void error(U32 status, const std::string& reason); + +protected: + LLHandle mObserverHandle; +}; + +struct LLParcelData +{ + LLUUID parcel_id; + LLUUID owner_id; + std::string name; + std::string desc; + S32 actual_area; + S32 billable_area; + U8 flags; + F32 global_x; + F32 global_y; + F32 global_z; + std::string sim_name; + LLUUID snapshot_id; + F32 dwell; + S32 sale_price; + S32 auction_id; +}; + +// An interface class for panels which display parcel information +// like name, description, area, snapshot etc. +class LLRemoteParcelInfoObserver +{ +public: + LLRemoteParcelInfoObserver() { mObserverHandle.bind(this); } + virtual ~LLRemoteParcelInfoObserver() {} + virtual void processParcelInfo(const LLParcelData& parcel_data) = 0; + virtual void setParcelID(const LLUUID& parcel_id) = 0; + virtual void setErrorStatus(U32 status, const std::string& reason) = 0; + LLHandle getObserverHandle() const { return mObserverHandle; } protected: - LLHandle mPlacePanelHandle; + LLRootHandle mObserverHandle; +}; + +class LLRemoteParcelInfoProcessor : public LLSingleton +{ +public: + virtual ~LLRemoteParcelInfoProcessor() {} + + void addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer); + void removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer); + + void sendParcelInfoRequest(const LLUUID& parcel_id); + + static void processParcelInfoReply(LLMessageSystem* msg, void**); + +private: + typedef std::multimap observer_multimap_t; + observer_multimap_t mObservers; }; #endif // LL_LLREMOTEPARCELREQUEST_H diff --git a/indra/newview/llrootview.h b/indra/newview/llrootview.h new file mode 100644 index 0000000000..af9517f922 --- /dev/null +++ b/indra/newview/llrootview.h @@ -0,0 +1,55 @@ +/** + * @file llrootview.h + * @brief Mother of all Views + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLROOTVIEW_H +#define LL_LLROOTVIEW_H + +#include "llview.h" +#include "lluictrlfactory.h" + +class LLRootViewRegistry : public LLWidgetRegistry +{}; + +class LLRootView : public LLView +{ +public: + LLRootView(const Params& p) + : LLView(p) + {} + + const widget_registry_t& getChildRegistry() const + { + // use default widget registry + return LLRootViewRegistry::instance(); + } +}; +#endif //LL_LLROOTVIEW_H diff --git a/indra/newview/llsavedsettingsglue.cpp b/indra/newview/llsavedsettingsglue.cpp index 073b51f80e..4736afa7ba 100644 --- a/indra/newview/llsavedsettingsglue.cpp +++ b/indra/newview/llsavedsettingsglue.cpp @@ -39,37 +39,27 @@ #include "llviewercontrol.h" -void LLSavedSettingsGlue::setBOOL(LLUICtrl* ctrl, void* data) +void LLSavedSettingsGlue::setBOOL(LLUICtrl* ctrl, const std::string& name) { - const char* name = (const char*)data; - LLSD value = ctrl->getValue(); - gSavedSettings.setBOOL(name, value.asBoolean()); + gSavedSettings.setBOOL(name, ctrl->getValue().asBoolean()); } -void LLSavedSettingsGlue::setS32(LLUICtrl* ctrl, void* data) +void LLSavedSettingsGlue::setS32(LLUICtrl* ctrl, const std::string& name) { - const char* name = (const char*)data; - LLSD value = ctrl->getValue(); - gSavedSettings.setS32(name, value.asInteger()); + gSavedSettings.setS32(name, ctrl->getValue().asInteger()); } -void LLSavedSettingsGlue::setF32(LLUICtrl* ctrl, void* data) +void LLSavedSettingsGlue::setF32(LLUICtrl* ctrl, const std::string& name) { - const char* name = (const char*)data; - LLSD value = ctrl->getValue(); - gSavedSettings.setF32(name, (F32)value.asReal()); + gSavedSettings.setF32(name, (F32)ctrl->getValue().asReal()); } -void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, void* data) +void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, const std::string& name) { - const char* name = (const char*)data; - LLSD value = ctrl->getValue(); - gSavedSettings.setU32(name, (U32)value.asInteger()); + gSavedSettings.setU32(name, (U32)ctrl->getValue().asInteger()); } -void LLSavedSettingsGlue::setString(LLUICtrl* ctrl, void* data) +void LLSavedSettingsGlue::setString(LLUICtrl* ctrl, const std::string& name) { - const char* name = (const char*)data; - LLSD value = ctrl->getValue(); - gSavedSettings.setString(name, value.asString()); + gSavedSettings.setString(name, ctrl->getValue().asString()); } diff --git a/indra/newview/llsavedsettingsglue.h b/indra/newview/llsavedsettingsglue.h index 8a0f36945c..6c8662dd58 100644 --- a/indra/newview/llsavedsettingsglue.h +++ b/indra/newview/llsavedsettingsglue.h @@ -42,11 +42,11 @@ class LLUICtrl; class LLSavedSettingsGlue { public: - static void setBOOL(LLUICtrl* ctrl, void* name); - static void setS32(LLUICtrl* ctrl, void* name); - static void setF32(LLUICtrl* ctrl, void* name); - static void setU32(LLUICtrl* ctrl, void* name); - static void setString(LLUICtrl* ctrl, void* name); + static void setBOOL(LLUICtrl* ctrl, const std::string& name); + static void setS32(LLUICtrl* ctrl, const std::string& name); + static void setF32(LLUICtrl* ctrl, const std::string& name); + static void setU32(LLUICtrl* ctrl, const std::string& name); + static void setString(LLUICtrl* ctrl, const std::string& name); }; #endif diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 0c6b2980dc..ed7c7dce12 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -79,7 +79,7 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerstats.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvovolume.h" #include "pipeline.h" @@ -100,10 +100,10 @@ const S32 MAX_OBJECTS_PER_PACKET = 254; // Globals // -BOOL gDebugSelectMgr = FALSE; +//BOOL gDebugSelectMgr = FALSE; -BOOL gHideSelectedObjects = FALSE; -BOOL gAllowSelectAvatar = FALSE; +//BOOL gHideSelectedObjects = FALSE; +//BOOL gAllowSelectAvatar = FALSE; BOOL LLSelectMgr::sRectSelectInclusive = TRUE; BOOL LLSelectMgr::sRenderHiddenSelections = TRUE; @@ -172,6 +172,9 @@ LLObjectSelection *get_null_object_selection() // LLSelectMgr() //----------------------------------------------------------------------------- LLSelectMgr::LLSelectMgr() + : mHideSelectedObjects(LLCachedControl(gSavedSettings, "HideSelectedObjects", FALSE)), + mAllowSelectAvatar( LLCachedControl(gSavedSettings, "AllowSelectAvatar", FALSE)), + mDebugSelectMgr(LLCachedControl(gSavedSettings, "DebugSelectMgr", FALSE)) { mTEMode = FALSE; mLastCameraPos.clearVec(); @@ -184,12 +187,12 @@ LLSelectMgr::LLSelectMgr() sHighlightUAnim = gSavedSettings.getF32("SelectionHighlightUAnim"); sHighlightVAnim = gSavedSettings.getF32("SelectionHighlightVAnim"); - sSilhouetteParentColor = gColors.getColor("SilhouetteParentColor"); - sSilhouetteChildColor = gColors.getColor("SilhouetteChildColor"); - sHighlightParentColor = gColors.getColor("HighlightParentColor"); - sHighlightChildColor = gColors.getColor("HighlightChildColor"); - sHighlightInspectColor = gColors.getColor("HighlightInspectColor"); - sContextSilhouetteColor = gColors.getColor("ContextSilhouetteColor")*0.5f; + sSilhouetteParentColor =gSavedSkinSettings.getColor("SilhouetteParentColor"); + sSilhouetteChildColor = gSavedSkinSettings.getColor("SilhouetteChildColor"); + sHighlightParentColor = gSavedSkinSettings.getColor("HighlightParentColor"); + sHighlightChildColor = gSavedSkinSettings.getColor("HighlightChildColor"); + sHighlightInspectColor = gSavedSkinSettings.getColor("HighlightInspectColor"); + sContextSilhouetteColor = gSavedSkinSettings.getColor("ContextSilhouetteColor")*0.5f; sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius"); @@ -202,6 +205,8 @@ LLSelectMgr::LLSelectMgr() mSelectedObjects = new LLObjectSelection(); mHoverObjects = new LLObjectSelection(); mHighlightedObjects = new LLObjectSelection(); + + } @@ -673,7 +678,7 @@ void LLSelectMgr::addAsFamily(std::vector& objects, BOOL add_to // Can't select yourself if (objectp->mID == gAgentID - && !gAllowSelectAvatar) + && !LLSelectMgr::getInstance()->mAllowSelectAvatar) { continue; } @@ -2691,7 +2696,7 @@ void LLSelectMgr::selectDelete() } LLNotification::Params params("ConfirmObjectDeleteLock"); - params.functor(boost::bind(&LLSelectMgr::confirmDelete, _1, _2, getSelection())); + params.functor.function(boost::bind(&LLSelectMgr::confirmDelete, _1, _2, getSelection())); if(locked_but_deleteable_object || no_copy_but_deleteable_object || @@ -3443,7 +3448,7 @@ void LLSelectMgr::deselectAllIfTooFar() if (select_dist_sq > deselect_dist_sq) { - if (gDebugSelectMgr) + if (mDebugSelectMgr) { llinfos << "Selection manager: auto-deselecting, select_dist = " << fsqrtf(select_dist_sq) << llendl; llinfos << "agent pos global = " << gAgent.getPositionGlobal() << llendl; @@ -4444,9 +4449,9 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, desc); // the reporter widget askes the server for info about picked objects - if (request_flags & (COMPLAINT_REPORT_REQUEST | BUG_REPORT_REQUEST)) + if (request_flags & COMPLAINT_REPORT_REQUEST ) { - EReportType report_type = (COMPLAINT_REPORT_REQUEST & request_flags) ? COMPLAINT_REPORT : BUG_REPORT; + EReportType report_type = COMPLAINT_REPORT ; LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type); if (reporterp) { @@ -5387,10 +5392,7 @@ void dialog_refresh_all() gFloaterTools->dirty(); - if( gPieObject->getVisible() ) - { - gPieObject->arrange(); - } + gPieObject->needsArrange(); if( gPieAttachment->getVisible() ) { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index d6c4b5485d..992cc1e906 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -38,7 +38,8 @@ #include "llstring.h" #include "llundo.h" #include "lluuid.h" -#include "llmemory.h" +#include "llpointer.h" +#include "llsafehandle.h" #include "llsaleinfo.h" #include "llcategory.h" #include "v3dmath.h" @@ -48,7 +49,7 @@ #include "llbbox.h" #include "llpermissions.h" #include "llviewerobject.h" - +#include "llcontrol.h" #include #include "boost/iterator/filter_iterator.hpp" @@ -338,6 +339,7 @@ public: static BOOL sRectSelectInclusive; // do we need to surround an object to pick it? static BOOL sRenderHiddenSelections; // do we show selection silhouettes that are occluded? static BOOL sRenderLightRadius; // do we show the radius of selected lights? + static F32 sHighlightThickness; static F32 sHighlightUScale; static F32 sHighlightVScale; @@ -352,6 +354,10 @@ public: static LLColor4 sHighlightInspectColor; static LLColor4 sContextSilhouetteColor; + LLCachedControl mHideSelectedObjects; + LLCachedControl mAllowSelectAvatar; + LLCachedControl mDebugSelectMgr; + public: LLSelectMgr(); ~LLSelectMgr(); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp new file mode 100644 index 0000000000..e7008abe60 --- /dev/null +++ b/indra/newview/llsidetray.cpp @@ -0,0 +1,746 @@ +/** + * @file llsidetray.cpp + * @brief SideBar implementation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lltextbox.h" + +#include "llsidetray.h" +#include "llviewerwindow.h" +#include "llaccordionpanel.h" +#include "llfocusmgr.h" +#include "llrootview.h" + +#include "llcollapsiblectrl.h" + +#include "llfloater.h" //for gFloaterView +#include "lliconctrl.h"//for Home tab icon +#include "llwindow.h"//for SetCursor +#include "llbottomtray.h"//for reshape + +//#include "llscrollcontainer.h" + +using namespace std; + +static LLRootViewRegistry::Register t1("side_tray"); +static LLDefaultWidgetRegistry::Register t2("sidetray_tab"); + +static const std::string COLLAPSED_NAME = "<<"; +static const std::string EXPANDED_NAME = ">>"; + +static const std::string TAB_PANEL_CAPTION_NAME = "sidetray_tab_panel"; +static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title"; + +LLSideTray* LLSideTray::sInstance = 0; + +class LLSideTrayInfoPanel: public LLPanel +{ +protected: + LLSideTrayInfoPanel(){} +public: + static LLSideTrayInfoPanel* createInstance(const string& image, const string& name,const string& description) + { + LLSideTrayInfoPanel* panel = new LLSideTrayInfoPanel(); + LLUICtrlFactory::getInstance()->buildPanel(panel,"panel_sidetray_tab_info.xml"); + if(panel) + panel->setData(image, name,description); + panel->setBorderVisible(true); + return panel; + + } + void setData(const string& image, const string& name,const string& description) + { + getChild("tab_name",false,false)->setValue(name); + getChild("tab_description",false,false)->setValue(description); + getChild("tab_icon",false,false)->setValue(image); + } + + BOOL handleHover(S32 x, S32 y, MASK mask) + { + getWindow()->setCursor(UI_CURSOR_HAND); + return TRUE; + } + + BOOL handleMouseUp(S32 x, S32 y, MASK mask) + { + onCommit(); + return LLPanel::handleMouseUp(x,y,mask); + } + +}; + + +LLSideTray* LLSideTray::getInstance() +{ + if (!sInstance) + { + sInstance = LLUICtrlFactory::createFromFile("panel_side_tray.xml",gViewerWindow->getRootView()); + } + + return sInstance; +} + +bool LLSideTray::instanceCreated () +{ + return sInstance!=0; +} + +LLSideTrayTab::LLSideTrayTab(const Params& params):mAccordionPanel(0) + +{ + mImagePath = params.image_path; + mTabTitle = params.tab_title; + mDescription = params.tab_description; +} +LLSideTrayTab::~LLSideTrayTab() +{ +} + +void LLSideTrayTab::addPanel(LLPanel* panel) +{ + //addChild(panel,false); +} + +bool LLSideTrayTab::addChild(LLView* view, S32 tab_group) +{ + if(mAccordionPanel == 0) + { + mAccordionPanel = new LLAccordionPanel(); + mAccordionPanel->setVisible(TRUE); + LLPanel::addChild(mAccordionPanel,tab_group); + } + + + bool res = true; + if(TAB_PANEL_CAPTION_NAME != view->getName())//skip our caption panel + { + mAccordionPanel->addCollapsibleCtrl(view); + } + else + res = LLPanel::addChild(view,tab_group); + + return res; +} + + + +//virtual +BOOL LLSideTrayTab::postBuild() +{ + LLPanel* title_panel = LLUICtrlFactory::getInstance()->createFromFile("panel_side_tray_tab_caption.xml",this); + string name = title_panel->getName(); + LLPanel::addChild(title_panel); + + title_panel->getChild(TAB_PANEL_CAPTION_TITLE_BOX)->setValue(mTabTitle); + + static LLUICachedControl default_background_color ("FloaterDefaultBackgroundColor", *(new LLColor4)); + static LLUICachedControl focus_background_color ("FloaterFocusBackgroundColor", *(new LLColor4)); + + setTransparentColor(default_background_color); + setBackgroundColor(focus_background_color); + + return true; +} + +S32 LLSideTrayTab::getMaxSideBarTabWidth() +{ + return (mAccordionPanel)?mAccordionPanel->getMaxPanelWidth():0; +} + +static const S32 splitter_margin = 1; + +//virtual +void LLSideTrayTab::arrange(S32 width, S32 height ) +{ + S32 offset = 0; + + LLView* title_panel = getChildView(TAB_PANEL_CAPTION_NAME, true, false); + + if(title_panel) + { + title_panel->setOrigin( 0, height - title_panel->getRect().getHeight() ); + offset = title_panel->getRect().getHeight(); + } + + LLRect sRect = mAccordionPanel->getRect(); + sRect.setLeftTopAndSize( splitter_margin, height - offset - splitter_margin, width - 2*splitter_margin, height - offset - 2*splitter_margin); + mAccordionPanel->setRect(sRect); + + mAccordionPanel->setMaxWidth(sRect.getWidth()); + mAccordionPanel->arrange(); +} + +void LLSideTrayTab::reshape (S32 width, S32 height, BOOL called_from_parent ) +{ + if(!mAccordionPanel) + return; + S32 offset = 0; + + LLView* title_panel = getChildView(TAB_PANEL_CAPTION_NAME, true, false); + + if(title_panel) + { + title_panel->setOrigin( 0, height - title_panel->getRect().getHeight() ); + title_panel->reshape(width,title_panel->getRect().getHeight()); + offset = title_panel->getRect().getHeight(); + } + + + + LLRect sRect = mAccordionPanel->getRect(); + sRect.setLeftTopAndSize( splitter_margin, height - offset - splitter_margin, width - 2*splitter_margin, height - offset - 2*splitter_margin); + mAccordionPanel->setMaxWidth(sRect.getWidth()); + mAccordionPanel->reshape(sRect.getWidth(), sRect.getHeight()); + + mAccordionPanel->setRect(sRect); + +} + +void LLSideTrayTab::draw() +{ + LLPanel::draw(); + + //border + gl_rect_2d(0,0,getRect().getWidth() - 1,getRect().getHeight() - 1,LLColor4::black,false); + + +} + +void LLSideTrayTab::onOpen (const LLSD& key) +{ + mAccordionPanel->onOpen(key); +} + +LLSideTrayTab* LLSideTrayTab::createInstance () +{ + LLSideTrayTab::Params tab_params; + tab_params.tab_title("Home"); + + LLSideTrayTab* tab = LLUICtrlFactory::create(tab_params); + return tab; +} + + +//virtual +LLSideTray::LLSideTray(Params& params) + :mActiveTab(0) + ,mCollapsed(false) + ,mCollapseButton(0) + ,mMaxBarWidth(0) + ,mHomeTab(0) +{ + mCollapsed=params.collapsed; +} + + +BOOL LLSideTray::postBuild() +{ + calcMaxSideBarWidth(); + + createButtons(); + + createHomeTab(); + + arrange(); + selectTabByName("home_tab"); + + if(mCollapsed) + collapseSideBar(); + + setMouseOpaque(false); + return true; +} + +/** + * add new panel to tab with tab_name name + * @param tab_name - name of sidebar tab to add new panel + * @param panel - pointer to panel + */ +bool LLSideTray::addPanel ( const std::string& tab_name + ,LLPanel* panel ) +{ + return false; +} +/** + * Add new tab to side bar + * @param tab_name - name of the new tab + * @param image - image for new sidebar button + * @param title - title for new tab + */ +bool LLSideTray::addTab ( const std::string& tab_name + ,const std::string& image + ,const std::string& title) +{ + LLSideTrayTab::Params params; + params.image_path = image; + params.tab_title = title; + LLSideTrayTab* tab = LLUICtrlFactory::create (params); + addChild(tab,1); + return true; +} + + +LLSideTrayTab* LLSideTray::getTab(const std::string& name) +{ + return getChild(name,false,false); +} + + + +void LLSideTray::toggleTabButton (LLSideTrayTab* tab) +{ + if(tab == NULL) + return; + string name = tab->getName(); + std::map::iterator tIt = mTabButtons.find(name); + if(tIt!=mTabButtons.end()) + tIt->second->setToggleState(!tIt->second->getToggleState()); +} + +bool LLSideTray::selectTabByIndex(size_t index) +{ + if(index>=mTabs.size()) + return false; + + LLSideTrayTab* sidebar_tab = dynamic_cast(mTabs[index]); + if(sidebar_tab == NULL) + return false; + return selectTabByName(sidebar_tab->getName()); +} + +bool LLSideTray::selectTabByName (const std::string& name) +{ + LLSideTrayTab* side_bar = getTab(name); + if(side_bar == 0 && name == "home_tab") + side_bar = mHomeTab; + + if(side_bar == NULL || side_bar == mActiveTab) + return false; + //deselect old tab + toggleTabButton(mActiveTab); + if(mActiveTab) + mActiveTab->setVisible(false); + + //select new tab + mActiveTab = side_bar; + toggleTabButton(mActiveTab); + LLSD key;//empty + mActiveTab->onOpen(key); + + mActiveTab->setVisible(true); + + //arrange(); + + //hide all tabs - show active tab + child_vector_const_iter_t child_it; + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + sidebar_tab->setVisible(sidebar_tab == mActiveTab); + } + return true; +} + +LLButton* LLSideTray::createButton (const std::string& name,const std::string& image,LLUICtrl::commit_callback_t callback) +{ + static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); + + LLButton::Params bparams; + + LLRect rect; + rect.setOriginAndSize(0, 0, sidetray_params.default_button_width, sidetray_params.default_button_height); + + bparams.name(name); + bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_BOTTOM); + bparams.rect (rect); + bparams.tab_stop(false); + bparams.image_unselected.name(sidetray_params.tab_btn_image_normal); + bparams.image_selected.name(sidetray_params.tab_btn_image_selected); + bparams.image_disabled.name(sidetray_params.tab_btn_image_normal); + bparams.image_disabled_selected.name(sidetray_params.tab_btn_image_selected); + + LLButton* button = LLUICtrlFactory::create (bparams); + button->setLabel(name); + button->setClickedCallback(callback); + + if(image.length()) + { + button->setImageOverlay(image); + } + + addChildInBack(button); + + return button; +} + +bool LLSideTray::addChild(LLView* view, S32 tab_group) +{ + LLSideTrayTab* tab_panel = dynamic_cast(view); + + if (tab_panel) + { + mTabs.push_back(tab_panel); + } + + return LLUICtrl::addChild(view, tab_group); +} + + +void LLSideTray::createButtons () +{ + //create show/hide button + mCollapseButton = createButton(EXPANDED_NAME,"",boost::bind(&LLSideTray::onToggleCollapse, this)); + + //create buttons for tabs + child_vector_const_iter_t child_it; + + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + + string name = sidebar_tab->getName(); + + LLButton* button = createButton("",sidebar_tab->mImagePath,boost::bind(&LLSideTray::onTabButtonClick, this, sidebar_tab->getName())); + mTabButtons[sidebar_tab->getName()] = button; + } + +} + +void LLSideTray::onTabButtonClick(string name) +{ + + selectTabByName (name); + if(mCollapsed) + expandSideBar(); +} + +void LLSideTray::onToggleCollapse() +{ + if(mCollapsed) + { + expandSideBar(); + selectTabByName("home_tab"); + } + else + collapseSideBar(); +} + + +void LLSideTray::reflectCollapseChange() +{ + setPanelRect(); + + if(mCollapsed) + gFloaterView->setSnapOffsetRight(0); + else + gFloaterView->setSnapOffsetRight(mMaxBarWidth); + + gFloaterView->refresh(); + + setFocus( FALSE ); +} + +void LLSideTray::arrange () +{ + static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); + + calcMaxSideBarWidth(); + + + + setPanelRect(); + + LLRect ctrl_rect; + ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-sidetray_params.default_button_width + ,sidetray_params.default_button_width + ,sidetray_params.default_button_height); + + mCollapseButton->setRect(ctrl_rect); + + //arrange tab buttons + //arrange tab buttons + child_vector_const_iter_t child_it; + int offset = (sidetray_params.default_button_height+sidetray_params.default_button_margin)*2; + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + + ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-offset + ,sidetray_params.default_button_width + ,sidetray_params.default_button_height); + + if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end()) + continue; + + LLButton* btn = mTabButtons[sidebar_tab->getName()]; + + btn->setRect(ctrl_rect); + offset+=sidetray_params.default_button_height; + offset+=sidetray_params.default_button_margin; + + btn->setVisible(ctrl_rect.mBottom > 0); + } + + ctrl_rect.setLeftTopAndSize(sidetray_params.default_button_width,getRect().getHeight(),mMaxBarWidth,getRect().getHeight()); + + //arrange tabs + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + + sidebar_tab->setRect(ctrl_rect); + sidebar_tab->arrange(mMaxBarWidth,getRect().getHeight()); + } + + mHomeTab->setRect(ctrl_rect); + mHomeTab->arrange(mMaxBarWidth,getRect().getHeight()); + +} + +void LLSideTray::collapseSideBar () +{ + mCollapsed = true; + mCollapseButton->setLabel(COLLAPSED_NAME); + mActiveTab->setVisible(FALSE); + reflectCollapseChange(); + setFocus( FALSE ); + +} +void LLSideTray::expandSideBar () +{ + mCollapsed = false; + mCollapseButton->setLabel(EXPANDED_NAME); + mActiveTab->setVisible(TRUE); + + reflectCollapseChange(); + +} + +void LLSideTray::calcMaxSideBarWidth() +{ + + S32 max_bar_width = 0; + + + child_vector_const_iter_t child_it; + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + max_bar_width = llmax(max_bar_width,sidebar_tab->getMaxSideBarTabWidth()); + } + + if(max_bar_width > 0) + mMaxBarWidth = max_bar_width; + +} +void LLSideTray::highlightFocused() +{ + if(!mActiveTab) + return; + /* uncomment in case something change + BOOL dependent_has_focus = gFocusMgr.childHasKeyboardFocus(this); + setBackgroundOpaque( dependent_has_focus ); + mActiveTab->setBackgroundOpaque( dependent_has_focus ); + */ + mActiveTab->setBackgroundOpaque( true ); + + +} +//virtual +BOOL LLSideTray::handleMouseDown (S32 x, S32 y, MASK mask) +{ + BOOL ret = LLPanel::handleMouseDown(x,y,mask); + if(ret) + setFocus(true); + return ret; +} +void LLSideTray::reshape (S32 width, S32 height, BOOL called_from_parent) +{ + + LLPanel::reshape(width, height, called_from_parent); + if(!mActiveTab) + return; + + static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); + + setPanelRect(); + + LLRect ctrl_rect; + ctrl_rect.setLeftTopAndSize(0 + ,getRect().getHeight()-sidetray_params.default_button_width + ,sidetray_params.default_button_width + ,sidetray_params.default_button_height); + + mCollapseButton->setRect(ctrl_rect); + + //arrange tab buttons + child_vector_const_iter_t child_it; + int offset = (sidetray_params.default_button_height+sidetray_params.default_button_margin)*2; + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + + ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-offset + ,sidetray_params.default_button_width + ,sidetray_params.default_button_height); + + if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end()) + continue; + + LLButton* btn = mTabButtons[sidebar_tab->getName()]; + + btn->setRect(ctrl_rect); + offset+=sidetray_params.default_button_height; + offset+=sidetray_params.default_button_margin; + + btn->setVisible(ctrl_rect.mBottom > 0); + } + + //arrange tabs + + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + sidebar_tab->reshape(mMaxBarWidth,getRect().getHeight()); + ctrl_rect.setLeftTopAndSize(sidetray_params.default_button_width,getRect().getHeight(),mMaxBarWidth,getRect().getHeight()); + sidebar_tab->setRect(ctrl_rect); + + } + + mHomeTab->reshape(mMaxBarWidth,getRect().getHeight()); + ctrl_rect.setLeftTopAndSize(sidetray_params.default_button_width,getRect().getHeight(),mMaxBarWidth,getRect().getHeight()); + mHomeTab->setRect(ctrl_rect); + + +} + +/** + * Activate tab with "panel_name" panel + * if no such tab - return false, otherwise true + */ +bool LLSideTray::showPanel (const std::string& panel_name, const LLSD& params) +{ + //arrange tabs + child_vector_const_iter_t child_it; + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLView* view = (*child_it)->getChildView(panel_name,true,false); + if(view) + { + onTabButtonClick((*child_it)->getName()); + LLPanel* panel = dynamic_cast(view); + if(panel) + panel->onOpen(params); + return true; + } + } + return false; +} + +void LLSideTray::createHomeTab() +{ + mHomeTab = LLSideTrayTab::createInstance(); + child_vector_iter_t child_it; + for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) + { + LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); + if(sidebar_tab == NULL) + continue; + + LLPanel* panel = LLSideTrayInfoPanel::createInstance(sidebar_tab->mImagePath,sidebar_tab->getTabTitle(),sidebar_tab->getDescription()); + + panel->setCommitCallback(boost::bind(&LLSideTray::onTabButtonClick, this, sidebar_tab->getName())); + + LLCollapsibleCtrl::Params panel_params; + panel_params.display_children(true); + panel_params.collapsible(false); + panel_params.header_visible(false); + panel_params.can_resize(false); + panel_params.min_height(200); + panel_params.padding_left(10); + panel_params.padding_right(10); + panel_params.padding_top(5); + panel_params.padding_bottom(5); + + LLCollapsibleCtrl* ctrl = LLUICtrlFactory::create(panel_params); + + + ctrl->setPanel(panel); + ctrl->postBuild(); + mHomeTab->addChild(ctrl,0); + } + + mHomeTab->setBackgroundVisible(true); + mHomeTab->postBuild(); + + LLUICtrl::addChild(mHomeTab, 0); +} +static const S32 fake_offset = 132; +static const S32 fake_top_offset = 78; + +void LLSideTray::setPanelRect () +{ + static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); + + const LLRect& parent_rect = gViewerWindow->getRootView()->getRect(); + + S32 panel_width = sidetray_params.default_button_width+sidetray_params.default_button_margin; + if(!mCollapsed) + panel_width+=mMaxBarWidth; + + S32 panel_height = parent_rect.getHeight()-fake_top_offset; + panel_height -= LLBottomTray::getInstance()->getRect().getHeight(); + + LLRect panel_rect; + panel_rect.setLeftTopAndSize( parent_rect.mRight-panel_width, parent_rect.mTop-fake_top_offset, panel_width, panel_height); + setRect(panel_rect); +} + +S32 LLSideTray::getTrayWidth() +{ + static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); + return getRect().getWidth() - (sidetray_params.default_button_width + sidetray_params.default_button_margin); +} diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h new file mode 100644 index 0000000000..7d26925753 --- /dev/null +++ b/indra/newview/llsidetray.h @@ -0,0 +1,240 @@ +/** + * @file LLSideTray.h + * @brief SideBar header file + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLSIDETRAY_H_ +#define LL_LLSIDETRAY_H_ + +#include "llpanel.h" +#include "string" + +class LLSideTray; +class LLAccordionPanel; + +class LLSideTrayTab: public LLPanel +{ + friend class LLUICtrlFactory; + friend class LLSideTray; +public: + + struct Params + : public LLInitParam::Block + { + // image name + Optional image_path; + Optional tab_title; + Optional tab_description; + Params():image_path("image","") + ,tab_title("tab_title","no title") + ,tab_description("description","no description") + {}; + }; +protected: + LLSideTrayTab(const Params& params); + + + S32 getMaxSideBarTabWidth(); +public: + virtual ~LLSideTrayTab(); + + void addPanel (LLPanel* panel); + /*virtual*/ BOOL postBuild (); + /*virtual*/ bool addChild (LLView* view, S32 tab_group); + + + void arrange (S32 width, S32 height); + void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); + + static LLSideTrayTab* createInstance (); + + const std::string& getDescription () const { return mDescription;} + const std::string& getTabTitle() const { return mTabTitle;} + + void draw(); + + void onOpen (const LLSD& key); + +private: + std::string mTabTitle; + std::string mImagePath; + std::string mDescription; + + LLAccordionPanel* mAccordionPanel; +}; + + +class LLSideTray : public LLPanel +{ + friend class LLUICtrlFactory; +public: + + LOG_CLASS(LLSideTray); + + struct Params + : public LLInitParam::Block + { + // initial state + Optional collapsed; + Optional tab_btn_image_normal; + Optional tab_btn_image_selected; + + Optional default_button_width; + Optional default_button_height; + Optional default_button_margin; + + Params(): + collapsed("collapsed",false) + ,tab_btn_image_normal("tab_btn_image","sidebar_tab_left.tga") + ,tab_btn_image_selected("tab_btn_image_selected","button_enabled_selected_32x128.tga") + ,default_button_width("tab_btn_width",32) + ,default_button_height("tab_btn_height",32) + ,default_button_margin("tab_btn_margin",0) + {}; + }; + + static LLSideTray* getInstance (); + static bool instanceCreated (); +protected: + LLSideTray(Params& params); + typedef std::vector child_vector_t; + typedef child_vector_t::iterator child_vector_iter_t; + typedef child_vector_t::const_iterator child_vector_const_iter_t; + typedef child_vector_t::reverse_iterator child_vector_reverse_iter_t; + typedef child_vector_t::const_reverse_iterator child_vector_const_reverse_iter_t; + +public: + + // interface functions + + /** + * Select tab with specific name and set it active + */ + bool selectTabByName (const std::string& name); + + /** + * Select tab with specific index and set it active + */ + bool selectTabByIndex(size_t index); + + /** + * add new panel to tab with tab_name name + * @param tab_name - name of sidebar tab to add new panel + * @param panel - pointer to panel + */ + bool addPanel ( const std::string& tab_name + ,LLPanel* panel ); + /** + * Add new tab to side bar + * @param tab_name - name of the new tab + * @param image - image for new sidebar button + * @param title - title for new tab + */ + bool addTab ( const std::string& tab_name + ,const std::string& image + ,const std::string& title); + + /** + * Activate tab with "panel_name" panel + * if no such tab - return false, otherwise true + */ + bool showPanel (const std::string& panel_name, const LLSD& params); + + /* + * collapse SideBar, hiding visible tab and moving tab buttons + * to the right corner of the screen + */ + void collapseSideBar (); + + /* + * expand SideBar + */ + void expandSideBar (); + + + /** + *hightlight if focused. manly copypaste from highlightFocusedFloater + */ + void highlightFocused(); + + void setVisible(BOOL visible) + { + LLPanel::setVisible(visible); + } + +public: + virtual ~LLSideTray(){}; + + virtual BOOL postBuild(); + + void onTabButtonClick(std::string name); + void onToggleCollapse(); + + bool addChild (LLView* view, S32 tab_group); + + BOOL handleMouseDown (S32 x, S32 y, MASK mask); + + void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); + S32 getTrayWidth(); + +protected: + LLSideTrayTab* getTab (const std::string& name); + + void createButtons (); + LLButton* createButton (const std::string& name,const std::string& image,LLUICtrl::commit_callback_t callback); + void createHomeTab (); + void arrange (); + void reflectCollapseChange(); + + void toggleTabButton (LLSideTrayTab* tab); + + + void calcMaxSideBarWidth(); + + void setPanelRect (); + + +private: + + std::map mTabButtons; + child_vector_t mTabs; + LLSideTrayTab* mHomeTab; + LLSideTrayTab* mActiveTab; + + LLButton* mCollapseButton; + bool mCollapsed; + + S32 mMaxBarWidth; + + static LLSideTray* sInstance; +}; + +#endif + diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp new file mode 100644 index 0000000000..bd93f5dd28 --- /dev/null +++ b/indra/newview/llslurl.cpp @@ -0,0 +1,114 @@ +/** + * @file llslurl.cpp + * @brief SLURL manipulation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llslurl.h" + +#include "llweb.h" + +const std::string LLSLURL::PREFIX_SL_HELP = "secondlife://app."; +const std::string LLSLURL::PREFIX_SL = "sl://"; +const std::string LLSLURL::PREFIX_SECONDLIFE = "secondlife://"; +const std::string LLSLURL::PREFIX_SLURL = "http://slurl.com/secondlife/"; + +const std::string LLSLURL::APP_TOKEN = "app/"; + +// static +std::string LLSLURL::stripProtocol(const std::string& url) +{ + std::string stripped = url; + if (matchPrefix(stripped, PREFIX_SL_HELP)) + { + stripped.erase(0, PREFIX_SL_HELP.length()); + } + else if (matchPrefix(stripped, PREFIX_SL)) + { + stripped.erase(0, PREFIX_SL.length()); + } + else if (matchPrefix(stripped, PREFIX_SECONDLIFE)) + { + stripped.erase(0, PREFIX_SECONDLIFE.length()); + } + else if (matchPrefix(stripped, PREFIX_SLURL)) + { + stripped.erase(0, PREFIX_SLURL.length()); + } + + return stripped; +} + +// static +bool LLSLURL::isSLURL(const std::string& url) +{ + if (matchPrefix(url, PREFIX_SL_HELP)) return true; + if (matchPrefix(url, PREFIX_SL)) return true; + if (matchPrefix(url, PREFIX_SECONDLIFE)) return true; + if (matchPrefix(url, PREFIX_SLURL)) return true; + + return false; +} + +// static +bool LLSLURL::isSLURLCommand(const std::string& url) +{ + if (matchPrefix(url, PREFIX_SL + APP_TOKEN) || + matchPrefix(url, PREFIX_SECONDLIFE + "/" + APP_TOKEN) || + matchPrefix(url, PREFIX_SLURL + APP_TOKEN) ) + { + return true; + } + + return false; +} + +// static +bool LLSLURL::isSLURLHelp(const std::string& url) +{ + return matchPrefix(url, PREFIX_SL_HELP); +} + +// static +std::string LLSLURL::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z) +{ + std::string slurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z); + slurl = LLWeb::escapeURL( slurl ); + return slurl; +} + +// static +bool LLSLURL::matchPrefix(const std::string& url, const std::string& prefix) +{ + std::string test_prefix = url.substr(0, prefix.length()); + LLStringUtil::toLower(test_prefix); + return test_prefix == prefix; +} diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h new file mode 100644 index 0000000000..05788623d9 --- /dev/null +++ b/indra/newview/llslurl.h @@ -0,0 +1,85 @@ +/** + * @file llslurl.h + * @brief SLURL manipulation + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_SLURL_H +#define LL_SLURL_H + +#include + +// IAN BUG: where should this live? +// IAN BUG: are static utility functions right? See LLUUID. +// question of whether to have a LLSLURL object or a +// some of this was moved from LLURLDispatcher + +/** + * SLURL manipulation + */ +class LLSLURL +{ +public: + static const std::string PREFIX_SL_HELP; + static const std::string PREFIX_SL; + static const std::string PREFIX_SECONDLIFE; + static const std::string PREFIX_SLURL; + + static const std::string APP_TOKEN; + + /** + * Is this any sort of secondlife:// or sl:// URL? + */ + static bool isSLURL(const std::string& url); + + /** + * Is this a special secondlife://app/ URL? + */ + static bool isSLURLCommand(const std::string& url); + + /** + * Not sure what it is. + */ + static bool isSLURLHelp(const std::string& url); + + /** + * builds: http://slurl.com/secondlife/RegionName/x/y/z/ + */ + static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z); + + /** + * Strip protocol part from the URL. + */ + static std::string stripProtocol(const std::string& url); + +private: + static bool matchPrefix(const std::string& url, const std::string& prefix); +}; + +#endif diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 4d67b374c8..8aec5c8377 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -35,9 +35,10 @@ #define SG_MIN_DIST_RATIO 0.00001f -#include "llmemory.h" #include "lldrawable.h" #include "lloctree.h" +#include "llpointer.h" +#include "llrefcount.h" #include "llvertexbuffer.h" #include "llgltypes.h" #include "llcubemap.h" @@ -399,7 +400,7 @@ public: virtual void updateSpatialExtents(); virtual void updateBinRadius(); virtual void setVisible(LLCamera& camera_in, std::vector* results = NULL, BOOL for_select = FALSE); - virtual void updateDistance(LLCamera& camera_in); + virtual void updateDistance(LLCamera& camera_in, bool force_update); virtual void makeActive(); virtual void move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate = FALSE); virtual BOOL updateMove(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2c0d11baab..d287f25181 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -51,15 +51,15 @@ #endif #include "llares.h" +#include "lllandmark.h" #include "llcachename.h" -#include "llviewercontrol.h" #include "lldir.h" #include "llerrorcontrol.h" #include "llfiltersd2xmlrpc.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "llhttpsender.h" -#include "imageids.h" -#include "lllandmark.h" +#include "lllocationhistory.h" #include "llloginflags.h" #include "llmd5.h" #include "llmemorystream.h" @@ -73,20 +73,21 @@ #include "llstring.h" #include "lluserrelations.h" #include "llversionviewer.h" +#include "llviewercontrol.h" #include "llvfs.h" #include "llxorcipher.h" // saved password, MAC address +#include "imageids.h" #include "message.h" #include "v3math.h" #include "llagent.h" +#include "llagentwearables.h" #include "llagentpilot.h" #include "llfloateravatarpicker.h" #include "llcallbacklist.h" #include "llcallingcard.h" -#include "llcolorscheme.h" #include "llconsole.h" #include "llcontainerview.h" -#include "llfloaterstats.h" #include "lldebugview.h" #include "lldrawable.h" #include "lleventnotifier.h" @@ -100,26 +101,26 @@ #include "llfloatergesture.h" #include "llfloaterhud.h" #include "llfloaterland.h" +#include "llfloaterpreference.h" #include "llfloatertopobjects.h" #include "llfloatertos.h" #include "llfloaterworldmap.h" -#include "llframestats.h" -#include "llframestatview.h" #include "llgesturemgr.h" #include "llgroupmgr.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llhttpclient.h" #include "llimagebmp.h" +#include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventoryview.h" #include "llkeyboard.h" #include "llloginhandler.h" // gLoginHandler, SLURL support #include "llpanellogin.h" -#include "llprefsim.h" #include "llmutelist.h" #include "llnotify.h" #include "llpanelavatar.h" +#include "llavatarpropertiesprocessor.h" #include "llpaneldirbrowser.h" #include "llpaneldirland.h" #include "llpanelevent.h" @@ -167,6 +168,7 @@ #include "llviewerthrottle.h" #include "llviewerwindow.h" #include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoclouds.h" #include "llweb.h" #include "llworld.h" @@ -185,6 +187,8 @@ #include "llwlparammanager.h" #include "llwaterparammanager.h" #include "llagentlanguage.h" +#include "llwearable.h" +#include "llinventorybridge.h" #if LL_LIBXUL_ENABLED #include "llmozlib.h" @@ -245,7 +249,6 @@ bool update_dialog_callback(const LLSD& notification, const LLSD& response); void login_packet_failed(void**, S32 result); void use_circuit_callback(void**, S32 result); void register_viewer_callbacks(LLMessageSystem* msg); -void init_stat_view(); void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32); bool callback_choose_gender(const LLSD& notification, const LLSD& response); void init_start_screen(S32 location_id); @@ -253,7 +256,7 @@ void release_start_screen(); void reset_login(); void apply_udp_blacklist(const std::string& csv); -void callback_cache_name(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group, void* data) +void callback_cache_name(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group) { LLNameListCtrl::refreshAll(id, firstname, lastname, is_group); LLNameBox::refreshAll(id, firstname, lastname, is_group); @@ -355,15 +358,25 @@ bool idle_startup() static bool stipend_since_login = false; - static bool samename = false; - // HACK: These are things from the main loop that usually aren't done // until initialization is complete, but need to be done here for things // to work. gIdleCallbacks.callFunctions(); - gViewerWindow->handlePerFrameHover(); + gViewerWindow->updateUI(); LLMortician::updateClass(); + const std::string delims (" "); + std::string system; + int begIdx, endIdx; + std::string osString = LLAppViewer::instance()->getOSInfo().getOSStringSimple(); + + begIdx = osString.find_first_not_of (delims); + endIdx = osString.find_first_of (delims, begIdx); + system = osString.substr (begIdx, endIdx - begIdx); + system += "Locale"; + + LLStringUtil::setLocale (LLTrans::getString(system)); + if (gNoRender) { // HACK, skip optional updates if you're running drones @@ -431,8 +444,6 @@ bool idle_startup() // Load autopilot and stats stuff gAgentPilot.load(gSavedSettings.getString("StatsPilotFile")); - gFrameStats.setFilename(gSavedSettings.getString("StatsFile")); - gFrameStats.setSummaryFilename(gSavedSettings.getString("StatsSummaryFile")); //gErrorStream.setTime(gSavedSettings.getBOOL("LogTimestamps")); @@ -780,15 +791,11 @@ bool idle_startup() // *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance(). - // Initialize UI - if (!gNoRender) + // Login screen needs menus for preferences, but we can enter + // this startup phase more than once. + if (gLoginMenuBarView == NULL) { - // Initialize all our tools. Must be done after saved settings loaded. - // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton. - LLToolMgr::getInstance()->initTools(); - - // Quickly get something onscreen to look at. - gViewerWindow->initWorldUI(); + init_menus(); } gViewerWindow->setNormalControlsVisible( FALSE ); @@ -854,13 +861,15 @@ bool idle_startup() gDirUtilp->setLindenUserDir(firstname, lastname); LLFile::mkdir(gDirUtilp->getLindenUserDir()); + LLLocationHistory::getInstance()->load(); + // Set PerAccountSettingsFile to the default value. gSavedSettings.setString("PerAccountSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, - LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount") - ) - ); + LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount"))); + // Note: can't store warnings files per account because some come up before login + // Overwrite default user settings with user settings LLAppViewer::instance()->loadSettingsFromDirectory("Account"); @@ -915,12 +924,12 @@ bool idle_startup() LLURLSimString::setString( location ); // END TODO - LLPanelLogin::close(); + LLPanelLogin::closePanel(); } //For HTML parsing in text boxes. - LLTextEditor::setLinkColor( gSavedSettings.getColor4("HTMLLinkColor") ); + LLTextEditor::setLinkColor( gSavedSkinSettings.getColor4("HTMLLinkColor") ); // Load URL History File LLURLHistory::loadFile("url_history.xml"); @@ -943,7 +952,7 @@ bool idle_startup() // UserLoginLocationReply arrives location_which = START_LOCATION_ID_LAST; } - else if (gSavedSettings.getBOOL("LoginLastLocation")) + else if (gSavedSettings.getString("LoginLocation") == "last" ) { agent_location_id = START_LOCATION_ID_LAST; // last location location_which = START_LOCATION_ID_LAST; @@ -963,7 +972,7 @@ bool idle_startup() // Display the startup progress bar. gViewerWindow->setShowProgress(TRUE); - gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Quit")); // *TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Quit")); // Poke the VFS, which could potentially block for a while if // Windows XP is acting up @@ -972,9 +981,6 @@ bool idle_startup() gVFS->pokeFiles(); - // color init must be after saved settings loaded - init_colors(); - // skipping over STATE_UPDATE_CHECK because that just waits for input LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); @@ -1037,9 +1043,7 @@ bool idle_startup() sAuthUriNum = 0; auth_method = "login_to_simulator"; - LLStringUtil::format_map_t args; - args["[APP_NAME]"] = LLAppViewer::instance()->getSecondLifeTitle(); - auth_desc = LLTrans::getString("LoginInProgress", args); + auth_desc = LLTrans::getString("LoginInProgress"); LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); } @@ -1063,13 +1067,9 @@ bool idle_startup() start << xml_escape_string(unescaped_start.str()); } - else if (gSavedSettings.getBOOL("LoginLastLocation")) - { - start << "last"; - } else { - start << "home"; + start << gSavedSettings.getString("LoginLocation"); } char hashed_mac_string[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ @@ -1107,7 +1107,7 @@ bool idle_startup() LL_DEBUGS("AppInit") << "STATE_LOGIN_NO_DATA_YET" << LL_ENDL; // If we get here we have gotten past the potential stall // in curl, so take "may appear frozen" out of progress bar. JC - auth_desc = "Logging in..."; + auth_desc = LLTrans::getString("LoginInProgressNoFrozen"); set_startup_status(progress, auth_desc, auth_message); // Process messages to keep from dropping circuit. LLMessageSystem* msg = gMessageSystem; @@ -1455,7 +1455,7 @@ bool idle_startup() it = options[0].find("folder_id"); if(it != options[0].end()) { - gAgent.mInventoryRootID.set((*it).second); + gAgent.getInventoryRootID().set((*it).second); //gInventory.mock(gAgent.getInventoryRootID()); } } @@ -1487,6 +1487,9 @@ bool idle_startup() if((*it).second == "Y") gPacificDaylightTime = TRUE; else gPacificDaylightTime = FALSE; } + + //setup map of datetime strings to codes and slt & local time offset from utc + LLStringOps::setupDatetimeInfo (gPacificDaylightTime); } options.clear(); if (LLUserAuth::getInstance()->getOptions("initial-outfit", options) @@ -1541,7 +1544,7 @@ bool idle_startup() && gAgentSessionID.notNull() && gMessageSystem->mOurCircuitCode && first_sim.isOk() - && gAgent.mInventoryRootID.notNull()) + && gAgent.getInventoryRootID().notNull()) { LLStartUp::setStartupState( STATE_WORLD_INIT ); } @@ -1589,7 +1592,7 @@ bool idle_startup() //--------------------------------------------------------------------- if (STATE_WORLD_INIT == LLStartUp::getStartupState()) { - set_startup_status(0.40f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD); + set_startup_status(0.30f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD); display_startup(); // We should have an agent id by this point. llassert(!(gAgentID == LLUUID::null)); @@ -1601,6 +1604,7 @@ bool idle_startup() // Since we connected, save off the settings so the user doesn't have to // type the name/password again if we crash. gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + gSavedSkinSettings.saveToFile(gSavedSettings.getString("SkinningSettingsFile"), TRUE); // // Initialize classes w/graphics stuff. @@ -1617,9 +1621,16 @@ bool idle_startup() LLWLParamManager::initClass(); LLWaterParamManager::initClass(); - // RN: don't initialize VO classes in drone mode, they are too closely tied to rendering LLViewerObject::initVOClasses(); + // Initialize all our tools. Must be done after saved settings loaded. + // NOTE: This also is where gToolMgr used to be instantiated before being turned into a singleton. + LLToolMgr::getInstance()->initTools(); + + // Pre-load floaters, like the world map, that are slow to spawn + // due to XML complexity. + gViewerWindow->initWorldUI(); + display_startup(); // This is where we used to initialize gWorldp. Original comment said: @@ -1662,6 +1673,14 @@ bool idle_startup() if (STATE_MULTIMEDIA_INIT == LLStartUp::getStartupState()) { LLStartUp::multimediaInit(); + LLStartUp::setStartupState( STATE_FONT_INIT ); + return FALSE; + } + + // Loading fonts takes several seconds + if (STATE_FONT_INIT == LLStartUp::getStartupState()) + { + LLStartUp::fontInit(); LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); return FALSE; } @@ -1689,14 +1708,8 @@ bool idle_startup() } gLoginMenuBarView->setVisible( FALSE ); gLoginMenuBarView->setEnabled( FALSE ); - - LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0); - gViewerWindow->adjustControlRectanglesForFirstUse(window); - - if(gSavedSettings.getBOOL("ShowMiniMap")) - { - LLFloaterMap::showInstance(); - } + + LLFloaterReg::showInitialVisibleInstances(); if (gSavedSettings.getBOOL("ShowCameraControls")) { @@ -1725,10 +1738,6 @@ bool idle_startup() LLError::logToFixedBuffer(gDebugView->mDebugConsolep); // set initial visibility of debug console gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole")); - if (gSavedSettings.getBOOL("ShowDebugStats")) - { - LLFloaterStats::showInstance(); - } } // @@ -1752,8 +1761,10 @@ bool idle_startup() if ( gCacheName == NULL ) { gCacheName = new LLCacheName(gMessageSystem); - gCacheName->addObserver(callback_cache_name); - + gCacheName->addObserver(&callback_cache_name); + gCacheName->LocalizeCacheName("waiting", LLTrans::getString("CacheWaiting")); + gCacheName->LocalizeCacheName("nobody", LLTrans::getString("CacheNobody")); + gCacheName->LocalizeCacheName("none", LLTrans::getString("CacheNone")); // Load stored cache if possible LLAppViewer::instance()->loadNameCache(); } @@ -1767,14 +1778,6 @@ bool idle_startup() //reset statistics LLViewerStats::getInstance()->resetStats(); - if (!gNoRender) - { - // - // Set up all of our statistics UI stuff. - // - init_stat_view(); - } - display_startup(); // // Set up region and surface defaults @@ -1796,15 +1799,8 @@ bool idle_startup() // Make sure agent knows correct aspect ratio // FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below - LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight()); - if (gViewerWindow->mWindow->getFullscreen()) - { - LLViewerCamera::getInstance()->setAspect(gViewerWindow->getDisplayAspectRatio()); - } - else - { - LLViewerCamera::getInstance()->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight()); - } + LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeight()); + LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio()); // Initialize FOV LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); @@ -2052,24 +2048,7 @@ bool idle_startup() } options.clear(); - if(LLUserAuth::getInstance()->getOptions("ui-config", options)) - { - LLUserAuth::options_t::iterator it = options.begin(); - LLUserAuth::options_t::iterator end = options.end(); - for (; it != end; ++it) - { - LLUserAuth::response_t::const_iterator option_it; - option_it = (*it).find("allow_first_life"); - if(option_it != (*it).end()) - { - if (option_it->second == "Y") - { - LLPanelAvatar::sAllowFirstLife = TRUE; - } - } - } - } - options.clear(); + bool show_hud = false; if(LLUserAuth::getInstance()->getOptions("tutorial_setting", options)) { @@ -2117,6 +2096,11 @@ bool idle_startup() { LLClassifiedInfo::loadCategories(options); } + + + //all categories loaded. lets create "My Favourites" category + gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE,true); + gInventory.buildParentChildMap(); llinfos << "Setting Inventory changed mask and notifying observers" << llendl; @@ -2145,17 +2129,9 @@ bool idle_startup() llinfos << "Requesting Agent Data" << llendl; gAgent.sendAgentDataUpdateRequest(); - bool shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); - // Create the inventory views llinfos << "Creating Inventory Views" << llendl; - LLInventoryView::showAgentInventory(); - - // Hide the inventory if it wasn't shown at exit - if(!shown_at_exit) - { - LLInventoryView::toggleVisibility(NULL); - } + LLFloaterReg::getInstance("inventory"); LLStartUp::setStartupState( STATE_MISC ); return FALSE; @@ -2211,6 +2187,7 @@ bool idle_startup() // and make sure it's saved gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE ); + gSavedSkinSettings.saveToFile( gSavedSettings.getString("SkinningSettingsFile") , TRUE ); }; if (!gNoRender) @@ -2296,38 +2273,20 @@ bool idle_startup() //{ //} + // The reason we show the alert is because we want to + // reduce confusion for when you log in and your provided + // location is not your expected location. So, if this is + // your first login, then you do not have an expectation, + // thus, do not show this alert. if (!gAgent.isFirstLogin()) { bool url_ok = LLURLSimString::sInstance.parse(); - if (!((agent_start_location == "url" && url_ok) || - (!url_ok && ((agent_start_location == "last" && gSavedSettings.getBOOL("LoginLastLocation")) || - (agent_start_location == "home" && !gSavedSettings.getBOOL("LoginLastLocation")))))) - { - // The reason we show the alert is because we want to - // reduce confusion for when you log in and your provided - // location is not your expected location. So, if this is - // your first login, then you do not have an expectation, - // thus, do not show this alert. - LLSD args; - if (url_ok) - { - args["TYPE"] = "desired"; - args["HELP"] = ""; - } - else if (gSavedSettings.getBOOL("LoginLastLocation")) - { - args["TYPE"] = "last"; - args["HELP"] = ""; - } - else - { - args["TYPE"] = "home"; - args["HELP"] = "You may want to set a new home location."; - } - LLNotifications::instance().add("AvatarMoved", args); - } - else + if ((url_ok && agent_start_location == "url") || + (!url_ok && ((agent_start_location == gSavedSettings.getString("LoginLocation"))))) { + // Start location is OK + // Disabled code to restore camera location and focus if logging in to default location + static bool samename = false; if (samename) { // restore old camera pos @@ -2342,13 +2301,30 @@ bool idle_startup() gAgent.stopCameraAnimation(); } } + else + { + std::string msg; + if (url_ok) + { + msg = "AvatarMovedDesired"; + } + else if (gSavedSettings.getString("LoginLocation") == "home") + { + msg = "AvatarMovedHome"; + } + else + { + msg = "AvatarMovedLast"; + } + LLNotifications::instance().add(msg); + } } //DEV-17797. get null folder. Any items found here moved to Lost and Found LLInventoryModel::findLostItems(); //DEV-10530. do cleanup. remove at some later date. jan-2009 - LLPrefsIM::cleanupBadSetting(); + LLFloaterPreference::cleanupBadSetting(); LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); @@ -2456,7 +2432,7 @@ bool idle_startup() else { // OK to just get the wearables - if ( gAgent.areWearablesLoaded() ) + if ( gAgentWearables.areWearablesLoaded() ) { // We have our clothing, proceed. //llinfos << "wearables loaded" << llendl; @@ -2477,11 +2453,9 @@ bool idle_startup() set_startup_status(1.0, "", ""); // Let the map know about the inventory. - if(gFloaterWorldMap) - { - gFloaterWorldMap->observeInventory(&gInventory); - gFloaterWorldMap->observeFriends(); - } + LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance(); + floater_world_map->observeInventory(&gInventory); + floater_world_map->observeFriends(); gViewerWindow->showCursor(); gViewerWindow->getWindow()->resetBusyCount(); @@ -2502,13 +2476,15 @@ bool idle_startup() } // Start automatic replay if the flag is set. - if (gSavedSettings.getBOOL("StatsAutoRun")) + if (gSavedSettings.getBOOL("StatsAutoRun") || LLAgentPilot::sReplaySession) { LLUUID id; LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL; gAgentPilot.startPlayback(); } + show_debug_menus(); // Debug menu visiblity and First Use trigger + // If we've got a startup URL, dispatch it LLStartUp::dispatchURL(); @@ -2539,6 +2515,9 @@ bool idle_startup() LLAppViewer::instance()->handleLoginComplete(); + // reset timers now that we are running "logged in" logic + LLFastTimer::reset(); + return TRUE; } @@ -2597,6 +2576,7 @@ void login_callback(S32 option, void *userdata) { // turn off the setting and write out to disk gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE ); + gSavedSkinSettings.saveToFile( gSavedSettings.getString("SkinningSettingsFile") , TRUE ); } // Next iteration through main loop should shut down the app cleanly. @@ -2604,7 +2584,7 @@ void login_callback(S32 option, void *userdata) if (LLAppViewer::instance()->quitRequested()) { - LLPanelLogin::close(); + LLPanelLogin::closePanel(); } return; } @@ -2761,7 +2741,7 @@ bool first_run_dialog_callback(const LLSD& notification, const LLSD& response) if (0 == option) { LL_DEBUGS("AppInit") << "First run dialog cancelling" << LL_ENDL; - LLWeb::loadURL( CREATE_ACCOUNT_URL ); + LLWeb::loadURLExternal(LLTrans::getString("create_account_url") ); } LLPanelLogin::giveFocus(); @@ -2786,12 +2766,12 @@ bool login_alert_status(const LLSD& notification, const LLSD& response) { case 0: // OK break; - case 1: // Help - LLWeb::loadURL( SUPPORT_URL ); - break; + // case 1: // Help + // LLWeb::loadURL(LLNotifications::instance().getGlobalString("SUPPORT_URL") ); + // break; case 2: // Teleport // Restart the login process, starting at our home locaton - LLURLSimString::setString(LLURLSimString::sLocationStringHome); + LLURLSimString::setString("home"); LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); break; default: @@ -2806,14 +2786,13 @@ void update_app(BOOL mandatory, const std::string& auth_msg) { // store off config state, as we might quit soon gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - + gSavedSkinSettings.saveToFile(gSavedSettings.getString("SkinningSettingsFile"), TRUE); std::ostringstream message; - //*TODO:translate std::string msg; if (!auth_msg.empty()) { - msg = "(" + auth_msg + ") \n"; + msg = "("+ auth_msg + ") \n"; } LLSD args; @@ -2986,9 +2965,7 @@ bool update_dialog_callback(const LLSD& notification, const LLSD& response) system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */ #elif LL_LINUX || LL_SOLARIS - OSMessageBox("Automatic updating is not yet implemented for Linux.\n" - "Please download the latest version from www.secondlife.com.", - LLStringUtil::null, OSMB_OK); + OSMessageBox(LLTrans::getString("MBNoAutoUpdate"), LLStringUtil::null, OSMB_OK); #endif LLAppViewer::instance()->forceQuit(); return false; @@ -3049,7 +3026,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_AvatarAnimation, process_avatar_animation); msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance); msg->setHandlerFunc("AgentCachedTextureResponse", LLAgent::processAgentCachedTextureResponse); - msg->setHandlerFunc("RebakeAvatarTextures", LLVOAvatar::processRebakeAvatarTextures); + msg->setHandlerFunc("RebakeAvatarTextures", LLVOAvatarSelf::processRebakeAvatarTextures); msg->setHandlerFuncFast(_PREHASH_CameraConstraint, process_camera_constraint); msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response); msg->setHandlerFunc("SetFollowCamProperties", process_set_follow_cam_properties); @@ -3093,20 +3070,20 @@ void register_viewer_callbacks(LLMessageSystem* msg) LLViewerParcelMgr::processParcelDwellReply); msg->setHandlerFunc("AvatarPropertiesReply", - LLPanelAvatar::processAvatarPropertiesReply); + &LLAvatarPropertiesProcessor::processAvatarPropertiesReply); msg->setHandlerFunc("AvatarInterestsReply", - LLPanelAvatar::processAvatarInterestsReply); + &LLAvatarPropertiesProcessor::processAvatarInterestsReply); msg->setHandlerFunc("AvatarGroupsReply", - LLPanelAvatar::processAvatarGroupsReply); + &LLAvatarPropertiesProcessor::processAvatarGroupsReply); // ratings deprecated //msg->setHandlerFuncFast(_PREHASH_AvatarStatisticsReply, // LLPanelAvatar::processAvatarStatisticsReply); msg->setHandlerFunc("AvatarNotesReply", - LLPanelAvatar::processAvatarNotesReply); + &LLAvatarPropertiesProcessor::processAvatarNotesReply); msg->setHandlerFunc("AvatarPicksReply", - LLPanelAvatar::processAvatarPicksReply); - msg->setHandlerFunc("AvatarClassifiedReply", - LLPanelAvatar::processAvatarClassifiedReply); + &LLAvatarPropertiesProcessor::processAvatarPicksReply); + msg->setHandlerFunc("AvatarClassifiedReply", + &LLAvatarPropertiesProcessor::processAvatarClassifiedReply); msg->setHandlerFuncFast(_PREHASH_CreateGroupReply, LLGroupMgr::processCreateGroupReply); @@ -3124,7 +3101,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) // LLFloaterRate::processReputationIndividualReply); msg->setHandlerFuncFast(_PREHASH_AgentWearablesUpdate, - LLAgent::processAgentInitialWearablesUpdate ); + LLAgentWearables::processAgentInitialWearablesUpdate ); msg->setHandlerFunc("ScriptControlChange", LLAgent::processScriptControlChange ); @@ -3180,9 +3157,9 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("MapItemReply", LLWorldMap::processMapItemReply); msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply); - msg->setHandlerFunc("PickInfoReply", LLPanelPick::processPickInfoReply); + msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply); msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply); - msg->setHandlerFunc("ParcelInfoReply", LLPanelPlace::processParcelInfoReply); + msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply); msg->setHandlerFunc("ScriptDialog", process_script_dialog); msg->setHandlerFunc("LoadURL", process_load_url); msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request); @@ -3202,14 +3179,6 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message); } - -void init_stat_view() -{ - LLFrameStatView *frameviewp = gDebugView->mFrameStatView; - frameviewp->setup(gFrameStats); - frameviewp->mShowPercent = FALSE; -} - void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32) { // nothing @@ -3271,7 +3240,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, has_name); if (0 == cat_array.count()) { - gAgent.createStandardWearables(gender); + gAgentWearables.createStandardWearables(gender); } else { @@ -3287,8 +3256,6 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, } // Loads a bitmap to display during load -// location_id = 0 => last position -// location_id = 1 => home position void init_start_screen(S32 location_id) { if (gStartImageGL.notNull()) @@ -3406,7 +3373,7 @@ void reset_login() } // Hide any other stuff - LLFloaterMap::hideInstance(); + LLFloaterReg::hideVisibleInstances(); } //--------------------------------------------------------------------------- @@ -3431,6 +3398,16 @@ void LLStartUp::multimediaInit() LLViewerParcelMedia::initClass(); } +void LLStartUp::fontInit() +{ + LL_DEBUGS("AppInit") << "Initializing fonts...." << LL_ENDL; + std::string msg = LLTrans::getString("LoginInitializingFonts"); + set_startup_status(0.45f, msg.c_str(), gAgent.mMOTD.c_str()); + display_startup(); + + LLFontGL::loadDefaultFonts(); +} + bool LLStartUp::dispatchURL() { // ok, if we've gotten this far and have a startup URL diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index fe347e9efe..93701800e9 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -58,6 +58,7 @@ typedef enum { STATE_LOGIN_PROCESS_RESPONSE, // Check authentication reply STATE_WORLD_INIT, // Start building the world STATE_MULTIMEDIA_INIT, // Init the rest of multimedia library + STATE_FONT_INIT, // Load default fonts STATE_SEED_GRANTED_WAIT, // Wait for seed cap grant STATE_SEED_CAP_GRANTED, // Have seed cap grant STATE_WORLD_WAIT, // Waiting for simulator @@ -92,6 +93,9 @@ public: static void multimediaInit(); // Initialize LLViewerMedia multimedia engine. + // Load default fonts not already loaded at start screen + static void fontInit(); + // outfit_folder_name can be a folder anywhere in your inventory, // but the name must be a case-sensitive exact match. // gender_name is either "male" or "female" diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index f36d12d638..981a843d94 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -53,6 +53,7 @@ #include "llmenugl.h" #include "llnotify.h" #include "llimview.h" +#include "llsd.h" #include "lltextbox.h" #include "llui.h" #include "llviewerparceloverlay.h" @@ -60,7 +61,7 @@ #include "llviewerstats.h" #include "llviewerwindow.h" #include "llframetimer.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llresmgr.h" #include "llworld.h" #include "llstatgraph.h" @@ -73,9 +74,10 @@ #include "lltoolmgr.h" #include "llfocusmgr.h" #include "llappviewer.h" - +#include "lltrans.h" // library includes #include "imageids.h" +#include "llfloaterreg.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -91,7 +93,7 @@ // Globals // LLStatusBar *gStatusBar = NULL; -S32 STATUS_BAR_HEIGHT = 0; +S32 STATUS_BAR_HEIGHT = 26; extern S32 MENU_BAR_HEIGHT; @@ -107,8 +109,6 @@ const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons sho const F32 ICON_FLASH_FREQUENCY = 2.f; const S32 TEXT_HEIGHT = 18; -static void onClickParcelInfo(void*); -static void onClickBalance(void*); static void onClickBuyCurrency(void*); static void onClickHealth(void*); static void onClickFly(void*); @@ -123,13 +123,15 @@ std::vector LLStatusBar::sDays; std::vector LLStatusBar::sMonths; const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; -LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) -: LLPanel(name, LLRect(), FALSE), // not mouse opaque -mBalance(0), -mHealth(100), -mSquareMetersCredit(0), -mSquareMetersCommitted(0) +LLStatusBar::LLStatusBar(const LLRect& rect) +: LLPanel(), + mBalance(0), + mHealth(100), + mSquareMetersCredit(0), + mSquareMetersCommitted(0) { + setRect(rect); + // status bar can possible overlay menus? setMouseOpaque(FALSE); setIsChrome(TRUE); @@ -149,17 +151,16 @@ mSquareMetersCommitted(0) // build date necessary data (must do after panel built) setupDate(); - mTextParcelName = getChild("ParcelNameText" ); - mTextBalance = getChild("BalanceText" ); - mTextHealth = getChild("HealthText" ); mTextTime = getChild("TimeText" ); + + mBtnBuyCurrency = getChild( "buycurrency" ); + mBtnBuyCurrency->setClickedCallback( onClickBuyCurrency, this ); childSetAction("scriptout", onClickScriptDebug, this); childSetAction("health", onClickHealth, this); childSetAction("no_fly", onClickFly, this); childSetAction("buyland", onClickBuyLand, this ); - childSetAction("buycurrency", onClickBuyCurrency, this ); childSetAction("no_build", onClickBuild, this ); childSetAction("no_scripts", onClickScripts, this ); childSetAction("restrictpush", onClickPush, this ); @@ -172,33 +173,33 @@ mSquareMetersCommitted(0) childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); - childSetActionTextbox("ParcelNameText", onClickParcelInfo ); - childSetActionTextbox("BalanceText", onClickBalance ); - // Adding Net Stat Graph S32 x = getRect().getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - mSGBandwidth = new LLStatGraph("BandwidthGraph", r); - mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + LLStatGraph::Params sgp; + sgp.name("BandwidthGraph"); + sgp.rect(r); + sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + sgp.mouse_opaque(false); + mSGBandwidth = LLUICtrlFactory::create(sgp); mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); - std::string text = childGetText("bandwidth_tooltip") + " "; - LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven - mSGBandwidth->setLabel(bandwidth_tooltip.getString()); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); - mSGBandwidth->setMouseOpaque(FALSE); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); - mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); - mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + //these don't seem to like being reused + LLStatGraph::Params pgp; + pgp.name("PacketLossPercent"); + pgp.rect(r); + pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); + pgp.mouse_opaque(false); + + mSGPacketLoss = LLUICtrlFactory::create(pgp); mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); - text = childGetText("packet_loss_tooltip") + " "; - LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven - mSGPacketLoss->setLabel(packet_loss_tooltip.getString()); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); @@ -206,7 +207,6 @@ mSquareMetersCommitted(0) mSGPacketLoss->setThreshold(1, 1.f); mSGPacketLoss->setThreshold(2, 3.f); mSGPacketLoss->setPrecision(1); - mSGPacketLoss->setMouseOpaque(FALSE); mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); @@ -236,9 +236,10 @@ void LLStatusBar::draw() if (isBackgroundVisible()) { + static LLUICachedControl drop_shadow_floater ("DropShadowFloater", 0); + static LLUICachedControl color_drop_shadow ("ColorDropShadow"); gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, - LLUI::sColorsGroup->getColor("ColorDropShadow"), - LLUI::sConfigGroup->getS32("DropShadowFloater") ); + color_drop_shadow, drop_shadow_floater ); } LLPanel::draw(); } @@ -247,66 +248,40 @@ void LLStatusBar::draw() // Per-frame updates of visibility void LLStatusBar::refresh() { - // Adding Net Stat Meter back in - F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; - mSGBandwidth->setMin(0.f); - mSGBandwidth->setMax(bwtotal*1.25f); - mSGBandwidth->setThreshold(0, bwtotal*0.75f); - mSGBandwidth->setThreshold(1, bwtotal); - mSGBandwidth->setThreshold(2, bwtotal); - - // *TODO: Localize / translate time - + bool net_stats_visible = gSavedSettings.getBOOL("ShowNetStats"); + + if (net_stats_visible) + { + // Adding Net Stat Meter back in + F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; + mSGBandwidth->setMin(0.f); + mSGBandwidth->setMax(bwtotal*1.25f); + mSGBandwidth->setThreshold(0, bwtotal*0.75f); + mSGBandwidth->setThreshold(1, bwtotal); + mSGBandwidth->setThreshold(2, bwtotal); + } + // Get current UTC time, adjusted for the user's clock // being off. time_t utc_time; utc_time = time_corrected(); - // There's only one internal tm buffer. - struct tm* internal_time; - - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); - - S32 hour = internal_time->tm_hour; - S32 min = internal_time->tm_min; - - std::string am_pm = "AM"; - if (hour > 11) - { - hour -= 12; - am_pm = "PM"; - } - - std::string tz = "PST"; - if (gPacificDaylightTime) - { - tz = "PDT"; - } - // Zero hour is 12 AM - if (hour == 0) hour = 12; - std::ostringstream t; - t << std::setfill(' ') << std::setw(2) << hour << ":" - << std::setfill('0') << std::setw(2) << min - << " " << am_pm << " " << tz; - mTextTime->setText(t.str()); + std::string timeStr = getString("time"); + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + mTextTime->setText(timeStr); - // Year starts at 1900, set the tooltip to have the date - std::ostringstream date; - date << sDays[internal_time->tm_wday] << ", " - << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " - << sMonths[internal_time->tm_mon] << " " - << internal_time->tm_year + 1900; - mTextTime->setToolTip(date.str()); + // set the tooltip to have the date + std::string dtStr = getString("timeTooltip"); + LLStringUtil::format (dtStr, substitution); + mTextTime->setToolTip (dtStr); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; S32 y = 0; - bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); - // reshape menu bar to its content's width if (MENU_RIGHT != gMenuBarView->getRect().getWidth()) { @@ -461,172 +436,8 @@ void LLStatusBar::refresh() x += buttonRect.getWidth(); } - std::string location_name; - if (region) - { - const LLVector3& agent_pos_region = gAgent.getPositionAgent(); - S32 pos_x = lltrunc( agent_pos_region.mV[VX] ); - S32 pos_y = lltrunc( agent_pos_region.mV[VY] ); - S32 pos_z = lltrunc( agent_pos_region.mV[VZ] ); - - // Round the numbers based on the velocity - LLVector3 agent_velocity = gAgent.getVelocity(); - F32 velocity_mag_sq = agent_velocity.magVecSquared(); - - const F32 FLY_CUTOFF = 6.f; // meters/sec - const F32 FLY_CUTOFF_SQ = FLY_CUTOFF * FLY_CUTOFF; - const F32 WALK_CUTOFF = 1.5f; // meters/sec - const F32 WALK_CUTOFF_SQ = WALK_CUTOFF * WALK_CUTOFF; - - if (velocity_mag_sq > FLY_CUTOFF_SQ) - { - pos_x -= pos_x % 4; - pos_y -= pos_y % 4; - } - else if (velocity_mag_sq > WALK_CUTOFF_SQ) - { - pos_x -= pos_x % 2; - pos_y -= pos_y % 2; - } - - mRegionDetails.mTime = mTextTime->getText(); - mRegionDetails.mBalance = mBalance; - mRegionDetails.mAccessString = region->getSimAccessString(); - mRegionDetails.mPing = region->getNetDetailsForLCD(); - if (parcel) - { - location_name = region->getName() - + llformat(" %d, %d, %d (%s) - %s", - pos_x, pos_y, pos_z, - region->getSimAccessString().c_str(), - parcel->getName().c_str()); - - // keep these around for the LCD to use - mRegionDetails.mRegionName = region->getName(); - mRegionDetails.mParcelName = parcel->getName(); - mRegionDetails.mX = pos_x; - mRegionDetails.mY = pos_y; - mRegionDetails.mZ = pos_z; - - mRegionDetails.mArea = parcel->getArea(); - mRegionDetails.mForSale = parcel->getForSale(); - mRegionDetails.mTraffic = LLViewerParcelMgr::getInstance()->getDwelling(); - - if (parcel->isPublic()) - { - mRegionDetails.mOwner = "Public"; - } - else - { - if (parcel->getIsGroupOwned()) - { - if(!parcel->getGroupID().isNull()) - { - gCacheName->getGroupName(parcel->getGroupID(), mRegionDetails.mOwner); - } - else - { - mRegionDetails.mOwner = "Group Owned"; - } - } - else - { - // Figure out the owner's name - gCacheName->getFullName(parcel->getOwnerID(), mRegionDetails.mOwner); - } - } - } - else - { - location_name = region->getName() - + llformat(" %d, %d, %d (%s)", - pos_x, pos_y, pos_z, - region->getSimAccessString().c_str()); - // keep these around for the LCD to use - mRegionDetails.mRegionName = region->getName(); - mRegionDetails.mParcelName = "Unknown"; - - mRegionDetails.mX = pos_x; - mRegionDetails.mY = pos_y; - mRegionDetails.mZ = pos_z; - mRegionDetails.mArea = 0; - mRegionDetails.mForSale = FALSE; - mRegionDetails.mOwner = "Unknown"; - mRegionDetails.mTraffic = 0.0f; - } - } - else - { - // no region - location_name = "(Unknown)"; - // keep these around for the LCD to use - mRegionDetails.mRegionName = "Unknown"; - mRegionDetails.mParcelName = "Unknown"; - mRegionDetails.mAccessString = "Unknown"; - mRegionDetails.mX = 0; - mRegionDetails.mY = 0; - mRegionDetails.mZ = 0; - mRegionDetails.mArea = 0; - mRegionDetails.mForSale = FALSE; - mRegionDetails.mOwner = "Unknown"; - mRegionDetails.mTraffic = 0.0f; - } - - mTextParcelName->setText(location_name); - - - - // x = right edge - // loop through: stat graphs, search btn, search text editor, money, buy money, clock - // adjust rect - // finally adjust parcel name rect - - S32 new_right = getRect().getWidth(); - if (search_visible) - { - childGetRect("search_btn", r); - //r.translate( new_right - r.mRight, 0); - //childSetRect("search_btn", r); - new_right -= r.getWidth(); - - childGetRect("search_editor", r); - //r.translate( new_right - r.mRight, 0); - //childSetRect("search_editor", r); - new_right -= r.getWidth() + 6; - } - else - { - childGetRect("stat_btn", r); - r.translate( new_right - r.mRight, 0); - childSetRect("stat_btn", r); - new_right -= r.getWidth() + 6; - } - - // Set rects of money, buy money, time - childGetRect("BalanceText", r); - r.translate( new_right - r.mRight, 0); - childSetRect("BalanceText", r); - new_right -= r.getWidth() - 18; - - childGetRect("buycurrency", r); - r.translate( new_right - r.mRight, 0); - childSetRect("buycurrency", r); - new_right -= r.getWidth() + 6; - - childGetRect("TimeText", r); - // mTextTime->getTextPixelWidth(); - r.translate( new_right - r.mRight, 0); - childSetRect("TimeText", r); - // new_right -= r.getWidth() + MENU_PARCEL_SPACING; - - - // Adjust region name and parcel name - x += 8; - - const S32 PARCEL_RIGHT = llmin(mTextTime->getRect().mLeft, mTextParcelName->getTextPixelWidth() + x + 5); - r.set(x+4, getRect().getHeight() - 2, PARCEL_RIGHT, 0); - mTextParcelName->setRect(r); - + bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); + // Set search bar visibility if (gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK) @@ -638,16 +449,15 @@ void LLStatusBar::refresh() childSetVisible("menubar_search_bevel_bg", search_visible); } - mSGBandwidth->setVisible(! search_visible); - mSGPacketLoss->setVisible(! search_visible); - childSetEnabled("stat_btn", ! search_visible); + mSGBandwidth->setVisible(net_stats_visible); + mSGPacketLoss->setVisible(net_stats_visible); + childSetEnabled("stat_btn", net_stats_visible); } void LLStatusBar::setVisibleForMouselook(bool visible) { - mTextBalance->setVisible(visible); mTextTime->setVisible(visible); - childSetVisible("buycurrency", visible); + mBtnBuyCurrency->setVisible(visible); childSetVisible("search_editor", visible); childSetVisible("search_btn", visible); childSetVisible("menubar_search_bevel_bg", visible); @@ -671,7 +481,15 @@ void LLStatusBar::setBalance(S32 balance) std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); std::string balance_str = "L$"; balance_str += money_str; - mTextBalance->setText( balance_str ); + mBtnBuyCurrency->setLabel( balance_str ); + + // Resize the balance button so that the label fits it, and the button expands to the left. + // *TODO: LLButton should have an option where to expand. + { + S32 saved_right = mBtnBuyCurrency->getRect().mRight; + mBtnBuyCurrency->autoResize(); + mBtnBuyCurrency->translate(saved_right - mBtnBuyCurrency->getRect().mRight, 0); + } if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) { @@ -775,18 +593,6 @@ S32 LLStatusBar::getSquareMetersLeft() const return mSquareMetersCredit - mSquareMetersCommitted; } -static void onClickParcelInfo(void* data) -{ - LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); - - LLFloaterLand::showInstance(); -} - -static void onClickBalance(void* data) -{ - onClickBuyCurrency(data); -} - static void onClickBuyCurrency(void* data) { LLFloaterBuyCurrency::buyCurrency(); @@ -920,7 +726,7 @@ void LLStatusBar::onClickSearch(void* data) { LLStatusBar* self = (LLStatusBar*)data; std::string search_text = self->childGetText("search_editor"); - LLFloaterDirectory::showFindAll(search_text); + LLFloaterReg::showInstance("search", LLSD().insert("panel", "all").insert("id", LLSD(search_text))); } // static diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index c5b4be035a..84dd761930 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -48,45 +48,11 @@ class LLUUID; class LLFrameTimer; class LLStatGraph; -// used by LCD screen -class LLRegionDetails -{ -public: - LLRegionDetails() : - mRegionName("Unknown"), - mParcelName("Unknown"), - mAccessString("Unknown"), - mX(0), - mY(0), - mZ(0), - mArea (0), - mForSale(FALSE), - mOwner("Unknown"), - mTraffic(0), - mBalance(0), - mPing(0) - { - } - std::string mRegionName; - std::string mParcelName; - std::string mAccessString; - S32 mX; - S32 mY; - S32 mZ; - S32 mArea; - BOOL mForSale; - std::string mOwner; - F32 mTraffic; - S32 mBalance; - std::string mTime; - U32 mPing; -}; - class LLStatusBar : public LLPanel { public: - LLStatusBar(const std::string& name, const LLRect& rect ); + LLStatusBar(const LLRect& rect ); /*virtual*/ ~LLStatusBar(); /*virtual*/ void draw(); @@ -116,7 +82,6 @@ public: S32 getSquareMetersCredit() const; S32 getSquareMetersCommitted() const; S32 getSquareMetersLeft() const; - LLRegionDetails mRegionDetails; private: // simple method to setup the part that holds the date @@ -127,12 +92,9 @@ private: static void onClickStatGraph(void* data); private: - LLTextBox *mTextBalance; LLTextBox *mTextHealth; LLTextBox *mTextTime; - LLTextBox* mTextParcelName; - LLStatGraph *mSGBandwidth; LLStatGraph *mSGPacketLoss; diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp index a34b4b83f3..a1384c28ba 100644 --- a/indra/newview/llstylemap.cpp +++ b/indra/newview/llstylemap.cpp @@ -64,7 +64,7 @@ const LLStyleSP &LLStyleMap::lookupAgent(const LLUUID &source) style->setFontName(LLStringUtil::null); if (source != LLUUID::null && source != gAgent.getID() ) { - style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + style->setColor(gSavedSkinSettings.getColor4("HTMLLinkColor")); std::string link = llformat("secondlife:///app/agent/%s/about",source.asString().c_str()); style->setLinkHREF(link); } @@ -90,7 +90,7 @@ const LLStyleSP &LLStyleMap::lookup(const LLUUID& id, const std::string& link) style->setFontName(LLStringUtil::null); if (id != LLUUID::null && !link.empty()) { - style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + style->setColor(gSavedSkinSettings.getColor4("HTMLLinkColor")); style->setLinkHREF(link); } else @@ -115,6 +115,6 @@ void LLStyleMap::update() { LLStyleSP &style = iter->second; // Update the link color in case it has been changed. - style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); + style->setColor(gSavedSkinSettings.getColor4("HTMLLinkColor")); } } diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index a27f0e2254..27a08e7d7b 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -68,7 +68,6 @@ LLColor4U MAX_WATER_COLOR(0, 48, 96, 240); S32 LLSurface::sTextureSize = 256; S32 LLSurface::sTexelsUpdated = 0; F32 LLSurface::sTextureUpdateTime = 0.f; -LLStat LLSurface::sTexelsUpdatedPerSecStat; // ---------------- LLSurface:: Public Members --------------- @@ -629,6 +628,7 @@ void LLSurface::updatePatchVisibilities(LLAgent &agent) BOOL LLSurface::idleUpdate(F32 max_update_time) { + LLMemType mt_ius(LLMemType::MTYPE_IDLE_UPDATE_SURFACE); if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN)) { return FALSE; diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index 003b2f2505..310ab5d2c3 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -173,7 +173,6 @@ public: static F32 sTextureUpdateTime; static S32 sTexelsUpdated; - static LLStat sTexelsUpdatedPerSecStat; protected: void createSTexture(); diff --git a/indra/newview/llsurfacepatch.h b/indra/newview/llsurfacepatch.h index 7e84f7f6c5..4cac977305 100644 --- a/indra/newview/llsurfacepatch.h +++ b/indra/newview/llsurfacepatch.h @@ -35,7 +35,7 @@ #include "v3math.h" #include "v3dmath.h" -#include "llmemory.h" +#include "llpointer.h" class LLSurface; class LLVOSurfacePatch; diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp new file mode 100644 index 0000000000..6fc120d920 --- /dev/null +++ b/indra/newview/llteleporthistory.cpp @@ -0,0 +1,198 @@ +/** + * @file llteleporthistory.cpp + * @brief Teleport history + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llteleporthistory.h" + +#include "llparcel.h" +#include "llsdserialize.h" + +#include "llagent.h" +#include "llslurl.h" +#include "llurlsimstring.h" +#include "llviewerparcelmgr.h" +#include "llviewerregion.h" +#include "llworldmap.h" + +////////////////////////////////////////////////////////////////////////////// +// LLTeleportHistoryItem +////////////////////////////////////////////////////////////////////////////// + +LLTeleportHistoryItem::LLTeleportHistoryItem(const LLSD& val) +{ + mTitle = val["title"].asString(); + mGlobalPos.setValue(val["global_pos"]); +} + +LLSD LLTeleportHistoryItem::toLLSD() const +{ + LLSD val; + + val["title"] = mTitle; + val["global_pos"] = mGlobalPos.getValue(); + + return val; +} + +////////////////////////////////////////////////////////////////////////////// +// LLTeleportHistory +////////////////////////////////////////////////////////////////////////////// + +LLTeleportHistory::LLTeleportHistory(): + mCurrentItem(-1), + mRequestedItem(-1), + mGotInitialUpdate(false) +{ + mTeleportFinishedConn = LLViewerParcelMgr::getInstance()-> + setTeleportFinishedCallback(boost::bind(&LLTeleportHistory::updateCurrentLocation, this)); + mTeleportFailedConn = LLViewerParcelMgr::getInstance()-> + setTeleportFailedCallback(boost::bind(&LLTeleportHistory::onTeleportFailed, this)); +} + +LLTeleportHistory::~LLTeleportHistory() +{ + mTeleportFinishedConn.disconnect(); + mTeleportFailedConn.disconnect(); +} + +void LLTeleportHistory::goToItem(int idx) + +{ + // Validate specified index. + if (idx < 0 || idx >= (int)mItems.size()) + { + llwarns << "Invalid teleport history index (" << idx << ") specified" << llendl; + dump(); + return; + } + + if (idx == mCurrentItem) + { + llwarns << "Will not teleport to the same location." << llendl; + dump(); + return; + } + + // Attempt to teleport to the requested item. + gAgent.teleportViaLocation(mItems[idx].mGlobalPos); + mRequestedItem = idx; +} + +void LLTeleportHistory::onTeleportFailed() +{ + // Are we trying to teleport within the history? + if (mRequestedItem != -1) + { + // Not anymore. + mRequestedItem = -1; + } +} + +void LLTeleportHistory::updateCurrentLocation() +{ + if (mRequestedItem != -1) // teleport within the history in progress? + { + mCurrentItem = mRequestedItem; + mRequestedItem = -1; + } + else + { + // If we're getting the initial location update + // while we already have a (loaded) non-empty history, + // there's no need to purge forward items or add a new item. + + if (mGotInitialUpdate || mItems.size() == 0) + { + // Purge forward items (if any). + if(mItems.size()) + mItems.erase (mItems.begin() + mCurrentItem + 1, mItems.end()); + + // Append an empty item to the history and make it current. + mItems.push_back(LLTeleportHistoryItem("", LLVector3d())); + mCurrentItem++; + } + + // Update current history item. + if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check + { + llwarns << "Invalid current item. (this should not happen)" << llendl; + return; + } + mItems[mCurrentItem].mTitle = getCurrentLocationTitle(); + mItems[mCurrentItem].mGlobalPos = gAgent.getPositionGlobal(); + mItems[mCurrentItem].mRegionID = gAgent.getRegion()->getRegionID(); + } + + dump(); + + if (!mGotInitialUpdate) + mGotInitialUpdate = true; + + // Signal the interesting party that we've changed. + onHistoryChanged(); +} + +boost::signals::connection LLTeleportHistory::setHistoryChangedCallback(history_callback_t cb) +{ + return mHistoryChangedSignal.connect(cb); +} + +void LLTeleportHistory::onHistoryChanged() +{ + mHistoryChangedSignal(); +} + +// static +std::string LLTeleportHistory::getCurrentLocationTitle() +{ + std::string location_name; + + if (!gAgent.buildLocationString(location_name, LLAgent::LOCATION_FORMAT_NORMAL)) + location_name = "Unknown"; + + return location_name; +} + +void LLTeleportHistory::dump() const +{ + llinfos << "Teleport history dump (" << mItems.size() << " items):" << llendl; + + for (size_t i=0; i +#include +#include +#include +#include + + +/** + * An item of the teleport history. + * + * Contains the location's global coordinates and its title. + */ +class LLTeleportHistoryItem +{ +public: + LLTeleportHistoryItem() + {} + + LLTeleportHistoryItem(std::string title, LLVector3d global_pos) + : mTitle(title), mGlobalPos(global_pos) + {} + + LLTeleportHistoryItem(const LLSD& val); + LLSD toLLSD() const; + + std::string mTitle; // human-readable location title + LLVector3d mGlobalPos; // global position + LLUUID mRegionID; // region ID for getting the region info +}; + +/** + * Teleport history. + * + * Along with the navigation bar "Back" and "Forward" buttons + * implements web browser-like navigation functionality. + * + * @see LLNavigationBar + */ +class LLTeleportHistory: public LLSingleton +{ + LOG_CLASS(LLTeleportHistory); + +public: + + typedef std::vector slurl_list_t; + typedef boost::function history_callback_t; + typedef boost::signal history_signal_t; + + LLTeleportHistory(); + ~LLTeleportHistory(); + + /** + * Go back in the history. + */ + void goBack() { goToItem(getCurrentItemIndex() - 1); } + + /** + * Go forward in the history. + */ + void goForward() { goToItem(getCurrentItemIndex() + 1); } + + /** + * Go to specific item in the history. + * + * The item is specified by its index (starting from 0). + */ + void goToItem(int idx); + + /** + * @return history items. + */ + const slurl_list_t& getItems() const { return mItems; } + + /** + * Is the history empty? + * + * History containing single item is treated as empty + * because the item points to the current location. + */ + bool isEmpty() const { return mItems.size() <= 1; } + + /** + * Get index of the current location in the history. + */ + int getCurrentItemIndex() const { return mCurrentItem; } + + /** + * Set a callback to be called upon history changes. + * + * Multiple callbacks can be set. + */ + boost::signals::connection setHistoryChangedCallback(history_callback_t cb); + + /** + * Save history to a file so that we can restore it on startup. + * + * @see load() + */ + void dump() const; + +private: + + /** + * Called by when a teleport fails. + * + * Called via callback set on the LLViewerParcelMgr "teleport failed" signal. + * + * @see mTeleportFailedConn + */ + void onTeleportFailed(); + + /** + * Update current location. + * + * Called when a teleport finishes. + * Called via callback set on the LLViewerParcelMgr "teleport finished" signal. + * + * Takes mRequestedItem into consideration: if it's not -1 + * (i.e. user is teleporting to an arbitrary location, not to a history item) + * we purge forward items and append a new one, making it current. Otherwise + * we just modify mCurrentItem. + * + * @see mRequestedItem + * @see mGotInitialUpdate + */ + void updateCurrentLocation(); + + /** + * Invokes the "history changed" callback(s). + */ + void onHistoryChanged(); + + static std::string getCurrentLocationTitle(); + + /** + * Actually, the teleport history. + */ + slurl_list_t mItems; + + /** + * Current position within the history. + */ + int mCurrentItem; + + /** + * Requested position within the history. + * + * When a teleport succeeds, this is checked by updateCurrentLocation() to tell + * if this is a teleport within the history (mRequestedItem >=0) or not (-1). + * + * Set by goToItem(); reset by onTeleportFailed() (if teleport fails). + * + * @see goToItem() + * @see updateCurrentLocation() + */ + int mRequestedItem; + + /** + * Have we received the initial location update? + * + * @see updateCurrentLocation() + */ + bool mGotInitialUpdate; + + /** + * Signal emitted when the history gets changed. + * + * Invokes callbacks set with setHistoryChangedCallback(). + */ + history_signal_t mHistoryChangedSignal; + + /** + * Teleport success notification connection. + * + * Using this connection we get notified when a teleport finishes + * or initial location update occurs. + */ + boost::signals::connection mTeleportFinishedConn; + + /** + * Teleport failure notification connection. + * + * Using this connection we get notified when a teleport fails. + */ + boost::signals::connection mTeleportFailedConn; +}; + +#endif diff --git a/indra/newview/lltexglobalcolor.cpp b/indra/newview/lltexglobalcolor.cpp new file mode 100644 index 0000000000..e81c3731f7 --- /dev/null +++ b/indra/newview/lltexglobalcolor.cpp @@ -0,0 +1,150 @@ +/** + * @file lltexlayerglobalcolor.cpp + * @brief SERAPH - ADD IN + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llagent.h" +#include "lltexlayer.h" +#include "llvoavatar.h" +#include "lltexglobalcolor.h" + +//----------------------------------------------------------------------------- +// LLTexGlobalColor +//----------------------------------------------------------------------------- + +LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar) + : + mAvatar(avatar), + mInfo(NULL) +{ +} + +LLTexGlobalColor::~LLTexGlobalColor() +{ + // mParamColorList are LLViewerVisualParam's and get deleted with ~LLCharacter() + //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer()); +} + +BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) +{ + llassert(mInfo == NULL); + mInfo = info; + //mID = info->mID; // No ID + + mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size()); + for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin(); + iter != mInfo->mParamColorInfoList.end(); + iter++) + { + LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this); + if (!param_color->setInfo(*iter)) + { + mInfo = NULL; + return FALSE; + } + mParamGlobalColorList.push_back(param_color); + } + + return TRUE; +} + +LLColor4 LLTexGlobalColor::getColor() const +{ + // Sum of color params + if (mParamGlobalColorList.empty()) + return LLColor4(1.f, 1.f, 1.f, 1.f); + + LLColor4 net_color(0.f, 0.f, 0.f, 0.f); + LLTexLayer::calculateTexLayerColor(mParamGlobalColorList, net_color); + return net_color; +} + +const std::string& LLTexGlobalColor::getName() const +{ + return mInfo->mName; +} + +//----------------------------------------------------------------------------- +// LLTexParamGlobalColor +//----------------------------------------------------------------------------- +LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) : + LLTexLayerParamColor((LLTexLayer*)NULL), + mTexGlobalColor(tex_global_color) +{ + mAvatar = tex_global_color->getAvatar(); +} + +void LLTexParamGlobalColor::onGlobalColorChanged(bool set_by_user) +{ + mAvatar->onGlobalColorChanged(mTexGlobalColor, set_by_user); +} + +//----------------------------------------------------------------------------- +// LLTexGlobalColorInfo +//----------------------------------------------------------------------------- + +LLTexGlobalColorInfo::LLTexGlobalColorInfo() +{ +} + + +LLTexGlobalColorInfo::~LLTexGlobalColorInfo() +{ + for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer()); +} + +BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) +{ + // name attribute + static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); + if (!node->getFastAttributeString(name_string, mName)) + { + llwarns << " element is missing name attribute." << llendl; + return FALSE; + } + // sub-element + for (LLXmlTreeNode* child = node->getChildByName("param"); + child; + child = node->getNextNamedChild()) + { + if (child->getChildByName("param_color")) + { + // + LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo(); + if (!info->parseXml(child)) + { + delete info; + return FALSE; + } + mParamColorInfoList.push_back(info); + } + } + return TRUE; +} diff --git a/indra/newview/lltexglobalcolor.h b/indra/newview/lltexglobalcolor.h new file mode 100644 index 0000000000..154b814392 --- /dev/null +++ b/indra/newview/lltexglobalcolor.h @@ -0,0 +1,86 @@ +/** + * @file lltexglobalcolor.h + * @brief This is global texture color info used by llvoavatar. + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLTEXGLOBALCOLOR_H +#define LL_LLTEXGLOBALCOLOR_H + +#include "lltexlayer.h" +#include "lltexlayerparams.h" + +class LLVOAvatar; +class LLTexGlobalColorInfo; + +class LLTexGlobalColor +{ +public: + LLTexGlobalColor( LLVOAvatar* avatar ); + ~LLTexGlobalColor(); + + LLTexGlobalColorInfo* getInfo() const { return mInfo; } + // This sets mInfo and calls initialization functions + BOOL setInfo(LLTexGlobalColorInfo *info); + + LLVOAvatar* getAvatar() const { return mAvatar; } + LLColor4 getColor() const; + const std::string& getName() const; + +private: + param_color_list_t mParamGlobalColorList; + LLVOAvatar* mAvatar; // just backlink, don't LLPointer + LLTexGlobalColorInfo *mInfo; +}; + +// Used by llvoavatar to determine skin/eye/hair color. +class LLTexGlobalColorInfo +{ + friend class LLTexGlobalColor; +public: + LLTexGlobalColorInfo(); + ~LLTexGlobalColorInfo(); + + BOOL parseXml(LLXmlTreeNode* node); + +private: + param_color_info_list_t mParamColorInfoList; + std::string mName; +}; + +class LLTexParamGlobalColor : public LLTexLayerParamColor +{ +public: + LLTexParamGlobalColor(LLTexGlobalColor *tex_color); +protected: + /*virtual*/ void onGlobalColorChanged(bool set_by_user); +private: + LLTexGlobalColor* mTexGlobalColor; +}; + +#endif diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index b05da8c6d8..716ab8eef4 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -31,80 +31,56 @@ */ #include "llviewerprecompiledheaders.h" - -#include "imageids.h" #include "llagent.h" -#include "llcrc.h" -#include "lldir.h" -#include "llglheaders.h" -#include "llimagebmp.h" -#include "llimagej2c.h" -#include "llimagetga.h" -#include "llpolymorph.h" -#include "llquantize.h" #include "lltexlayer.h" -#include "llui.h" -#include "llvfile.h" -#include "llviewerimagelist.h" -#include "llviewerimagelist.h" -#include "llviewerregion.h" #include "llviewerstats.h" -#include "llviewerwindow.h" +#include "llviewerregion.h" #include "llvoavatar.h" -#include "llxmltree.h" +#include "llvoavatarself.h" #include "pipeline.h" -#include "v4coloru.h" -#include "llrender.h" #include "llassetuploadresponders.h" +#include "lltexlayerparams.h" +#include "llui.h" //#include "../tools/imdebug/imdebug.h" using namespace LLVOAvatarDefines; -// static -S32 LLTexLayerSetBuffer::sGLByteCount = 0; -S32 LLTexLayerSetBuffer::sGLBumpByteCount = 0; - //----------------------------------------------------------------------------- // LLBakedUploadData() //----------------------------------------------------------------------------- -LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar, - LLTexLayerSet* layerset, - LLTexLayerSetBuffer* layerset_buffer, - const LLUUID & id ) : - mAvatar( avatar ), - mLayerSet( layerset ), - mLayerSetBuffer( layerset_buffer ), - mID(id) +LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar, + LLTexLayerSet* layerset, + const LLUUID& id) : + mAvatar(avatar), + mTexLayerSet(layerset), + mID(id), + mStartTime(LLFrameTimer::getTotalTime()) // Record starting time { - mStartTime = LLFrameTimer::getTotalTime(); // Record starting time - for( S32 i = 0; i < WT_COUNT; i++ ) - { - LLWearable* wearable = gAgent.getWearable( (EWearableType)i); - if( wearable ) - { - mWearableAssets[i] = wearable->getID(); - } - } } //----------------------------------------------------------------------------- // LLTexLayerSetBuffer // The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. //----------------------------------------------------------------------------- -LLTexLayerSetBuffer::LLTexLayerSetBuffer( LLTexLayerSet* owner, S32 width, S32 height, BOOL has_bump ) - : + +// static +S32 LLTexLayerSetBuffer::sGLByteCount = 0; +S32 LLTexLayerSetBuffer::sGLBumpByteCount = 0; + +LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner, + S32 width, S32 height, + BOOL has_bump) : // ORDER_LAST => must render these after the hints are created. LLDynamicTexture( width, height, 4, LLDynamicTexture::ORDER_LAST, TRUE ), mNeedsUpdate( TRUE ), mNeedsUpload( FALSE ), mUploadPending( FALSE ), // Not used for any logic here, just to sync sending of updates - mTexLayerSet( owner ) + mTexLayerSet(owner), + mHasBump(has_bump), + mBumpTex(NULL) { LLTexLayerSetBuffer::sGLByteCount += getSize(); - mHasBump = has_bump ; - mBumpTex = NULL ; - createBumpTexture() ; } @@ -115,10 +91,11 @@ LLTexLayerSetBuffer::~LLTexLayerSetBuffer() if( mBumpTex.notNull()) { mBumpTex = NULL ; - LLImageGL::sGlobalTextureMemory -= mWidth * mHeight * 4; + LLImageGL::sGlobalTextureMemoryInBytes -= mWidth * mHeight * 4; LLTexLayerSetBuffer::sGLBumpByteCount -= mWidth * mHeight * 4; } } + //virtual void LLTexLayerSetBuffer::restoreGLTexture() { @@ -132,7 +109,7 @@ void LLTexLayerSetBuffer::destroyGLTexture() if( mBumpTex.notNull() ) { mBumpTex = NULL ; - LLImageGL::sGlobalTextureMemory -= mWidth * mHeight * 4; + LLImageGL::sGlobalTextureMemoryInBytes -= mWidth * mHeight * 4; LLTexLayerSetBuffer::sGLBumpByteCount -= mWidth * mHeight * 4; } @@ -163,7 +140,7 @@ void LLTexLayerSetBuffer::createBumpTexture() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLImageGL::sGlobalTextureMemory += mWidth * mHeight * 4; + LLImageGL::sGlobalTextureMemoryInBytes += mWidth * mHeight * 4; LLTexLayerSetBuffer::sGLBumpByteCount += mWidth * mHeight * 4; } } @@ -202,7 +179,7 @@ void LLTexLayerSetBuffer::cancelUpload() mUploadPending = FALSE; } -void LLTexLayerSetBuffer::pushProjection() +void LLTexLayerSetBuffer::pushProjection() const { glMatrixMode(GL_PROJECTION); gGL.pushMatrix(); @@ -214,7 +191,7 @@ void LLTexLayerSetBuffer::pushProjection() glLoadIdentity(); } -void LLTexLayerSetBuffer::popProjection() +void LLTexLayerSetBuffer::popProjection() const { glMatrixMode(GL_PROJECTION); gGL.popMatrix(); @@ -225,12 +202,12 @@ void LLTexLayerSetBuffer::popProjection() BOOL LLTexLayerSetBuffer::needsRender() { - LLVOAvatar* avatar = mTexLayerSet->getAvatar(); + const LLVOAvatarSelf* avatar = mTexLayerSet->getAvatar(); BOOL upload_now = mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal(); - BOOL needs_update = gAgent.mNumPendingQueries == 0 && (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating; + BOOL needs_update = gAgentQueryManager.hasNoPendingQueries() && (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating; if (needs_update) { - BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT); + BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT); if (invalid_skirt) { // we were trying to create a skirt texture @@ -272,7 +249,7 @@ BOOL LLTexLayerSetBuffer::render() // do we need to upload, and do we have sufficient data to create an uploadable composite? // When do we upload the texture if gAgent.mNumPendingQueries is non-zero? - BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); + BOOL upload_now = (gAgentQueryManager.hasNoPendingQueries() && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal()); BOOL success = TRUE; // Composite bump @@ -312,7 +289,6 @@ BOOL LLTexLayerSetBuffer::render() { if (!success) { - delete [] baked_bump_data; llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegion() << llendl; mUploadPending = FALSE; } @@ -330,6 +306,7 @@ BOOL LLTexLayerSetBuffer::render() mTexture->setGLTextureCreated(true); mNeedsUpdate = FALSE; + delete [] baked_bump_data; return success; } @@ -353,7 +330,7 @@ BOOL LLTexLayerSetBuffer::updateImmediate() return result; } -void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) +void LLTexLayerSetBuffer::readBackAndUpload(const U8* baked_bump_data) { // pointers for storing data to upload U8* baked_color_data = new U8[ mWidth * mHeight * 4 ]; @@ -375,10 +352,8 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) LLPointer baked_mask_image = new LLImageRaw(mWidth, mHeight, 1 ); U8* baked_mask_data = baked_mask_image->getData(); - - mTexLayerSet->gatherAlphaMasks(baked_mask_data, mWidth, mHeight); -// imdebug("lum b=8 w=%d h=%d %p", mWidth, mHeight, baked_mask_data); - + + mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mWidth, mHeight); // writes into baked_color_data const char* comment_text = NULL; @@ -387,13 +362,11 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) LLPointer baked_image = new LLImageRaw( mWidth, mHeight, baked_image_components ); U8* baked_image_data = baked_image->getData(); + if( mBumpTex.notNull() ) { comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // 5 channels: rgb, heightfield/alpha, mask - // Hide the alpha for the eyelashes in a corner of the bump map - if (mTexLayerSet->getBodyRegion() == "head") - { S32 i = 0; for( S32 u = 0; u < mWidth; u++ ) { @@ -409,25 +382,6 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) } } else - { - S32 i = 0; - for( S32 u = 0; u < mWidth; u++ ) - { - for( S32 v = 0; v < mHeight; v++ ) - { - baked_image_data[5*i + 0] = baked_color_data[4*i + 0]; - baked_image_data[5*i + 1] = baked_color_data[4*i + 1]; - baked_image_data[5*i + 2] = baked_color_data[4*i + 2]; - baked_image_data[5*i + 3] = 255; // reserve for alpha - baked_image_data[5*i + 4] = baked_mask_data[i]; - i++; - } - } - } - } - else - { - if (mTexLayerSet->getBodyRegion() == "skirt" || mTexLayerSet->getBodyRegion() == "hair") { S32 i = 0; for( S32 u = 0; u < mWidth; u++ ) @@ -442,22 +396,6 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) } } } - else - { - S32 i = 0; - for( S32 u = 0; u < mWidth; u++ ) - { - for( S32 v = 0; v < mHeight; v++ ) - { - baked_image_data[4*i + 0] = baked_color_data[4*i + 0]; - baked_image_data[4*i + 1] = baked_color_data[4*i + 1]; - baked_image_data[4*i + 2] = baked_color_data[4*i + 2]; - baked_image_data[4*i + 3] = 255; // eyes should have no mask - reserve for alpha - i++; - } - } - } - } LLPointer compressedImage = new LLImageJ2C; compressedImage->setRate(0.f); @@ -490,7 +428,7 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) { // baked_upload_data is owned by the responder and deleted after the request completes LLBakedUploadData* baked_upload_data = - new LLBakedUploadData( gAgent.getAvatarObject(), this->mTexLayerSet, this, asset_id ); + new LLBakedUploadData(gAgent.getAvatarObject(), this->mTexLayerSet, asset_id); mUploadID = asset_id; // upload the image @@ -536,73 +474,74 @@ void LLTexLayerSetBuffer::readBackAndUpload(U8* baked_bump_data) } delete [] baked_color_data; - delete [] baked_bump_data; } // static -void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, void* userdata, S32 result, LLExtStat ext_status) // StoreAssetData callback (not fixed) +void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, + void* userdata, + S32 result, + LLExtStat ext_status) // StoreAssetData callback (not fixed) { LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata; - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (0 == result && avatar && !avatar->isDead()) + if (0 == result && + avatar && + !avatar->isDead() && + baked_upload_data->mAvatar == avatar && // Sanity check: only the user's avatar should be uploading textures. + baked_upload_data->mTexLayerSet->hasComposite() + ) { - // Sanity check: only the user's avatar should be uploading textures. - if( baked_upload_data->mAvatar == avatar ) + LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite(); + + if (layerset_buffer->mUploadID.isNull()) { - // Composite may have changed since the pointer was stored - need to do some checking. - LLTexLayerSetBuffer* prev_layerset_buffer = baked_upload_data->mLayerSetBuffer; - // Can't just call getComposite() because this will trigger creation if none exists. - LLTexLayerSetBuffer* curr_layerset_buffer = - baked_upload_data->mLayerSet->hasComposite()?baked_upload_data->mLayerSet->getComposite():NULL; + // The upload got canceled, we should be in the + // process of baking a new texture so request an + // upload with the new data - if (prev_layerset_buffer != curr_layerset_buffer) + // BAP: does this really belong in this callback, as + // opposed to where the cancellation takes place? + // suspect this does nothing. + layerset_buffer->requestUpload(); + } + else if (baked_upload_data->mID == layerset_buffer->mUploadID) + { + // This is the upload we're currently waiting for. + layerset_buffer->mUploadID.setNull(); + layerset_buffer->mUploadPending = FALSE; + + if (result >= 0) { - llinfos << "Baked texture out of date, composite no longer valid, ignored" << llendl; + LLVOAvatarDefines::ETextureIndex baked_te = avatar->getBakedTE(layerset_buffer->mTexLayerSet); + // Update baked texture info with the new UUID + U64 now = LLFrameTimer::getTotalTime(); // Record starting time + llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; + avatar->setNewBakedTexture(baked_te, uuid); } else - { - curr_layerset_buffer->mUploadPending = FALSE; - - if (curr_layerset_buffer->mUploadID.isNull()) - { - // The upload got canceled, we should be in the process of baking a new texture - // so request an upload with the new data - curr_layerset_buffer->requestUpload(); - } - else if( baked_upload_data->mID == curr_layerset_buffer->mUploadID ) - { - // This is the upload we're currently waiting for. - curr_layerset_buffer->mUploadID.setNull(); - - if( result >= 0 ) - { - ETextureIndex baked_te = avatar->getBakedTE( curr_layerset_buffer->mTexLayerSet ); - U64 now = LLFrameTimer::getTotalTime(); // Record starting time - llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; - avatar->setNewBakedTexture( baked_te, uuid ); - } - else - { - llinfos << "Baked upload failed. Reason: " << result << llendl; - // *FIX: retry upload after n seconds, asset server could be busy - } - } - else - { - llinfos << "Received baked texture out of date, ignored." << llendl; - } - - avatar->dirtyMesh(); + { + // Avatar appearance is changing, ignore the upload results + llinfos << "Baked upload failed. Reason: " << result << llendl; + // *FIX: retry upload after n seconds, asset server could be busy } } + else + { + llinfos << "Received baked texture out of date, ignored." << llendl; + } + + avatar->dirtyMesh(); } else { - // Baked texture failed to upload, but since we didn't set the new baked texture, it means that they'll - // try and rebake it at some point in the future (after login?) + // Baked texture failed to upload (in which case since we + // didn't set the new baked texture, it means that they'll try + // and rebake it at some point in the future (after login?)), + // or this response to upload is out of date, in which case a + // current response should be on the way or already processed. llwarns << "Baked upload failed" << llendl; } @@ -635,8 +574,7 @@ void LLTexLayerSetBuffer::bindBumpTexture( U32 stage ) // An ordered set of texture layers that get composited into a single texture. //----------------------------------------------------------------------------- -LLTexLayerSetInfo::LLTexLayerSetInfo( ) - : +LLTexLayerSetInfo::LLTexLayerSetInfo() : mBodyRegion( "" ), mWidth( 512 ), mHeight( 512 ), @@ -701,6 +639,19 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) return TRUE; } +// creates visual params without generating layersets or layers +void LLTexLayerSetInfo::createVisualParams(LLVOAvatar *avatar) +{ + //layer_info_list_t mLayerInfoList; + for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin(); + layer_iter != mLayerInfoList.end(); + layer_iter++) + { + LLTexLayerInfo *layer_info = *layer_iter; + layer_info->createVisualParams(avatar); + } +} + //----------------------------------------------------------------------------- // LLTexLayerSet // An ordered set of texture layers that get composited into a single texture. @@ -708,8 +659,7 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) BOOL LLTexLayerSet::sHasCaches = FALSE; -LLTexLayerSet::LLTexLayerSet( LLVOAvatar* avatar ) - : +LLTexLayerSet::LLTexLayerSet(LLVOAvatarSelf* const avatar) : mComposite( NULL ), mAvatar( avatar ), mUpdatesEnabled( FALSE ), @@ -720,7 +670,9 @@ LLTexLayerSet::LLTexLayerSet( LLVOAvatar* avatar ) LLTexLayerSet::~LLTexLayerSet() { + deleteCaches(); std::for_each(mLayerList.begin(), mLayerList.end(), DeletePointer()); + std::for_each(mMaskLayerList.begin(), mMaskLayerList.end(), DeletePointer()); delete mComposite; } @@ -728,15 +680,16 @@ LLTexLayerSet::~LLTexLayerSet() // setInfo //----------------------------------------------------------------------------- -BOOL LLTexLayerSet::setInfo(LLTexLayerSetInfo *info) +BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) { llassert(mInfo == NULL); mInfo = info; //mID = info->mID; // No ID - LLTexLayerSetInfo::layer_info_list_t::iterator iter; mLayerList.reserve(info->mLayerInfoList.size()); - for (iter = info->mLayerInfoList.begin(); iter != info->mLayerInfoList.end(); iter++) + for (LLTexLayerSetInfo::layer_info_list_t::const_iterator iter = info->mLayerInfoList.begin(); + iter != info->mLayerInfoList.end(); + iter++) { LLTexLayer* layer = new LLTexLayer( this ); if (!layer->setInfo(*iter)) @@ -744,8 +697,15 @@ BOOL LLTexLayerSet::setInfo(LLTexLayerSetInfo *info) mInfo = NULL; return FALSE; } + if (!layer->isVisibilityMask()) + { mLayerList.push_back( layer ); } + else + { + mMaskLayerList.push_back(layer); + } + } requestUpdate(); @@ -784,19 +744,26 @@ void LLTexLayerSet::deleteCaches() LLTexLayer* layer = *iter; layer->deleteCaches(); } + for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) + { + LLTexLayer* layer = *iter; + layer->deleteCaches(); + } } // Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on. -BOOL LLTexLayerSet::isLocalTextureDataAvailable() +BOOL LLTexLayerSet::isLocalTextureDataAvailable() const { - return mAvatar->isLocalTextureDataAvailable( this ); + if (!mAvatar->isSelf()) return FALSE; + return ((LLVOAvatarSelf *)mAvatar)->isLocalTextureDataAvailable(this); } // Returns TRUE if all of the data for the textures that this layerset depends on have arrived. -BOOL LLTexLayerSet::isLocalTextureDataFinal() +BOOL LLTexLayerSet::isLocalTextureDataFinal() const { - return mAvatar->isLocalTextureDataFinal( this ); + if (!mAvatar->isSelf()) return FALSE; + return ((LLVOAvatarSelf *)mAvatar)->isLocalTextureDataFinal(this); } @@ -808,62 +775,26 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE); gGL.setColorMask(true, true); + BOOL render_morph = mAvatar->morphMaskNeedsUpdate(mBakedTexIndex); + // composite color layers for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { LLTexLayer* layer = *iter; - if( layer->getRenderPass() == RP_COLOR ) + if (layer->getRenderPass() == LLTexLayer::RP_COLOR) { gGL.flush(); - success &= layer->render( x, y, width, height ); + success &= layer->render(x, y, width, height, render_morph); gGL.flush(); - } - } - - // (Optionally) replace alpha with a single component image from a tga file. - if( !getInfo()->mStaticAlphaFileName.empty() ) - { - LLGLSNoAlphaTest gls_no_alpha_test; - gGL.flush(); - gGL.setColorMask(false, true); - gGL.setSceneBlendType(LLRender::BT_REPLACE); - - { - LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE ); - if( image_gl ) + if (layer->isMorphValid()) { - LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->bind(image_gl); - gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); - gl_rect_2d_simple_tex( width, height ); - } - else - { - success = FALSE; + mAvatar->setMorphMasksValid(TRUE, mBakedTexIndex); } } - gGL.flush(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - gGL.setColorMask(true, true); - gGL.setSceneBlendType(LLRender::BT_ALPHA); } - else - if( getInfo()->mClearAlpha ) - { - // Set the alpha channel to one (clean up after previous blending) - LLGLDisable no_alpha(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.f, 0.f, 0.f, 1.f ); - gGL.flush(); - gGL.setColorMask(false, true); + + renderAlphaMaskTextures(width, height, false); - gl_rect_2d_simple( width, height ); - - gGL.flush(); - gGL.setColorMask(true, true); - } stop_glerror(); return success; @@ -881,9 +812,9 @@ BOOL LLTexLayerSet::renderBump( S32 x, S32 y, S32 width, S32 height ) for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { LLTexLayer* layer = *iter; - if( layer->getRenderPass() == RP_BUMP ) + if (layer->getRenderPass() == LLTexLayer::RP_BUMP) { - success &= layer->render( x, y, width, height ); +// success &= layer->render(x, y, width, height); } } @@ -901,6 +832,16 @@ BOOL LLTexLayerSet::renderBump( S32 x, S32 y, S32 width, S32 height ) return success; } +BOOL LLTexLayerSet::isBodyRegion(const std::string& region) const +{ + return mInfo->mBodyRegion == region; +} + +const std::string LLTexLayerSet::getBodyRegion() const +{ + return mInfo->mBodyRegion; +} + void LLTexLayerSet::requestUpdate() { if( mUpdatesEnabled ) @@ -933,8 +874,9 @@ void LLTexLayerSet::createComposite() // Composite other avatars at reduced resolution if( !mAvatar->isSelf() ) { - width /= 2; - height /= 2; + // TODO: replace with sanity check to ensure not called for non-self avatars +// width /= 2; +// height /= 2; } mComposite = new LLTexLayerSetBuffer( this, width, height, mHasBump ); } @@ -967,12 +909,14 @@ LLTexLayerSetBuffer* LLTexLayerSet::getComposite() return mComposite; } -void LLTexLayerSet::gatherAlphaMasks(U8 *data, S32 width, S32 height) +void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height) { S32 size = width * height; memset(data, 255, width * height); + BOOL render_morph = mAvatar->morphMaskNeedsUpdate(mBakedTexIndex); + for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { LLTexLayer* layer = *iter; @@ -981,8 +925,10 @@ void LLTexLayerSet::gatherAlphaMasks(U8 *data, S32 width, S32 height) { LLColor4 net_color; layer->findNetColor( &net_color ); + // TODO: eliminate need for layer morph mask valid flag layer->invalidateMorphMasks(); - layer->renderAlphaMasks(mComposite->getOriginX(), mComposite->getOriginY(), width, height, &net_color); + mAvatar->invalidateMorphMasks(mBakedTexIndex); + layer->renderMorphMasks(mComposite->getOriginX(), mComposite->getOriginY(), width, height, net_color, render_morph); alphaData = layer->getAlphaData(); } if (alphaData) @@ -997,35 +943,111 @@ void LLTexLayerSet::gatherAlphaMasks(U8 *data, S32 width, S32 height) } } } + + // Set alpha back to that of our alpha masks. + renderAlphaMaskTextures(width, height, true); +} + +void LLTexLayerSet::renderAlphaMaskTextures(S32 width, S32 height, bool forceClear) +{ + const LLTexLayerSetInfo *info = getInfo(); + + gGL.setColorMask(false, true); + gGL.setSceneBlendType(LLRender::BT_REPLACE); + // (Optionally) replace alpha with a single component image from a tga file. + if (!info->mStaticAlphaFileName.empty() && mMaskLayerList.empty()) + { + LLGLSNoAlphaTest gls_no_alpha_test; + gGL.flush(); + { + LLImageGL* image_gl = LLTexLayerStaticImageList::getInstance()->getImageGL(info->mStaticAlphaFileName, TRUE); + if( image_gl ) + { + LLGLSUIDefault gls_ui; + gGL.getTexUnit(0)->bind(image_gl); + gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); + gl_rect_2d_simple_tex( width, height ); + } + } + gGL.flush(); + } + else if (forceClear || info->mClearAlpha || (mMaskLayerList.size() > 0)) + { + // Set the alpha channel to one (clean up after previous blending) + gGL.flush(); + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.color4f( 0.f, 0.f, 0.f, 1.f ); + + gl_rect_2d_simple( width, height ); + + gGL.flush(); + } + + // (Optional) Mask out part of the baked texture with alpha masks + // will still have an effect even if mClearAlpha is set or the alpha component was replaced + if (mMaskLayerList.size() > 0) + { + gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA); + gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); + for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) + { + LLTexLayer* layer = *iter; + gGL.flush(); + layer->blendAlphaTexture(width, height); + gGL.flush(); + } + + } + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); + gGL.setColorMask(true, true); + gGL.setSceneBlendType(LLRender::BT_ALPHA); } void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components) +{ + mAvatar->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex); +} + +//----------------------------------------------------------------------------- +// finds a specific layer based on a passed in name +//----------------------------------------------------------------------------- +LLTexLayer* LLTexLayerSet::findLayerByName(std::string name) { for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) { LLTexLayer* layer = *iter; - layer->applyMorphMask(tex_data, width, height, num_components); + + if (layer->getName().compare(name) == 0) + { + return layer; + } } + return NULL; } + //----------------------------------------------------------------------------- // LLTexLayerInfo //----------------------------------------------------------------------------- -LLTexLayerInfo::LLTexLayerInfo( ) - : +LLTexLayerInfo::LLTexLayerInfo() : mWriteAllChannels( FALSE ), - mRenderPass( RP_COLOR ), + mRenderPass(LLTexLayer::RP_COLOR), mFixedColor( 0.f, 0.f, 0.f, 0.f ), mLocalTexture( -1 ), mStaticImageIsMask( FALSE ), - mUseLocalTextureAlphaOnly( FALSE ) + mUseLocalTextureAlphaOnly(FALSE), + mIsVisibilityMask(FALSE) { } LLTexLayerInfo::~LLTexLayerInfo( ) { - std::for_each(mColorInfoList.begin(), mColorInfoList.end(), DeletePointer()); - std::for_each(mAlphaInfoList.begin(), mAlphaInfoList.end(), DeletePointer()); + std::for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer()); + std::for_each(mParamAlphaInfoList.begin(), mParamAlphaInfoList.end(), DeletePointer()); } BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) @@ -1048,7 +1070,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) { if( render_pass_name == "bump" ) { - mRenderPass = RP_BUMP; + mRenderPass = LLTexLayer::RP_BUMP; } } @@ -1057,6 +1079,14 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle global_color_string = LLXmlTree::addAttributeString("global_color"); node->getFastAttributeString( global_color_string, mGlobalColor ); + // Visibility mask (optional) + BOOL is_visibility; + static LLStdStringHandle visibility_mask_string = LLXmlTree::addAttributeString("visibility_mask"); + if (node->getFastAttributeBOOL(visibility_mask_string, is_visibility)) + { + mIsVisibilityMask = is_visibility; + } + // color attribute (optional) LLColor4U color4u; static LLStdStringHandle fixed_color_string = LLXmlTree::addAttributeString("fixed_color"); @@ -1070,7 +1100,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) texture_node; texture_node = node->getNextNamedChild()) { - std::string local_texture; + std::string local_texture_name; static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); static LLStdStringHandle local_texture_string = LLXmlTree::addAttributeString("local_texture"); static LLStdStringHandle file_is_mask_string = LLXmlTree::addAttributeString("file_is_mask"); @@ -1079,73 +1109,27 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) { texture_node->getFastAttributeBOOL( file_is_mask_string, mStaticImageIsMask ); } - else if( texture_node->getFastAttributeString( local_texture_string, local_texture ) ) + else if (texture_node->getFastAttributeString(local_texture_string, local_texture_name)) { texture_node->getFastAttributeBOOL( local_texture_alpha_only_string, mUseLocalTextureAlphaOnly ); - if( "upper_shirt" == local_texture ) - { - mLocalTexture = TEX_UPPER_SHIRT; - } - else if( "upper_bodypaint" == local_texture ) - { - mLocalTexture = TEX_UPPER_BODYPAINT; - } - else if( "lower_pants" == local_texture ) - { - mLocalTexture = TEX_LOWER_PANTS; - } - else if( "lower_bodypaint" == local_texture ) - { - mLocalTexture = TEX_LOWER_BODYPAINT; - } - else if( "lower_shoes" == local_texture ) - { - mLocalTexture = TEX_LOWER_SHOES; - } - else if( "head_bodypaint" == local_texture ) - { - mLocalTexture = TEX_HEAD_BODYPAINT; - } - else if( "lower_socks" == local_texture ) - { - mLocalTexture = TEX_LOWER_SOCKS; - } - else if( "upper_jacket" == local_texture ) - { - mLocalTexture = TEX_UPPER_JACKET; - } - else if( "lower_jacket" == local_texture ) - { - mLocalTexture = TEX_LOWER_JACKET; - } - else if( "upper_gloves" == local_texture ) - { - mLocalTexture = TEX_UPPER_GLOVES; - } - else if( "upper_undershirt" == local_texture ) - { - mLocalTexture = TEX_UPPER_UNDERSHIRT; - } - else if( "lower_underpants" == local_texture ) + /* if ("upper_shirt" == local_texture_name) + mLocalTexture = TEX_UPPER_SHIRT; */ + mLocalTexture = TEX_NUM_INDICES; + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + iter++) { - mLocalTexture = TEX_LOWER_UNDERPANTS; - } - else if( "eyes_iris" == local_texture ) + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + if (local_texture_name == texture_dict->mName) { - mLocalTexture = TEX_EYES_IRIS; + mLocalTexture = iter->first; + break; } - else if( "skirt" == local_texture ) - { - mLocalTexture = TEX_SKIRT; - } - else if( "hair_grain" == local_texture ) - { - mLocalTexture = TEX_HAIR; } - else + if (mLocalTexture == TEX_NUM_INDICES) { - llwarns << " element has invalid local_texure attribute: " << mName << " " << local_texture << llendl; + llwarns << " element has invalid local_texure attribute: " << mName << " " << local_texture_name << llendl; return FALSE; } } @@ -1179,13 +1163,13 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) if( child->getChildByName( "param_color" ) ) { // - LLTexParamColorInfo* info = new LLTexParamColorInfo( ); + LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo(); if (!info->parseXml(child)) { delete info; return FALSE; } - mColorInfoList.push_back( info ); + mParamColorInfoList.push_back(info); } else if( child->getChildByName( "param_alpha" ) ) { @@ -1196,13 +1180,47 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) delete info; return FALSE; } - mAlphaInfoList.push_back( info ); + mParamAlphaInfoList.push_back(info); } } return TRUE; } +BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar) +{ + BOOL success = TRUE; + for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin(); + color_info_iter != mParamColorInfoList.end(); + color_info_iter++) + { + LLTexLayerParamColorInfo * color_info = *color_info_iter; + LLTexLayerParamColor* param_color = new LLTexLayerParamColor(avatar); + if (!param_color->setInfo(color_info)) + { + llwarns << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << llendl; + delete param_color; + success = FALSE; + } + } + + for (param_alpha_info_list_t::iterator alpha_info_iter = mParamAlphaInfoList.begin(); + alpha_info_iter != mParamAlphaInfoList.end(); + alpha_info_iter++) + { + LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter; + LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(avatar); + if (!param_alpha->setInfo(alpha_info)) + { + llwarns << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << llendl; + delete param_alpha; + success = FALSE; + } + } + + return success; +} + //----------------------------------------------------------------------------- // LLTexLayer // A single texture layer, consisting of: @@ -1216,12 +1234,12 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) // * a texture entry index (TE) // * (optional) one or more alpha parameters (weighted alpha textures) //----------------------------------------------------------------------------- -LLTexLayer::LLTexLayer( LLTexLayerSet* layer_set ) - : +LLTexLayer::LLTexLayer(LLTexLayerSet* layer_set) : mTexLayerSet( layer_set ), mMorphMasksValid( FALSE ), mStaticImageInvalid( FALSE ), - mInfo( NULL ) + mInfo(NULL), + mHasMorph(FALSE) { } @@ -1238,45 +1256,28 @@ LLTexLayer::~LLTexLayer() U8* alpha_data = iter->second; delete [] alpha_data; } + } //----------------------------------------------------------------------------- // setInfo //----------------------------------------------------------------------------- -BOOL LLTexLayer::setInfo(LLTexLayerInfo* info) +BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info) { llassert(mInfo == NULL); mInfo = info; //mID = info->mID; // No ID - if (info->mRenderPass == RP_BUMP) + if (info->mRenderPass == LLTexLayer::RP_BUMP) mTexLayerSet->setBump(TRUE); + mParamColorList.reserve(mInfo->mParamColorInfoList.size()); + for (param_color_info_list_t::const_iterator iter = mInfo->mParamColorInfoList.begin(); + iter != mInfo->mParamColorInfoList.end(); + iter++) { - LLTexLayerInfo::morph_name_list_t::iterator iter; - for (iter = mInfo->mMorphNameList.begin(); iter != mInfo->mMorphNameList.end(); iter++) - { - // *FIX: we assume that the referenced visual param is a - // morph target, need a better way of actually looking - // this up. - LLPolyMorphTarget *morph_param; - std::string *name = &(iter->first); - morph_param = (LLPolyMorphTarget *)(getTexLayerSet()->getAvatar()->getVisualParam(name->c_str())); - if (morph_param) - { - BOOL invert = iter->second; - addMaskedMorph(morph_param, invert); - } - } - } - - { - LLTexLayerInfo::color_info_list_t::iterator iter; - mParamColorList.reserve(mInfo->mColorInfoList.size()); - for (iter = mInfo->mColorInfoList.begin(); iter != mInfo->mColorInfoList.end(); iter++) - { - LLTexParamColor* param_color = new LLTexParamColor( this ); + LLTexLayerParamColor* param_color = new LLTexLayerParamColor(this); if (!param_color->setInfo(*iter)) { mInfo = NULL; @@ -1284,11 +1285,11 @@ BOOL LLTexLayer::setInfo(LLTexLayerInfo* info) } mParamColorList.push_back( param_color ); } - } - { - LLTexLayerInfo::alpha_info_list_t::iterator iter; - mParamAlphaList.reserve(mInfo->mAlphaInfoList.size()); - for (iter = mInfo->mAlphaInfoList.begin(); iter != mInfo->mAlphaInfoList.end(); iter++) + + mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size()); + for (param_alpha_info_list_t::const_iterator iter = mInfo->mParamAlphaInfoList.begin(); + iter != mInfo->mParamAlphaInfoList.end(); + iter++) { LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha( this ); if (!param_alpha->setInfo(*iter)) @@ -1298,84 +1299,83 @@ BOOL LLTexLayer::setInfo(LLTexLayerInfo* info) } mParamAlphaList.push_back( param_alpha ); } - } return TRUE; } -#if 0 // obsolete -//----------------------------------------------------------------------------- -// parseData -//----------------------------------------------------------------------------- -BOOL LLTexLayer::parseData( LLXmlTreeNode* node ) +//static +void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color) { - LLTexLayerInfo *info = new LLTexLayerInfo; - - if (!info->parseXml(node)) + for (param_color_list_t::const_iterator iter = param_list.begin(); + iter != param_list.end(); iter++) +{ + const LLTexLayerParamColor* param = *iter; + LLColor4 param_net = param->getNetColor(); + const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo(); + switch(info->getOperation()) { - delete info; - return FALSE; + case LLTexLayerParamColor::OP_ADD: + net_color += param_net; + break; + case LLTexLayerParamColor::OP_MULTIPLY: + net_color = net_color * param_net; + break; + case LLTexLayerParamColor::OP_BLEND: + net_color = lerp(net_color, param_net, param->getWeight()); + break; + default: + llassert(0); + break; } - if (!setInfo(info)) - { - delete info; - return FALSE; } - return TRUE; + net_color.clamp(); } -#endif - -//----------------------------------------------------------------------------- - void LLTexLayer::deleteCaches() { - for( alpha_list_t::iterator iter = mParamAlphaList.begin(); + for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++ ) { LLTexLayerParamAlpha* param = *iter; param->deleteCaches(); } - mStaticImageRaw = NULL; } -BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) +BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, BOOL render_morph) { LLGLEnable color_mat(GL_COLOR_MATERIAL); gPipeline.disableLights(); - BOOL success = TRUE; - - BOOL color_specified = FALSE; - BOOL alpha_mask_specified = FALSE; - LLColor4 net_color; - color_specified = findNetColor( &net_color ); - + BOOL color_specified = findNetColor(&net_color); + if (mTexLayerSet->getAvatar()->mIsDummy) { color_specified = true; net_color = LLVOAvatar::getDummyColor(); } + BOOL success = TRUE; + // If you can't see the layer, don't render it. if( is_approx_zero( net_color.mV[VW] ) ) { return success; } - alpha_list_t::iterator iter = mParamAlphaList.begin(); + BOOL alpha_mask_specified = FALSE; + param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); if( iter != mParamAlphaList.end() ) { // If we have alpha masks, but we're skipping all of them, skip the whole layer. // However, we can't do this optimization if we have morph masks that need updating. - if( mMaskedMorphs.empty() ) + if (!mHasMorph) { BOOL skip_layer = TRUE; while( iter != mParamAlphaList.end() ) { - LLTexLayerParamAlpha* param = *iter; + const LLTexLayerParamAlpha* param = *iter; if( !param->getSkip() ) { @@ -1392,7 +1392,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) } } - renderAlphaMasks( x, y, width, height, &net_color ); + renderMorphMasks(x, y, width, height, net_color, render_morph); alpha_mask_specified = TRUE; gGL.flush(); gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA); @@ -1437,7 +1437,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) if( !getInfo()->mStaticImageFileName.empty() ) { { - LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); + LLImageGL* image_gl = LLTexLayerStaticImageList::getInstance()->getImageGL(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); if( image_gl ) { gGL.getTexUnit(0)->bind(image_gl); @@ -1451,14 +1451,14 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height ) } } - if( ((-1 == getInfo()->mLocalTexture) || + if(((-1 == getInfo()->mLocalTexture) || getInfo()->mUseLocalTextureAlphaOnly) && getInfo()->mStaticImageFileName.empty() && color_specified ) { LLGLDisable no_alpha(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4fv( net_color.mV); + gGL.color4fv( net_color.mV ); gl_rect_2d_simple( width, height ); } @@ -1483,9 +1483,9 @@ U8* LLTexLayer::getAlphaData() const LLUUID& uuid = mTexLayerSet->getAvatar()->getLocalTextureID((ETextureIndex)getInfo()->mLocalTexture); alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES); - for( alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++ ) + for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) { - LLTexLayerParamAlpha* param = *iter; + const LLTexLayerParamAlpha* param = *iter; F32 param_weight = param->getWeight(); alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32)); } @@ -1496,7 +1496,7 @@ U8* LLTexLayer::getAlphaData() return (iter2 == mAlphaCache.end()) ? 0 : iter2->second; } -BOOL LLTexLayer::findNetColor( LLColor4* net_color ) +BOOL LLTexLayer::findNetColor(LLColor4* net_color) const { // Color is either: // * one or more color parameters (weighted colors) (which may make use of a global color or fixed color) @@ -1510,8 +1510,7 @@ BOOL LLTexLayer::findNetColor( LLColor4* net_color ) { net_color->setVec( mTexLayerSet->getAvatar()->getGlobalColor( getInfo()->mGlobalColor ) ); } - else - if( getInfo()->mFixedColor.mV[VW] ) + else if (getInfo()->mFixedColor.mV[VW]) { net_color->setVec( getInfo()->mFixedColor ); } @@ -1520,30 +1519,7 @@ BOOL LLTexLayer::findNetColor( LLColor4* net_color ) net_color->setVec( 0.f, 0.f, 0.f, 0.f ); } - for( color_list_t::iterator iter = mParamColorList.begin(); - iter != mParamColorList.end(); iter++ ) - { - LLTexParamColor* param = *iter; - LLColor4 param_net = param->getNetColor(); - switch( param->getOperation() ) - { - case OP_ADD: - *net_color += param_net; - break; - case OP_MULTIPLY: - net_color->mV[VX] *= param_net.mV[VX]; - net_color->mV[VY] *= param_net.mV[VY]; - net_color->mV[VZ] *= param_net.mV[VZ]; - net_color->mV[VW] *= param_net.mV[VW]; - break; - case OP_BLEND: - net_color->setVec( lerp(*net_color, param_net, param->getWeight()) ); - break; - default: - llassert(0); - break; - } - } + calculateTexLayerColor(mParamColorList, *net_color); return TRUE; } @@ -1564,8 +1540,51 @@ BOOL LLTexLayer::findNetColor( LLColor4* net_color ) return FALSE; // No need to draw a separate colored polygon } +BOOL LLTexLayer::blendAlphaTexture(S32 width, S32 height) +{ + BOOL success = TRUE; + + gGL.flush(); + + if( !getInfo()->mStaticImageFileName.empty() ) + { + LLImageGL* image_gl = LLTexLayerStaticImageList::getInstance()->getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); + if( image_gl ) + { + LLGLSNoAlphaTest gls_no_alpha_test; + gGL.getTexUnit(0)->bind(image_gl); + gl_rect_2d_simple_tex( width, height ); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } + else + { + success = FALSE; + } + } + else + { + if (getInfo()->mLocalTexture >=0 && getInfo()->mLocalTexture < TEX_NUM_INDICES) + { + LLImageGL* image_gl = NULL; + if (mTexLayerSet->getAvatar()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl)) + { + if (image_gl) + { + LLGLSNoAlphaTest gls_no_alpha_test; + gGL.getTexUnit(0)->bind(image_gl); + gl_rect_2d_simple_tex( width, height ); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + success = TRUE; + } + } + } + } + + return success; +} + -BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4* colorp ) +BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, BOOL render_morph) { BOOL success = TRUE; @@ -1573,9 +1592,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 gGL.setColorMask(false, true); - alpha_list_t::iterator iter = mParamAlphaList.begin(); - LLTexLayerParamAlpha* first_param = *iter; - + LLTexLayerParamAlpha* first_param = *mParamAlphaList.begin(); // Note: if the first param is a mulitply, multiply against the current buffer's alpha if( !first_param || !first_param->getMultiplyBlend() ) { @@ -1593,8 +1610,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 // Accumulate alphas LLGLSNoAlphaTest gls_no_alpha_test; gGL.color4f( 1.f, 1.f, 1.f, 1.f ); - - for( iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++ ) + for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) { LLTexLayerParamAlpha* param = *iter; success &= param->render( x, y, width, height ); @@ -1602,12 +1618,11 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 // Approximates a min() function gGL.flush(); - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); + gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA); // Accumulate the alpha component of the texture if( getInfo()->mLocalTexture != -1 ) { - { LLImageGL* image_gl = NULL; if( mTexLayerSet->getAvatar()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) ) { @@ -1631,12 +1646,10 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 success = FALSE; } } - } if( !getInfo()->mStaticImageFileName.empty() ) { - { - LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); + LLImageGL* image_gl = LLTexLayerStaticImageList::getInstance()->getImageGL(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); if( image_gl ) { if( (image_gl->getComponents() == 4) || @@ -1653,15 +1666,14 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 success = FALSE; } } - } // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); - if( colorp->mV[VW] != 1.f ) + if (layer_color.mV[VW] != 1.f) { LLGLDisable no_alpha(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4fv( colorp->mV ); + gGL.color4fv(layer_color.mV); gl_rect_2d_simple( width, height ); } @@ -1670,34 +1682,28 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 gGL.setColorMask(true, true); - if (!mMorphMasksValid && !mMaskedMorphs.empty()) + if (render_morph && mHasMorph) { LLCRC alpha_mask_crc; const LLUUID& uuid = mTexLayerSet->getAvatar()->getLocalTextureID((ETextureIndex)getInfo()->mLocalTexture); alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES); - for( alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++ ) + for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) { - LLTexLayerParamAlpha* param = *iter; + const LLTexLayerParamAlpha* param = *iter; F32 param_weight = param->getWeight(); alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32)); } U32 cache_index = alpha_mask_crc.getCRC(); - - alpha_cache_t::iterator iter2 = mAlphaCache.find(cache_index); - U8* alpha_data; - if (iter2 != mAlphaCache.end()) - { - alpha_data = iter2->second; - } - else + U8* alpha_data = get_if_there(mAlphaCache,cache_index,(U8*)NULL); + if (!alpha_data) { // clear out a slot if we have filled our cache S32 max_cache_entries = getTexLayerSet()->getAvatar()->isSelf() ? 4 : 1; while ((S32)mAlphaCache.size() >= max_cache_entries) { - iter2 = mAlphaCache.begin(); // arbitrarily grab the first entry + alpha_cache_t::iterator iter2 = mAlphaCache.begin(); // arbitrarily grab the first entry alpha_data = iter2->second; delete [] alpha_data; mAlphaCache.erase(iter2); @@ -1710,28 +1716,12 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 getTexLayerSet()->getAvatar()->dirtyMesh(); mMorphMasksValid = TRUE; - - for( morph_list_t::iterator iter3 = mMaskedMorphs.begin(); - iter3 != mMaskedMorphs.end(); iter3++ ) - { - LLMaskedMorph* maskedMorph = &(*iter3); - maskedMorph->mMorphTarget->applyMask(alpha_data, width, height, 1, maskedMorph->mInvert); - } + getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1); } return success; } -void LLTexLayer::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components) -{ - for( morph_list_t::iterator iter = mMaskedMorphs.begin(); - iter != mMaskedMorphs.end(); iter++ ) - { - LLMaskedMorph* maskedMorph = &(*iter); - maskedMorph->mMorphTarget->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); - } -} - // Returns TRUE on success. BOOL LLTexLayer::renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask ) { @@ -1808,666 +1798,54 @@ void LLTexLayer::requestUpdate() mTexLayerSet->requestUpdate(); } -void LLTexLayer::addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert) +const std::string& LLTexLayer::getName() const { - mMaskedMorphs.push_front(LLMaskedMorph(morph_target, invert)); + return mInfo->mName; } -void LLTexLayer::invalidateMorphMasks() +LLTexLayer::ERenderPass LLTexLayer::getRenderPass() const { - mMorphMasksValid = FALSE; + return mInfo->mRenderPass; } - -//----------------------------------------------------------------------------- -// LLTexLayerParamAlphaInfo -//----------------------------------------------------------------------------- -LLTexLayerParamAlphaInfo::LLTexLayerParamAlphaInfo( ) - : - mMultiplyBlend( FALSE ), - mSkipIfZeroWeight( FALSE ), - mDomain( 0.f ) +const std::string& LLTexLayer::getGlobalColor() const { + return mInfo->mGlobalColor; } -BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) -{ - llassert( node->hasName( "param" ) && node->getChildByName( "param_alpha" ) ); - - if( !LLViewerVisualParamInfo::parseXml(node) ) - return FALSE; - - LLXmlTreeNode* param_alpha_node = node->getChildByName( "param_alpha" ); - if( !param_alpha_node ) - { - return FALSE; - } - - static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); - if( param_alpha_node->getFastAttributeString( tga_file_string, mStaticImageFileName ) ) - { - // Don't load the image file until it's actually needed. - } -// else -// { -// llwarns << " element is missing tga_file attribute." << llendl; -// } - - static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend"); - param_alpha_node->getFastAttributeBOOL( multiply_blend_string, mMultiplyBlend ); - - static LLStdStringHandle skip_if_zero_string = LLXmlTree::addAttributeString("skip_if_zero"); - param_alpha_node->getFastAttributeBOOL( skip_if_zero_string, mSkipIfZeroWeight ); - - static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain"); - param_alpha_node->getFastAttributeF32( domain_string, mDomain ); - - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLTexLayerParamAlpha -//----------------------------------------------------------------------------- - -// static -LLTexLayerParamAlpha::param_alpha_ptr_list_t LLTexLayerParamAlpha::sInstances; - -// static -void LLTexLayerParamAlpha::dumpCacheByteCount() -{ - S32 gl_bytes = 0; - getCacheByteCount( &gl_bytes ); - llinfos << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << llendl; -} - -// static -void LLTexLayerParamAlpha::getCacheByteCount( S32* gl_bytes ) -{ - *gl_bytes = 0; - - for( param_alpha_ptr_list_t::iterator iter = sInstances.begin(); - iter != sInstances.end(); iter++ ) - { - LLTexLayerParamAlpha* instance = *iter; - LLImageGL* image_gl = instance->mCachedProcessedImageGL; - if( image_gl ) - { - S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); - - if( image_gl->getHasGLTexture() ) - { - *gl_bytes += bytes; - } - } - } -} - -LLTexLayerParamAlpha::LLTexLayerParamAlpha( LLTexLayer* layer ) - : - mCachedProcessedImageGL( NULL ), - mTexLayer( layer ), - mNeedsCreateTexture( FALSE ), - mStaticImageInvalid( FALSE ), - mAvgDistortionVec(1.f, 1.f, 1.f), - mCachedEffectiveWeight(0.f) -{ - sInstances.push_front( this ); -} - -LLTexLayerParamAlpha::~LLTexLayerParamAlpha() -{ - deleteCaches(); - sInstances.remove( this ); -} - -//----------------------------------------------------------------------------- -// setInfo() -//----------------------------------------------------------------------------- -BOOL LLTexLayerParamAlpha::setInfo(LLTexLayerParamAlphaInfo *info) -{ - llassert(mInfo == NULL); - if (info->mID < 0) - return FALSE; - mInfo = info; - mID = info->mID; - - mTexLayer->getTexLayerSet()->getAvatar()->addVisualParam( this ); - setWeight(getDefaultWeight(), FALSE ); - - return TRUE; -} - -//----------------------------------------------------------------------------- - -void LLTexLayerParamAlpha::deleteCaches() -{ - mStaticImageTGA = NULL; // deletes image - mCachedProcessedImageGL = NULL; - mStaticImageRaw = NULL; - mNeedsCreateTexture = FALSE; -} - -void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL set_by_user) -{ - if (mIsAnimating) - { - return; - } - F32 min_weight = getMinWeight(); - F32 max_weight = getMaxWeight(); - F32 new_weight = llclamp(weight, min_weight, max_weight); - U8 cur_u8 = F32_to_U8( mCurWeight, min_weight, max_weight ); - U8 new_u8 = F32_to_U8( new_weight, min_weight, max_weight ); - if( cur_u8 != new_u8) - { - mCurWeight = new_weight; - - LLVOAvatar* avatar = mTexLayer->getTexLayerSet()->getAvatar(); - if( avatar->getSex() & getSex() ) - { - if ( gAgent.cameraCustomizeAvatar() ) - { - set_by_user = FALSE; - } - avatar->invalidateComposite( mTexLayer->getTexLayerSet(), set_by_user ); - mTexLayer->invalidateMorphMasks(); - avatar->updateMeshTextures(); - } - } -} - -void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL set_by_user) -{ - mTargetWeight = target_value; - setWeight(target_value, set_by_user); - mIsAnimating = TRUE; - if (mNext) - { - mNext->setAnimationTarget(target_value, set_by_user); - } -} - -void LLTexLayerParamAlpha::animate(F32 delta, BOOL set_by_user) -{ - if (mNext) - { - mNext->animate(delta, set_by_user); - } -} - -BOOL LLTexLayerParamAlpha::getSkip() -{ - LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar(); - - if( getInfo()->mSkipIfZeroWeight ) - { - F32 effective_weight = ( avatar->getSex() & getSex() ) ? mCurWeight : getDefaultWeight(); - if (is_approx_zero( effective_weight )) - { - return TRUE; - } - } - - EWearableType type = (EWearableType)getWearableType(); - if( (type != WT_INVALID) && !avatar->isWearingWearableType( type ) ) - { - return TRUE; - } - - return FALSE; -} - - -BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) -{ - BOOL success = TRUE; - - F32 effective_weight = ( mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex() ) ? mCurWeight : getDefaultWeight(); - BOOL weight_changed = effective_weight != mCachedEffectiveWeight; - if( getSkip() ) - { - return success; - } - - gGL.flush(); - if( getInfo()->mMultiplyBlend ) - { - gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function - } - else - { - gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function - } - - if( !getInfo()->mStaticImageFileName.empty() && !mStaticImageInvalid) - { - if( mStaticImageTGA.isNull() ) - { - // Don't load the image file until we actually need it the first time. Like now. - mStaticImageTGA = gTexStaticImageList.getImageTGA( getInfo()->mStaticImageFileName ); - // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE; - - if( mStaticImageTGA.isNull() ) - { - llwarns << "Unable to load static file: " << getInfo()->mStaticImageFileName << llendl; - mStaticImageInvalid = TRUE; // don't try again. - return FALSE; - } - } - - const S32 image_tga_width = mStaticImageTGA->getWidth(); - const S32 image_tga_height = mStaticImageTGA->getHeight(); - if( !mCachedProcessedImageGL || - (mCachedProcessedImageGL->getWidth() != image_tga_width) || - (mCachedProcessedImageGL->getHeight() != image_tga_height) || - (weight_changed) ) - { -// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl; - mCachedEffectiveWeight = effective_weight; - - if( !mCachedProcessedImageGL ) - { - mCachedProcessedImageGL = new LLImageGL( image_tga_width, image_tga_height, 1, FALSE); - - // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mCachedProcessedImageGL ? TRUE : FALSE; - - mCachedProcessedImageGL->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); - } - - // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed. - mStaticImageRaw = NULL; - mStaticImageRaw = new LLImageRaw; - mStaticImageTGA->decodeAndProcess( mStaticImageRaw, getInfo()->mDomain, effective_weight ); - mNeedsCreateTexture = TRUE; - } - - if( mCachedProcessedImageGL ) - { - { - // Create the GL texture, and then hang onto it for future use. - if( mNeedsCreateTexture ) - { - mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); - mNeedsCreateTexture = FALSE; - gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); - mCachedProcessedImageGL->setAddressMode(LLTexUnit::TAM_CLAMP); - } - - LLGLSNoAlphaTest gls_no_alpha_test; - gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); - gl_rect_2d_simple_tex( width, height ); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - stop_glerror(); - } - } - - // Don't keep the cache for other people's avatars - // (It's not really a "cache" in that case, but the logic is the same) - if( !mTexLayer->getTexLayerSet()->getAvatar()->isSelf() ) - { - mCachedProcessedImageGL = NULL; - } - } - else - { - LLGLDisable no_alpha(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.f, 0.f, 0.f, effective_weight ); - gl_rect_2d_simple( width, height ); - } - - return success; -} - -//----------------------------------------------------------------------------- -// LLTexGlobalColorInfo -//----------------------------------------------------------------------------- - -LLTexGlobalColorInfo::LLTexGlobalColorInfo() -{ -} - - -LLTexGlobalColorInfo::~LLTexGlobalColorInfo() -{ - for_each(mColorInfoList.begin(), mColorInfoList.end(), DeletePointer()); -} - -BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) -{ - // name attribute - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if( !node->getFastAttributeString( name_string, mName ) ) - { - llwarns << " element is missing name attribute." << llendl; - return FALSE; - } - // sub-element - for (LLXmlTreeNode* child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if( child->getChildByName( "param_color" ) ) - { - // - LLTexParamColorInfo* info = new LLTexParamColorInfo(); - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - mColorInfoList.push_back( info ); - } - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLTexGlobalColor -//----------------------------------------------------------------------------- - -LLTexGlobalColor::LLTexGlobalColor( LLVOAvatar* avatar ) - : - mAvatar( avatar ), - mInfo( NULL ) -{ -} - - -LLTexGlobalColor::~LLTexGlobalColor() -{ - // mParamList are LLViewerVisualParam's and get deleted with ~LLCharacter() - //std::for_each(mParamList.begin(), mParamList.end(), DeletePointer()); -} - -BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) -{ - llassert(mInfo == NULL); - mInfo = info; - //mID = info->mID; // No ID - - LLTexGlobalColorInfo::color_info_list_t::iterator iter; - mParamList.reserve(mInfo->mColorInfoList.size()); - for (iter = mInfo->mColorInfoList.begin(); iter != mInfo->mColorInfoList.end(); iter++) - { - LLTexParamColor* param_color = new LLTexParamColor( this ); - if (!param_color->setInfo(*iter)) - { - mInfo = NULL; - return FALSE; - } - mParamList.push_back( param_color ); - } - - return TRUE; -} - -//----------------------------------------------------------------------------- - -LLColor4 LLTexGlobalColor::getColor() -{ - // Sum of color params - if( !mParamList.empty() ) - { - LLColor4 net_color( 0.f, 0.f, 0.f, 0.f ); - - for( param_list_t::iterator iter = mParamList.begin(); - iter != mParamList.end(); iter++ ) - { - LLTexParamColor* param = *iter; - LLColor4 param_net = param->getNetColor(); - switch( param->getOperation() ) - { - case OP_ADD: - net_color += param_net; - break; - case OP_MULTIPLY: - net_color.mV[VX] *= param_net.mV[VX]; - net_color.mV[VY] *= param_net.mV[VY]; - net_color.mV[VZ] *= param_net.mV[VZ]; - net_color.mV[VW] *= param_net.mV[VW]; - break; - case OP_BLEND: - net_color = lerp(net_color, param_net, param->getWeight()); - break; - default: - llassert(0); - break; - } - } - - net_color.mV[VX] = llclampf( net_color.mV[VX] ); - net_color.mV[VY] = llclampf( net_color.mV[VY] ); - net_color.mV[VZ] = llclampf( net_color.mV[VZ] ); - net_color.mV[VW] = llclampf( net_color.mV[VW] ); - - return net_color; - } - return LLColor4( 1.f, 1.f, 1.f, 1.f ); -} - -//----------------------------------------------------------------------------- -// LLTexParamColorInfo -//----------------------------------------------------------------------------- -LLTexParamColorInfo::LLTexParamColorInfo() - : - mOperation( OP_ADD ), - mNumColors( 0 ) -{ -} - -BOOL LLTexParamColorInfo::parseXml(LLXmlTreeNode *node) +void LLTexLayer::invalidateMorphMasks() { - llassert( node->hasName( "param" ) && node->getChildByName( "param_color" ) ); - - if (!LLViewerVisualParamInfo::parseXml(node)) - return FALSE; - - LLXmlTreeNode* param_color_node = node->getChildByName( "param_color" ); - if( !param_color_node ) - { - return FALSE; - } - - std::string op_string; - static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation"); - if( param_color_node->getFastAttributeString( operation_string, op_string ) ) - { - LLStringUtil::toLower(op_string); - if ( op_string == "add" ) mOperation = OP_ADD; - else if ( op_string == "multiply" ) mOperation = OP_MULTIPLY; - else if ( op_string == "blend" ) mOperation = OP_BLEND; - } - - mNumColors = 0; - - LLColor4U color4u; - for (LLXmlTreeNode* child = param_color_node->getChildByName( "value" ); - child; - child = param_color_node->getNextNamedChild()) - { - if( (mNumColors < MAX_COLOR_VALUES) ) - { - static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color"); - if( child->getFastAttributeColor4U( color_string, color4u ) ) - { - mColors[ mNumColors ].setVec(color4u); - mNumColors++; - } - } - } - if( !mNumColors ) - { - llwarns << " is missing sub-elements" << llendl; - return FALSE; + mMorphMasksValid = FALSE; } - if( (mOperation == OP_BLEND) && (mNumColors != 1) ) +BOOL LLTexLayer::isVisibilityMask() const { - llwarns << " with operation\"blend\" must have exactly one " << llendl; - return FALSE; - } - - return TRUE; + return mInfo->mIsVisibilityMask; } //----------------------------------------------------------------------------- -// LLTexParamColor +// LLTexLayerStaticImageList //----------------------------------------------------------------------------- -LLTexParamColor::LLTexParamColor( LLTexGlobalColor* tex_global_color ) - : - mAvgDistortionVec(1.f, 1.f, 1.f), - mTexGlobalColor( tex_global_color ), - mTexLayer( NULL ), - mAvatar( tex_global_color->getAvatar() ) -{ -} -LLTexParamColor::LLTexParamColor( LLTexLayer* layer ) - : - mAvgDistortionVec(1.f, 1.f, 1.f), - mTexGlobalColor( NULL ), - mTexLayer( layer ), - mAvatar( layer->getTexLayerSet()->getAvatar() ) +LLTexLayerStaticImageList::LLTexLayerStaticImageList() : + mGLBytes(0), + mTGABytes(0), + mImageNames(16384) { } - -LLTexParamColor::~LLTexParamColor() -{ -} - -//----------------------------------------------------------------------------- -// setInfo() -//----------------------------------------------------------------------------- - -BOOL LLTexParamColor::setInfo(LLTexParamColorInfo *info) -{ - llassert(mInfo == NULL); - if (info->mID < 0) - return FALSE; - mID = info->mID; - mInfo = info; - - mAvatar->addVisualParam( this ); - setWeight( getDefaultWeight(), FALSE ); - - return TRUE; -} - -LLColor4 LLTexParamColor::getNetColor() -{ - llassert( getInfo()->mNumColors >= 1 ); - - F32 effective_weight = ( mAvatar && (mAvatar->getSex() & getSex()) ) ? mCurWeight : getDefaultWeight(); - - S32 index_last = getInfo()->mNumColors - 1; - F32 scaled_weight = effective_weight * index_last; - S32 index_start = (S32) scaled_weight; - S32 index_end = index_start + 1; - if( index_start == index_last ) - { - return getInfo()->mColors[index_last]; - } - else - { - F32 weight = scaled_weight - index_start; - const LLColor4 *start = &getInfo()->mColors[ index_start ]; - const LLColor4 *end = &getInfo()->mColors[ index_end ]; - return LLColor4( - (1.f - weight) * start->mV[VX] + weight * end->mV[VX], - (1.f - weight) * start->mV[VY] + weight * end->mV[VY], - (1.f - weight) * start->mV[VZ] + weight * end->mV[VZ], - (1.f - weight) * start->mV[VW] + weight * end->mV[VW] ); - } -} - -void LLTexParamColor::setWeight(F32 weight, BOOL set_by_user) -{ - if (mIsAnimating) - { - return; - } - F32 min_weight = getMinWeight(); - F32 max_weight = getMaxWeight(); - F32 new_weight = llclamp(weight, min_weight, max_weight); - U8 cur_u8 = F32_to_U8( mCurWeight, min_weight, max_weight ); - U8 new_u8 = F32_to_U8( new_weight, min_weight, max_weight ); - if( cur_u8 != new_u8) - { - mCurWeight = new_weight; - - if( getInfo()->mNumColors <= 0 ) - { - // This will happen when we set the default weight the first time. - return; - } - - if( mAvatar->getSex() & getSex() ) - { - if( mTexGlobalColor ) - { - mAvatar->onGlobalColorChanged( mTexGlobalColor, set_by_user ); - } - else - if( mTexLayer ) - { - mAvatar->invalidateComposite( mTexLayer->getTexLayerSet(), set_by_user ); - } - } -// llinfos << "param " << mName << " = " << new_weight << llendl; - } -} - -void LLTexParamColor::setAnimationTarget(F32 target_value, BOOL set_by_user) -{ - // set value first then set interpolating flag to ignore further updates - mTargetWeight = target_value; - setWeight(target_value, set_by_user); - mIsAnimating = TRUE; - if (mNext) - { - mNext->setAnimationTarget(target_value, set_by_user); - } -} - -void LLTexParamColor::animate(F32 delta, BOOL set_by_user) -{ - if (mNext) - { - mNext->animate(delta, set_by_user); - } -} - - -//----------------------------------------------------------------------------- -// LLTexStaticImageList -//----------------------------------------------------------------------------- - -// static -LLTexStaticImageList gTexStaticImageList; -LLStringTable LLTexStaticImageList::sImageNames(16384); - -LLTexStaticImageList::LLTexStaticImageList() - : - mGLBytes( 0 ), - mTGABytes( 0 ) -{} - -LLTexStaticImageList::~LLTexStaticImageList() +LLTexLayerStaticImageList::~LLTexLayerStaticImageList() { deleteCachedImages(); } -void LLTexStaticImageList::dumpByteCount() +void LLTexLayerStaticImageList::dumpByteCount() { llinfos << "Avatar Static Textures " << "KB GL:" << (mGLBytes / 1024) << "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; } -void LLTexStaticImageList::deleteCachedImages() +void LLTexLayerStaticImageList::deleteCachedImages() { if( mGLBytes || mTGABytes ) { @@ -2491,10 +1869,10 @@ void LLTexStaticImageList::deleteCachedImages() // Returns an LLImageTGA that contains the encoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -LLImageTGA* LLTexStaticImageList::getImageTGA(const std::string& file_name) +LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name) { - const char *namekey = sImageNames.addString(file_name); - image_tga_map_t::iterator iter = mStaticImageListTGA.find(namekey); + const char *namekey = mImageNames.addString(file_name); + image_tga_map_t::const_iterator iter = mStaticImageListTGA.find(namekey); if( iter != mStaticImageListTGA.end() ) { return iter->second; @@ -2517,16 +1895,14 @@ LLImageTGA* LLTexStaticImageList::getImageTGA(const std::string& file_name) } } - - // Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -LLImageGL* LLTexStaticImageList::getImageGL(const std::string& file_name, BOOL is_mask ) +LLImageGL* LLTexLayerStaticImageList::getImageGL(const std::string& file_name, BOOL is_mask) { LLPointer image_gl; - const char *namekey = sImageNames.addString(file_name); + const char *namekey = mImageNames.addString(file_name); - image_gl_map_t::iterator iter = mStaticImageListGL.find(namekey); + image_gl_map_t::const_iterator iter = mStaticImageListGL.find(namekey); if( iter != mStaticImageListGL.end() ) { image_gl = iter->second; @@ -2562,7 +1938,7 @@ LLImageGL* LLTexStaticImageList::getImageGL(const std::string& file_name, BOOL i // Reads a .tga file, decodes it, and puts the decoded data in image_raw. // Returns TRUE if successful. -BOOL LLTexStaticImageList::loadImageRaw( const std::string& file_name, LLImageRaw* image_raw ) +BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw) { BOOL success = FALSE; std::string path; @@ -2577,11 +1953,4 @@ BOOL LLTexStaticImageList::loadImageRaw( const std::string& file_name, LLImageRa return success; } -//----------------------------------------------------------------------------- -// LLMaskedMorph() -//----------------------------------------------------------------------------- -LLMaskedMorph::LLMaskedMorph( LLPolyMorphTarget *morph_target, BOOL invert ) : mMorphTarget(morph_target), mInvert(invert) -{ - morph_target->addPendingMorphMask(); -} diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 1924d0bee3..5890440108 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -34,136 +34,94 @@ #define LL_LLTEXLAYER_H #include -#include "llassetstorage.h" #include "lldynamictexture.h" -#include "llrect.h" -#include "llstring.h" -#include "lluuid.h" -#include "llviewerimage.h" -#include "llviewervisualparam.h" #include "llwearable.h" -#include "v4color.h" -#include "llfloater.h" +#include "llvoavatardefines.h" -class LLTexLayerSetInfo; -class LLTexLayerSet; -class LLTexLayerInfo; -class LLTexLayer; +class LLVOAvatar; +class LLVOAvatarSelf; class LLImageGL; class LLImageTGA; -class LLTexGlobalColorInfo; -class LLTexLayerParamAlphaInfo; -class LLTexLayerParamAlpha; -class LLTexParamColorInfo; -class LLTexParamColor; -class LLPolyMesh; -class LLXmlTreeNode; class LLImageRaw; +class LLXmlTreeNode; class LLPolyMorphTarget; +class LLTexLayerSet; +class LLTexLayerSetInfo; +class LLTexLayerInfo; +class LLTexLayerSetBuffer; +class LLTexLayerParamColor; +class LLTexLayerParamColorInfo; +class LLTexLayerParamAlpha; +class LLTexLayerParamAlphaInfo; -class LLTextureCtrl; -class LLVOAvatar; - - -enum EColorOperation -{ - OP_ADD = 0, - OP_MULTIPLY = 1, - OP_BLEND = 2, - OP_COUNT = 3 // Number of operations -}; - +typedef std::vector param_color_list_t; +typedef std::vector param_alpha_list_t; +typedef std::vector param_color_info_list_t; +typedef std::vector param_alpha_info_list_t; //----------------------------------------------------------------------------- -// LLTexLayerParamAlphaInfo -//----------------------------------------------------------------------------- -class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo +// LLTexLayer +// A single texture layer +// Only exists for llvoavatarself + +class LLTexLayer { - friend class LLTexLayerParamAlpha; public: - LLTexLayerParamAlphaInfo(); - /*virtual*/ ~LLTexLayerParamAlphaInfo() {}; + enum ERenderPass + { + RP_COLOR, + RP_BUMP, + RP_SHINE + }; + + LLTexLayer(LLTexLayerSet* const layer_set); + ~LLTexLayer(); - /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + const LLTexLayerInfo* getInfo() const { return mInfo; } + BOOL setInfo(const LLTexLayerInfo *info); // This sets mInfo and calls initialization functions + BOOL render(S32 x, S32 y, S32 width, S32 height, BOOL render_morph); + void requestUpdate(); + LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; } -protected: - std::string mStaticImageFileName; - BOOL mMultiplyBlend; - BOOL mSkipIfZeroWeight; - F32 mDomain; -}; + void deleteCaches(); + U8* getAlphaData(); + void invalidateMorphMasks(); + void setHasMorph(BOOL newval) { mHasMorph = newval; } + BOOL isMorphValid() { return mMorphMasksValid; } -//----------------------------------------------------------------------------- -// LLTexParamColorInfo -//----------------------------------------------------------------------------- -class LLTexParamColorInfo : public LLViewerVisualParamInfo -{ - friend class LLTexParamColor; + const std::string& getName() const; + ERenderPass getRenderPass() const; + const std::string& getGlobalColor() const; -public: - LLTexParamColorInfo(); - virtual ~LLTexParamColorInfo() {}; - BOOL parseXml( LLXmlTreeNode* node ); - -protected: - enum { MAX_COLOR_VALUES = 20 }; - EColorOperation mOperation; - LLColor4 mColors[MAX_COLOR_VALUES]; - S32 mNumColors; -}; + BOOL findNetColor(LLColor4* color) const; + BOOL renderImageRaw(U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask); + BOOL blendAlphaTexture(S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer + BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, BOOL render_morph); + BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); } + BOOL isVisibilityMask() const; -//----------------------------------------------------------------------------- -// LLTexGlobalColorInfo -//----------------------------------------------------------------------------- -class LLTexGlobalColorInfo -{ - friend class LLTexGlobalColor; -public: - LLTexGlobalColorInfo(); - ~LLTexGlobalColorInfo(); + static void calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color); - BOOL parseXml(LLXmlTreeNode* node); - -protected: - typedef std::vector color_info_list_t; - color_info_list_t mColorInfoList; - std::string mName; -}; +private: + LLTexLayerSet* const mTexLayerSet; -//----------------------------------------------------------------------------- -// LLTexLayerSetInfo -// Containes shared layer set data -//----------------------------------------------------------------------------- -class LLTexLayerSetInfo -{ - friend class LLTexLayerSet; -public: - LLTexLayerSetInfo(); - ~LLTexLayerSetInfo(); + // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order. + param_color_list_t mParamColorList; + // mGlobalColor name stored in mInfo + // mFixedColor value stored in mInfo + param_alpha_list_t mParamAlphaList; - BOOL parseXml(LLXmlTreeNode* node); + BOOL mMorphMasksValid; + typedef std::map alpha_cache_t; + alpha_cache_t mAlphaCache; + BOOL mStaticImageInvalid; -protected: - std::string mBodyRegion; - S32 mWidth; - S32 mHeight; - std::string mStaticAlphaFileName; - BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) - - typedef std::vector layer_info_list_t; - layer_info_list_t mLayerInfoList; -}; + BOOL mHasMorph; -//----------------------------------------------------------------------------- -// LLTexLayerInfo -//----------------------------------------------------------------------------- -enum ERenderPass -{ - RP_COLOR, - RP_BUMP, - RP_SHINE + const LLTexLayerInfo *mInfo; }; +// Make private class LLTexLayerInfo { friend class LLTexLayer; @@ -172,12 +130,13 @@ public: ~LLTexLayerInfo(); BOOL parseXml(LLXmlTreeNode* node); + BOOL createVisualParams(LLVOAvatar *avatar); -protected: +private: std::string mName; - BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, - ERenderPass mRenderPass; + BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer, + LLTexLayer::ERenderPass mRenderPass; std::string mGlobalColor; LLColor4 mFixedColor; @@ -185,377 +144,200 @@ protected: S32 mLocalTexture; std::string mStaticImageFileName; BOOL mStaticImageIsMask; - BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask - - typedef std::vector > morph_name_list_t; - morph_name_list_t mMorphNameList; + BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask + BOOL mIsVisibilityMask; - typedef std::vector color_info_list_t; - color_info_list_t mColorInfoList; - - typedef std::vector alpha_info_list_t; - alpha_info_list_t mAlphaInfoList; - + typedef std::vector< std::pair< std::string,BOOL > > morph_name_list_t; + morph_name_list_t mMorphNameList; + param_color_info_list_t mParamColorInfoList; + param_alpha_info_list_t mParamAlphaInfoList; }; +// +// LLTexLayer //----------------------------------------------------------------------------- -// LLTexLayerSetBuffer -// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. -//----------------------------------------------------------------------------- -class LLTexLayerSetBuffer : public LLDynamicTexture -{ -public: - LLTexLayerSetBuffer( LLTexLayerSet* owner, S32 width, S32 height, BOOL has_bump ); - virtual ~LLTexLayerSetBuffer(); - - virtual void preRender(BOOL clear_depth); - virtual void postRender(BOOL success); - virtual BOOL render(); - BOOL updateImmediate(); - void bindBumpTexture( U32 stage ); - bool isInitialized(void) const; - BOOL needsRender(); - void requestUpdate(); - void requestUpload(); - void cancelUpload(); - BOOL uploadPending() { return mUploadPending; } - BOOL render( S32 x, S32 y, S32 width, S32 height ); - void readBackAndUpload(U8* baked_bump_data); - void createBumpTexture() ; - - static void onTextureUploadComplete( const LLUUID& uuid, - void* userdata, - S32 result, LLExtStat ext_status); - static void dumpTotalByteCount(); - - virtual void restoreGLTexture() ; - virtual void destroyGLTexture() ; - -private: - void pushProjection(); - void popProjection(); - -private: - BOOL mHasBump ; - BOOL mNeedsUpdate; - BOOL mNeedsUpload; - BOOL mUploadPending; - LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) - LLTexLayerSet* mTexLayerSet; - LLPointer mBumpTex; // zero if none - - static S32 sGLByteCount; - static S32 sGLBumpByteCount; -}; //----------------------------------------------------------------------------- // LLTexLayerSet // An ordered set of texture layers that get composited into a single texture. -//----------------------------------------------------------------------------- +// Only exists for llvoavatarself + class LLTexLayerSet { + friend class LLTexLayerSetBuffer; public: - LLTexLayerSet( LLVOAvatar* avatar ); + LLTexLayerSet(LLVOAvatarSelf* const avatar); ~LLTexLayerSet(); - //BOOL parseData(LLXmlTreeNode* node); - LLTexLayerSetInfo* getInfo() const { return mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexLayerSetInfo *info); - - BOOL render( S32 x, S32 y, S32 width, S32 height ); - BOOL renderBump( S32 x, S32 y, S32 width,S32 height ); - BOOL isBodyRegion( const std::string& region ) { return mInfo->mBodyRegion == region; } + const LLTexLayerSetInfo* getInfo() const { return mInfo; } + BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions + + BOOL render(S32 x, S32 y, S32 width, S32 height); + BOOL renderBump(S32 x, S32 y, S32 width,S32 height); + + BOOL isBodyRegion(const std::string& region) const; LLTexLayerSetBuffer* getComposite(); void requestUpdate(); void requestUpload(); void cancelUpload(); - LLVOAvatar* getAvatar() { return mAvatar; } void updateComposite(); - BOOL isLocalTextureDataAvailable(); - BOOL isLocalTextureDataFinal(); + BOOL isLocalTextureDataAvailable() const; + BOOL isLocalTextureDataFinal() const; void createComposite(); void destroyComposite(); - void setUpdatesEnabled( BOOL b ); - BOOL getUpdatesEnabled() { return mUpdatesEnabled; } + void setUpdatesEnabled(BOOL b); + BOOL getUpdatesEnabled() const { return mUpdatesEnabled; } void deleteCaches(); - void gatherAlphaMasks(U8 *data, S32 width, S32 height); + void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height); void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); - const std::string getBodyRegion() { return mInfo->mBodyRegion; } - BOOL hasComposite() { return (mComposite != NULL); } - void setBump( BOOL b ) { mHasBump = b; } - BOOL hasBump() { return mHasBump; } + void renderAlphaMaskTextures(S32 width, S32 height, bool forceClear = false); + LLTexLayer* findLayerByName(std::string name); + + LLVOAvatarSelf* getAvatar() const { return mAvatar; } + const std::string getBodyRegion() const; + BOOL hasComposite() const { return (mComposite != NULL); } + void setBump(BOOL b) { mHasBump = b; } + BOOL hasBump() const { return mHasBump; } + LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; } + void setBakedTexIndex( LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } public: static BOOL sHasCaches; -protected: +private: typedef std::vector layer_list_t; layer_list_t mLayerList; + layer_list_t mMaskLayerList; LLTexLayerSetBuffer* mComposite; - // Backlink only; don't make this an LLPointer. - LLVOAvatar* mAvatar; + LLVOAvatarSelf* const mAvatar; // Backlink only; don't make this an LLPointer. BOOL mUpdatesEnabled; BOOL mHasBump; - LLTexLayerSetInfo *mInfo; -}; + LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex; -//----------------------------------------------------------------------------- -// LLMaskedMorph -//----------------------------------------------------------------------------- - -class LLMaskedMorph -{ -public: - LLMaskedMorph( LLPolyMorphTarget *morph_target, BOOL invert ); - -public: - LLPolyMorphTarget *mMorphTarget; - BOOL mInvert; + const LLTexLayerSetInfo *mInfo; }; -//----------------------------------------------------------------------------- -// LLTexLayer -// A single texture layer -//----------------------------------------------------------------------------- -class LLTexLayer +// Contains shared layer set data +class LLTexLayerSetInfo { + friend class LLTexLayerSet; public: - LLTexLayer( LLTexLayerSet* layer_set ); - ~LLTexLayer(); - - //BOOL parseData(LLXmlTreeNode* node); - LLTexLayerInfo* getInfo() const { return mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexLayerInfo *info); + LLTexLayerSetInfo(); + ~LLTexLayerSetInfo(); - BOOL render( S32 x, S32 y, S32 width, S32 height ); - void requestUpdate(); - LLTexLayerSet* getTexLayerSet() { return mTexLayerSet; } - - const std::string& getName() { return mInfo->mName; } - - void addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert); - void deleteCaches(); - U8* getAlphaData(); - void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components); - - void invalidateMorphMasks(); - ERenderPass getRenderPass() { return mInfo->mRenderPass; } - const std::string& getGlobalColor() { return mInfo->mGlobalColor; } - BOOL findNetColor( LLColor4* color ); - BOOL renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask ); - BOOL renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4* colorp ); - BOOL hasAlphaParams() { return (!mParamAlphaList.empty());} - -protected: - LLTexLayerSet* mTexLayerSet; - LLPointer mStaticImageRaw; - - // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order. - typedef std::vector color_list_t; - color_list_t mParamColorList; - // mGlobalColor name stored in mInfo - // mFixedColor value stored in mInfo + BOOL parseXml(LLXmlTreeNode* node); + void createVisualParams(LLVOAvatar *avatar); - typedef std::vector alpha_list_t; - alpha_list_t mParamAlphaList; - +private: + std::string mBodyRegion; + S32 mWidth; + S32 mHeight; + std::string mStaticAlphaFileName; + BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName) - typedef std::deque morph_list_t; - morph_list_t mMaskedMorphs; - typedef std::map alpha_cache_t; - alpha_cache_t mAlphaCache; - BOOL mMorphMasksValid; - BOOL mStaticImageInvalid; - - LLTexLayerInfo *mInfo; + typedef std::vector layer_info_list_t; + layer_info_list_t mLayerInfoList; }; -//----------------------------------------------------------------------------- -// LLTexLayerParamAlpha -//----------------------------------------------------------------------------- -class LLTexLayerParamAlpha : public LLViewerVisualParam +// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. +class LLTexLayerSetBuffer : public LLDynamicTexture { public: - LLTexLayerParamAlpha( LLTexLayer* layer ); - /*virtual*/ ~LLTexLayerParamAlpha(); + LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height, BOOL has_bump); + virtual ~LLTexLayerSetBuffer(); - // Special: These functions are overridden by child classes - LLTexLayerParamAlphaInfo* getInfo() const { return (LLTexLayerParamAlphaInfo*)mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexLayerParamAlphaInfo *info); - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex avatar_sex ) {} - /*virtual*/ void setWeight(F32 weight, BOOL set_by_user); - /*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user); - /*virtual*/ void animate(F32 delta, BOOL set_by_user); - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion() { return 1.f; } - /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } - /*virtual*/ F32 getMaxDistortion() { return 3.f; } - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);} - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; - - // New functions + virtual void preRender(BOOL clear_depth); + virtual void postRender(BOOL success); + virtual BOOL render(); + BOOL updateImmediate(); + void bindBumpTexture(U32 stage); + bool isInitialized(void) const; + BOOL needsRender(); + void requestUpdate(); + void requestUpload(); + void cancelUpload(); + BOOL uploadPending() { return mUploadPending; } BOOL render( S32 x, S32 y, S32 width, S32 height ); - BOOL getSkip(); - void deleteCaches(); - LLTexLayer* getTexLayer() { return mTexLayer; } - BOOL getMultiplyBlend() { return getInfo()->mMultiplyBlend; } - -protected: - LLPointer mCachedProcessedImageGL; - LLTexLayer* mTexLayer; - LLPointer mStaticImageTGA; - LLPointer mStaticImageRaw; - BOOL mNeedsCreateTexture; - BOOL mStaticImageInvalid; - LLVector3 mAvgDistortionVec; - F32 mCachedEffectiveWeight; + void readBackAndUpload(const U8* baked_bump_data); + void createBumpTexture(); -public: - // Global list of instances for gathering statistics - static void dumpCacheByteCount(); - static void getCacheByteCount( S32* gl_bytes ); - - typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t; - static param_alpha_ptr_list_t sInstances; -}; + static void onTextureUploadComplete(const LLUUID& uuid, + void* userdata, + S32 result, LLExtStat ext_status); + static void dumpTotalByteCount(); + virtual void restoreGLTexture(); + virtual void destroyGLTexture(); -//----------------------------------------------------------------------------- -// LLTexGlobalColor -//----------------------------------------------------------------------------- -class LLTexGlobalColor -{ -public: - LLTexGlobalColor( LLVOAvatar* avatar ); - ~LLTexGlobalColor(); +private: + void pushProjection() const; + void popProjection() const; - //BOOL parseData(LLXmlTreeNode* node); - LLTexGlobalColorInfo* getInfo() const { return mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexGlobalColorInfo *info); - - void requstUpdate(); - LLVOAvatar* getAvatar() { return mAvatar; } - LLColor4 getColor(); - const std::string& getName() { return mInfo->mName; } +private: + const BOOL mHasBump; + LLTexLayerSet* const mTexLayerSet; -protected: - typedef std::vector param_list_t; - param_list_t mParamList; - LLVOAvatar* mAvatar; // just backlink, don't LLPointer + BOOL mNeedsUpdate; + BOOL mNeedsUpload; + BOOL mUploadPending; + LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) + LLPointer mBumpTex; // zero if none - LLTexGlobalColorInfo *mInfo; + static S32 sGLByteCount; + static S32 sGLBumpByteCount; }; - -//----------------------------------------------------------------------------- -// LLTexParamColor +// +// LLTexLayerSet //----------------------------------------------------------------------------- -class LLTexParamColor : public LLViewerVisualParam -{ -public: - LLTexParamColor( LLTexGlobalColor* tex_color ); - LLTexParamColor( LLTexLayer* layer ); - /* virtual */ ~LLTexParamColor(); - - // Special: These functions are overridden by child classes - LLTexParamColorInfo* getInfo() const { return (LLTexParamColorInfo*)mInfo; } - // This sets mInfo and calls initialization functions - BOOL setInfo(LLTexParamColorInfo *info); - - // LLVisualParam Virtual functions - ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); - /*virtual*/ void apply( ESex avatar_sex ) {} - /*virtual*/ void setWeight(F32 weight, BOOL set_by_user); - /*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user); - /*virtual*/ void animate(F32 delta, BOOL set_by_user); - - - // LLViewerVisualParam Virtual functions - /*virtual*/ F32 getTotalDistortion() { return 1.f; } - /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } - /*virtual*/ F32 getMaxDistortion() { return 3.f; } - /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); } - /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; - - // New functions - LLColor4 getNetColor(); - EColorOperation getOperation() const { return getInfo()->mOperation; } - -protected: - LLVector3 mAvgDistortionVec; - LLTexGlobalColor* mTexGlobalColor; // either has mTexGlobalColor or mTexLayer as its parent - LLTexLayer* mTexLayer; - LLVOAvatar* mAvatar; // redundant, but simplifies the code (don't LLPointer) -}; - -//----------------------------------------------------------------------------- -// LLTexStaticImageList //----------------------------------------------------------------------------- +// LLTexLayerStaticImageList +// -class LLTexStaticImageList +class LLTexLayerStaticImageList : public LLSingleton { public: - LLTexStaticImageList(); - ~LLTexStaticImageList(); + LLTexLayerStaticImageList(); + ~LLTexLayerStaticImageList(); - LLImageRaw* getImageRaw( const std::string& file_name ); - LLImageGL* getImageGL( const std::string& file_name, BOOL is_mask ); - LLImageTGA* getImageTGA( const std::string& file_name ); + LLImageGL* getImageGL(const std::string& file_name, BOOL is_mask); + LLImageTGA* getImageTGA(const std::string& file_name); void deleteCachedImages(); void dumpByteCount(); private: - BOOL loadImageRaw( const std::string& file_name, LLImageRaw* image_raw ); + BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw); private: - static LLStringTable sImageNames; + LLStringTable mImageNames; - typedef std::map< const char *, LLPointer > image_gl_map_t; - typedef std::map< const char *, LLPointer > image_tga_map_t; + typedef std::map< const char*, LLPointer > image_gl_map_t; image_gl_map_t mStaticImageListGL; + typedef std::map< const char*, LLPointer > image_tga_map_t; image_tga_map_t mStaticImageListTGA; -public: S32 mGLBytes; S32 mTGABytes; }; // Used by LLTexLayerSetBuffer for a callback. - -// For DEV-DEV-31590, "Heap corruption and crash after outfit -// changes", added the mLayerSet member. The current -// LLTexLayerSetBuffer can be found by querying mLayerSet->mComposite, -// but we still store the original mLayerSetBuffer here so we can -// detect when an upload is out of date. This prevents a memory -// stomp. See LLTexLayerSetBuffer::onTextureUploadComplete() for usage. +// Note to anyone merging branches - this supercedes the previous fix +// for DEV-31590 "Heap corruption and crash after outfit changes", +// here and in lltexlayer.cpp. Equally correct and a bit simpler. class LLBakedUploadData { public: - LLBakedUploadData( LLVOAvatar* avatar, LLTexLayerSet* layerset, LLTexLayerSetBuffer* layerset_buffer, const LLUUID & id); + LLBakedUploadData(const LLVOAvatarSelf* avatar, LLTexLayerSet* layerset, const LLUUID& id); ~LLBakedUploadData() {} - LLUUID mID; - LLVOAvatar* mAvatar; // just backlink, don't LLPointer - LLTexLayerSet* mLayerSet; - LLTexLayerSetBuffer* mLayerSetBuffer; - LLUUID mWearableAssets[WT_COUNT]; - U64 mStartTime; // Used to measure time baked texture upload requires + const LLUUID mID; + const LLVOAvatarSelf* mAvatar; // just backlink, don't LLPointer + LLTexLayerSet* mTexLayerSet; + const U64 mStartTime; // Used to measure time baked texture upload requires }; -extern LLTexStaticImageList gTexStaticImageList; - #endif // LL_LLTEXLAYER_H diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp new file mode 100644 index 0000000000..e00f6aeb04 --- /dev/null +++ b/indra/newview/lltexlayerparams.cpp @@ -0,0 +1,541 @@ +/** + * @file lltexlayerparams.cpp + * @brief SERAPH - ADD IN + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llagent.h" +#include "lltexlayer.h" +#include "llvoavatarself.h" +#include "lltexlayerparams.h" +#include "llui.h" + +//----------------------------------------------------------------------------- +// LLTexLayerParam +//----------------------------------------------------------------------------- +LLTexLayerParam::LLTexLayerParam(LLTexLayer *layer) : + mTexLayer(layer), + mAvatar(NULL) +{ + if (mTexLayer != NULL) + { + mAvatar = mTexLayer->getTexLayerSet()->getAvatar(); + } +} + +LLTexLayerParam::LLTexLayerParam(LLVOAvatar *avatar) : + mTexLayer(NULL) +{ + mAvatar = avatar; +} + + +BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info) +{ + LLViewerVisualParam::setInfo(info); + mAvatar->addVisualParam( this); + return TRUE; +} + + + +//----------------------------------------------------------------------------- +// LLTexLayerParamAlpha +//----------------------------------------------------------------------------- + +// static +LLTexLayerParamAlpha::param_alpha_ptr_list_t LLTexLayerParamAlpha::sInstances; + +// static +void LLTexLayerParamAlpha::dumpCacheByteCount() +{ + S32 gl_bytes = 0; + getCacheByteCount( &gl_bytes); + llinfos << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << llendl; +} + +// static +void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes) +{ + *gl_bytes = 0; + + for (param_alpha_ptr_list_t::iterator iter = sInstances.begin(); + iter != sInstances.end(); iter++) + { + LLTexLayerParamAlpha* instance = *iter; + LLImageGL* image_gl = instance->mCachedProcessedImageGL; + if (image_gl) + { + S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); + + if (image_gl->getHasGLTexture()) + { + *gl_bytes += bytes; + } + } + } +} + +LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayer* layer) : + LLTexLayerParam(layer), + mCachedProcessedImageGL(NULL), + mNeedsCreateTexture(FALSE), + mStaticImageInvalid(FALSE), + mAvgDistortionVec(1.f, 1.f, 1.f), + mCachedEffectiveWeight(0.f) +{ + sInstances.push_front(this); +} + +LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLVOAvatar* avatar) : + LLTexLayerParam(avatar), + mCachedProcessedImageGL(NULL), + mNeedsCreateTexture(FALSE), + mStaticImageInvalid(FALSE), + mAvgDistortionVec(1.f, 1.f, 1.f), + mCachedEffectiveWeight(0.f) +{ + sInstances.push_front(this); +} + + +LLTexLayerParamAlpha::~LLTexLayerParamAlpha() +{ + deleteCaches(); + sInstances.remove(this); +} + +void LLTexLayerParamAlpha::deleteCaches() +{ + mStaticImageTGA = NULL; // deletes image + mCachedProcessedImageGL = NULL; + mStaticImageRaw = NULL; + mNeedsCreateTexture = FALSE; +} + +BOOL LLTexLayerParamAlpha::getMultiplyBlend() const +{ + return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend; +} + +void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL set_by_user) +{ + if (mIsAnimating || mTexLayer == NULL) + { + return; + } + F32 min_weight = getMinWeight(); + F32 max_weight = getMaxWeight(); + F32 new_weight = llclamp(weight, min_weight, max_weight); + U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight); + U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight); + if (cur_u8 != new_u8) + { + mCurWeight = new_weight; + + LLVOAvatar* avatar = mTexLayer->getTexLayerSet()->getAvatar(); + if (avatar->getSex() & getSex()) + { + if (gAgent.cameraCustomizeAvatar()) + { + set_by_user = FALSE; + } + avatar->invalidateComposite(mTexLayer->getTexLayerSet(), set_by_user); + mTexLayer->invalidateMorphMasks(); + avatar->updateMeshTextures(); + } + } +} + +void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL set_by_user) +{ + mTargetWeight = target_value; + setWeight(target_value, set_by_user); + mIsAnimating = TRUE; + if (mNext) + { + mNext->setAnimationTarget(target_value, set_by_user); + } +} + +void LLTexLayerParamAlpha::animate(F32 delta, BOOL set_by_user) +{ + if (mNext) + { + mNext->animate(delta, set_by_user); + } +} + +BOOL LLTexLayerParamAlpha::getSkip() const +{ + if (!mTexLayer) + { + return TRUE; + } + + const LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar(); + + if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight) + { + F32 effective_weight = (avatar->getSex() & getSex()) ? mCurWeight : getDefaultWeight(); + if (is_approx_zero(effective_weight)) + { + return TRUE; + } + } + + EWearableType type = (EWearableType)getWearableType(); + if ((type != WT_INVALID) && !avatar->isWearingWearableType(type)) + { + return TRUE; + } + + return FALSE; +} + + +BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) +{ + BOOL success = TRUE; + + if (!mTexLayer) + { + return success; + } + + F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex()) ? mCurWeight : getDefaultWeight(); + BOOL weight_changed = effective_weight != mCachedEffectiveWeight; + if (getSkip()) + { + return success; + } + + LLTexLayerParamAlphaInfo *info = (LLTexLayerParamAlphaInfo *)getInfo(); + gGL.flush(); + if (info->mMultiplyBlend) + { + gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function + } + else + { + gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function + } + + if (!info->mStaticImageFileName.empty() && !mStaticImageInvalid) + { + if (mStaticImageTGA.isNull()) + { + // Don't load the image file until we actually need it the first time. Like now. + mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName); + // We now have something in one of our caches + LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE; + + if (mStaticImageTGA.isNull()) + { + llwarns << "Unable to load static file: " << info->mStaticImageFileName << llendl; + mStaticImageInvalid = TRUE; // don't try again. + return FALSE; + } + } + + const S32 image_tga_width = mStaticImageTGA->getWidth(); + const S32 image_tga_height = mStaticImageTGA->getHeight(); + if (!mCachedProcessedImageGL || + (mCachedProcessedImageGL->getWidth() != image_tga_width) || + (mCachedProcessedImageGL->getHeight() != image_tga_height) || + (weight_changed)) + { +// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl; + mCachedEffectiveWeight = effective_weight; + + if (!mCachedProcessedImageGL) + { + mCachedProcessedImageGL = new LLImageGL(image_tga_width, image_tga_height, 1, FALSE); + + // We now have something in one of our caches + LLTexLayerSet::sHasCaches |= mCachedProcessedImageGL ? TRUE : FALSE; + + mCachedProcessedImageGL->setExplicitFormat(GL_ALPHA8, GL_ALPHA); + } + + // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed. + mStaticImageRaw = NULL; + mStaticImageRaw = new LLImageRaw; + mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight); + mNeedsCreateTexture = TRUE; + } + + if (mCachedProcessedImageGL) + { + { + // Create the GL texture, and then hang onto it for future use. + if (mNeedsCreateTexture) + { + mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw); + mNeedsCreateTexture = FALSE; + gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); + mCachedProcessedImageGL->setAddressMode(LLTexUnit::TAM_CLAMP); + } + + LLGLSNoAlphaTest gls_no_alpha_test; + gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); + gl_rect_2d_simple_tex(width, height); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + stop_glerror(); + } + } + + // Don't keep the cache for other people's avatars + // (It's not really a "cache" in that case, but the logic is the same) + if (mAvatar->isSelf()) + { + mCachedProcessedImageGL = NULL; + } + } + else + { + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.color4f(0.f, 0.f, 0.f, effective_weight); + gl_rect_2d_simple(width, height); + } + + return success; +} + +//----------------------------------------------------------------------------- +// LLTexLayerParamAlphaInfo +//----------------------------------------------------------------------------- +LLTexLayerParamAlphaInfo::LLTexLayerParamAlphaInfo() : + mMultiplyBlend(FALSE), + mSkipIfZeroWeight(FALSE), + mDomain(0.f) +{ +} + +BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) +{ + llassert(node->hasName("param") && node->getChildByName("param_alpha")); + + if (!LLViewerVisualParamInfo::parseXml(node)) + return FALSE; + + LLXmlTreeNode* param_alpha_node = node->getChildByName("param_alpha"); + if (!param_alpha_node) + { + return FALSE; + } + + static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file"); + if (param_alpha_node->getFastAttributeString(tga_file_string, mStaticImageFileName)) + { + // Don't load the image file until it's actually needed. + } +// else +// { +// llwarns << " element is missing tga_file attribute." << llendl; +// } + + static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend"); + param_alpha_node->getFastAttributeBOOL(multiply_blend_string, mMultiplyBlend); + + static LLStdStringHandle skip_if_zero_string = LLXmlTree::addAttributeString("skip_if_zero"); + param_alpha_node->getFastAttributeBOOL(skip_if_zero_string, mSkipIfZeroWeight); + + static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain"); + param_alpha_node->getFastAttributeF32(domain_string, mDomain); + + return TRUE; +} + + + + +LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayer* layer) : + LLTexLayerParam(layer), + mAvgDistortionVec(1.f, 1.f, 1.f) +{ +} + +LLTexLayerParamColor::LLTexLayerParamColor(LLVOAvatar *avatar) : + LLTexLayerParam(avatar), + mAvgDistortionVec(1.f, 1.f, 1.f) +{ +} + +LLTexLayerParamColor::~LLTexLayerParamColor() +{ +} + +LLColor4 LLTexLayerParamColor::getNetColor() const +{ + const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo(); + + llassert(info->mNumColors >= 1); + + F32 effective_weight = (mAvatar && (mAvatar->getSex() & getSex())) ? mCurWeight : getDefaultWeight(); + + S32 index_last = info->mNumColors - 1; + F32 scaled_weight = effective_weight * index_last; + S32 index_start = (S32) scaled_weight; + S32 index_end = index_start + 1; + if (index_start == index_last) + { + return info->mColors[index_last]; + } + else + { + F32 weight = scaled_weight - index_start; + const LLColor4 *start = &info->mColors[ index_start ]; + const LLColor4 *end = &info->mColors[ index_end ]; + return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX], + (1.f - weight) * start->mV[VY] + weight * end->mV[VY], + (1.f - weight) * start->mV[VZ] + weight * end->mV[VZ], + (1.f - weight) * start->mV[VW] + weight * end->mV[VW]); + } +} + +void LLTexLayerParamColor::setWeight(F32 weight, BOOL set_by_user) +{ + if (mIsAnimating) + { + return; + } + + const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo(); + F32 min_weight = getMinWeight(); + F32 max_weight = getMaxWeight(); + F32 new_weight = llclamp(weight, min_weight, max_weight); + U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight); + U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight); + if (cur_u8 != new_u8) + { + mCurWeight = new_weight; + + if (info->mNumColors <= 0) + { + // This will happen when we set the default weight the first time. + return; + } + + if (mAvatar->getSex() & getSex()) + { + onGlobalColorChanged(set_by_user); + if (mTexLayer) + { + mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), set_by_user); + } + } +// llinfos << "param " << mName << " = " << new_weight << llendl; + } +} + +void LLTexLayerParamColor::setAnimationTarget(F32 target_value, BOOL set_by_user) +{ + // set value first then set interpolating flag to ignore further updates + mTargetWeight = target_value; + setWeight(target_value, set_by_user); + mIsAnimating = TRUE; + if (mNext) + { + mNext->setAnimationTarget(target_value, set_by_user); + } +} + +void LLTexLayerParamColor::animate(F32 delta, BOOL set_by_user) +{ + if (mNext) + { + mNext->animate(delta, set_by_user); + } +} + +//----------------------------------------------------------------------------- +// LLTexLayerParamColorInfo +//----------------------------------------------------------------------------- +LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() : + mOperation(LLTexLayerParamColor::OP_ADD), + mNumColors(0) +{ +} + +BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) +{ + llassert(node->hasName("param") && node->getChildByName("param_color")); + + if (!LLViewerVisualParamInfo::parseXml(node)) + return FALSE; + + LLXmlTreeNode* param_color_node = node->getChildByName("param_color"); + if (!param_color_node) + { + return FALSE; + } + + std::string op_string; + static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation"); + if (param_color_node->getFastAttributeString(operation_string, op_string)) + { + LLStringUtil::toLower(op_string); + if (op_string == "add") mOperation = LLTexLayerParamColor::OP_ADD; + else if (op_string == "multiply") mOperation = LLTexLayerParamColor::OP_MULTIPLY; + else if (op_string == "blend") mOperation = LLTexLayerParamColor::OP_BLEND; + } + + mNumColors = 0; + + LLColor4U color4u; + for (LLXmlTreeNode* child = param_color_node->getChildByName("value"); + child; + child = param_color_node->getNextNamedChild()) + { + if ((mNumColors < MAX_COLOR_VALUES)) + { + static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color"); + if (child->getFastAttributeColor4U(color_string, color4u)) + { + mColors[ mNumColors ].setVec(color4u); + mNumColors++; + } + } + } + if (!mNumColors) + { + llwarns << " is missing sub-elements" << llendl; + return FALSE; + } + + if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1)) + { + llwarns << " with operation\"blend\" must have exactly one " << llendl; + return FALSE; + } + + return TRUE; +} diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h new file mode 100644 index 0000000000..8c01738317 --- /dev/null +++ b/indra/newview/lltexlayerparams.h @@ -0,0 +1,180 @@ +/** + * @file lltexlayerparams.h + * @brief Texture layer parameters, used by lltexlayer. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLTEXLAYERPARAMS_H +#define LL_LLTEXLAYERPARAMS_H + +#include "llviewervisualparam.h" + +class LLTexLayer; +class LLVOAvatar; + +class LLTexLayerParam : public LLViewerVisualParam +{ +public: + LLTexLayerParam(LLTexLayer *layer); + LLTexLayerParam(LLVOAvatar *avatar); + /* Virtual */ BOOL setInfo(LLViewerVisualParamInfo *info); +protected: + LLTexLayer* mTexLayer; + LLVOAvatar* mAvatar; +}; + +//----------------------------------------------------------------------------- +// LLTexLayerParamAlpha +// +class LLTexLayerParamAlpha : public LLTexLayerParam +{ +public: + LLTexLayerParamAlpha( LLTexLayer* layer ); + LLTexLayerParamAlpha( LLVOAvatar* avatar ); + /*virtual*/ ~LLTexLayerParamAlpha(); + + // LLVisualParam Virtual functions + ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + /*virtual*/ void apply( ESex avatar_sex ) {} + /*virtual*/ void setWeight(F32 weight, BOOL set_by_user); + /*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user); + /*virtual*/ void animate(F32 delta, BOOL set_by_user); + + // LLViewerVisualParam Virtual functions + /*virtual*/ F32 getTotalDistortion() { return 1.f; } + /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } + /*virtual*/ F32 getMaxDistortion() { return 3.f; } + /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);} + /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; + /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; + + // New functions + BOOL render( S32 x, S32 y, S32 width, S32 height ); + BOOL getSkip() const; + void deleteCaches(); + BOOL getMultiplyBlend() const; + +private: + LLPointer mCachedProcessedImageGL; + LLPointer mStaticImageTGA; + LLPointer mStaticImageRaw; + BOOL mNeedsCreateTexture; + BOOL mStaticImageInvalid; + LLVector3 mAvgDistortionVec; + F32 mCachedEffectiveWeight; + +public: + // Global list of instances for gathering statistics + static void dumpCacheByteCount(); + static void getCacheByteCount( S32* gl_bytes ); + + typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t; + static param_alpha_ptr_list_t sInstances; +}; +class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo +{ + friend class LLTexLayerParamAlpha; +public: + LLTexLayerParamAlphaInfo(); + /*virtual*/ ~LLTexLayerParamAlphaInfo() {}; + + /*virtual*/ BOOL parseXml(LLXmlTreeNode* node); + +private: + std::string mStaticImageFileName; + BOOL mMultiplyBlend; + BOOL mSkipIfZeroWeight; + F32 mDomain; +}; +// +// LLTexLayerParamAlpha +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// LLTexLayerParamColor +// +class LLTexLayerParamColor : public LLTexLayerParam +{ +public: + enum EColorOperation + { + OP_ADD = 0, + OP_MULTIPLY = 1, + OP_BLEND = 2, + OP_COUNT = 3 // Number of operations + }; + + LLTexLayerParamColor( LLTexLayer* layer ); + LLTexLayerParamColor( LLVOAvatar* avatar ); + /* virtual */ ~LLTexLayerParamColor(); + + // LLVisualParam Virtual functions + ///*virtual*/ BOOL parseData(LLXmlTreeNode* node); + /*virtual*/ void apply( ESex avatar_sex ) {} + /*virtual*/ void setWeight(F32 weight, BOOL set_by_user); + /*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user); + /*virtual*/ void animate(F32 delta, BOOL set_by_user); + + + // LLViewerVisualParam Virtual functions + /*virtual*/ F32 getTotalDistortion() { return 1.f; } + /*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; } + /*virtual*/ F32 getMaxDistortion() { return 3.f; } + /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); } + /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; + /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; + + // New functions + LLColor4 getNetColor() const; +protected: + virtual void onGlobalColorChanged(bool set_by_user) {} +private: + LLVector3 mAvgDistortionVec; +}; + +class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo +{ + friend class LLTexLayerParamColor; + +public: + LLTexLayerParamColorInfo(); + virtual ~LLTexLayerParamColorInfo() {}; + BOOL parseXml( LLXmlTreeNode* node ); + LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; } +private: + enum { MAX_COLOR_VALUES = 20 }; + LLTexLayerParamColor::EColorOperation mOperation; + LLColor4 mColors[MAX_COLOR_VALUES]; + S32 mNumColors; +}; + +// +// LLTexLayerParamColor +//----------------------------------------------------------------------------- + +#endif diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index a3966ed666..1b249d75d1 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -946,7 +946,7 @@ std::string LLTextureCache::getLocalFileName(const LLUUID& id) // Does not include extension std::string idstr = id.asString(); // TODO: should we be storing cached textures in skin directory? - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "default", "textures", idstr); + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_LOCAL_ASSETS, idstr); return filename; } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index dc34c5ad37..3c9290acea 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -59,6 +59,7 @@ #include "llscrollcontainer.h" #include "lltoolmgr.h" #include "lltoolpipette.h" +#include "llsearcheditor.h" #include "lltool.h" #include "llviewerwindow.h" @@ -69,26 +70,9 @@ #include "lltrans.h" -static const S32 CLOSE_BTN_WIDTH = 100; -const S32 PIPETTE_BTN_WIDTH = 32; static const S32 HPAD = 4; static const S32 VPAD = 4; static const S32 LINE = 16; -static const S32 SMALL_BTN_WIDTH = 64; -static const S32 TEX_PICKER_MIN_WIDTH = - (HPAD + - CLOSE_BTN_WIDTH + - HPAD + - CLOSE_BTN_WIDTH + - HPAD + - SMALL_BTN_WIDTH + - HPAD + - SMALL_BTN_WIDTH + - HPAD + - 30 + - RESIZE_HANDLE_WIDTH * 2); -static const S32 CLEAR_BTN_WIDTH = 50; -static const S32 TEX_PICKER_MIN_HEIGHT = 290; static const S32 FOOTER_HEIGHT = 100; static const S32 BORDER_PAD = HPAD; static const S32 TEXTURE_INVENTORY_PADDING = 30; @@ -108,7 +92,6 @@ class LLFloaterTexturePicker : public LLFloater public: LLFloaterTexturePicker( LLTextureCtrl* owner, - const LLRect& rect, const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask non_immediate_filter_perm_mask, @@ -136,8 +119,6 @@ public: const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only); void setCanApplyImmediately(BOOL b); - void setDirty( BOOL b ) { mIsDirty = b; } - BOOL isDirty() const { return mIsDirty; } void setActive( BOOL active ); LLTextureCtrl* getOwner() const { return mOwner; } @@ -147,20 +128,21 @@ public: PermissionMask getFilterPermMask(); void updateFilterPermMask(); void commitIfImmediateSet(); - + + void onSearchEdit(const std::string& search_string ); + static void onBtnSetToDefault( void* userdata ); static void onBtnSelect( void* userdata ); static void onBtnCancel( void* userdata ); - static void onBtnPipette( void* userdata ); + void onBtnPipette( ); //static void onBtnRevert( void* userdata ); static void onBtnWhite( void* userdata ); static void onBtnNone( void* userdata ); static void onBtnClear( void* userdata ); - static void onSelectionChange(const std::deque &items, BOOL user_action, void* data); + void onSelectionChange(const std::deque &items, BOOL user_action); static void onShowFolders(LLUICtrl* ctrl, void* userdata); static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); - static void onSearchEdit(const std::string& search_string, void* user_data ); - static void onTextureSelect( const LLTextureEntry& te, void *data ); + void onTextureSelect( const LLTextureEntry& te ); protected: LLPointer mTexturep; @@ -179,7 +161,6 @@ protected: LLTextBox* mResolutionLabel; std::string mPendingName; - BOOL mIsDirty; BOOL mActive; LLSearchEditor* mSearchEdit; @@ -194,18 +175,12 @@ protected: LLFloaterTexturePicker::LLFloaterTexturePicker( LLTextureCtrl* owner, - const LLRect& rect, const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately, const std::string& fallback_image_name) - : - LLFloater( std::string("texture picker"), - rect, - std::string( "Pick: " ) + label, - TRUE, - TEX_PICKER_MIN_WIDTH, TEX_PICKER_MIN_HEIGHT ), +: LLFloater(), mOwner( owner ), mImageAssetID( owner->getImageAssetID() ), mFallbackImageName( fallback_image_name ), @@ -214,78 +189,15 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mLabel(label), mTentativeLabel(NULL), mResolutionLabel(NULL), - mIsDirty( FALSE ), mActive( TRUE ), mSearchEdit(NULL), mImmediateFilterPermMask(immediate_filter_perm_mask), mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mContextConeOpacity(0.f) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); - - mTentativeLabel = getChild("Multiple"); - - mResolutionLabel = getChild("unknown"); - - - childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); - childSetAction("None", LLFloaterTexturePicker::onBtnNone,this); - childSetAction("Blank", LLFloaterTexturePicker::onBtnWhite,this); - - - childSetCommitCallback("show_folders_check", onShowFolders, this); - childSetVisible("show_folders_check", FALSE); - - mSearchEdit = getChild("inventory search editor"); - mSearchEdit->setSearchCallback(onSearchEdit, this); - - mInventoryPanel = getChild("inventory panel"); - - if(mInventoryPanel) - { - U32 filter_types = 0x0; - filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; - filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; - - mInventoryPanel->setFilterTypes(filter_types); - //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. - mInventoryPanel->setFilterPermMask(immediate_filter_perm_mask); - mInventoryPanel->setSelectCallback(onSelectionChange, this); - mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - mInventoryPanel->setAllowMultiSelect(FALSE); - - // store this filter as the default one - mInventoryPanel->getRootFolder()->getFilter()->markDefault(); - - // Commented out to stop opening all folders with textures - // mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE); - - // don't put keyboard focus on selected item, because the selection callback - // will assume that this was user input - mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO); - } - mCanApplyImmediately = can_apply_immediately; - mNoCopyTextureSelected = FALSE; - - childSetValue("apply_immediate_check", gSavedSettings.getBOOL("ApplyTextureImmediately")); - childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this); - - if (!can_apply_immediately) - { - childSetEnabled("show_folders_check", FALSE); - } - - childSetAction("Pipette", LLFloaterTexturePicker::onBtnPipette,this); - childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); - childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); - - // update permission filter once UI is fully initialized - updateFilterPermMask(); - + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); setCanMinimize(FALSE); - - mSavedFolderState.setApply(FALSE); } LLFloaterTexturePicker::~LLFloaterTexturePicker() @@ -297,7 +209,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id) if( mImageAssetID != image_id && mActive) { mNoCopyTextureSelected = FALSE; - mIsDirty = TRUE; + mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? mImageAssetID = image_id; LLUUID item_id = findItemID(mImageAssetID, FALSE); if (item_id.isNull()) @@ -360,6 +272,10 @@ void LLFloaterTexturePicker::updateImageStats() mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]")); } } + else + { + mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("")); + } } // virtual @@ -435,7 +351,7 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) root_folder->scrollToShowSelection(); // move focus to inventory proper - root_folder->setFocus(TRUE); + mInventoryPanel->setFocus(TRUE); // treat this as a user selection of the first filtered result commitIfImmediateSet(); @@ -443,7 +359,7 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) return TRUE; } - if (root_folder->hasFocus() && key == KEY_UP) + if (mInventoryPanel->hasFocus() && key == KEY_UP) { mSearchEdit->focusFirstItem(TRUE); } @@ -474,13 +390,76 @@ BOOL LLFloaterTexturePicker::postBuild() setTitle(pick + mLabel); } + mTentativeLabel = getChild("Multiple"); + + mResolutionLabel = getChild("unknown"); + + + childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); + childSetAction("None", LLFloaterTexturePicker::onBtnNone,this); + childSetAction("Blank", LLFloaterTexturePicker::onBtnWhite,this); + + + childSetCommitCallback("show_folders_check", onShowFolders, this); + childSetVisible("show_folders_check", FALSE); + + mSearchEdit = getChild("inventory search editor"); + mSearchEdit->setSearchCallback(boost::bind(&LLFloaterTexturePicker::onSearchEdit, this, _1)); + + mInventoryPanel = getChild("inventory panel"); + + if(mInventoryPanel) + { + U32 filter_types = 0x0; + filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; + filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; + + mInventoryPanel->setFilterTypes(filter_types); + //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. + mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask); + mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2)); + mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mInventoryPanel->setAllowMultiSelect(FALSE); + + // store this filter as the default one + mInventoryPanel->getRootFolder()->getFilter()->markDefault(); + + // Commented out to stop opening all folders with textures + // mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE); + + // don't put keyboard focus on selected item, because the selection callback + // will assume that this was user input + mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO); + } + + + mNoCopyTextureSelected = FALSE; + + childSetValue("apply_immediate_check", gSavedSettings.getBOOL("ApplyTextureImmediately")); + childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this); + + if (!mCanApplyImmediately) + { + childSetEnabled("show_folders_check", FALSE); + } + + getChild("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this)); + childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); + childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); + // update permission filter once UI is fully initialized + updateFilterPermMask(); + mSavedFolderState.setApply(FALSE); + + LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); + return TRUE; } // virtual void LLFloaterTexturePicker::draw() { + static LLUICachedControl floater_header_size ("UIFloaterHeaderSize", 0); if (mOwner) { // draw cone of context pointing back to texture swatch @@ -579,9 +558,9 @@ void LLFloaterTexturePicker::draw() // Border LLRect border( BORDER_PAD, - getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD, - ((TEX_PICKER_MIN_WIDTH / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, - BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - TEX_PICKER_MIN_HEIGHT)); + getRect().getHeight() - floater_header_size - BORDER_PAD, + ((getMinWidth() / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, + BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - getMinHeight())); gl_rect_2d( border, LLColor4::black, FALSE ); @@ -602,7 +581,7 @@ void LLFloaterTexturePicker::draw() mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); // Draw Tentative Label over the image - if( mOwner->getTentative() && !mIsDirty ) + if( mOwner->getTentative() && !mViewModel->isDirty() ) { mTentativeLabel->setVisible( TRUE ); drawChild(mTentativeLabel); @@ -719,7 +698,7 @@ void LLFloaterTexturePicker::onBtnRevert(void* userdata) // TODO: Change this to tell the owner to cancel. It needs to be // smart enough to restore multi-texture selections. self->mOwner->onFloaterCommit(); - self->mIsDirty = FALSE; + self->mViewModel->resetDirty(); }*/ // static @@ -731,8 +710,8 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata) { self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CANCEL); } - self->mIsDirty = FALSE; - self->close(); + self->mViewModel->resetDirty(); + self->closeFloater(); } // static @@ -743,52 +722,42 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata) { self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_SELECT); } - self->close(); + self->closeFloater(); } -// static -void LLFloaterTexturePicker::onBtnPipette( void* userdata ) +void LLFloaterTexturePicker::onBtnPipette() { - LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - - if ( self) + BOOL pipette_active = childGetValue("Pipette").asBoolean(); + pipette_active = !pipette_active; + if (pipette_active) { - BOOL pipette_active = self->childGetValue("Pipette").asBoolean(); - pipette_active = !pipette_active; - if (pipette_active) - { - LLToolPipette::getInstance()->setSelectCallback(onTextureSelect, self); - LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); - } - else - { - LLToolMgr::getInstance()->clearTransientTool(); - } + LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); + } + else + { + LLToolMgr::getInstance()->clearTransientTool(); } - } -// static -void LLFloaterTexturePicker::onSelectionChange(const std::deque &items, BOOL user_action, void* data) +void LLFloaterTexturePicker::onSelectionChange(const std::deque &items, BOOL user_action) { - LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data; if (items.size()) { LLFolderViewItem* first_item = items.front(); LLInventoryItem* itemp = gInventory.getItem(first_item->getListener()->getUUID()); - self->mNoCopyTextureSelected = FALSE; + mNoCopyTextureSelected = FALSE; if (itemp) { if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) { - self->mNoCopyTextureSelected = TRUE; + mNoCopyTextureSelected = TRUE; } - self->mImageAssetID = itemp->getAssetUUID(); - self->mIsDirty = TRUE; + mImageAssetID = itemp->getAssetUUID(); + mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? if (user_action) { // only commit intentional selections, not implicit ones - self->commitIfImmediateSet(); + commitIfImmediateSet(); } } } @@ -827,107 +796,97 @@ void LLFloaterTexturePicker::updateFilterPermMask() //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. } -void LLFloaterTexturePicker::onSearchEdit(const std::string& search_string, void* user_data ) +void LLFloaterTexturePicker::onSearchEdit(const std::string& search_string ) { - LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; - std::string upper_case_search_string = search_string; LLStringUtil::toUpper(upper_case_search_string); if (upper_case_search_string.empty()) { - if (picker->mInventoryPanel->getFilterSubString().empty()) + if (mInventoryPanel->getFilterSubString().empty()) { // current filter and new filter empty, do nothing return; } - picker->mSavedFolderState.setApply(TRUE); - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState); + mSavedFolderState.setApply(TRUE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); // add folder with current item to list of previously opened folders LLOpenFoldersWithSelection opener; - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); - picker->mInventoryPanel->getRootFolder()->scrollToShowSelection(); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); + mInventoryPanel->getRootFolder()->scrollToShowSelection(); } - else if (picker->mInventoryPanel->getFilterSubString().empty()) + else if (mInventoryPanel->getFilterSubString().empty()) { // first letter in search term, save existing folder open state - if (!picker->mInventoryPanel->getRootFolder()->isFilterModified()) + if (!mInventoryPanel->getRootFolder()->isFilterModified()) { - picker->mSavedFolderState.setApply(FALSE); - picker->mInventoryPanel->getRootFolder()->applyFunctorRecursively(picker->mSavedFolderState); + mSavedFolderState.setApply(FALSE); + mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState); } } - picker->mInventoryPanel->setFilterSubString(upper_case_search_string); + mInventoryPanel->setFilterSubString(upper_case_search_string); } -//static -void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *data ) +void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) { - LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data; - - LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE); - if (self && inventory_item_id.notNull()) + LLUUID inventory_item_id = findItemID(te.getID(), TRUE); + if (inventory_item_id.notNull()) { LLToolPipette::getInstance()->setResult(TRUE, ""); - self->setImageID(te.getID()); + setImageID(te.getID()); - self->mNoCopyTextureSelected = FALSE; + mNoCopyTextureSelected = FALSE; LLInventoryItem* itemp = gInventory.getItem(inventory_item_id); if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) { // no copy texture - self->mNoCopyTextureSelected = TRUE; + mNoCopyTextureSelected = TRUE; } - self->commitIfImmediateSet(); + commitIfImmediateSet(); } else { - LLToolPipette::getInstance()->setResult(FALSE, "You do not have a copy this \nof texture in your inventory"); + LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture")); } } /////////////////////////////////////////////////////////////////////// // LLTextureCtrl -static LLRegisterWidget r("texture_picker"); +static LLDefaultWidgetRegistry::Register r("texture_picker"); -LLTextureCtrl::LLTextureCtrl( - const std::string& name, - const LLRect &rect, - const std::string& label, - const LLUUID &image_id, - const LLUUID &default_image_id, - const std::string& default_image_name ) - : - LLUICtrl(name, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), +LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) +: LLUICtrl(p), mDragCallback(NULL), mDropCallback(NULL), mOnCancelCallback(NULL), mOnSelectCallback(NULL), - mBorderColor( gColors.getColor("DefaultHighlightLight") ), - mImageAssetID( image_id ), - mDefaultImageAssetID( default_image_id ), - mDefaultImageName( default_image_name ), - mLabel( label ), + mBorderColor( p.border_color() ), mAllowNoTexture( FALSE ), mImmediateFilterPermMask( PERM_NONE ), mNonImmediateFilterPermMask( PERM_NONE ), mCanApplyImmediately( FALSE ), mNeedsRawImageData( FALSE ), mValid( TRUE ), - mDirty( FALSE ), - mShowLoadingPlaceholder( TRUE ) + mShowLoadingPlaceholder( TRUE ), + mImageAssetID(p.image_id), + mDefaultImageAssetID(p.default_image_id), + mDefaultImageName(p.default_image_name) { - mCaption = new LLTextBox( label, - LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), - label, - LLFontGL::getFontSansSerifSmall() ); - mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); + setAllowNoTexture(p.allow_no_texture); + setCanApplyImmediately(p.can_apply_immediately); + + LLTextBox::Params params(p.caption_text); + params.name(p.label); + params.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 )); + params.text(p.label); + params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM); + mCaption = LLUICtrlFactory::create (params); addChild( mCaption ); S32 image_top = getRect().getHeight(); @@ -935,92 +894,27 @@ LLTextureCtrl::LLTextureCtrl( S32 image_middle = (image_top + image_bottom) / 2; S32 line_height = llround(LLFontGL::getFontSansSerifSmall()->getLineHeight()); - mTentativeLabel = new LLTextBox( std::string("Multiple"), - LLRect( - 0, image_middle + line_height / 2, - getRect().getWidth(), image_middle - line_height / 2 ), - std::string("Multiple"), - LLFontGL::getFontSansSerifSmall() ); - mTentativeLabel->setHAlign( LLFontGL::HCENTER ); - mTentativeLabel->setFollowsAll(); + LLTextBox::Params tentative_label_p(p.multiselect_text); + tentative_label_p.name("Multiple"); + tentative_label_p.rect(LLRect (0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 )); + tentative_label_p.follows.flags(FOLLOWS_ALL); + mTentativeLabel = LLUICtrlFactory::create (tentative_label_p); addChild( mTentativeLabel ); - LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); + LLRect border_rect = getLocalRect(); border_rect.mBottom += BTN_HEIGHT_SMALL; - mBorder = new LLViewBorder(std::string("border"), border_rect, LLViewBorder::BEVEL_IN); - mBorder->setFollowsAll(); + LLViewBorder::Params vbparams(p.border); + vbparams.name("border"); + vbparams.rect(border_rect); + mBorder = LLUICtrlFactory::create (vbparams); addChild(mBorder); - setEnabled(TRUE); // for the tooltip mLoadingPlaceholderString = LLTrans::getString("texture_loading"); } - LLTextureCtrl::~LLTextureCtrl() { - closeFloater(); -} - -// virtual -LLXMLNodePtr LLTextureCtrl::getXML(bool save_children) const -{ - LLXMLNodePtr node = LLUICtrl::getXML(); - - node->createChild("label", TRUE)->setStringValue(getLabel()); - - node->createChild("default_image_name", TRUE)->setStringValue(getDefaultImageName()); - - node->createChild("allow_no_texture", TRUE)->setBoolValue(mAllowNoTexture); - - node->createChild("can_apply_immediately", TRUE)->setBoolValue(mCanApplyImmediately ); - - return node; -} - -LLView* LLTextureCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("texture_picker"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent); - - std::string label; - node->getAttributeString("label", label); - - std::string image_id(""); - node->getAttributeString("image", image_id); - - std::string default_image_id(""); - node->getAttributeString("default_image", default_image_id); - - std::string default_image_name("Default"); - node->getAttributeString("default_image_name", default_image_name); - - BOOL allow_no_texture = FALSE; - node->getAttributeBOOL("allow_no_texture", allow_no_texture); - - BOOL can_apply_immediately = FALSE; - node->getAttributeBOOL("can_apply_immediately", can_apply_immediately); - - if (label.empty()) - { - label.assign(node->getValue()); - } - - LLTextureCtrl* texture_picker = new LLTextureCtrl( - name, - rect, - label, - LLUUID(image_id), - LLUUID(default_image_id), - default_image_name ); - texture_picker->setAllowNoTexture(allow_no_texture); - texture_picker->setCanApplyImmediately(can_apply_immediately); - - texture_picker->initFromXML(node, parent); - - return texture_picker; + closeDependentFloater(); } void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder) @@ -1047,7 +941,7 @@ void LLTextureCtrl::setVisible( BOOL visible ) { if( !visible ) { - closeFloater(); + closeDependentFloater(); } LLUICtrl::setVisible( visible ); } @@ -1066,7 +960,7 @@ void LLTextureCtrl::setEnabled( BOOL enabled ) setToolTip( std::string() ); // *TODO: would be better to keep floater open and show // disabled state. - closeFloater(); + closeDependentFloater(); } if( floaterp ) @@ -1092,18 +986,6 @@ void LLTextureCtrl::setValid(BOOL valid ) } } -// virtual -BOOL LLTextureCtrl::isDirty() const -{ - return mDirty; -} - -// virtual -void LLTextureCtrl::resetDirty() -{ - mDirty = FALSE; -} - // virtual void LLTextureCtrl::clear() @@ -1119,25 +1001,20 @@ void LLTextureCtrl::setLabel(const std::string& label) void LLTextureCtrl::showPicker(BOOL take_focus) { + // show hourglass cursor when loading inventory window + // because inventory construction is slooow + getWindow()->setCursor(UI_CURSOR_WAIT); LLFloater* floaterp = mFloaterHandle.get(); // Show the dialog if( floaterp ) { - floaterp->open( ); /* Flawfinder: ignore */ + floaterp->openFloater(); } else { - if( !mLastFloaterLeftTop.mX && !mLastFloaterLeftTop.mY ) - { - gFloaterView->getNewFloaterPosition(&mLastFloaterLeftTop.mX, &mLastFloaterLeftTop.mY); - } - LLRect rect = gSavedSettings.getRect("TexturePickerRect"); - rect.translate( mLastFloaterLeftTop.mX - rect.mLeft, mLastFloaterLeftTop.mY - rect.mTop ); - floaterp = new LLFloaterTexturePicker( this, - rect, mLabel, mImmediateFilterPermMask, mNonImmediateFilterPermMask, @@ -1146,8 +1023,10 @@ void LLTextureCtrl::showPicker(BOOL take_focus) mFloaterHandle = floaterp->getHandle(); - gFloaterView->getParentFloater(this)->addDependentFloater(floaterp); - floaterp->open(); /* Flawfinder: ignore */ + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) + root_floater->addDependentFloater(floaterp); + floaterp->openFloater(); } if (take_focus) @@ -1157,13 +1036,13 @@ void LLTextureCtrl::showPicker(BOOL take_focus) } -void LLTextureCtrl::closeFloater() +void LLTextureCtrl::closeDependentFloater() { LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); if( floaterp ) { floaterp->setOwner(NULL); - floaterp->close(); + floaterp->closeFloater(); } } @@ -1210,7 +1089,6 @@ void LLTextureCtrl::onFloaterClose() if (floaterp) { floaterp->setOwner(NULL); - mLastFloaterLeftTop.set( floaterp->getRect().mLeft, floaterp->getRect().mTop ); } mFloaterHandle.markDead(); @@ -1222,7 +1100,11 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op) if( floaterp && getEnabled()) { - mDirty = (op != TEXTURE_CANCEL); + if (op == TEXTURE_CANCEL) + mViewModel->resetDirty(); + else + mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? + if( floaterp->isDirty() ) { setTentative( FALSE ); @@ -1232,11 +1114,11 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op) lldebugs << "mImageAssetID: " << mImageAssetID << llendl; if (op == TEXTURE_SELECT && mOnSelectCallback) { - mOnSelectCallback(this, mCallbackUserData); + mOnSelectCallback( this, LLSD() ); } else if (op == TEXTURE_CANCEL && mOnCancelCallback) { - mOnCancelCallback(this, mCallbackUserData); + mOnCancelCallback( this, LLSD() ); } else { @@ -1256,7 +1138,7 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id ) if( floaterp && getEnabled() ) { floaterp->setImageID( asset_id ); - floaterp->setDirty( FALSE ); + floaterp->resetDirty(); } } } @@ -1320,7 +1202,7 @@ void LLTextureCtrl::draw() // Border LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); - gl_rect_2d( border, mBorderColor, FALSE ); + gl_rect_2d( border, mBorderColor.get(), FALSE ); // Interior LLRect interior = border; @@ -1388,7 +1270,7 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) { if(mDragCallback) { - return mDragCallback(this, item, mCallbackUserData); + return mDragCallback(this, item); } else { @@ -1408,7 +1290,7 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) { // if it returns TRUE, we return TRUE, and therefore the // commit is called above. - return mDropCallback(this, item, mCallbackUserData); + return mDropCallback(this, item); } // no callback installed, so just set the image ids and carry on. @@ -1438,66 +1320,6 @@ LLSD LLTextureCtrl::getValue() const } -///////////////////////////////////////////////////////////////////////////////// -// LLToolTexEyedropper - -class LLToolTexEyedropper : public LLTool -{ -public: - LLToolTexEyedropper( void (*callback)(const LLUUID& obj_id, const LLUUID& image_id, void* userdata ), void* userdata ); - virtual ~LLToolTexEyedropper(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - -protected: - void (*mCallback)(const LLUUID& obj_id, const LLUUID& image_id, void* userdata ); - void* mCallbackUserData; -}; - - -LLToolTexEyedropper::LLToolTexEyedropper( - void (*callback)(const LLUUID& obj_id, const LLUUID& image_id, void* userdata ), - void* userdata ) - : LLTool(std::string("texeyedropper")), - mCallback( callback ), - mCallbackUserData( userdata ) -{ -} - -LLToolTexEyedropper::~LLToolTexEyedropper() -{ -} - - -BOOL LLToolTexEyedropper::handleMouseDown(S32 x, S32 y, MASK mask) -{ - // this will affect framerate on mouse down - const LLPickInfo& pick = gViewerWindow->pickImmediate(x, y, FALSE); - LLViewerObject* hit_obj = pick.getObject(); - if (hit_obj && - !hit_obj->isAvatar()) - { - if( (0 <= pick.mObjectFace) && (pick.mObjectFace < hit_obj->getNumTEs()) ) - { - LLViewerImage* image = hit_obj->getTEImage( pick.mObjectFace ); - if( image ) - { - if( mCallback ) - { - mCallback( hit_obj->getID(), image->getID(), mCallbackUserData ); - } - } - } - } - return TRUE; -} - -BOOL LLToolTexEyedropper::handleHover(S32 x, S32 y, MASK mask) -{ - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolTexEyedropper" << llendl; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_CROSS); // TODO: better cursor - return TRUE; -} diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 623f15eef5..ebe2cd2e5f 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -39,16 +39,17 @@ #include "llstring.h" #include "lluictrl.h" #include "llpermissionsflags.h" +#include "lltextbox.h" // for params +#include "llviewborder.h" // for params class LLButton; class LLFloaterTexturePicker; class LLInventoryItem; -class LLTextBox; -class LLViewBorder; class LLViewerImage; // used for setting drag & drop callbacks. -typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*); +typedef boost::function drag_n_drop_callback; + ////////////////////////////////////////////////////////////////////////////////////////// // LLTextureCtrl @@ -66,17 +67,45 @@ public: } ETexturePickOp; public: - LLTextureCtrl( - const std::string& name, const LLRect& rect, - const std::string& label, - const LLUUID& image_id, - const LLUUID& default_image_id, - const std::string& default_image_name ); + struct Params : public LLInitParam::Block + { + Optional image_id; + Optional default_image_id; + Optional default_image_name; + Optional allow_no_texture; + Optional can_apply_immediately; + Optional label_width; + Optional border_color; + + Optional multiselect_text, + caption_text; + + Optional border; + + Params() + : image_id("image"), + default_image_id("default_image"), + default_image_name("default_image_name"), + allow_no_texture("allow_no_texture"), + can_apply_immediately("can_apply_immediately"), + label_width("label_width", -1), + border_color("border_color"), + multiselect_text("multiselect_text"), + caption_text("caption_text"), + border("border") + { + name = "texture picker"; + mouse_opaque(true); + follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); + } + }; +protected: + LLTextureCtrl(const Params&); + friend class LLUICtrlFactory; +public: virtual ~LLTextureCtrl(); // LLView interface - virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, @@ -90,9 +119,6 @@ public: virtual void setVisible( BOOL visible ); virtual void setEnabled( BOOL enabled ); - virtual BOOL isDirty() const; - virtual void resetDirty(); - void setValid(BOOL valid); // LLUICtrl interface @@ -105,6 +131,7 @@ public: // LLTextureCtrl interface void showPicker(BOOL take_focus); void setLabel(const std::string& label); + void setLabelWidth(S32 label_width) {mLabelWidth =label_width;} const std::string& getLabel() const { return mLabel; } void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; } @@ -133,7 +160,7 @@ public: PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; } PermissionMask getNonImmediateFilterPermMask() { return mNonImmediateFilterPermMask; } - void closeFloater(); + void closeDependentFloater(); void onFloaterClose(); void onFloaterCommit(ETexturePickOp op); @@ -146,10 +173,10 @@ public: // the drop happened - resulting in an on commit callback, but not // necessariliy any other change. void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; } - - void setOnCancelCallback(LLUICtrlCallback cb) { mOnCancelCallback = cb; } - void setOnSelectCallback(LLUICtrlCallback cb) { mOnSelectCallback = cb; } + void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; } + + void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; } void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder); @@ -160,10 +187,10 @@ private: private: drag_n_drop_callback mDragCallback; drag_n_drop_callback mDropCallback; - LLUICtrlCallback mOnCancelCallback; - LLUICtrlCallback mOnSelectCallback; + commit_callback_t mOnCancelCallback; + commit_callback_t mOnSelectCallback; LLPointer mTexturep; - LLColor4 mBorderColor; + LLUIColor mBorderColor; LLUUID mImageItemID; LLUUID mImageAssetID; LLUUID mDefaultImageAssetID; @@ -174,16 +201,15 @@ private: LLTextBox* mCaption; std::string mLabel; BOOL mAllowNoTexture; // If true, the user can select "none" as an option - LLCoordGL mLastFloaterLeftTop; PermissionMask mImmediateFilterPermMask; PermissionMask mNonImmediateFilterPermMask; BOOL mCanApplyImmediately; BOOL mNeedsRawImageData; LLViewBorder* mBorder; BOOL mValid; - BOOL mDirty; BOOL mShowLoadingPlaceholder; std::string mLoadingPlaceholderString; + S32 mLabelWidth; }; // XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index e9dd7921cd..be535761fc 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1877,6 +1877,21 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 } ////////////////////////////////////////////////////////////////////////////// +BOOL LLTextureFetch::isFromLocalCache(const LLUUID& id) +{ + BOOL from_cache = FALSE ; + + LLMutexLock lock(&mQueueMutex); + LLTextureFetchWorker* worker = getWorker(id); + if (worker) + { + worker->lockWorkData(); + from_cache = worker->mInLocalCache ; + worker->unlockWorkData(); + } + + return from_cache ; +} S32 LLTextureFetch::getFetchState(const LLUUID& id, F32& data_progress_p, F32& requested_priority_p, U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p) diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 56650e721c..282fbb6481 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -67,6 +67,7 @@ public: bool receiveImagePacket(const LLHost& host, const LLUUID& id, U16 packet_num, U16 data_size, U8* data); // Debug + BOOL isFromLocalCache(const LLUUID& id); S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p, U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p); void dump(); diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index f00d5e5b48..50b73bfbc7 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -83,12 +83,20 @@ public: S32 mHilite; public: - LLTextureBar(const std::string& name, const LLRect& r, LLTextureView* texview) - : LLView(name, r, FALSE), - mHilite(0), - mTextureView(texview) + struct Params : public LLInitParam::Block { - } + Mandatory texture_view; + Params() + : texture_view("texture_view") + { + mouse_opaque(false); + } + }; + LLTextureBar(const Params& p) + : LLView(p), + mHilite(0), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -366,13 +374,21 @@ LLRect LLTextureBar::getRequiredRect() class LLGLTexMemBar : public LLView { public: - LLGLTexMemBar(const std::string& name, LLTextureView* texview) - : LLView(name, FALSE), - mTextureView(texview) + struct Params : public LLInitParam::Block { - S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); - setRect(LLRect(0,0,100,line_height * 4)); - } + Mandatory texture_view; + Params() + : texture_view("texture_view") + { + S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); + rect(LLRect(0,0,100,line_height * 4)); + } + }; + + LLGLTexMemBar(const Params& p) + : LLView(p), + mTextureView(p.texture_view) + {} virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -384,10 +400,10 @@ private: void LLGLTexMemBar::draw() { - S32 bound_mem = (LLViewerImage::sBoundTextureMemory >> 20); - S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMem; - S32 total_mem = (LLViewerImage::sTotalTextureMemory >> 20); - S32 max_total_mem = LLViewerImage::sMaxTotalTextureMem; + S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes); + S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMemInMegaBytes; + S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sTotalTextureMemoryInBytes); + S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes; F32 discard_bias = LLViewerImage::sDesiredDiscardBias; S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); @@ -521,8 +537,8 @@ LLRect LLGLTexMemBar::getRequiredRect() //////////////////////////////////////////////////////////////////////////// -LLTextureView::LLTextureView(const std::string& name, const LLRect& rect) - : LLContainerView(name, rect), +LLTextureView::LLTextureView(const LLTextureView::Params& p) + : LLContainerView(p), mFreezeView(FALSE), mOrderFetch(FALSE), mPrintList(FALSE), @@ -709,7 +725,10 @@ void LLTextureView::draw() else sortChildren(LLTextureBar::sort()); - mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this); + LLGLTexMemBar::Params tmbp; + tmbp.name("gl texmem bar"); + tmbp.texture_view(this); + mGLTexMemBar = LLUICtrlFactory::create(tmbp); addChild(mGLTexMemBar); reshape(getRect().getWidth(), getRect().getHeight(), TRUE); @@ -746,7 +765,11 @@ BOOL LLTextureView::addBar(LLViewerImage *imagep, S32 hilite) mNumTextureBars++; - barp = new LLTextureBar("texture bar", r, this); + LLTextureBar::Params tbp; + tbp.name("texture bar"); + tbp.rect(r); + tbp.texture_view(this); + barp = LLUICtrlFactory::create(tbp); barp->mImagep = imagep; barp->mHilite = hilite; diff --git a/indra/newview/lltextureview.h b/indra/newview/lltextureview.h index f91a296b97..99b6db9662 100644 --- a/indra/newview/lltextureview.h +++ b/indra/newview/lltextureview.h @@ -43,8 +43,10 @@ class LLTextureView : public LLContainerView { friend class LLTextureBar; friend class LLGLTexMemBar; +protected: + LLTextureView(const Params&); + friend class LLUICtrlFactory; public: - LLTextureView(const std::string& name, const LLRect& rect); ~LLTextureView(); /*virtual*/ void draw(); diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 6a3ada0474..7b058e9efa 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -91,7 +91,7 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLTool::handleHover(S32 x, S32 y, MASK mask) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); lldebugst(LLERR_USER_INPUT) << "hover handled by a tool" << llendl; // by default, do nothing, say we handled it return TRUE; diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 33edb3ef27..d27958c2ac 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -36,18 +36,21 @@ #include "lltoolbar.h" #include "imageids.h" +#include "llfloaterreg.h" #include "llfontgl.h" +#include "llflyoutbutton.h" #include "llrect.h" #include "llparcel.h" #include "llagent.h" +#include "llagentwearables.h" #include "llbutton.h" #include "llfocusmgr.h" #include "llviewercontrol.h" #include "llmenucommands.h" #include "llimview.h" #include "lluiconstants.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "lltooldraganddrop.h" #include "llinventoryview.h" #include "llfloaterchatterbox.h" @@ -57,6 +60,9 @@ #include "llui.h" #include "llviewermenu.h" #include "llfirstuse.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llscrolllistcell.h" #include "llviewerparcelmgr.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" @@ -65,29 +71,12 @@ #include "llfloaterchat.h" #include "llfloatermute.h" #include "llimpanel.h" -#include "llscrolllistctrl.h" +#include "lllayoutstack.h" #if LL_DARWIN #include "llresizehandle.h" - // This class draws like an LLResizeHandle but has no interactivity. - // It's just there to provide a cue to the user that the lower right corner of the window functions as a resize handle. - class LLFakeResizeHandle : public LLResizeHandle - { - public: - LLFakeResizeHandle(const std::string& name, const LLRect& rect, S32 min_width, S32 min_height, ECorner corner = RIGHT_BOTTOM ) - : LLResizeHandle(name, rect, min_width, min_height, corner ) - { - - } - - virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; }; - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) { return FALSE; }; - - }; - #endif // LL_DARWIN // @@ -95,7 +84,6 @@ // LLToolBar *gToolBar = NULL; -S32 TOOL_BAR_HEIGHT = 20; // // Statics @@ -114,44 +102,13 @@ LLToolBar::LLToolBar() { setIsChrome(TRUE); setFocusRoot(TRUE); + + mCommitCallbackRegistrar.add("HandleCommunicate", &LLToolBar::onClickCommunicate); } BOOL LLToolBar::postBuild() { - childSetCommitCallback("communicate_btn", onClickCommunicate, this); - childSetControlName("communicate_btn", "ShowCommunicate"); - - childSetAction("chat_btn", onClickChat, this); - childSetControlName("chat_btn", "ChatVisible"); - - childSetAction("appearance_btn", onClickAppearance, this); - childSetControlName("appearance_btn", ""); - - childSetAction("fly_btn", onClickFly, this); - childSetControlName("fly_btn", "FlyBtnState"); - - childSetAction("sit_btn", onClickSit, this); - childSetControlName("sit_btn", "SitBtnState"); - - childSetAction("snapshot_btn", onClickSnapshot, this); - childSetControlName("snapshot_btn", ""); - - childSetAction("directory_btn", onClickDirectory, this); - childSetControlName("directory_btn", "ShowDirectory"); - - childSetAction("build_btn", onClickBuild, this); - childSetControlName("build_btn", "BuildBtnState"); - - childSetAction("radar_btn", onClickRadar, this); - childSetControlName("radar_btn", "ShowMiniMap"); - - childSetAction("map_btn", onClickMap, this); - childSetControlName("map_btn", "ShowWorldMap"); - - childSetAction("inventory_btn", onClickInventory, this); - childSetControlName("inventory_btn", "ShowInventory"); - for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { @@ -167,8 +124,14 @@ BOOL LLToolBar::postBuild() if(mResizeHandle == NULL) { LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); - mResizeHandle = new LLFakeResizeHandle(std::string(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); - this->addChildAtEnd(mResizeHandle); + LLResizeHandle::Params p; + p.name(""); + p.rect(rect); + p.min_width(RESIZE_HANDLE_WIDTH); + p.min_height(RESIZE_HANDLE_HEIGHT); + p.enabled(false); + mResizeHandle = LLUICtrlFactory::create(p); + addChildInBack(mResizeHandle); LLLayoutStack* toolbar_stack = getChild("toolbar_stack"); toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight()); } @@ -196,11 +159,14 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, LLInventoryView* active_inventory = LLInventoryView::getActiveInventory(); + LLRect button_screen_rect; + inventory_btn->localRectToScreen(inventory_btn->getRect(),&button_screen_rect); + if(active_inventory && active_inventory->getVisible()) { mInventoryAutoOpen = FALSE; } - else if (inventory_btn->getRect().pointInRect(x, y)) + else if (button_screen_rect.pointInRect(x, y)) { if (mInventoryAutoOpen) { @@ -290,18 +256,34 @@ void LLToolBar::refresh() sitting = gAgent.getAvatarObject()->mIsSitting; } - childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying()) && !sitting ); - - childSetEnabled("build_btn", LLViewerParcelMgr::getInstance()->agentCanBuild() ); + if (!gAgent.canFly()) + { + gSavedSettings.setBOOL("FlyBtnEnabled", gAgent.getFlying() ? true : false); + gSavedSettings.setBOOL("FlyBtnState", false); + } + else + { + gSavedSettings.setBOOL("FlyBtnEnabled", sitting ? false : true); + } // Check to see if we're in build mode - BOOL build_mode = LLToolMgr::getInstance()->inEdit(); - // And not just clicking on a scripted object - if (LLToolGrab::getInstance()->getHideBuildHighlight()) + bool build_enabled = LLToolMgr::getInstance()->canEdit(); + if (build_enabled) + { + gSavedSettings.setBOOL("BuildBtnEnabled", true); + bool build_mode = LLToolMgr::getInstance()->inEdit(); + // HACK: Not in mouselook and not just clicking on a scripted object + if (gAgent.cameraMouselook() || LLToolGrab::getInstance()->getHideBuildHighlight()) { build_mode = FALSE; } gSavedSettings.setBOOL("BuildBtnState", build_mode); + } + else + { + gSavedSettings.setBOOL("BuildBtnEnabled", false); + gSavedSettings.setBOOL("BuildBtnState", false); + } if (isInVisibleChain()) { @@ -319,29 +301,38 @@ void LLToolBar::updateCommunicateList() LLFloater* frontmost_floater = LLFloaterChatterBox::getInstance()->getActiveFloater(); LLScrollListItem* itemp = NULL; - itemp = communicate_button->add(LLFloaterMyFriends::getInstance()->getShortTitle(), LLSD("contacts"), ADD_TOP); + LLSD contact_sd; + contact_sd["value"] = "contacts"; + contact_sd["columns"][0]["value"] = LLFloaterMyFriends::getInstance()->getShortTitle(); if (LLFloaterMyFriends::getInstance() == frontmost_floater) { - ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); + contact_sd["columns"][0]["font"]["style"] = "BOLD"; // make sure current tab is selected in list if (selected.isUndefined()) { - selected = itemp->getValue(); + selected = "contacts"; } } - itemp = communicate_button->add(LLFloaterChat::getInstance()->getShortTitle(), LLSD("local chat"), ADD_TOP); + itemp = communicate_button->addElement(contact_sd, ADD_TOP); + + LLSD communicate_sd; + communicate_sd["value"] = "local chat"; + communicate_sd["columns"][0]["value"] = LLFloaterChat::getInstance()->getShortTitle(); + if (LLFloaterChat::getInstance() == frontmost_floater) { - ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); + communicate_sd["columns"][0]["font"]["style"] = "BOLD"; if (selected.isUndefined()) { - selected = itemp->getValue(); + selected = "local chat"; } } + itemp = communicate_button->addElement(communicate_sd, ADD_TOP); + communicate_button->addSeparator(ADD_TOP); communicate_button->add(getString("Redock Windows"), LLSD("redock"), ADD_TOP); communicate_button->addSeparator(ADD_TOP); - communicate_button->add(LLFloaterMute::getInstance()->getShortTitle(), LLSD("mute list"), ADD_TOP); + communicate_button->add(LLFloaterReg::getTypedInstance("mute")->getShortTitle(), LLSD("mute list"), ADD_TOP); std::set >::const_iterator floater_handle_it; @@ -357,38 +348,40 @@ void LLToolBar::updateCommunicateList() { std::string floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : ""; floater_title.append(im_floaterp->getShortTitle()); - itemp = communicate_button->add(floater_title, im_floaterp->getSessionID(), ADD_TOP); + LLSD im_sd; + im_sd["value"] = im_floaterp->getSessionID(); + im_sd["columns"][0]["value"] = floater_title; if (im_floaterp == frontmost_floater) { - ((LLScrollListText*)itemp->getColumn(0))->setFontStyle(LLFontGL::BOLD); + im_sd["columns"][0]["font"]["style"] = "BOLD"; if (selected.isUndefined()) { - selected = itemp->getValue(); + selected = im_floaterp->getSessionID(); } } + itemp = communicate_button->addElement(im_sd, ADD_TOP); } } - communicate_button->setToggleState(gSavedSettings.getBOOL("ShowCommunicate")); communicate_button->setValue(selected); } // static -void LLToolBar::onClickCommunicate(LLUICtrl* ctrl, void* user_data) +void LLToolBar::onClickCommunicate(LLUICtrl* ctrl, const LLSD& user_data) { - LLToolBar* toolbar = (LLToolBar*)user_data; - LLFlyoutButton* communicate_button = toolbar->getChild("communicate_btn"); + LLFlyoutButton* communicate_button = dynamic_cast(ctrl); + llassert_always(communicate_button); LLSD selected_option = communicate_button->getValue(); if (selected_option.asString() == "contacts") { - LLFloaterMyFriends::showInstance(); + LLFloaterReg::showInstance("contacts", "friends"); } else if (selected_option.asString() == "local chat") { - LLFloaterChat::showInstance(); + LLFloaterReg::showInstance("communicate", "local"); } else if (selected_option.asString() == "redock") { @@ -410,112 +403,20 @@ void LLToolBar::onClickCommunicate(LLUICtrl* ctrl, void* user_data) } } - LLFloaterChatterBox::showInstance(session_to_show); + LLFloaterReg::showInstance("communicate", session_to_show); } else if (selected_option.asString() == "mute list") { - LLFloaterMute::showInstance(); + LLFloaterReg::showInstance("mute"); } else if (selected_option.isUndefined()) // user just clicked the communicate button, treat as toggle { - if (LLFloaterChatterBox::getInstance()->getFloaterCount() == 0) - { - LLFloaterMyFriends::toggleInstance(); + LLFloaterReg::toggleInstance("communicate"); } - else - { - LLFloaterChatterBox::toggleInstance(); - } - } - else // otherwise selection_option is a specific IM session id - { - LLFloaterChatterBox::showInstance(selected_option); - } -} - - -// static -void LLToolBar::onClickChat(void* user_data) -{ - handle_chat(NULL); -} - -// static -void LLToolBar::onClickAppearance(void*) -{ - if (gAgent.areWearablesLoaded()) - { - gAgent.changeCameraToCustomizeAvatar(); - } -} - - -// static -void LLToolBar::onClickFly(void*) -{ - gAgent.toggleFlying(); -} - - -// static -void LLToolBar::onClickSit(void*) -{ - if (!(gAgent.getControlFlags() & AGENT_CONTROL_SIT_ON_GROUND)) - { - // sit down - gAgent.setFlying(FALSE); - gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); - - // Might be first sit - LLFirstUse::useSit(); - } - else + else // otherwise selection_option is undifined or a specific IM session id { - // stand up - gAgent.setFlying(FALSE); - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + LLFloaterReg::showInstance("communicate", selected_option); } } -// static -void LLToolBar::onClickSnapshot(void*) -{ - LLFloaterSnapshot::show (0); -} - - -// static -void LLToolBar::onClickDirectory(void*) -{ - handle_find(NULL); -} - - -// static -void LLToolBar::onClickBuild(void*) -{ - toggle_build_mode(); -} - - -// static -void LLToolBar::onClickRadar(void*) -{ - handle_mini_map(NULL); -} - - -// static -void LLToolBar::onClickMap(void*) -{ - handle_map(NULL); -} - - -// static -void LLToolBar::onClickInventory(void*) -{ - handle_inventory(NULL); -} - diff --git a/indra/newview/lltoolbar.h b/indra/newview/lltoolbar.h index 094d016e39..954c6270a6 100644 --- a/indra/newview/lltoolbar.h +++ b/indra/newview/lltoolbar.h @@ -37,12 +37,7 @@ #include "llframetimer.h" -// "Constants" loaded from settings.xml at start time -extern S32 TOOL_BAR_HEIGHT; - -#if LL_DARWIN - class LLFakeResizeHandle; -#endif // LL_DARWIN +class LLResizeHandle; class LLToolBar : public LLPanel @@ -71,17 +66,7 @@ public: void refresh(); // callbacks - static void onClickCommunicate(LLUICtrl*, void*); - static void onClickChat(void* data); - static void onClickAppearance(void* data); - static void onClickFly(void*); - static void onClickSit(void*); - static void onClickSnapshot(void* data); - static void onClickDirectory(void* data); - static void onClickBuild(void* data); - static void onClickRadar(void* data); - static void onClickMap(void* data); - static void onClickInventory(void* data); + static void onClickCommunicate(LLUICtrl*, const LLSD&); static F32 sInventoryAutoOpenTime; @@ -94,7 +79,7 @@ private: LLFrameTimer mInventoryAutoOpenTimer; S32 mNumUnreadIMs; #if LL_DARWIN - LLFakeResizeHandle *mResizeHandle; + LLResizeHandle *mResizeHandle; #endif // LL_DARWIN }; diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index c42693d03f..0088a6a2a4 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -412,7 +412,7 @@ BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask ) mMouseX = x; mMouseY = y; mGotHover = TRUE; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLLAND); + gViewerWindow->setCursor(UI_CURSOR_TOOLLAND); return TRUE; } diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 0b6e01886a..cb964082b8 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -34,6 +34,7 @@ #include "lltoolcomp.h" +#include "llfloaterreg.h" #include "llgl.h" #include "indra_constants.h" @@ -64,6 +65,9 @@ const S32 HPAD = 4; extern LLControlGroup gSavedSettings; +// we use this in various places instead of NULL +static LLTool* sNullTool = new LLTool(std::string("null"), NULL); + //----------------------------------------------------------------------- // LLToolComposite @@ -87,7 +91,9 @@ void LLToolComposite::setCurrentTool( LLTool* new_tool ) LLToolComposite::LLToolComposite(const std::string& name) : LLTool(name), - mCur(NULL), mDefault(NULL), mSelected(FALSE), + mCur(sNullTool), + mDefault(sNullTool), + mSelected(FALSE), mMouseDown(FALSE), mManip(NULL), mSelectRect(NULL) { } @@ -290,7 +296,7 @@ BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask) { // You should already have an object selected from the mousedown. // If so, show its properties - gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); + LLFloaterReg::showInstance("build", "Content"); return TRUE; } // Nothing selected means the first mouse click was probably @@ -407,8 +413,7 @@ BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask) { // You should already have an object selected from the mousedown. // If so, show its properties - gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); - //gBuildView->setPropertiesPanelOpen(TRUE); + LLFloaterReg::showInstance("build", "Content"); return TRUE; } else @@ -605,8 +610,7 @@ BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask) { // You should already have an object selected from the mousedown. // If so, show its properties - gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); - //gBuildView->setPropertiesPanelOpen(TRUE); + LLFloaterReg::showInstance("build", "Content"); return TRUE; } else @@ -638,7 +642,7 @@ LLToolCompGun::LLToolCompGun() { mGun = new LLToolGun(this); mGrab = new LLToolGrab(this); - mNull = new LLTool(std::string("null"), this); + mNull = sNullTool; setCurrentTool(mGun); mDefault = mGun; @@ -653,7 +657,8 @@ LLToolCompGun::~LLToolCompGun() delete mGrab; mGrab = NULL; - delete mNull; + // don't delete a static object + // delete mNull; mNull = NULL; } diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 156093a21a..0c0253a76a 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -35,10 +35,12 @@ #include "message.h" #include "lltooldraganddrop.h" +#include "llfloaterreg.h" #include "llinstantmessage.h" #include "lldir.h" #include "llagent.h" +#include "llagentwearables.h" #include "llviewercontrol.h" #include "llfirstuse.h" #include "llfloater.h" @@ -47,6 +49,7 @@ #include "llgesturemgr.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" +#include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventoryview.h" #include "llmutelist.h" @@ -63,11 +66,12 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvolume.h" #include "llworld.h" #include "object_flags.h" #include "llimview.h" +#include "llrootview.h" // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < MTUBYTES @@ -846,7 +850,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop, { handled = TRUE; - LLView* root_view = gViewerWindow->getRootView(); + LLRootView* root_view = gViewerWindow->getRootView(); for (mCurItemIndex = 0; mCurItemIndex < (S32)mCargoIDs.size(); mCurItemIndex++) { @@ -1461,10 +1465,10 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, } } hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); - if (gFloaterTools->getVisible()) + if (LLFloaterReg::instanceVisible("build")) { // *FIX: only show this if panel not expanded? - gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); + LLFloaterReg::showInstance("build", "Content"); } // VEFFECT: AddToInventory @@ -1827,7 +1831,7 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item) BOOL copyable = FALSE; if(item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE; - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); if(!my_avatar) { return FALSE; @@ -1847,7 +1851,7 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item) break; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(!copyable && gAgent.isWearingItem(item->getUUID())) + if(!copyable && gAgentWearables.isWearingItem(item->getUUID())) { acceptable = FALSE; } @@ -1877,7 +1881,7 @@ BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item) return FALSE; } - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); if(!my_avatar) { return FALSE; @@ -1924,7 +1928,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // gAgent.getGroupID()) // && (obj->mPermModify || obj->mFlagAllowInventoryAdd)); BOOL worn = FALSE; - LLVOAvatar* my_avatar = NULL; + LLVOAvatarSelf* my_avatar = NULL; switch(item->getType()) { case LLAssetType::AT_OBJECT: @@ -1936,7 +1940,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL break; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(gAgent.isWearingItem(item->getUUID())) + if(gAgentWearables.isWearingItem(item->getUUID())) { worn = TRUE; } @@ -2080,7 +2084,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( } // must not be already wearing it - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if( !avatar || avatar->isWearingAttachment(item->getUUID()) ) { return ACCEPT_NO; @@ -2122,7 +2126,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( locateInventory(item, cat); if(!item || !item->isComplete()) return ACCEPT_NO; - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) { return ACCEPT_NO; @@ -2185,7 +2189,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( LLViewerInventoryCategory* cat; locateInventory(item, cat); if(!item || !item->isComplete()) return ACCEPT_NO; - LLVOAvatar* my_avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) ) { return ACCEPT_NO; @@ -2383,7 +2387,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( { // Don't wear anything until initial wearables are loaded, can // destroy clothing items. - if (!gAgent.areWearablesLoaded()) + if (!gAgentWearables.areWearablesLoaded()) { LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); return ACCEPT_NO; @@ -2478,7 +2482,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( { // Don't wear anything until initial wearables are loaded, can // destroy clothing items. - if (!gAgent.areWearablesLoaded()) + if (!gAgentWearables.areWearablesLoaded()) { LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); return ACCEPT_NO; @@ -2679,7 +2683,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( // cannot give away no-transfer objects return ACCEPT_NO; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if(avatar && avatar->isWearingAttachment( item->getUUID() ) ) { // You can't give objects that are attached to you @@ -2897,11 +2901,10 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory( } else if(mSource == SOURCE_NOTECARD) { - LLPreviewNotecard* card; - card = (LLPreviewNotecard*)LLPreview::find(mSourceID); - if(card) + LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance("preview_notecard", mSourceID); + if(preview) { - item = (LLViewerInventoryItem*)card->getDragItem(); + item = (LLViewerInventoryItem*)preview->getDragItem(); } } if(item) return item; diff --git a/indra/newview/lltoolface.cpp b/indra/newview/lltoolface.cpp index d06e41c771..b335d7125a 100644 --- a/indra/newview/lltoolface.cpp +++ b/indra/newview/lltoolface.cpp @@ -36,14 +36,13 @@ #include "lltoolface.h" // Library includes +#include "llfloaterreg.h" #include "v3math.h" // Viewer includes #include "llagent.h" -//#include "llbuildview.h" #include "llviewercontrol.h" #include "llselectmgr.h" -#include "lltoolview.h" #include "llviewerobject.h" #include "llviewerwindow.h" #include "llfloatertools.h" @@ -67,9 +66,7 @@ BOOL LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask) { // You should already have an object selected from the mousedown. // If so, show its properties - //gBuildView->showFacePanel(); - gFloaterTools->showPanel( LLFloaterTools::PANEL_FACE ); - //gBuildView->showMore(LLBuildView::PANEL_FACE); + LLFloaterReg::showInstance("build", "Texture"); return TRUE; } else diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 4e8274a6ef..ca78073575 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -54,7 +54,7 @@ #include "llviewercamera.h" #include "llviewerobject.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llmorphview.h" // Globals diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index d9811dac6c..409549a66b 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -61,7 +61,7 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" const S32 SLOP_DIST_SQ = 4; @@ -885,7 +885,7 @@ void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask) // Look for cursor against the edge of the screen // Only works in fullscreen - if (gSavedSettings.getBOOL("FullScreen")) + if (!gSavedSettings.getBOOL("NotFullScreen")) { if (gAgent.cameraThirdPerson() ) { diff --git a/indra/newview/lltoolgrab.h b/indra/newview/lltoolgrab.h index cf2405cafc..16ccb3f24f 100644 --- a/indra/newview/lltoolgrab.h +++ b/indra/newview/lltoolgrab.h @@ -36,7 +36,7 @@ #include "lltool.h" #include "v3math.h" #include "llquaternion.h" -#include "llmemory.h" +#include "llsingleton.h" #include "lluuid.h" #include "llviewerwindow.h" // for LLPickInfo diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index d21fd49647..72fd8b3bac 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -48,6 +48,9 @@ #include "lltoolmgr.h" #include "lltoolgrab.h" +// Linden library includes +#include "llwindow.h" // setMouseClipping() + LLToolGun::LLToolGun( LLToolComposite* composite ) : LLTool( std::string("gun"), composite ) { @@ -132,7 +135,7 @@ void LLToolGun::draw() { if( gSavedSettings.getBOOL("ShowCrosshairs") ) { - LLUIImagePtr crosshair = LLUI::getUIImage("UIImgCrosshairsUUID"); + LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga"); crosshair->draw( ( gViewerWindow->getWindowWidth() - crosshair->getWidth() ) / 2, ( gViewerWindow->getWindowHeight() - crosshair->getHeight() ) / 2); diff --git a/indra/newview/lltoolindividual.cpp b/indra/newview/lltoolindividual.cpp index 8382e0d72d..163c7cbd9b 100644 --- a/indra/newview/lltoolindividual.cpp +++ b/indra/newview/lltoolindividual.cpp @@ -41,6 +41,7 @@ #include "llviewerprecompiledheaders.h" #include "lltoolindividual.h" +#include "llfloaterreg.h" #include "llselectmgr.h" #include "llviewerobject.h" #include "llviewerwindow.h" @@ -93,9 +94,7 @@ BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask) { // You should already have an object selected from the mousedown. // If so, show its inventory. - //gBuildView->showInventoryPanel(); - //gBuildView->showPanel(LLBuildView::PANEL_CONTENTS); - gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); + LLFloaterReg::showInstance("build", "Content"); return TRUE; } else diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 5ba7217c99..e3ee209030 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -34,8 +34,13 @@ #include "lltoolmgr.h" -#include "lltool.h" +#include "lluictrl.h" +#include "llmenugl.h" +#include "llfloaterreg.h" + +#include "llfirstuse.h" // tools and manipulators +#include "lltool.h" #include "llmanipscale.h" #include "llselectmgr.h" #include "lltoolbrush.h" @@ -47,12 +52,14 @@ #include "lltoolindividual.h" #include "lltoolmorph.h" #include "lltoolpie.h" -#include "lltoolplacer.h" #include "lltoolselectland.h" #include "lltoolobjpicker.h" #include "lltoolpipette.h" #include "llagent.h" #include "llviewercontrol.h" +#include "llviewerjoystick.h" +#include "llviewermenu.h" +#include "llviewerparcelmgr.h" // Used when app not active to avoid processing hover. @@ -76,6 +83,11 @@ LLToolMgr::LLToolMgr() mSelectedTool( NULL ), mCurrentToolset( NULL ) { + // Not a panel, register these callbacks globally. + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this)); + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this)); + gToolNull = new LLTool(LLStringUtil::null); // Does nothing setCurrentTool(gToolNull); @@ -172,7 +184,7 @@ void LLToolMgr::setCurrentTool( LLTool* tool ) LLTool* LLToolMgr::getCurrentTool() { - MASK override_mask = gKeyboard->currentMask(TRUE); + MASK override_mask = gKeyboard ? gKeyboard->currentMask(TRUE) : 0; LLTool* cur_tool = NULL; // always use transient tools if available @@ -226,11 +238,77 @@ void LLToolMgr::updateToolStatus() getCurrentTool(); } -BOOL LLToolMgr::inEdit() +bool LLToolMgr::inEdit() { return mBaseTool != LLToolPie::getInstance() && mBaseTool != gToolNull; } +bool LLToolMgr::canEdit() +{ + return LLViewerParcelMgr::getInstance()->agentCanBuild(); +} + +void LLToolMgr::toggleBuildMode() +{ + if (inBuildMode()) + { + if (gSavedSettings.getBOOL("EditCameraMovement")) + { + // just reset the view, will pull us out of edit mode + handle_reset_view(); + } + else + { + // manually disable edit mode, but do not affect the camera + gAgent.resetView(false); + LLFloaterReg::hideInstance("build"); + gViewerWindow->showCursor(); + } + // avoid spurious avatar movements pulling out of edit mode + LLViewerJoystick::getInstance()->setNeedsReset(); + } + else + { + ECameraMode camMode = gAgent.getCameraMode(); + if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode) + { + // pull the user out of mouselook or appearance mode when entering build mode + handle_reset_view(); + } + + if (gSavedSettings.getBOOL("EditCameraMovement")) + { + // camera should be set + if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { + handle_toggle_flycam(); + } + + if (gAgent.getFocusOnAvatar()) + { + // zoom in if we're looking at the avatar + gAgent.setFocusOnAvatar(FALSE, ANIMATE); + gAgent.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis())); + gAgent.cameraZoomIn(0.666f); + gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); + } + } + + + setCurrentToolset(gBasicToolset); + getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); + + // Could be first use + LLFirstUse::useBuild(); + + gAgent.resetView(false); + + // avoid spurious avatar movements + LLViewerJoystick::getInstance()->setNeedsReset(); + + } +} + bool LLToolMgr::inBuildMode() { // when entering mouselook inEdit() immediately returns true before @@ -396,8 +474,6 @@ void LLToolset::selectPrevTool() } } -void select_tool( void *tool_pointer ) -{ - LLTool *tool = (LLTool *)tool_pointer; - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( tool ); -} +//////////////////////////////////////////////////////////////////////////// + + diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index 92647c99de..22aec97864 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -58,7 +58,9 @@ public: LLTool* getCurrentTool(); // returns active tool, taking into account keyboard state LLTool* getBaseTool(); // returns active tool when overrides are deactivated - BOOL inEdit(); + bool inEdit(); + bool canEdit(); + void toggleBuildMode(); /* Determines if we are in Build mode or not. */ bool inBuildMode(); @@ -115,10 +117,6 @@ protected: tool_list_t mToolList; }; -// Handy callbacks for switching tools -void select_tool(void *tool); - - // Globals extern LLToolset* gBasicToolset; diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 75e19645a6..af0d784a3e 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -56,13 +56,12 @@ #include "llsky.h" #include "lltexlayer.h" #include "lltoolmgr.h" -#include "lltoolview.h" #include "llui.h" #include "llviewercamera.h" #include "llviewerimagelist.h" #include "llviewerobject.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "pipeline.h" @@ -145,7 +144,7 @@ BOOL LLVisualParamHint::needsRender() void LLVisualParamHint::preRender(BOOL clear_depth) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); mLastParamWeight = avatarp->getVisualParamWeight(mVisualParam); avatarp->setVisualParamWeight(mVisualParam, mVisualParamWeight); @@ -292,7 +291,7 @@ BOOL LLVisualParamReset::render() { if (sDirty) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); avatarp->updateComposites(); avatarp->updateVisualParams(); avatarp->updateGeometry(avatarp->mDrawable); diff --git a/indra/newview/lltoolobjpicker.cpp b/indra/newview/lltoolobjpicker.cpp index d69688706f..b2088a8232 100644 --- a/indra/newview/lltoolobjpicker.cpp +++ b/indra/newview/lltoolobjpicker.cpp @@ -48,6 +48,7 @@ #include "llviewercamera.h" #include "llviewerwindow.h" #include "lldrawable.h" +#include "llrootview.h" LLToolObjPicker::LLToolObjPicker() @@ -62,7 +63,7 @@ LLToolObjPicker::LLToolObjPicker() // returns TRUE if an object was selected BOOL LLToolObjPicker::handleMouseDown(S32 x, S32 y, MASK mask) { - LLView* viewp = gViewerWindow->getRootView(); + LLRootView* viewp = gViewerWindow->getRootView(); BOOL handled = viewp->handleMouseDown(x, y, mask); mHitObjectID.setNull(); @@ -131,7 +132,7 @@ BOOL LLToolObjPicker::handleHover(S32 x, S32 y, MASK mask) cursor = UI_CURSOR_TOOLPICKOBJECT3; - gViewerWindow->getWindow()->setCursor(cursor); + gViewerWindow->setCursor(cursor); } return handled; } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 986555db49..a6dcebc3b5 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -63,7 +63,7 @@ #include "llviewerparcelmgr.h" #include "llviewerwindow.h" #include "llviewermedia.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" #include "llui.h" #include "llweb.h" @@ -79,7 +79,6 @@ static ECursorType cursor_from_parcel_media(U8 click_action); LLToolPie::LLToolPie() : LLTool(std::string("Select")), - mPieMouseButtonDown( FALSE ), mGrabMouseButtonDown( FALSE ), mMouseOutsideSlop( FALSE ), mClickAction(0) @@ -98,32 +97,35 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask) void LLToolPie::leftMouseCallback(const LLPickInfo& pick_info) { LLToolPie::getInstance()->mPick = pick_info; - LLToolPie::getInstance()->pickAndShowMenu(FALSE); + LLToolPie::getInstance()->pickLeftMouseDownCallback(); } BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) { - // don't pick transparent so users can't "pay" transparent objects - gViewerWindow->pickAsync(x, y, mask, rightMouseCallback, FALSE, TRUE); - mPieMouseButtonDown = TRUE; - // don't steal focus from UI return FALSE; } +BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) +{ + LLToolMgr::getInstance()->clearTransientTool(); + gViewerWindow->pickAsync(x, y, mask, rightMouseCallback, FALSE, TRUE); + return LLTool::handleRightMouseUp(x, y, mask); +} + // static void LLToolPie::rightMouseCallback(const LLPickInfo& pick_info) { LLToolPie::getInstance()->mPick = pick_info; - LLToolPie::getInstance()->pickAndShowMenu(TRUE); + LLToolPie::getInstance()->pickRightMouseUpCallback(); } // True if you selected an object. -BOOL LLToolPie::pickAndShowMenu(BOOL always_show) +BOOL LLToolPie::pickLeftMouseDownCallback() { S32 x = mPick.mMousePt.mX; S32 y = mPick.mMousePt.mY; MASK mask = mPick.mKeyMask; - if (!always_show && mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL) + if (mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel(); if (parcel) @@ -164,7 +166,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) || (parent && parent->flagHandleTouch()); // If it's a left-click, and we have a special action, do it. - if (useClickAction(always_show, mask, object, parent)) + if (useClickAction(mask, object, parent)) { mClickAction = 0; if (object && object->getClickAction()) @@ -240,8 +242,8 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // Switch to grab tool if physical or triggerable if (object && !object->isAvatar() && - ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) && - !always_show) + ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) + ) { gGrabTransientTool = this; LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); @@ -256,8 +258,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // If left-click never selects or spawns a menu // Eat the event. - if (!gSavedSettings.getBOOL("LeftClickShowMenu") - && !always_show) + if (!gSavedSettings.getBOOL("LeftClickShowMenu")) { // mouse already released if (!mGrabMouseButtonDown) @@ -292,7 +293,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) return LLTool::handleMouseDown(x, y, mask); } - if (!always_show && gAgent.leftButtonGrabbed()) + if (gAgent.leftButtonGrabbed()) { // if the left button is grabbed, don't put up the pie menu return LLTool::handleMouseDown(x, y, mask); @@ -302,116 +303,15 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); // Spawn pie menu - if (mPick.mPickType == LLPickInfo::PICK_LAND) - { - LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal ); - gMenuHolder->setParcelSelection(selection); - gPieLand->show(x, y, mPieMouseButtonDown); - - // VEFFECT: ShowPie - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); - effectp->setPositionGlobal(mPick.mPosGlobal); - effectp->setColor(LLColor4U(gAgent.getEffectColor())); - effectp->setDuration(0.25f); - } - else if (mPick.mObjectID == gAgent.getID() ) - { - if(!gPieSelf) - { - //either at very early startup stage or at late quitting stage, - //this event is ignored. - return TRUE ; - } - - gPieSelf->show(x, y, mPieMouseButtonDown); - } - else if (object) - { - gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); - - if (object->isAvatar() - || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) - { - // Find the attachment's avatar - while( object && object->isAttachment()) - { - object = (LLViewerObject*)object->getParent(); - } - - // Object is an avatar, so check for mute by id. - LLVOAvatar* avatar = (LLVOAvatar*)object; - std::string name = avatar->getFullname(); - if (LLMuteList::getInstance()->isMuted(avatar->getID(), name)) - { - gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate - //gMutePieMenu->setLabel("Unmute"); - } - else - { - gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate - //gMutePieMenu->setLabel("Mute"); - } - - gPieAvatar->show(x, y, mPieMouseButtonDown); - } - else if (object->isAttachment()) - { - gPieAttachment->show(x, y, mPieMouseButtonDown); - } - else - { - // BUG: What about chatting child objects? - std::string name; - LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); - if (node) - { - name = node->mName; - } - if (LLMuteList::getInstance()->isMuted(object->getID(), name)) - { - gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate - //gMuteObjectPieMenu->setLabel("Unmute"); - } - else - { - gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate - //gMuteObjectPieMenu->setLabel("Mute"); - } - - gPieObject->show(x, y, mPieMouseButtonDown); - - // VEFFECT: ShowPie object - // Don't show when you click on someone else, it freaks them - // out. - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); - effectp->setPositionGlobal(mPick.mPosGlobal); - effectp->setColor(LLColor4U(gAgent.getEffectColor())); - effectp->setDuration(0.25f); - } - } - - if (always_show) - { - // ignore return value - LLTool::handleRightMouseDown(x, y, mask); - } - else - { - // ignore return value - LLTool::handleMouseDown(x, y, mask); - } - - // We handled the event. + LLTool::handleRightMouseDown(x, y, mask); return TRUE; } -BOOL LLToolPie::useClickAction(BOOL always_show, - MASK mask, +BOOL LLToolPie::useClickAction(MASK mask, LLViewerObject* object, LLViewerObject* parent) { - return !always_show - && mask == MASK_NONE + return mask == MASK_NONE && object && !object->isAttachment() && LLPrimitive::isPrimitive(object->getPCode()) @@ -567,27 +467,27 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) parent = object->getRootEdit(); } - if (object && useClickAction(FALSE, mask, object, parent)) + if (object && useClickAction(mask, object, parent)) { ECursorType cursor = cursor_from_object(object); - gViewerWindow->getWindow()->setCursor(cursor); + gViewerWindow->setCursor(cursor); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } else if ((object && !object->isAvatar() && object->usePhysics()) || (parent && !parent->isAvatar() && parent->usePhysics())) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLGRAB); + gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } else if ( (object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_HAND); + gViewerWindow->setCursor(UI_CURSOR_HAND); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } else { - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; } @@ -610,7 +510,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) // the world. Keep the cursor an arrow, assuming that // after the user moves off the UI, they won't be on the // same object anymore. - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); // Make sure the hover-picked object is ignored. gHoverView->resetLastHoverObject(); break; @@ -624,13 +524,6 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) return LLTool::handleMouseUp(x, y, mask); } -BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask) -{ - mPieMouseButtonDown = FALSE; - LLToolMgr::getInstance()->clearTransientTool(); - return LLTool::handleRightMouseUp(x, y, mask); -} - BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) { @@ -832,3 +725,116 @@ static ECursorType cursor_from_parcel_media(U8 click_action) return UI_CURSOR_TOOLPLAY; } } + + +// True if you selected an object. +BOOL LLToolPie::pickRightMouseUpCallback() +{ + S32 x = mPick.mMousePt.mX; + S32 y = mPick.mMousePt.mY; + MASK mask = mPick.mKeyMask; + + if (mPick.mPickType != LLPickInfo::PICK_LAND) + { + LLViewerParcelMgr::getInstance()->deselectLand(); + } + + // didn't click in any UI object, so must have clicked in the world + LLViewerObject *object = mPick.getObject(); + LLViewerObject *parent = NULL; + if(object) + parent = object->getRootEdit(); + + // Can't ignore children here. + LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE); + + // Spawn pie menu + if (mPick.mPickType == LLPickInfo::PICK_LAND) + { + LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal ); + gMenuHolder->setParcelSelection(selection); + gPieLand->show(x, y); + + showVisualContextMenuEffect(); + + } + else if (mPick.mObjectID == gAgent.getID() ) + { + if(!gPieSelf) + { + //either at very early startup stage or at late quitting stage, + //this event is ignored. + return TRUE ; + } + + gPieSelf->show(x, y); + } + else if (object) + { + gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); + + if (object->isAvatar() + || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner())) + { + // Find the attachment's avatar + while( object && object->isAttachment()) + { + object = (LLViewerObject*)object->getParent(); + } + + // Object is an avatar, so check for mute by id. + LLVOAvatar* avatar = (LLVOAvatar*)object; + std::string name = avatar->getFullname(); + if (LLMuteList::getInstance()->isMuted(avatar->getID(), avatar->getFullname())) + { + gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate + } + else + { + gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate + } + + gPieAvatar->show(x, y); + } + else if (object->isAttachment()) + { + gPieAttachment->show(x, y); + } + else + { + // BUG: What about chatting child objects? + std::string name; + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); + if (node) + { + name = node->mName; + } + if (LLMuteList::getInstance()->isMuted(object->getID(), name)) + { + gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate + } + else + { + gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate + } + + gPieObject->show(x, y); + + showVisualContextMenuEffect(); + } + } + + LLTool::handleRightMouseUp(x, y, mask); + // We handled the event. + return TRUE; +} + +void LLToolPie::showVisualContextMenuEffect() +{ + // VEFFECT: ShowPie + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); + effectp->setPositionGlobal(mPick.mPosGlobal); + effectp->setColor(LLColor4U(gAgent.getEffectColor())); + effectp->setDuration(0.25f); + +} diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 83df03cda2..82de2b363e 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -73,13 +73,13 @@ public: private: - BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); - BOOL pickAndShowMenu(BOOL edit_menu); - BOOL useClickAction(BOOL always_show, MASK mask, LLViewerObject* object, - LLViewerObject* parent); + BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y); + BOOL pickLeftMouseDownCallback(); + BOOL pickRightMouseUpCallback(); + BOOL useClickAction (MASK mask, LLViewerObject* object,LLViewerObject* parent); + void showVisualContextMenuEffect(); private: - BOOL mPieMouseButtonDown; BOOL mGrabMouseButtonDown; BOOL mMouseOutsideSlop; // for this drag, has mouse moved outside slop region LLPickInfo mPick; diff --git a/indra/newview/lltoolpipette.cpp b/indra/newview/lltoolpipette.cpp index 9d95ccc06f..878ed0f9a9 100644 --- a/indra/newview/lltoolpipette.cpp +++ b/indra/newview/lltoolpipette.cpp @@ -55,8 +55,6 @@ LLToolPipette::LLToolPipette() : LLTool(std::string("Pipette")), mSuccess(TRUE) { - mSelectCallback = NULL; - mUserData = NULL; } @@ -106,6 +104,15 @@ BOOL LLToolPipette::handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky return TRUE; } +void LLToolPipette::setTextureEntry(const LLTextureEntry* entry) +{ + if (entry) + { + mTextureEntry = *entry; + mSignal(mTextureEntry); + } +} + void LLToolPipette::pickCallback(const LLPickInfo& pick_info) { LLViewerObject* hit_obj = pick_info.getObject(); @@ -118,20 +125,11 @@ void LLToolPipette::pickCallback(const LLPickInfo& pick_info) { //TODO: this should highlight the selected face only LLSelectMgr::getInstance()->highlightObjectOnly(hit_obj); - LLToolPipette::getInstance()->mTextureEntry = *hit_obj->getTE(pick_info.mObjectFace); - if (LLToolPipette::getInstance()->mSelectCallback) - { - LLToolPipette::getInstance()->mSelectCallback(LLToolPipette::getInstance()->mTextureEntry, LLToolPipette::getInstance()->mUserData); - } + const LLTextureEntry* entry = hit_obj->getTE(pick_info.mObjectFace); + LLToolPipette::getInstance()->setTextureEntry(entry); } } -void LLToolPipette::setSelectCallback(select_callback callback, void* user_data) -{ - mSelectCallback = callback; - mUserData = user_data; -} - void LLToolPipette::setResult(BOOL success, const std::string& msg) { mTooltipMsg = msg; diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index 54c24e9467..fcccafe1a4 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -40,6 +40,8 @@ #include "lltool.h" #include "lltextureentry.h" +#include +#include class LLViewerObject; class LLPickInfo; @@ -56,18 +58,19 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen); - typedef void (*select_callback)(const LLTextureEntry& te, void *data); - void setSelectCallback(select_callback callback, void* user_data); + // Note: Don't return connection; use boost::bind + boost::signal::trackable to disconnect slots + typedef boost::signal signal_t; + void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); } void setResult(BOOL success, const std::string& msg); - + + void setTextureEntry(const LLTextureEntry* entry); static void pickCallback(const LLPickInfo& pick_info); protected: LLTextureEntry mTextureEntry; - select_callback mSelectCallback; + signal_t mSignal; BOOL mSuccess; std::string mTooltipMsg; - void* mUserData; }; #endif //LL_LLTOOLPIPETTE_H diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 88fddd9336..607818305e 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -35,9 +35,6 @@ // self header #include "lltoolplacer.h" -// linden library headers -#include "llprimitive.h" - // viewer headers #include "llbutton.h" #include "llviewercontrol.h" @@ -65,13 +62,17 @@ #include "llviewercamera.h" #include "llviewerstats.h" +// linden library headers +#include "llprimitive.h" +#include "llwindow.h" // incBusyCount() + const LLVector3 DEFAULT_OBJECT_SCALE(0.5f, 0.5f, 0.5f); //static LLPCode LLToolPlacer::sObjectType = LL_PCODE_CUBE; LLToolPlacer::LLToolPlacer() -: LLTool( std::string("Create") ) +: LLTool( "Create" ) { } @@ -521,7 +522,7 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) BOOL LLToolPlacer::handleHover(S32 x, S32 y, MASK mask) { lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPlacer" << llendl; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLCREATE); + gViewerWindow->setCursor(UI_CURSOR_TOOLCREATE); return TRUE; } @@ -534,92 +535,3 @@ void LLToolPlacer::handleDeselect() { } -////////////////////////////////////////////////////// -// LLToolPlacerPanel - -// static -LLPCode LLToolPlacerPanel::sCube = LL_PCODE_CUBE; -LLPCode LLToolPlacerPanel::sPrism = LL_PCODE_PRISM; -LLPCode LLToolPlacerPanel::sPyramid = LL_PCODE_PYRAMID; -LLPCode LLToolPlacerPanel::sTetrahedron = LL_PCODE_TETRAHEDRON; -LLPCode LLToolPlacerPanel::sCylinder = LL_PCODE_CYLINDER; -LLPCode LLToolPlacerPanel::sCylinderHemi= LL_PCODE_CYLINDER_HEMI; -LLPCode LLToolPlacerPanel::sCone = LL_PCODE_CONE; -LLPCode LLToolPlacerPanel::sConeHemi = LL_PCODE_CONE_HEMI; -LLPCode LLToolPlacerPanel::sTorus = LL_PCODE_TORUS; -LLPCode LLToolPlacerPanel::sSquareTorus = LLViewerObject::LL_VO_SQUARE_TORUS; -LLPCode LLToolPlacerPanel::sTriangleTorus = LLViewerObject::LL_VO_TRIANGLE_TORUS; -LLPCode LLToolPlacerPanel::sSphere = LL_PCODE_SPHERE; -LLPCode LLToolPlacerPanel::sSphereHemi = LL_PCODE_SPHERE_HEMI; -LLPCode LLToolPlacerPanel::sTree = LL_PCODE_LEGACY_TREE; -LLPCode LLToolPlacerPanel::sGrass = LL_PCODE_LEGACY_GRASS; - -S32 LLToolPlacerPanel::sButtonsAdded = 0; -LLButton* LLToolPlacerPanel::sButtons[ TOOL_PLACER_NUM_BUTTONS ]; - -LLToolPlacerPanel::LLToolPlacerPanel(const std::string& name, const LLRect& rect) - : - LLPanel( name, rect ) -{ - /* DEPRECATED - JC - addButton( "UIImgCubeUUID", "UIImgCubeSelectedUUID", &LLToolPlacerPanel::sCube ); - addButton( "UIImgPrismUUID", "UIImgPrismSelectedUUID", &LLToolPlacerPanel::sPrism ); - addButton( "UIImgPyramidUUID", "UIImgPyramidSelectedUUID", &LLToolPlacerPanel::sPyramid ); - addButton( "UIImgTetrahedronUUID", "UIImgTetrahedronSelectedUUID", &LLToolPlacerPanel::sTetrahedron ); - addButton( "UIImgCylinderUUID", "UIImgCylinderSelectedUUID", &LLToolPlacerPanel::sCylinder ); - addButton( "UIImgHalfCylinderUUID", "UIImgHalfCylinderSelectedUUID",&LLToolPlacerPanel::sCylinderHemi ); - addButton( "UIImgConeUUID", "UIImgConeSelectedUUID", &LLToolPlacerPanel::sCone ); - addButton( "UIImgHalfConeUUID", "UIImgHalfConeSelectedUUID", &LLToolPlacerPanel::sConeHemi ); - addButton( "UIImgSphereUUID", "UIImgSphereSelectedUUID", &LLToolPlacerPanel::sSphere ); - addButton( "UIImgHalfSphereUUID", "UIImgHalfSphereSelectedUUID", &LLToolPlacerPanel::sSphereHemi ); - addButton( "UIImgTreeUUID", "UIImgTreeSelectedUUID", &LLToolPlacerPanel::sTree ); - addButton( "UIImgGrassUUID", "UIImgGrassSelectedUUID", &LLToolPlacerPanel::sGrass ); - addButton( "ObjectTorusImageID", "ObjectTorusActiveImageID", &LLToolPlacerPanel::sTorus ); - addButton( "ObjectTubeImageID", "ObjectTubeActiveImageID", &LLToolPlacerPanel::sSquareTorus ); - */ -} - -void LLToolPlacerPanel::addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ) -{ - const S32 TOOL_SIZE = 32; - const S32 HORIZ_SPACING = TOOL_SIZE + 5; - const S32 VERT_SPACING = TOOL_SIZE + 5; - const S32 VPAD = 10; - const S32 HPAD = 7; - - S32 row = sButtonsAdded / 4; - S32 column = sButtonsAdded % 4; - - LLRect help_rect = gSavedSettings.getRect("ToolHelpRect"); - - // Build the rectangle, recalling the origin is at lower left - // and we want the icons to build down from the top. - LLRect rect; - rect.setLeftTopAndSize( - HPAD + (column * HORIZ_SPACING), - help_rect.mBottom - VPAD - (row * VERT_SPACING), - TOOL_SIZE, - TOOL_SIZE ); - - LLButton* btn = new LLButton( - std::string("ToolPlacerOptBtn"), - rect, - up_state, - down_state, - LLStringUtil::null, &LLToolPlacerPanel::setObjectType, - pcode, - LLFontGL::getFontSansSerif()); - btn->setFollowsBottom(); - btn->setFollowsLeft(); - addChild(btn); - - sButtons[sButtonsAdded] = btn; - sButtonsAdded++; -} - -// static -void LLToolPlacerPanel::setObjectType( void* data ) -{ - LLPCode pcode = *(LLPCode*) data; - LLToolPlacer::setObjectType( pcode ); -} diff --git a/indra/newview/lltoolplacer.h b/indra/newview/lltoolplacer.h index d478f7b1c2..b7422380d4 100644 --- a/indra/newview/lltoolplacer.h +++ b/indra/newview/lltoolplacer.h @@ -67,43 +67,4 @@ private: BOOL addDuplicate(S32 x, S32 y); }; -//////////////////////////////////////////////////// -// LLToolPlacerPanel - - -const S32 TOOL_PLACER_NUM_BUTTONS = 14; - - -class LLToolPlacerPanel : public LLPanel -{ -public: - - LLToolPlacerPanel(const std::string& name, const LLRect& rect); - - static void setObjectType( void* data ); - - static LLPCode sCube; - static LLPCode sPrism; - static LLPCode sPyramid; - static LLPCode sTetrahedron; - static LLPCode sCylinder; - static LLPCode sCylinderHemi; - static LLPCode sCone; - static LLPCode sConeHemi; - static LLPCode sTorus; - static LLPCode sSquareTorus; - static LLPCode sTriangleTorus; - static LLPCode sSphere; - static LLPCode sSphereHemi; - static LLPCode sTree; - static LLPCode sGrass; - -private: - void addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ); - -private: - static S32 sButtonsAdded; - static LLButton* sButtons[ TOOL_PLACER_NUM_BUTTONS ]; -}; - #endif diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 80e99174c7..97e2865179 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -48,11 +48,11 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llworld.h" // Globals -extern BOOL gAllowSelectAvatar; +//extern BOOL gAllowSelectAvatar; const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; @@ -87,7 +87,7 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); // *NOTE: These settings must be cleaned up at bottom of function. - if (temp_select || gAllowSelectAvatar) + if (temp_select || LLSelectMgr::getInstance()->mAllowSelectAvatar) { gSavedSettings.setBOOL("SelectOwnedOnly", FALSE); gSavedSettings.setBOOL("SelectMovableOnly", FALSE); @@ -217,7 +217,7 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi } //if(!object) // Cleanup temp select settings above. - if (temp_select || gAllowSelectAvatar) + if (temp_select ||LLSelectMgr::getInstance()->mAllowSelectAvatar) { gSavedSettings.setBOOL("SelectOwnedOnly", select_owned); gSavedSettings.setBOOL("SelectMovableOnly", select_movable); diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index 91223904b7..07c996a84f 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -43,7 +43,6 @@ #include "llfloatertools.h" #include "llselectmgr.h" #include "llstatusbar.h" -#include "lltoolview.h" #include "llviewerparcelmgr.h" #include "llviewerwindow.h" @@ -177,13 +176,13 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) roundXY(mEastNorthTop); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, land)" << llendl; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); } else { mDragEndValid = FALSE; lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, no land)" << llendl; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_NO); + gViewerWindow->setCursor(UI_CURSOR_NO); } mDragEndX = x; @@ -192,13 +191,13 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) else { lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, in slop)" << llendl; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); } } else { lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (inactive)" << llendl; - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); } return TRUE; diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp index d544bff992..f87d1480d7 100644 --- a/indra/newview/lltoolselectrect.cpp +++ b/indra/newview/lltoolselectrect.cpp @@ -44,7 +44,6 @@ #include "llviewercontrol.h" #include "llui.h" #include "llselectmgr.h" -#include "lltoolview.h" #include "lltoolmgr.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" @@ -159,7 +158,7 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (inactive)" << llendl; } - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); + gViewerWindow->setCursor(UI_CURSOR_ARROW); return TRUE; } diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp index 9f6a77d245..f8393ebc47 100644 --- a/indra/newview/lltoolview.cpp +++ b/indra/newview/lltoolview.cpp @@ -65,9 +65,9 @@ LLToolContainer::~LLToolContainer() LLToolView::LLToolView(const std::string& name, const LLRect& rect) -: LLView(name, rect, MOUSE_OPAQUE), - mButtonCount(0) +: mButtonCount(0) { + LLView::init(LLView::Params().name(name).rect(rect).mouse_opaque(true)); } diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index d54cc798d2..8e4f637832 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -39,7 +39,7 @@ #include "llgl.h" #include "llrender.h" #include "llinventory.h" -#include "llmemory.h" +#include "llpointer.h" #include "llstring.h" #include "lluuid.h" #include "v3math.h" @@ -51,7 +51,6 @@ #include "lltracker.h" #include "llagent.h" #include "llcallingcard.h" -#include "llcolorscheme.h" #include "llfloaterworldmap.h" #include "llhudtext.h" #include "llhudview.h" @@ -113,12 +112,14 @@ void LLTracker::stopTracking(void* userdata) // static virtual void LLTracker::drawHUDArrow() { + static LLCachedControl map_track_color(gSavedSkinSettings, "MapTrackColor", LLColor4::white); + /* tracking autopilot destination has been disabled -- 2004.01.09, Leviathan // Draw dot for autopilot target if (gAgent.getAutoPilot()) { - instance()->drawMarker( gAgent.getAutoPilotTargetGlobal(), gTrackColor ); + instance()->drawMarker( gAgent.getAutoPilotTargetGlobal(), map_track_color ); return; } */ @@ -128,12 +129,12 @@ void LLTracker::drawHUDArrow() // Tracked avatar if(LLAvatarTracker::instance().haveTrackingInfo()) { - instance()->drawMarker( LLAvatarTracker::instance().getGlobalPos(), gTrackColor ); + instance()->drawMarker( LLAvatarTracker::instance().getGlobalPos(), map_track_color ); } break; case TRACKING_LANDMARK: - instance()->drawMarker( getTrackedPositionGlobal(), gTrackColor ); + instance()->drawMarker( getTrackedPositionGlobal(), map_track_color ); break; case TRACKING_LOCATION: @@ -145,7 +146,7 @@ void LLTracker::drawHUDArrow() + 0.1f * (LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f); #endif instance()->mTrackedPositionGlobal.mdV[VZ] = llclamp((F32)instance()->mTrackedPositionGlobal.mdV[VZ], LLWorld::getInstance()->resolveLandHeightGlobal(getTrackedPositionGlobal()) + 1.5f, (F32)instance()->getTrackedPositionGlobal().mdV[VZ]); - instance()->drawMarker( getTrackedPositionGlobal(), gTrackColor ); + instance()->drawMarker( getTrackedPositionGlobal(), map_track_color ); break; default: @@ -161,7 +162,9 @@ void LLTracker::render3D() { return; } - + + static LLCachedControl map_track_color(gSavedSkinSettings, "MapTrackColor", LLColor4::white); + // Arbitary location beacon if( instance()->mIsTrackingLocation ) { @@ -181,7 +184,7 @@ void LLTracker::render3D() } else { - renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, + renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, instance()->mBeaconText, instance()->mTrackedLocationName ); } } @@ -223,7 +226,7 @@ void LLTracker::render3D() // and back again instance()->mHasReachedLandmark = FALSE; } - renderBeacon( instance()->mTrackedPositionGlobal, gTrackColor, + renderBeacon( instance()->mTrackedPositionGlobal, map_track_color, instance()->mBeaconText, instance()->mTrackedLandmarkName ); } } @@ -252,7 +255,7 @@ void LLTracker::render3D() } else { - renderBeacon( av_tracker.getGlobalPos(), gTrackColor, + renderBeacon( av_tracker.getGlobalPos(), map_track_color, instance()->mBeaconText, av_tracker.getName() ); } } diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index 2850365272..bfe9d6c6b5 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -40,7 +40,7 @@ #define LL_LLTRACKER_H #include "lldarray.h" -#include "llmemory.h" +#include "llpointer.h" #include "llstring.h" #include "lluuid.h" #include "v3dmath.h" diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index 7f63972c8d..f5160fd26c 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -41,6 +41,7 @@ #include "llkeyboard.h" #include "llfocusmgr.h" #include "llviewercontrol.h" +#include "llrootview.h" // static LLUploadDialog* LLUploadDialog::sDialog = NULL; @@ -64,8 +65,7 @@ void LLUploadDialog::modalUploadFinished() // Private methods LLUploadDialog::LLUploadDialog( const std::string& msg) - : - LLPanel( std::string("Uploading..."), LLRect(0,100,100,0) ) // dummy rect. Will reshape below. + : LLPanel() { setBackgroundVisible( TRUE ); @@ -75,11 +75,16 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) } LLUploadDialog::sDialog = this; - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLFontGL::getFontSansSerif(); LLRect msg_rect; for (int line_num=0; line_num<16; ++line_num) { - mLabelBox[line_num] = new LLTextBox( std::string("Filename"), msg_rect, std::string("Filename"), font ); + LLTextBox::Params params; + params.name("Filename"); + params.rect(msg_rect); + params.text("Filename"); + params.font(font); + mLabelBox[line_num] = LLUICtrlFactory::create (params); addChild(mLabelBox[line_num]); } @@ -91,7 +96,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) void LLUploadDialog::setMessage( const std::string& msg) { - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLFontGL::getFontSansSerif(); const S32 VPAD = 16; const S32 HPAD = 25; @@ -139,7 +144,7 @@ void LLUploadDialog::setMessage( const std::string& msg) msg_rect.setOriginAndSize( msg_x, msg_y, max_msg_width, line_height ); mLabelBox[line_num]->setRect(msg_rect); mLabelBox[line_num]->setText(cur_line); - mLabelBox[line_num]->setColor( gColors.getColor( "LabelTextColor" ) ); + mLabelBox[line_num]->setColor( gSavedSkinSettings.getColor( "LabelTextColor" ) ); mLabelBox[line_num]->setVisible(TRUE); msg_y -= line_height; ++line_num; diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 85ab44bc13..6c8e7e1f69 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -42,6 +42,7 @@ #include "llfloaterworldmap.h" #include "llfloaterhtmlhelp.h" #include "llpanellogin.h" +#include "llslurl.h" #include "llstartup.h" // gStartupState #include "llurlsimstring.h" #include "llweb.h" @@ -50,20 +51,9 @@ // library includes #include "llsd.h" -const std::string SLURL_SL_HELP_PREFIX = "secondlife://app."; -const std::string SLURL_SL_PREFIX = "sl://"; -const std::string SLURL_SECONDLIFE_PREFIX = "secondlife://"; -const std::string SLURL_SLURL_PREFIX = "http://slurl.com/secondlife/"; - -const std::string SLURL_APP_TOKEN = "app/"; - class LLURLDispatcherImpl { public: - static bool isSLURL(const std::string& url); - - static bool isSLURLCommand(const std::string& url); - static bool dispatch(const std::string& url, LLWebBrowserCtrl* web, bool trusted_browser); @@ -104,35 +94,9 @@ private: // Called by LLWorldMap when a region name has been resolved to a // location in-world, used by places-panel display. - static bool matchPrefix(const std::string& url, const std::string& prefix); - - static std::string stripProtocol(const std::string& url); - friend class LLTeleportHandler; }; -// static -bool LLURLDispatcherImpl::isSLURL(const std::string& url) -{ - if (matchPrefix(url, SLURL_SL_HELP_PREFIX)) return true; - if (matchPrefix(url, SLURL_SL_PREFIX)) return true; - if (matchPrefix(url, SLURL_SECONDLIFE_PREFIX)) return true; - if (matchPrefix(url, SLURL_SLURL_PREFIX)) return true; - return false; -} - -// static -bool LLURLDispatcherImpl::isSLURLCommand(const std::string& url) -{ - if (matchPrefix(url, SLURL_SL_PREFIX + SLURL_APP_TOKEN) - || matchPrefix(url, SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN) - || matchPrefix(url, SLURL_SLURL_PREFIX + SLURL_APP_TOKEN) ) - { - return true; - } - return false; -} - // static bool LLURLDispatcherImpl::dispatchCore(const std::string& url, bool right_mouse, @@ -178,7 +142,7 @@ bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url) bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, bool right_mouse) { #if LL_LIBXUL_ENABLED - if (matchPrefix(url, SLURL_SL_HELP_PREFIX)) + if (LLSLURL::isURLHelp(url)) { gViewerHtmlHelp.show(); return true; @@ -193,7 +157,7 @@ bool LLURLDispatcherImpl::dispatchApp(const std::string& url, LLWebBrowserCtrl* web, bool trusted_browser) { - if (!isSLURL(url)) + if (!LLSLURL::isSLURL(url)) { return false; } @@ -211,7 +175,7 @@ bool LLURLDispatcherImpl::dispatchApp(const std::string& url, // static bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mouse) { - if (!isSLURL(url)) + if (!LLSLURL::isSLURL(url)) { return false; } @@ -230,7 +194,7 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mous return true; } - std::string sim_string = stripProtocol(url); + std::string sim_string = LLSLURL::stripProtocol(url); std::string region_name; S32 x = 128; S32 y = 128; @@ -251,7 +215,7 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mous /*static*/ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport) { - std::string sim_string = stripProtocol(url); + std::string sim_string = LLSLURL::stripProtocol(url); std::string region_name; S32 x = 128; S32 y = 128; @@ -289,7 +253,7 @@ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::strin /* static */ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport) { - std::string sim_string = stripProtocol(url); + std::string sim_string = LLSLURL::stripProtocol(url); std::string region_name; S32 x = 128; S32 y = 128; @@ -316,10 +280,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str LLVector3d global_pos = from_region_handle(region_handle); global_pos += LLVector3d(local_pos); gAgent.teleportViaLocation(global_pos); - if(gFloaterWorldMap) - { - gFloaterWorldMap->trackLocation(global_pos); - } + LLFloaterWorldMap::getInstance()->trackLocation(global_pos); } else { @@ -337,37 +298,6 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str } } -// static -bool LLURLDispatcherImpl::matchPrefix(const std::string& url, const std::string& prefix) -{ - std::string test_prefix = url.substr(0, prefix.length()); - LLStringUtil::toLower(test_prefix); - return test_prefix == prefix; -} - -// static -std::string LLURLDispatcherImpl::stripProtocol(const std::string& url) -{ - std::string stripped = url; - if (matchPrefix(stripped, SLURL_SL_HELP_PREFIX)) - { - stripped.erase(0, SLURL_SL_HELP_PREFIX.length()); - } - else if (matchPrefix(stripped, SLURL_SL_PREFIX)) - { - stripped.erase(0, SLURL_SL_PREFIX.length()); - } - else if (matchPrefix(stripped, SLURL_SECONDLIFE_PREFIX)) - { - stripped.erase(0, SLURL_SECONDLIFE_PREFIX.length()); - } - else if (matchPrefix(stripped, SLURL_SLURL_PREFIX)) - { - stripped.erase(0, SLURL_SLURL_PREFIX.length()); - } - return stripped; -} - //--------------------------------------------------------------------------- // Teleportation links are handled here because they are tightly coupled // to URL parsing and sim-fragment parsing @@ -390,7 +320,7 @@ public: std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]); // build secondlife://De%20Haro/123/45/67 for use in callback - std::string url = SLURL_SECONDLIFE_PREFIX; + std::string url = LLSLURL::PREFIX_SECONDLIFE; for (int i = 0; i < tokens.size(); ++i) { url += tokens[i].asString() + "/"; @@ -406,18 +336,6 @@ LLTeleportHandler gTeleportHandler; //--------------------------------------------------------------------------- -// static -bool LLURLDispatcher::isSLURL(const std::string& url) -{ - return LLURLDispatcherImpl::isSLURL(url); -} - -// static -bool LLURLDispatcher::isSLURLCommand(const std::string& url) -{ - return LLURLDispatcherImpl::isSLURLCommand(url); -} - // static bool LLURLDispatcher::dispatch(const std::string& url, LLWebBrowserCtrl* web, @@ -445,12 +363,3 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url) LLWebBrowserCtrl* web = NULL; return LLURLDispatcherImpl::dispatch(url, web, trusted_browser); } - -// static -std::string LLURLDispatcher::buildSLURL(const std::string& regionname, - S32 x, S32 y, S32 z) -{ - std::string slurl = SLURL_SLURL_PREFIX + regionname + llformat("/%d/%d/%d",x,y,z); - slurl = LLWeb::escapeURL( slurl ); - return slurl; -} diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h index a4f6866a07..15e3ec73d8 100644 --- a/indra/newview/llurldispatcher.h +++ b/indra/newview/llurldispatcher.h @@ -38,12 +38,6 @@ class LLWebBrowserCtrl; class LLURLDispatcher { public: - static bool isSLURL(const std::string& url); - // Is this any sort of secondlife:// or sl:// URL? - - static bool isSLURLCommand(const std::string& url); - // Is this a special secondlife://app/ URL? - static bool dispatch(const std::string& url, LLWebBrowserCtrl* web, bool trusted_browser); @@ -63,9 +57,6 @@ public: static bool dispatchRightClick(const std::string& url); static bool dispatchFromTextEditor(const std::string& url); - - static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z); - // builds: http://slurl.com/secondlife/RegionName/x/y/z/ }; #endif diff --git a/indra/newview/llviewchildren.cpp b/indra/newview/llviewchildren.cpp index 1a66b24891..842ffc7f9a 100644 --- a/indra/newview/llviewchildren.cpp +++ b/indra/newview/llviewchildren.cpp @@ -94,10 +94,10 @@ void LLViewChildren::setBadge(const std::string& id, Badge badge, bool visible) switch (badge) { default: - case BADGE_OK: child->setImage(std::string("badge_ok.j2c")); break; - case BADGE_NOTE: child->setImage(std::string("badge_note.j2c")); break; - case BADGE_WARN: child->setImage(std::string("badge_warn.j2c")); break; - case BADGE_ERROR: child->setImage(std::string("badge_error.j2c")); break; + case BADGE_OK: child->setValue(std::string("badge_ok.j2c")); break; + case BADGE_NOTE: child->setValue(std::string("badge_note.j2c")); break; + case BADGE_WARN: child->setValue(std::string("badge_warn.j2c")); break; + case BADGE_ERROR: child->setValue(std::string("badge_error.j2c")); break; } } } diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 72d1494d96..3f3c10a7c7 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -31,18 +31,12 @@ */ #include "llviewerprecompiledheaders.h" -#include "llviewercamera.h" - -#include // for setprecision -#include "llquaternion.h" +#include "llviewercamera.h" +// Viewer includes #include "llagent.h" #include "llviewercontrol.h" -#include "lldrawable.h" -#include "llface.h" -#include "llgl.h" -#include "llglheaders.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" @@ -51,6 +45,17 @@ #include "lltoolmgr.h" #include "llviewerjoystick.h" +// Linden library includes +#include "lldrawable.h" +#include "llface.h" +#include "llgl.h" +#include "llglheaders.h" +#include "llquaternion.h" +#include "llwindow.h" // getPixelAspectRatio() + +// System includes +#include // for setprecision + //glu pick matrix implementation borrowed from Mesa3D glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport) { @@ -106,6 +111,7 @@ LLViewerCamera::LLViewerCamera() : LLCamera() mScreenPixelArea = 0; mZoomFactor = 1.f; mZoomSubregion = 1; + gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2)); } void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, @@ -452,8 +458,15 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord } } + LLRect world_view_rect = gViewerWindow->getWorldViewRect(); + S32 viewport[4]; + viewport[0] = world_view_rect.mLeft; + viewport[1] = world_view_rect.mBottom; + viewport[2] = world_view_rect.getWidth(); + viewport[3] = world_view_rect.getHeight(); + if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ], - gGLModelView, gGLProjection, (GLint*)gGLViewport, + gGLModelView, gGLProjection, (GLint*)viewport, &x, &y, &z)) { // convert screen coordinates to virtual UI coordinates @@ -461,9 +474,9 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord y /= gViewerWindow->getDisplayScale().mV[VY]; // should now have the x,y coords of grab_point in screen space - const LLRect& window_rect = gViewerWindow->getWindowRect(); + LLRect world_view_rect = gViewerWindow->getVirtualWorldViewRect(); - // ...sanity check + // convert to pixel coordinates S32 int_x = lltrunc(x); S32 int_y = lltrunc(y); @@ -471,14 +484,14 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord if (clamp) { - if (int_x < window_rect.mLeft) + if (int_x < world_view_rect.mLeft) { - out_point.mX = window_rect.mLeft; + out_point.mX = world_view_rect.mLeft; valid = FALSE; } - else if (int_x > window_rect.mRight) + else if (int_x > world_view_rect.mRight) { - out_point.mX = window_rect.mRight; + out_point.mX = world_view_rect.mRight; valid = FALSE; } else @@ -486,14 +499,14 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord out_point.mX = int_x; } - if (int_y < window_rect.mBottom) + if (int_y < world_view_rect.mBottom) { - out_point.mY = window_rect.mBottom; + out_point.mY = world_view_rect.mBottom; valid = FALSE; } - else if (int_y > window_rect.mTop) + else if (int_y > world_view_rect.mTop) { - out_point.mY = window_rect.mTop; + out_point.mY = world_view_rect.mTop; valid = FALSE; } else @@ -507,19 +520,19 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord out_point.mX = int_x; out_point.mY = int_y; - if (int_x < window_rect.mLeft) + if (int_x < world_view_rect.mLeft) { valid = FALSE; } - else if (int_x > window_rect.mRight) + else if (int_x > world_view_rect.mRight) { valid = FALSE; } - if (int_y < window_rect.mBottom) + if (int_y < world_view_rect.mBottom) { valid = FALSE; } - else if (int_y > window_rect.mTop) + else if (int_y > world_view_rect.mTop) { valid = FALSE; } @@ -548,24 +561,30 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, in_front = FALSE; } + LLRect world_view_rect = gViewerWindow->getWorldViewRect(); + S32 viewport[4]; + viewport[0] = world_view_rect.mLeft; + viewport[1] = world_view_rect.mBottom; + viewport[2] = world_view_rect.getWidth(); + viewport[3] = world_view_rect.getHeight(); GLdouble x, y, z; // object's window coords, GL-style if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ], gGLModelView, - gGLProjection, (GLint*)gGLViewport, + gGLProjection, (GLint*)viewport, &x, &y, &z)) { x /= gViewerWindow->getDisplayScale().mV[VX]; y /= gViewerWindow->getDisplayScale().mV[VY]; // should now have the x,y coords of grab_point in screen space - const LLRect& window_rect = gViewerWindow->getVirtualWindowRect(); + const LLRect& world_rect = gViewerWindow->getVirtualWorldViewRect(); // ...sanity check S32 int_x = lltrunc(x); S32 int_y = lltrunc(y); // find the center - GLdouble center_x = (GLdouble)(0.5f * (window_rect.mLeft + window_rect.mRight)); - GLdouble center_y = (GLdouble)(0.5f * (window_rect.mBottom + window_rect.mTop)); + GLdouble center_x = (GLdouble)world_rect.getCenterX(); + GLdouble center_y = (GLdouble)world_rect.getCenterY(); if (x == center_x && y == center_y) { @@ -586,41 +605,41 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, // the slope of the line is undefined if (line_y > 0.f) { - int_y = window_rect.mTop; + int_y = world_rect.mTop; } else { - int_y = window_rect.mBottom; + int_y = world_rect.mBottom; } } - else if (0 == window_rect.getWidth()) + else if (0 == world_rect.getWidth()) { // the diagonal slope of the view is undefined - if (y < window_rect.mBottom) + if (y < world_rect.mBottom) { - int_y = window_rect.mBottom; + int_y = world_rect.mBottom; } - else if ( y > window_rect.mTop) + else if ( y > world_rect.mTop) { - int_y = window_rect.mTop; + int_y = world_rect.mTop; } } else { F32 line_slope = (F32)(line_y / line_x); - F32 rect_slope = ((F32)window_rect.getHeight()) / ((F32)window_rect.getWidth()); + F32 rect_slope = ((F32)world_rect.getHeight()) / ((F32)world_rect.getWidth()); if (fabs(line_slope) > rect_slope) { if (line_y < 0.f) { // bottom - int_y = window_rect.mBottom; + int_y = world_rect.mBottom; } else { // top - int_y = window_rect.mTop; + int_y = world_rect.mTop; } int_x = lltrunc(((GLdouble)int_y - center_y) / line_slope + center_x); } @@ -629,12 +648,12 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, if (line_x < 0.f) { // left - int_x = window_rect.mLeft; + int_x = world_rect.mLeft; } else { // right - int_x = window_rect.mRight; + int_x = world_rect.mRight; } int_y = lltrunc(((GLdouble)int_x - center_x) * line_slope + center_y); } @@ -643,29 +662,30 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, // exactly parallel ==> push to the corners if (line_x > 0.f) { - int_x = window_rect.mRight; + int_x = world_rect.mRight; } else { - int_x = window_rect.mLeft; + int_x = world_rect.mLeft; } if (line_y > 0.0f) { - int_y = window_rect.mTop; + int_y = world_rect.mTop; } else { - int_y = window_rect.mBottom; + int_y = world_rect.mBottom; } } } if (!in_front) { - int_x = window_rect.mLeft + window_rect.mRight - int_x; - int_y = window_rect.mBottom + window_rect.mTop - int_y; + int_x = world_rect.mLeft + world_rect.mRight - int_x; + int_y = world_rect.mBottom + world_rect.mTop - int_y; } - out_point.mX = int_x; - out_point.mY = int_y; + + out_point.mX = int_x + world_rect.mLeft; + out_point.mY = int_y + world_rect.mBottom; return TRUE; } return FALSE; @@ -803,3 +823,11 @@ void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads) { mCameraFOVDefault = vertical_fov_rads; } + +// static +void LLViewerCamera::updateCameraAngle( void* user_data, const LLSD& value) +{ + LLViewerCamera* self=(LLViewerCamera*)user_data; + self->setDefaultFOV(value.asReal()); +} + diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 6a0c42beec..9615d00200 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -61,6 +61,7 @@ public: const LLVector3 &point_of_interest); static void updateFrustumPlanes(LLCamera& camera, BOOL ortho = FALSE, BOOL zflip = FALSE, BOOL no_hacks = FALSE); + static void updateCameraAngle(void* user_data, const LLSD& value); void setPerspective(BOOL for_selection, S32 x, S32 y_from_bot, S32 width, S32 height, BOOL limit_select_distance, F32 z_near = 0, F32 z_far = 0); const LLMatrix4 &getProjection() const; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index eb8cdd82b3..320b950649 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -35,7 +35,8 @@ #include "llviewercontrol.h" -#include "indra_constants.h" +// Library includes +#include "llwindow.h" // getGamma() // For Listeners #include "audioengine.h" @@ -45,14 +46,13 @@ #include "llflexibleobject.h" #include "llfeaturemanager.h" #include "llviewershadermgr.h" -#include "llpanelgeneral.h" -#include "llpanelinput.h" + #include "llsky.h" #include "llvieweraudio.h" #include "llviewerimagelist.h" #include "llviewerthrottle.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoiceclient.h" #include "llvosky.h" #include "llvotree.h" @@ -77,11 +77,11 @@ BOOL gHackGodmode = FALSE; #endif -std::map gSettings; -LLControlGroup gSavedSettings; // saved at end of session -LLControlGroup gSavedPerAccountSettings; // saved at end of session -LLControlGroup gColors; // read-only -LLControlGroup gCrashSettings; // saved at end of session +LLControlGroup gSavedSettings("Global"); // saved at end of session +LLControlGroup gSavedSkinSettings("Skinning"); // saved at end of session +LLControlGroup gSavedPerAccountSettings("PerAccount"); // saved at end of session +LLControlGroup gCrashSettings("CrashSettings"); // saved at end of session +LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warnings std::string gLastRunVersion; std::string gCurrentVersion; @@ -121,7 +121,7 @@ static bool handleSetShaderChanged(const LLSD& newvalue) static bool handleSetSelfInvisible( const LLSD& newvalue) { - LLVOAvatar::onChangeSelfInvisible( newvalue.asBoolean() ); + LLVOAvatarSelf::onChangeSelfInvisible( newvalue.asBoolean() ); return true; } @@ -378,7 +378,7 @@ static bool handleRenderUseImpostorsChanged(const LLSD& newvalue) static bool handleRenderDebugGLChanged(const LLSD& newvalue) { - gDebugGL = newvalue.asBoolean(); + gDebugGL = newvalue.asBoolean() || gDebugSession; gGL.clearErrors(); return true; } @@ -427,6 +427,16 @@ bool handleVectorizeChanged(const LLSD& newvalue) return true; } +bool handleHighResSnapshotChanged(const LLSD& newvalue) +{ + // High Res Snapshot active, must uncheck RenderUIInSnapshot + if (newvalue.asBoolean()) + { + gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE ); + } + return true; +} + bool handleVoiceClientPrefsChanged(const LLSD& newvalue) { if(gVoiceClient) @@ -436,214 +446,161 @@ bool handleVoiceClientPrefsChanged(const LLSD& newvalue) return true; } +bool handleVelocityInterpolate(const LLSD& newvalue) +{ + LLMessageSystem* msg = gMessageSystem; + if ( newvalue.asBoolean() ) + { + msg->newMessageFast(_PREHASH_VelocityInterpolateOn); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gAgent.sendReliableMessage(); + llinfos << "Velocity Interpolation On" << llendl; + } + else + { + msg->newMessageFast(_PREHASH_VelocityInterpolateOff); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gAgent.sendReliableMessage(); + llinfos << "Velocity Interpolation Off" << llendl; + } + return true; +} + //////////////////////////////////////////////////////////////////////////// void settings_setup_listeners() { - gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _1)); - gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _1)); - gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _1)); - gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); - gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); - gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); - gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _1)); - gSavedSettings.getControl("RenderAvatarInvisible")->getSignal()->connect(boost::bind(&handleSetSelfInvisible, _1)); - gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _1)); - gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1)); - gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1)); - gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _1)); - gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1)); - gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1)); - gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1)); - gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _1)); - gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _1)); - gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _1)); - gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); - gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); - gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); - gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); - gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _1)); - gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); - gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1)); - gSavedSettings.getControl("RenderDebugGL")->getSignal()->connect(boost::bind(&handleRenderDebugGLChanged, _1)); - gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _1)); - gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _1)); - gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _1)); - gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _1)); - gSavedSettings.getControl("ChatPersistTime")->getSignal()->connect(boost::bind(&handleChatPersistTimeChanged, _1)); - gSavedSettings.getControl("ConsoleMaxLines")->getSignal()->connect(boost::bind(&handleConsoleMaxLinesChanged, _1)); - gSavedSettings.getControl("UploadBakedTexOld")->getSignal()->connect(boost::bind(&handleUploadBakedTexOldChanged, _1)); - gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _1)); - gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelDistance")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _1)); - gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("MuteVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); - gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _1)); - gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _1)); - gSavedSettings.getControl("RenderLightingDetail")->getSignal()->connect(boost::bind(&handleRenderLightingDetailChanged, _1)); - gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _1)); - gSavedSettings.getControl("JoystickAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("JoystickAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("JoystickAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("JoystickAxis3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("JoystickAxis4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("JoystickAxis5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("JoystickAxis6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisScale6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("FlycamAxisDeadZone6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("AvatarAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("BuildAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1)); - gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _1)); - gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1)); - gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1)); - gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1)); - gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); - gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); - gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); - gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); - gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("PushToTalkToggle")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("VoiceEarLocation")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); - gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1)); -} - -template <> eControlType get_control_type(const U32& in, LLSD& out) -{ - out = (LLSD::Integer)in; - return TYPE_U32; -} - -template <> eControlType get_control_type(const S32& in, LLSD& out) -{ - out = in; - return TYPE_S32; -} - -template <> eControlType get_control_type(const F32& in, LLSD& out) -{ - out = in; - return TYPE_F32; -} - -template <> eControlType get_control_type (const bool& in, LLSD& out) -{ - out = in; - return TYPE_BOOLEAN; -} -/* -// Yay BOOL, its really an S32. -template <> eControlType get_control_type (const BOOL& in, LLSD& out) -{ - out = in; - return TYPE_BOOLEAN; -} -*/ -template <> eControlType get_control_type(const std::string& in, LLSD& out) -{ - out = in; - return TYPE_STRING; -} - -template <> eControlType get_control_type(const LLVector3& in, LLSD& out) -{ - out = in.getValue(); - return TYPE_VEC3; -} - -template <> eControlType get_control_type(const LLVector3d& in, LLSD& out) -{ - out = in.getValue(); - return TYPE_VEC3D; -} - -template <> eControlType get_control_type(const LLRect& in, LLSD& out) -{ - out = in.getValue(); - return TYPE_RECT; -} - -template <> eControlType get_control_type(const LLColor4& in, LLSD& out) -{ - out = in.getValue(); - return TYPE_COL4; -} - -template <> eControlType get_control_type(const LLColor3& in, LLSD& out) -{ - out = in.getValue(); - return TYPE_COL3; -} - -template <> eControlType get_control_type(const LLColor4U& in, LLSD& out) -{ - out = in.getValue(); - return TYPE_COL4U; -} - -template <> eControlType get_control_type(const LLSD& in, LLSD& out) -{ - out = in; - return TYPE_LLSD; + gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _2)); + gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _2)); + gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _2)); + gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _2)); + gSavedSettings.getControl("RenderAvatarInvisible")->getSignal()->connect(boost::bind(&handleSetSelfInvisible, _2)); + gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2)); + gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2)); + gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2)); + gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _2)); + gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _2)); + gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _2)); + gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _2)); + gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _2)); + gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _2)); + gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _2)); + gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); + gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _2)); + gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); + gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _2)); + gSavedSettings.getControl("RenderDebugGL")->getSignal()->connect(boost::bind(&handleRenderDebugGLChanged, _2)); + gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2)); + gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2)); + gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2)); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _2)); + gSavedSettings.getControl("ChatPersistTime")->getSignal()->connect(boost::bind(&handleChatPersistTimeChanged, _2)); + gSavedSettings.getControl("ConsoleMaxLines")->getSignal()->connect(boost::bind(&handleConsoleMaxLinesChanged, _2)); + gSavedSettings.getControl("UploadBakedTexOld")->getSignal()->connect(boost::bind(&handleUploadBakedTexOldChanged, _2)); + gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _2)); + gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelDistance")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _2)); + gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("MuteVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _2)); + gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _2)); + gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _2)); + gSavedSettings.getControl("RenderLightingDetail")->getSignal()->connect(boost::bind(&handleRenderLightingDetailChanged, _2)); + gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _2)); + gSavedSettings.getControl("JoystickAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("JoystickAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("JoystickAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("JoystickAxis3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("JoystickAxis4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("JoystickAxis5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("JoystickAxis6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisScale6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("FlycamAxisDeadZone6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("AvatarAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("BuildAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _2)); + gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _2)); + gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _2)); + gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _2)); + gSavedSkinSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _2)); + gSavedSettings.getControl("HighResSnapshot")->getSignal()->connect(boost::bind(handleHighResSnapshotChanged, _2)); + gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); + gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); + gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); + gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _2)); + gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("PushToTalkToggle")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("VoiceEarLocation")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); + gSavedSettings.getControl("VelocityInterpolate")->getSignal()->connect(boost::bind(&handleVelocityInterpolate, _2)); } diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index c4003111d3..3271e5fe9b 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -47,17 +47,14 @@ extern BOOL gHackGodmode; //setting variables are declared in this function void settings_setup_listeners(); -extern std::map gSettings; - // for the graphics settings void create_graphics_group(LLControlGroup& group); // saved at end of session extern LLControlGroup gSavedSettings; +extern LLControlGroup gSavedSkinSettings; extern LLControlGroup gSavedPerAccountSettings; - -// Read-only -extern LLControlGroup gColors; +extern LLControlGroup gWarningSettings; // Saved at end of session extern LLControlGroup gCrashSettings; @@ -66,110 +63,5 @@ extern LLControlGroup gCrashSettings; extern std::string gLastRunVersion; extern std::string gCurrentVersion; -//! Helper function for LLCachedControl -template -eControlType get_control_type(const T& in, LLSD& out) -{ - llerrs << "Usupported control type: " << typeid(T).name() << "." << llendl; - return TYPE_COUNT; -} - -//! Publish/Subscribe object to interact with LLControlGroups. - -//! An LLCachedControl instance to connect to a LLControlVariable -//! without have to manually create and bind a listener to a local -//! object. -template -class LLCachedControl -{ - T mCachedValue; - LLPointer mControl; - boost::signals2::scoped_connection mConnection; - -public: - LLCachedControl(const std::string& name, - const T& default_value, - const std::string& comment = "Declared In Code") - { - mControl = gSavedSettings.getControl(name); - if(mControl.isNull()) - { - declareTypedControl(gSavedSettings, name, default_value, comment); - mControl = gSavedSettings.getControl(name); - if(mControl.isNull()) - { - llerrs << "The control could not be created!!!" << llendl; - } - - mCachedValue = default_value; - } - else - { - mCachedValue = (const T&)mControl->getValue(); - } - - // Add a listener to the controls signal... - mConnection = mControl->getSignal()->connect( - boost::bind(&LLCachedControl::handleValueChange, this, _1) - ); - } - - ~LLCachedControl() - { - } - - LLCachedControl& operator =(const T& newvalue) - { - setTypeValue(*mControl, newvalue); - } - - operator const T&() { return mCachedValue; } - -private: - void declareTypedControl(LLControlGroup& group, - const std::string& name, - const T& default_value, - const std::string& comment) - { - LLSD init_value; - eControlType type = get_control_type(default_value, init_value); - if(type < TYPE_COUNT) - { - group.declareControl(name, type, init_value, comment, FALSE); - } - } - - bool handleValueChange(const LLSD& newvalue) - { - mCachedValue = (const T &)newvalue; - return true; - } - - void setTypeValue(LLControlVariable& c, const T& v) - { - // Implicit conversion from T to LLSD... - c.set(v); - } -}; - -template <> eControlType get_control_type(const U32& in, LLSD& out); -template <> eControlType get_control_type(const S32& in, LLSD& out); -template <> eControlType get_control_type(const F32& in, LLSD& out); -template <> eControlType get_control_type (const bool& in, LLSD& out); -// Yay BOOL, its really an S32. -//template <> eControlType get_control_type (const BOOL& in, LLSD& out) -template <> eControlType get_control_type(const std::string& in, LLSD& out); -template <> eControlType get_control_type(const LLVector3& in, LLSD& out); -template <> eControlType get_control_type(const LLVector3d& in, LLSD& out); -template <> eControlType get_control_type(const LLRect& in, LLSD& out); -template <> eControlType get_control_type(const LLColor4& in, LLSD& out); -template <> eControlType get_control_type(const LLColor3& in, LLSD& out); -template <> eControlType get_control_type(const LLColor4U& in, LLSD& out); -template <> eControlType get_control_type(const LLSD& in, LLSD& out); - -//#define TEST_CACHED_CONTROL 1 -#ifdef TEST_CACHED_CONTROL -void test_cached_control(); -#endif // TEST_CACHED_CONTROL #endif // LL_LLVIEWERCONTROL_H diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 977582ba24..a340514e3b 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -46,10 +46,10 @@ #include "lldrawpoolalpha.h" #include "llfeaturemanager.h" #include "llfirstuse.h" -#include "llframestats.h" #include "llhudmanager.h" #include "llimagebmp.h" #include "llimagegl.h" +#include "llmemory.h" #include "llselectmgr.h" #include "llsky.h" #include "llstartup.h" @@ -58,12 +58,13 @@ #include "lltooldraganddrop.h" #include "lltoolpie.h" #include "lltracker.h" +#include "lltrans.h" #include "llui.h" #include "llviewercamera.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvograss.h" #include "llworld.h" #include "pipeline.h" @@ -163,6 +164,7 @@ void display_startup() void display_update_camera() { + LLMemType mt_uc(LLMemType::MTYPE_DISPLAY_UPDATE_CAMERA); llpushcallstacks ; // TODO: cut draw distance down if customizing avatar? // TODO: cut draw distance on per-parcel basis? @@ -199,7 +201,7 @@ void display_stats() F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency"); if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq) { - gMemoryAllocated = getCurrentRSS(); + gMemoryAllocated = LLMemory::getCurrentRSS(); U32 memory = (U32)(gMemoryAllocated / (1024*1024)); llinfos << llformat("MEMORY: %d MB", memory) << llendl; gRecentMemoryTime.reset(); @@ -209,6 +211,7 @@ void display_stats() // Paint the display! void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { + LLMemType mt_render(LLMemType::MTYPE_RENDER); LLFastTimer t(LLFastTimer::FTM_RENDER); if (LLPipeline::sRenderFrameTest) @@ -226,8 +229,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkStates(); LLGLState::checkTextureChannels(); + stop_glerror(); + gPipeline.disableLights(); + stop_glerror(); + // Don't draw if the window is hidden or minimized. // In fact, must explicitly check the minimized state before drawing. // Attempting to draw into a minimized window causes a GL error. JC @@ -238,11 +245,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Clean up memory the pools may have allocated if (rebuild) { - gFrameStats.start(LLFrameStats::REBUILD); + stop_glerror(); gPipeline.rebuildPools(); + stop_glerror(); } + stop_glerror(); gViewerWindow->returnEmptyPicks(); + stop_glerror(); return; } @@ -299,7 +309,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // LLAppViewer::instance()->pingMainloopTimeout("Display:TextureStats"); - gFrameStats.start(LLFrameStats::UPDATE_TEX_STATS); stop_glerror(); LLImageGL::updateStats(gFrameTimeSeconds); @@ -369,7 +378,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) case LLAgent::TELEPORT_START_ARRIVAL: // Transition to ARRIVING. Viewer has received avatar update, etc., from destination simulator gTeleportArrivalTimer.reset(); - gViewerWindow->setProgressCancelButtonVisible(FALSE, std::string("Cancel")); //TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel")); gViewerWindow->setProgressPercent(75.f); gAgent.setTeleportState( LLAgent::TELEPORT_ARRIVING ); gAgent.setTeleportMessage( @@ -388,7 +397,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLFirstUse::useTeleport(); gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); } - gViewerWindow->setProgressCancelButtonVisible(FALSE, std::string("Cancel")); //TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(FALSE, LLTrans::getString("Cancel")); gViewerWindow->setProgressPercent( arrival_fraction * 25.f + 75.f); gViewerWindow->setProgressString(message); } @@ -504,11 +513,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } } - gViewerWindow->setupViewport(); + gViewerWindow->setup3DViewport(); gPipeline.resetFrameStats(); // Reset per-frame statistics. if (!gDisconnected) { + LLMemType mt_du(LLMemType::MTYPE_DISPLAY_UPDATE); LLAppViewer::instance()->pingMainloopTimeout("Display:Update"); if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { //don't draw hud objects in this frame @@ -528,17 +538,21 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) stop_glerror(); // *TODO: merge these two methods - LLHUDManager::getInstance()->updateEffects(); - LLHUDObject::updateAll(); - stop_glerror(); - - gFrameStats.start(LLFrameStats::UPDATE_GEOM); - const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time - gPipeline.createObjects(max_geom_update_time); - gPipeline.updateGeom(max_geom_update_time); - stop_glerror(); - - gFrameStats.start(LLFrameStats::UPDATE_CULL); + { + LLMemType mt_uh(LLMemType::MTYPE_DISPLAY_UPDATE_HUD); + LLHUDManager::getInstance()->updateEffects(); + LLHUDObject::updateAll(); + stop_glerror(); + } + + { + LLMemType mt_ug(LLMemType::MTYPE_DISPLAY_UPDATE_GEOM); + const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time + gPipeline.createObjects(max_geom_update_time); + gPipeline.updateGeom(max_geom_update_time); + stop_glerror(); + } + S32 water_clip = 0; if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT) > 1) && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER)) @@ -552,7 +566,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) water_clip = 1; } } - + LLAppViewer::instance()->pingMainloopTimeout("Display:Cull"); //Increment drawable frame counter @@ -601,6 +615,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLAppViewer::instance()->pingMainloopTimeout("Display:Swap"); { + LLMemType mt_ds(LLMemType::MTYPE_DISPLAY_SWAP); { LLFastTimer ftm(LLFastTimer::FTM_CLIENT_COPY); LLVertexBuffer::clientCopy(0.016); @@ -643,7 +658,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glLoadMatrixf(proj.m); glMatrixMode(GL_MODELVIEW); glLoadMatrixf(mod.m); - gViewerWindow->setupViewport(); + gViewerWindow->setup3DViewport(); LLGLState::checkStates(); LLGLState::checkTextureChannels(); @@ -655,6 +670,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!for_snapshot) { + LLMemType mt_gw(LLMemType::MTYPE_DISPLAY_GEN_REFLECTION); LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); } @@ -669,9 +685,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages"); LLError::LLCallStacks::clear() ; llpushcallstacks ; - gFrameStats.start(LLFrameStats::IMAGE_UPDATE); { + LLMemType mt_iu(LLMemType::MTYPE_DISPLAY_IMAGE_UPDATE); LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); LLViewerImage::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(), @@ -694,7 +710,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // LLAppViewer::instance()->pingMainloopTimeout("Display:StateSort"); { - gFrameStats.start(LLFrameStats::STATE_SORT); + LLMemType mt_ss(LLMemType::MTYPE_DISPLAY_STATE_SORT); gPipeline.stateSort(*LLViewerCamera::getInstance(), result); stop_glerror(); @@ -705,7 +721,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // rebuildPools // // - gFrameStats.start(LLFrameStats::REBUILD); gPipeline.rebuildPools(); stop_glerror(); } @@ -714,6 +729,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLPipeline::sUseOcclusion = occlusion; { + LLMemType mt_ds(LLMemType::MTYPE_DISPLAY_SKY); LLAppViewer::instance()->pingMainloopTimeout("Display:Sky"); LLFastTimer t(LLFastTimer::FTM_UPDATE_SKY); gSky.updateSky(); @@ -741,7 +757,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); // glLoadIdentity(); - // LLRect floater_rect = frontmost_floaterp->getScreenRect(); + // LLRect floater_rect = frontmost_floaterp->calcScreenRect(); // // deflate by one pixel so rounding errors don't occlude outside of floater extents // floater_rect.stretch(-1); // LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidth(), @@ -792,7 +808,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot()) && !gRestoreGL) { - + LLMemType mt_rg(LLMemType::MTYPE_DISPLAY_RENDER_GEOM); gGL.setColorMask(true, false); if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { @@ -818,6 +834,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (to_texture) { + LLMemType mt_rf(LLMemType::MTYPE_DISPLAY_RENDER_FLUSH); if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { gPipeline.mDeferredScreen.flush(); @@ -844,16 +861,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); if (!for_snapshot) { - gFrameStats.start(LLFrameStats::RENDER_UI); + LLFastTimer t(LLFastTimer::FTM_RENDER_UI); render_ui(); } LLSpatialGroup::sNoDelete = FALSE; } - + LLAppViewer::instance()->pingMainloopTimeout("Display:FrameStats"); - gFrameStats.start(LLFrameStats::MISC_END); stop_glerror(); if (LLPipeline::sRenderFrameTest) @@ -869,6 +885,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) void render_hud_attachments() { + LLMemType mt_ra(LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS); glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); @@ -1027,6 +1044,7 @@ BOOL setup_hud_matrices(const LLRect& screen_region) void render_ui(F32 zoom_factor, int subfield) { + LLMemType mt_ru(LLMemType::MTYPE_DISPLAY_RENDER_UI); LLGLState::checkStates(); glPushMatrix(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp new file mode 100644 index 0000000000..950d5ba20c --- /dev/null +++ b/indra/newview/llviewerfloaterreg.cpp @@ -0,0 +1,112 @@ +/** + * @file llviewerfloaterreg.cpp + * @brief LLViewerFloaterReg class registers floaters used in the viewer + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterreg.h" + +#include "llviewerfloaterreg.h" + +#include "llcompilequeue.h" +#include "llfloaterabout.h" +#include "llfloateraddlandmark.h" +#include "llfloateravatarinfo.h" +#include "llfloaterchat.h" +#include "llfloaterchatterbox.h" +#include "llfloaterdirectory.h" +#include "llfloaterjoystick.h" +#include "llfloatervoicedevicesettings.h" +#include "llfloatermap.h" +#include "llfloatermemleak.h" +#include "llfloatermute.h" +#include "llfloaterpreference.h" +#include "llfloatersnapshot.h" +#include "llfloatertools.h" +#include "llfloateruipreview.h" +#include "llfloaterworldmap.h" +#include "llinventoryview.h" +#include "llnearbychathistory.h" + +#include "llpreviewanim.h" +#include "llpreviewgesture.h" +#include "llpreviewlandmark.h" +#include "llpreviewnotecard.h" +#include "llpreviewscript.h" +#include "llpreviewsound.h" +#include "llpreviewtexture.h" +#include "llfloaterminiinspector.h" + +void LLViewerFloaterReg::registerFloaters() +{ + LLFloaterReg::add("mini_inspector", "panel_mini_inspector.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("sl_about", "floater_about.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("search", "floater_directory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("inventory", "floater_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("add_landmark", "floater_add_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("mute", "floater_mute.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("ui_preview", "floater_ui_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pref_voicedevicesettings", "floater_device_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("communicate", "floater_chatterbox.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("chat", "floater_chat_history.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("nearby_chat", "floater_nearby_chat.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("contacts", "floater_my_friends.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("preview_avatar", "floater_profile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("me_profile", "floater_me.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + + LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_landmark", "floater_preview_existing_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + + LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); +} diff --git a/indra/newview/llviewerfloaterreg.h b/indra/newview/llviewerfloaterreg.h new file mode 100644 index 0000000000..08c9589ebb --- /dev/null +++ b/indra/newview/llviewerfloaterreg.h @@ -0,0 +1,43 @@ +/** + * @file llviewerfloaterreg.h + * @brief The LLViewerFloaterReg class declaration + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLVIEWERFLOATERREG_H +#define LL_LLVIEWERFLOATERREG_H + +class LLViewerFloaterReg +{ +public: + static void registerFloaters(); +}; + + +#endif // LL_LLVIEWERFLOATERREG_H diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 168f9af1d1..2fb56fbcb8 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -47,6 +47,7 @@ #include "llviewermessage.h" // send_guid_sound_trigger #include "llviewernetwork.h" #include "llagent.h" +#include "llbottomtray.h" // Globals LLViewerGestureList gGestureList; @@ -136,7 +137,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) { // Don't play nodding animation, since that might not blend // with the gesture animation. - gChatBar->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); + LLBottomTray::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); } } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index f47d0777b0..45d24ee7e8 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -44,12 +44,14 @@ #include "llimview.h" #include "llgesturemgr.h" +#include "llinventorybridge.h" #include "llinventoryview.h" #include "llviewerregion.h" #include "llviewerobjectlist.h" #include "llpreviewgesture.h" #include "llviewerwindow.h" +#include "lltrans.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -307,8 +309,8 @@ bool LLViewerInventoryItem::exportFileLocal(LLFILE* fp) const fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str()); mPermissions.exportFile(fp); fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); - const char* inv_type_str = LLInventoryType::lookup(mInventoryType); - if(inv_type_str) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str); + const std::string inv_type_str = LLInventoryType::lookup(mInventoryType); + if(!inv_type_str.empty()) fprintf(fp, "\t\tinv_type\t%s\n", inv_type_str.c_str()); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp, "\t\tcreation_date\t%d\n", (S32) mCreationDate); fprintf(fp,"\t}\n"); @@ -684,12 +686,9 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) gInventory.updateItem(item); gInventory.notifyObservers(); - if(!LLPreview::show(inv_item,FALSE)) - { - LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null); - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + LLPreviewGesture* preview = LLPreviewGesture::show(inv_item, LLUUID::null); + // Force to be entirely onscreen. + gFloaterView->adjustToFitScreen(preview, FALSE); } LLInventoryCallbackManager gInventoryCallbacks; @@ -800,3 +799,187 @@ void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecar viewer_region->getCapAPI().post(request); } + +void create_new_item(const std::string& name, + const LLUUID& parent_id, + LLAssetType::EType asset_type, + LLInventoryType::EType inv_type, + U32 next_owner_perm) +{ + std::string desc; + LLAssetType::generateDescriptionFor(asset_type, desc); + next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER; + + + if (inv_type == LLInventoryType::IT_GESTURE) + { + LLPointer cb = new CreateGestureCallback(); + create_inventory_item(gAgent.getID(), gAgent.getSessionID(), + parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, + NOT_WEARABLE, next_owner_perm, cb); + } + else + { + LLPointer cb = NULL; + create_inventory_item(gAgent.getID(), gAgent.getSessionID(), + parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type, + NOT_WEARABLE, next_owner_perm, cb); + } + +} + +const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not) +const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably not) +const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not) + +void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, const LLSD& userdata) +{ + std::string type = userdata.asString(); + + if ("category" == type) + { + LLUUID category; + if (bridge) + { + category = gInventory.createNewCategory(bridge->getUUID(), LLAssetType::AT_NONE, LLStringUtil::null); + } + else + { + category = gInventory.createNewCategory(gAgent.getInventoryRootID(), LLAssetType::AT_NONE, LLStringUtil::null); + } + gInventory.notifyObservers(); + folder->setSelectionByID(category, TRUE); + } + else if ("lsl" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_LSL_TEXT); + create_new_item(NEW_LSL_NAME, + parent_id, + LLAssetType::AT_LSL_TEXT, + LLInventoryType::IT_LSL, + PERM_MOVE | PERM_TRANSFER); + } + else if ("notecard" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_NOTECARD); + create_new_item(NEW_NOTECARD_NAME, + parent_id, + LLAssetType::AT_NOTECARD, + LLInventoryType::IT_NOTECARD, + PERM_ALL); + } + else if ("gesture" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_GESTURE); + create_new_item(NEW_GESTURE_NAME, + parent_id, + LLAssetType::AT_GESTURE, + LLInventoryType::IT_GESTURE, + PERM_ALL); + } + else if ("shirt" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_SHIRT); + } + else if ("pants" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_PANTS); + } + else if ("shoes" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_SHOES); + } + else if ("socks" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_SOCKS); + } + else if ("jacket" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_JACKET); + } + else if ("skirt" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_SKIRT); + } + else if ("gloves" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_GLOVES); + } + else if ("undershirt" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_UNDERSHIRT); + } + else if ("underpants" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_CLOTHING); + LLFolderBridge::createWearable(parent_id, WT_UNDERPANTS); + } + else if ("shape" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + LLFolderBridge::createWearable(parent_id, WT_SHAPE); + } + else if ("skin" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + LLFolderBridge::createWearable(parent_id, WT_SKIN); + } + else if ("hair" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + LLFolderBridge::createWearable(parent_id, WT_HAIR); + } + else if ("eyes" == type) + { + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLAssetType::AT_BODYPART); + LLFolderBridge::createWearable(parent_id, WT_EYES); + } + + folder->setNeedsAutoRename(TRUE); +} + +LLAssetType::EType LLViewerInventoryItem::getType() const +{ + if (mType == LLAssetType::AT_LINK) + { + LLInventoryItem *linked_item = gInventory.getItem(mAssetUUID); + if (linked_item) + { + return linked_item->getType(); + } + } + return LLInventoryItem::getType(); +} + +const LLUUID& LLViewerInventoryItem::getAssetUUID() const +{ + if (mType == LLAssetType::AT_LINK) + { + LLInventoryItem *linked_item = gInventory.getItem(mAssetUUID); + if (linked_item) + { + return linked_item->getAssetUUID(); + } + } + + return LLInventoryItem::getAssetUUID(); +} + +const std::string& LLViewerInventoryItem::getName() const +{ + if (mType == LLAssetType::AT_LINK) + { + return LLInventoryItem::getName(); //+" link"; + } + + return LLInventoryItem::getName(); +} + diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 1ddf8a58f9..8318931dde 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -37,6 +37,9 @@ #include "llframetimer.h" #include "llwearable.h" +class LLFolderView; +class LLFolderBridge; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLViewerInventoryItem // @@ -53,6 +56,10 @@ protected: ~LLViewerInventoryItem( void ); // ref counted public: + virtual LLAssetType::EType getType() const; + virtual const LLUUID& getAssetUUID() const; + virtual const std::string& getName() const; + // construct a complete viewer inventory item LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid, const LLPermissions& permissions, @@ -286,4 +293,8 @@ void copy_inventory_from_notecard(const LLUUID& object_id, U32 callback_id = 0); +void menu_create_inventory_item(LLFolderView* folder, + LLFolderBridge* bridge, + const LLSD& userdata); + #endif // LL_LLVIEWERINVENTORY_H diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 4847ac7a72..c003579684 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -71,20 +71,20 @@ public: void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; } void setVisibleInFirstPerson(BOOL visibility) { mVisibleInFirst = visibility; } - BOOL getVisibleInFirstPerson() { return mVisibleInFirst; } + BOOL getVisibleInFirstPerson() const { return mVisibleInFirst; } void setGroup(S32 group) { mGroup = group; } void setOriginalPosition(LLVector3 &position); void setAttachmentVisibility(BOOL visible); void setIsHUDAttachment(BOOL is_hud) { mIsHUDAttachment = is_hud; } - BOOL getIsHUDAttachment() { return mIsHUDAttachment; } + BOOL getIsHUDAttachment() const { return mIsHUDAttachment; } - BOOL isAnimatable() { return FALSE; } + BOOL isAnimatable() const { return FALSE; } - S32 getGroup() { return mGroup; } - S32 getPieSlice() { return mPieSlice; } - LLViewerObject *getObject() { return mAttachedObject; } - S32 getNumObjects() { return (mAttachedObject ? 1 : 0); } - const LLUUID& getItemID() { return mItemID; } + S32 getGroup() const { return mGroup; } + S32 getPieSlice() const { return mPieSlice; } + LLViewerObject *getObject() const { return mAttachedObject; } + S32 getNumObjects() const { return (mAttachedObject ? 1 : 0); } + const LLUUID& getItemID() const { return mItemID; } // // unique methods diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 15c814829c..ab5cdeba44 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -43,7 +43,7 @@ #include "llmoveview.h" #include "lltoolfocus.h" #include "llviewerwindow.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" // // Constants @@ -224,7 +224,7 @@ void agent_toggle_fly( EKeystate s ) // Only catch the edge if (KEYSTATE_DOWN == s ) { - gAgent.toggleFlying(); + LLAgent::toggleFlying(); } } @@ -500,7 +500,8 @@ void stop_moving( EKeystate s ) void start_chat( EKeystate s ) { // start chat - gChatBar->startChat(NULL); + LLChatBar::startChat(NULL); +// gChatBar->startChat(NULL); } void start_gesture( EKeystate s ) @@ -508,16 +509,18 @@ void start_gesture( EKeystate s ) if (KEYSTATE_UP == s && !(gFocusMgr.getKeyboardFocus() && gFocusMgr.getKeyboardFocus()->acceptsTextInput())) { - if (gChatBar->getCurrentChat().empty()) - { - // No existing chat in chat editor, insert '/' - gChatBar->startChat("/"); - } - else - { - // Don't overwrite existing text in chat editor - gChatBar->startChat(NULL); - } + //TODO* remove DUMMY chatbar + LLChatBar::startChat(NULL); +// if (gChatBar->getCurrentChat().empty()) +// { +// // No existing chat in chat editor, insert '/' +// gChatBar->startChat("/"); +// } +// else +// { +// // Don't overwrite existing text in chat editor +// gChatBar->startChat(NULL); +// } } } diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 82f8359732..1b3fd5d49b 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -553,7 +553,7 @@ void LLViewerMedia::buildMediaManagerData( LLMediaManagerData* init_data ) // Users can change skins while client is running, so make sure // we pick up on changes. gSavedSettings.getControl("SkinCurrent")->getSignal()->connect( - boost::bind( LLViewerMediaImpl::handleSkinCurrentChanged, _1 ) ); + boost::bind( LLViewerMediaImpl::handleSkinCurrentChanged, _2 ) ); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ac36cf7bb6..bdc86a3a69 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -41,9 +41,11 @@ // linden library includes #include "audioengine.h" +#include "llfloaterreg.h" #include "indra_constants.h" #include "llassetstorage.h" #include "llchat.h" +#include "llcombobox.h" #include "llfeaturemanager.h" #include "llfocusmgr.h" #include "llfontgl.h" @@ -64,7 +66,7 @@ // newview includes #include "llagent.h" - +#include "llagentwearables.h" #include "llagentpilot.h" #include "llbox.h" #include "llcallingcard.h" @@ -84,7 +86,6 @@ #include "llfloaterbuycurrency.h" #include "llfloateractivespeakers.h" #include "llfloateranimpreview.h" -#include "llfloateravatarinfo.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" #include "llfloaterbuildoptions.h" @@ -98,9 +99,7 @@ #include "llfloatercustomize.h" #include "llfloaterdaycycle.h" #include "llfloaterdirectory.h" -#include "llfloatereditui.h" #include "llfloaterchatterbox.h" -#include "llfloaterfriends.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" @@ -119,7 +118,6 @@ #include "llfloatermap.h" #include "llfloatermute.h" #include "llfloateropenobject.h" -#include "llfloaterpermissionsmgr.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" #include "llfloaterpreference.h" @@ -128,16 +126,13 @@ #include "llfloaterscriptdebug.h" #include "llfloatersettingsdebug.h" #include "llfloaterenvsettings.h" -#include "llfloaterstats.h" -#include "llfloatertest.h" #include "llfloatertools.h" #include "llfloaterwater.h" #include "llfloaterwindlight.h" #include "llfloaterworldmap.h" #include "llfloatermemleak.h" -#include "llframestats.h" -#include "llframestatview.h" #include "llfasttimerview.h" +#include "llfriendactions.h" #include "llmemoryview.h" #include "llgivemoney.h" #include "llgroupmgr.h" @@ -148,6 +143,7 @@ #include "llimagebmp.h" #include "llimagej2c.h" #include "llimagetga.h" +#include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventoryview.h" #include "llkeyboard.h" @@ -162,6 +158,7 @@ #include "llparcel.h" #include "llprimitive.h" #include "llresmgr.h" +#include "llrootview.h" #include "llselectmgr.h" #include "llsky.h" #include "llstatusbar.h" @@ -177,13 +174,12 @@ #include "lltoolgrab.h" #include "lltoolmgr.h" #include "lltoolpie.h" -#include "lltoolplacer.h" #include "lltoolselectland.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "lluploaddialog.h" #include "lluserauth.h" #include "lluuid.h" -#include "llvelocitybar.h" #include "llviewercamera.h" #include "llviewergenericmessage.h" #include "llviewergesture.h" @@ -199,6 +195,7 @@ #include "llviewerstats.h" #include "llviewerwindow.h" #include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvolume.h" #include "llweb.h" #include "llworld.h" @@ -216,17 +213,6 @@ #include "lltexlayer.h" using namespace LLVOAvatarDefines; -using namespace LLOldEvents; - -void init_client_menu(LLMenuGL* menu); -void init_server_menu(LLMenuGL* menu); - -void init_debug_world_menu(LLMenuGL* menu); -void init_debug_rendering_menu(LLMenuGL* menu); -void init_debug_ui_menu(LLMenuGL* menu); -void init_debug_xui_menu(LLMenuGL* menu); -void init_debug_avatar_menu(LLMenuGL* menu); -void init_debug_baked_texture_menu(LLMenuGL* menu); BOOL enable_land_build(void*); BOOL enable_object_build(void*); @@ -238,13 +224,14 @@ void handle_test_load_url(void*); // // Evil hackish imported globals -// -extern BOOL gRenderLightGlows; -extern BOOL gRenderAvatar; -extern BOOL gHideSelectedObjects; -extern BOOL gShowOverlayTitle; -extern BOOL gOcclusionCull; -extern BOOL gAllowSelectAvatar; + +//extern BOOL gHideSelectedObjects; +//extern BOOL gAllowSelectAvatar; +//extern BOOL gDebugAvatarRotation; +extern BOOL gDebugClicks; +extern BOOL gDebugWindowProc; +//extern BOOL gDebugTextEditorTips; +//extern BOOL gDebugSelectMgr; // // Globals @@ -256,15 +243,11 @@ LLMenuGL *gPopupMenuView = NULL; LLMenuBarGL *gLoginMenuBarView = NULL; // Pie menus -LLPieMenu *gPieSelf = NULL; -LLPieMenu *gPieAvatar = NULL; -LLPieMenu *gPieObject = NULL; -LLPieMenu *gPieAttachment = NULL; -LLPieMenu *gPieLand = NULL; - -// local constants -const std::string CLIENT_MENU_NAME("Advanced"); -const std::string SERVER_MENU_NAME("Admin"); +LLContextMenu *gPieSelf = NULL; +LLContextMenu *gPieAvatar = NULL; +LLContextMenu *gPieObject = NULL; +LLContextMenu *gPieAttachment = NULL; +LLContextMenu *gPieLand = NULL; const std::string SAVE_INTO_INVENTORY("Save Object Back to My Inventory"); const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); @@ -272,27 +255,24 @@ const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents" LLMenuGL* gAttachSubMenu = NULL; LLMenuGL* gDetachSubMenu = NULL; LLMenuGL* gTakeOffClothes = NULL; -LLPieMenu* gPieRate = NULL; -LLPieMenu* gAttachScreenPieMenu = NULL; -LLPieMenu* gAttachPieMenu = NULL; -LLPieMenu* gAttachBodyPartPieMenus[8]; -LLPieMenu* gDetachPieMenu = NULL; -LLPieMenu* gDetachScreenPieMenu = NULL; -LLPieMenu* gDetachBodyPartPieMenus[8]; +LLContextMenu* gPieRate = NULL; +LLContextMenu* gAttachScreenPieMenu = NULL; +LLContextMenu* gAttachPieMenu = NULL; +LLContextMenu* gAttachBodyPartPieMenus[8]; +LLContextMenu* gDetachPieMenu = NULL; +LLContextMenu* gDetachScreenPieMenu = NULL; +LLContextMenu* gDetachBodyPartPieMenus[8]; LLMenuItemCallGL* gAFKMenu = NULL; LLMenuItemCallGL* gBusyMenu = NULL; -typedef LLMemberListener view_listener_t; - // // Local prototypes -// -void handle_leave_group(void *); // File Menu +const char* upload_pick(void* data); void handle_compress_image(void*); -BOOL enable_save_as(void *); + // Edit menu void handle_dump_group_info(void *); @@ -300,7 +280,6 @@ void handle_dump_capabilities_info(void *); void handle_dump_focus(void*); // Advanced->Consoles menu -void handle_show_notifications_console(void*); void handle_region_dump_settings(void*); void handle_region_dump_temp_asset_data(void*); void handle_region_clear_temp_asset_data(void*); @@ -309,7 +288,7 @@ void handle_region_clear_temp_asset_data(void*); BOOL sitting_on_selection(); void near_sit_object(); -void label_sit_or_stand(std::string& label, void*); +//void label_sit_or_stand(std::string& label, void*); // buy and take alias into the same UI positions, so these // declarations handle this mess. BOOL is_selection_buy_not_take(); @@ -321,51 +300,31 @@ BOOL enable_buy(void*); void handle_buy(void *); void handle_buy_object(LLSaleInfo sale_info); void handle_buy_contents(LLSaleInfo sale_info); -void label_touch(std::string& label, void*); // Land pie menu void near_sit_down_point(BOOL success, void *); // Avatar pie menu -void handle_follow(void *userdata); -void handle_talk_to(void *userdata); // Debug menu -void show_permissions_control(void*); -void toggle_build_options(void* user_data); -void reload_ui(void*); -void handle_agent_stop_moving(void*); -void print_packets_lost(void*); -void drop_packet(void*); -void velocity_interpolate( void* data ); -void toggle_wind_audio(void); -void toggle_water_audio(void); + + +void velocity_interpolate( void* ); + void handle_rebake_textures(void*); BOOL check_admin_override(void*); void handle_admin_override_toggle(void*); #ifdef TOGGLE_HACKED_GODLIKE_VIEWER void handle_toggle_hacked_godmode(void*); BOOL check_toggle_hacked_godmode(void*); +bool enable_toggle_hacked_godmode(void*); #endif -void toggle_glow(void *); -BOOL check_glow(void *); - -void toggle_vertex_shaders(void *); -BOOL check_vertex_shaders(void *); - -void toggle_cull_small(void *); - void toggle_show_xui_names(void *); BOOL check_show_xui_names(void *); -void run_vectorize_perf_test(void *) -{ - gSavedSettings.setBOOL("VectorizePerfTest", TRUE); -} - // Debug UI -void handle_web_search_demo(void*); + void handle_web_browser_test(void*); void handle_buy_currency_test(void*); void handle_save_to_xml(void*); @@ -376,16 +335,12 @@ void handle_god_mode(void*); // God menu void handle_leave_god_mode(void*); -BOOL is_inventory_visible( void* user_data ); + void handle_reset_view(); -void disabled_duplicate(void*); void handle_duplicate_in_place(void*); -void handle_repeat_duplicate(void*); -void handle_export(void*); -// void handle_deed_object_to_group(void*); -// BOOL enable_deed_object_to_group(void*); + void handle_object_owner_self(void*); void handle_object_owner_permissive(void*); void handle_object_lock(void*); @@ -400,11 +355,8 @@ void handle_force_parcel_owner_to_me(void*); void handle_force_parcel_to_content(void*); void handle_claim_public_land(void*); -void handle_god_request_havok(void *); void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry -void reload_personal_settings_overrides(void *); void reload_vertex_shader(void *); -void slow_mo_animations(void *); void handle_disconnect_viewer(void *); void force_error_breakpoint(void *); @@ -414,25 +366,13 @@ void force_error_infinite_loop(void *); void force_error_software_exception(void *); void force_error_driver_crash(void *); -void handle_stopall(void*); -//void handle_hinge(void*); -//void handle_ptop(void*); -//void handle_lptop(void*); -//void handle_wheel(void*); -//void handle_dehinge(void*); -BOOL enable_dehinge(void*); void handle_force_delete(void*); void print_object_info(void*); void print_agent_nvpairs(void*); void toggle_debug_menus(void*); -void export_info_callback(LLAssetInfo *info, void **user_data, S32 result); -void export_data_callback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, void **user_data, S32 result); void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status); -BOOL menu_check_build_tool( void* user_data ); -void handle_reload_settings(void*); -void focus_here(void*); void dump_select_mgr(void*); -void dump_volume_mgr(void*); + void dump_inventory(void*); void edit_ui(void*); void toggle_visibility(void*); @@ -442,52 +382,30 @@ BOOL get_visibility(void*); void request_friendship(const LLUUID& agent_id); // Tools menu -void handle_force_unlock(void*); void handle_selected_texture_info(void*); -void handle_dump_image_list(void*); -void handle_crash(void*); void handle_dump_followcam(void*); void handle_viewer_enable_message_log(void*); void handle_viewer_disable_message_log(void*); -void handle_send_postcard(void*); -void handle_gestures_old(void*); -void handle_focus(void *); + BOOL enable_buy_land(void*); -void handle_move(void*); -void handle_show_inventory(void*); -void handle_activate(void*); -BOOL enable_activate(void*); // Help menu -void handle_buy_currency(void*); void handle_test_male(void *); void handle_test_female(void *); void handle_toggle_pg(void*); void handle_dump_attachments(void *); -void handle_show_overlay_title(void*); void handle_dump_avatar_local_textures(void*); void handle_debug_avatar_textures(void*); void handle_grab_texture(void*); BOOL enable_grab_texture(void*); void handle_dump_region_object_cache(void*); -BOOL menu_ui_enabled(void *user_data); -BOOL menu_check_control( void* user_data); -void menu_toggle_variable( void* user_data ); -BOOL menu_check_variable( void* user_data); -BOOL enable_land_selected( void* ); -BOOL enable_more_than_one_selected(void* ); -BOOL enable_selection_you_own_all(void*); -BOOL enable_selection_you_own_one(void*); BOOL enable_save_into_inventory(void*); BOOL enable_save_into_task_inventory(void*); -BOOL enable_not_thirdperson(void*); -// BOOL enable_export_selected(void *); -BOOL enable_have_card(void*); -BOOL enable_detach(void*); -BOOL enable_region_owner(void*); + +BOOL enable_detach(const LLSD& = LLSD()); void menu_toggle_attached_lights(void* user_data); void menu_toggle_attached_particles(void* user_data); @@ -521,27 +439,6 @@ void LLMenuParcelObserver::changed() } -//----------------------------------------------------------------------------- -// Menu Construction -//----------------------------------------------------------------------------- - -// code required to calculate anything about the menus -void pre_init_menus() -{ - // static information - LLColor4 color; - color = gColors.getColor( "MenuDefaultBgColor" ); - LLMenuGL::setDefaultBackgroundColor( color ); - color = gColors.getColor( "MenuItemEnabledColor" ); - LLMenuItemGL::setEnabledColor( color ); - color = gColors.getColor( "MenuItemDisabledColor" ); - LLMenuItemGL::setDisabledColor( color ); - color = gColors.getColor( "MenuItemHighlightBgColor" ); - LLMenuItemGL::setHighlightBGColor( color ); - color = gColors.getColor( "MenuItemHighlightFgColor" ); - LLMenuItemGL::setHighlightFGColor( color ); -} - void initialize_menus(); //----------------------------------------------------------------------------- @@ -593,62 +490,63 @@ void init_menus() /// The popup menu is now populated by the show_context_menu() /// method. - gPopupMenuView = new LLMenuGL( "Popup" ); - gPopupMenuView->setVisible( FALSE ); + LLMenuGL::Params menu_params; + menu_params.name = "Popup"; + menu_params.visible = false; + gPopupMenuView = LLUICtrlFactory::create(menu_params); gMenuHolder->addChild( gPopupMenuView ); /// /// Pie menus /// - gPieSelf = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_self.xml", gMenuHolder); + gPieSelf = LLUICtrlFactory::getInstance()->createFromFile("menu_pie_self.xml", gMenuHolder); // TomY TODO: what shall we do about these? - gDetachScreenPieMenu = gMenuHolder->getChild("Object Detach HUD", true); - gDetachPieMenu = gMenuHolder->getChild("Object Detach", true); + gDetachScreenPieMenu = gMenuHolder->getChild("Object Detach HUD", true); + gDetachPieMenu = gMenuHolder->getChild("Object Detach", true); - gPieAvatar = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_avatar.xml", gMenuHolder); + gPieAvatar = LLUICtrlFactory::getInstance()->createFromFile("menu_pie_avatar.xml", gMenuHolder); - gPieObject = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_object.xml", gMenuHolder); + gPieObject = LLUICtrlFactory::getInstance()->createFromFile("menu_pie_object.xml", gMenuHolder); - gAttachScreenPieMenu = gMenuHolder->getChild("Object Attach HUD"); - gAttachPieMenu = gMenuHolder->getChild("Object Attach"); - gPieRate = gMenuHolder->getChild("Rate Menu"); + gAttachScreenPieMenu = gMenuHolder->getChild("Object Attach HUD"); + gAttachPieMenu = gMenuHolder->getChild("Object Attach"); + gPieRate = gMenuHolder->getChild("Rate Menu"); - gPieAttachment = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_attachment.xml", gMenuHolder); + gPieAttachment = LLUICtrlFactory::getInstance()->createFromFile("menu_pie_attachment.xml", gMenuHolder); - gPieLand = LLUICtrlFactory::getInstance()->buildPieMenu("menu_pie_land.xml", gMenuHolder); + gPieLand = LLUICtrlFactory::getInstance()->createFromFile("menu_pie_land.xml", gMenuHolder); /// /// set up the colors /// LLColor4 color; - LLColor4 pie_color = gColors.getColor("PieMenuBgColor"); - gPieSelf->setBackgroundColor( pie_color ); - gPieAvatar->setBackgroundColor( pie_color ); - gPieObject->setBackgroundColor( pie_color ); - gPieAttachment->setBackgroundColor( pie_color ); - gPieLand->setBackgroundColor( pie_color ); + LLColor4 context_menu_color = gSavedSkinSettings.getColor("MenuPopupBgColor"); + + gPieSelf->setBackgroundColor( context_menu_color ); + gPieAvatar->setBackgroundColor( context_menu_color ); + gPieObject->setBackgroundColor( context_menu_color ); + gPieAttachment->setBackgroundColor( context_menu_color ); + + gPieLand->setBackgroundColor( context_menu_color ); - color = gColors.getColor( "MenuPopupBgColor" ); + color = gSavedSkinSettings.getColor( "MenuPopupBgColor" ); gPopupMenuView->setBackgroundColor( color ); // If we are not in production, use a different color to make it apparent. if (LLViewerLogin::getInstance()->isInProductionGrid()) { - color = gColors.getColor( "MenuBarBgColor" ); + color = gSavedSkinSettings.getColor( "MenuBarBgColor" ); } else { - color = gColors.getColor( "MenuNonProductionBgColor" ); + color = gSavedSkinSettings.getColor( "MenuNonProductionBgColor" ); } - gMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_viewer.xml", gMenuHolder); + gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile("menu_viewer.xml", gMenuHolder); gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT)); gMenuBarView->setBackgroundColor( color ); - // gMenuBarView->setItemVisible("Tools", FALSE); - gMenuBarView->arrange(); - gMenuHolder->addChild(gMenuBarView); // menu holder appears on top of menu bar so you can see the menu title @@ -659,6 +557,7 @@ void init_menus() LLViewerLogin::getInstance()->isInProductionGrid()); // Assume L$10 for now, the server will tell us the real cost at login + // *TODO:Also fix cost in llfolderview.cpp for Inventory menus const std::string upload_cost("10"); gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost); gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost); @@ -670,817 +569,1866 @@ void init_menus() gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE); - // TomY TODO convert these two - LLMenuGL*menu; - - menu = new LLMenuGL(CLIENT_MENU_NAME); - init_client_menu(menu); - gMenuBarView->appendMenu( menu ); - menu->updateParent(LLMenuGL::sMenuContainer); - - menu = new LLMenuGL(SERVER_MENU_NAME); - init_server_menu(menu); - gMenuBarView->appendMenu( menu ); - menu->updateParent(LLMenuGL::sMenuContainer); - gMenuBarView->createJumpKeys(); // Let land based option enable when parcel changes gMenuParcelObserver = new LLMenuParcelObserver(); - // - // Debug menu visiblity - // - show_debug_menus(); - - gLoginMenuBarView = (LLMenuBarGL*)LLUICtrlFactory::getInstance()->buildMenu("menu_login.xml", gMenuHolder); + gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile("menu_login.xml", gMenuHolder); + gLoginMenuBarView->arrangeAndClear(); LLRect menuBarRect = gLoginMenuBarView->getRect(); gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop, gViewerWindow->getRootView()->getRect().getWidth() - menuBarRect.mLeft, menuBarRect.mBottom)); - gLoginMenuBarView->setBackgroundColor( color ); - gMenuHolder->addChild(gLoginMenuBarView); } +/////////////////// +// SHOW CONSOLES // +/////////////////// -void init_client_menu(LLMenuGL* menu) +class LLAdvancedToggleConsole : public view_listener_t { - LLMenuGL* sub_menu = NULL; - - //menu->append(new LLMenuItemCallGL("Permissions Control", &show_permissions_control)); - // this is now in the view menu so we don't need it here! - + bool handleEvent(const LLSD& userdata) { - // *TODO: Translate - LLMenuGL* sub = new LLMenuGL("Consoles"); - menu->appendMenu(sub); - sub->append(new LLMenuItemCheckGL("Frame Console", - &toggle_visibility, - NULL, - &get_visibility, - (void*)gDebugView->mFrameStatView, - '2', MASK_CONTROL|MASK_SHIFT ) ); - sub->append(new LLMenuItemCheckGL("Texture Console", - &toggle_visibility, - NULL, - &get_visibility, - (void*)gTextureView, - '3', MASK_CONTROL|MASK_SHIFT ) ); - LLView* debugview = gDebugView->mDebugConsolep; - sub->append(new LLMenuItemCheckGL("Debug Console", - &toggle_visibility, - NULL, - &get_visibility, - debugview, - '4', MASK_CONTROL|MASK_SHIFT ) ); - - sub->append(new LLMenuItemCheckGL("Fast Timers", - &toggle_visibility, - NULL, - &get_visibility, - (void*)gDebugView->mFastTimerView, - '9', MASK_CONTROL|MASK_SHIFT ) ); + std::string console_type = userdata.asString(); + if ("texture" == console_type) + { + toggle_visibility( (void*)gTextureView ); + } + else if ("debug" == console_type) + { + toggle_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) ); + } + else if ("fast timers" == console_type) + { + toggle_visibility( (void*)gDebugView->mFastTimerView ); + } #if MEM_TRACK_MEM - sub->append(new LLMenuItemCheckGL("Memory", - &toggle_visibility, - NULL, - &get_visibility, - (void*)gDebugView->mMemoryView, - '0', MASK_CONTROL|MASK_SHIFT ) ); + else if ("memory view" == console_type) + { + toggle_visibility( (void*)gDebugView->mMemoryView ); + } #endif - - sub->appendSeparator(); - - // Debugging view for unified notifications - sub->append(new LLMenuItemCallGL("Notifications Console...", - &handle_show_notifications_console, NULL, NULL, '5', MASK_CONTROL|MASK_SHIFT )); - - - sub->appendSeparator(); - - sub->append(new LLMenuItemCallGL("Region Info to Debug Console", - &handle_region_dump_settings, NULL)); - sub->append(new LLMenuItemCallGL("Group Info to Debug Console", - &handle_dump_group_info, NULL, NULL)); - sub->append(new LLMenuItemCallGL("Capabilities Info to Debug Console", - &handle_dump_capabilities_info, NULL, NULL)); - sub->createJumpKeys(); + else if ("notifications" == console_type) + { + LLFloaterNotificationConsole::showInstance(); + } + return true; } - - // neither of these works particularly well at the moment - /*menu->append(new LLMenuItemCallGL( "Reload UI XML", &reload_ui, - NULL, NULL) );*/ - /*menu->append(new LLMenuItemCallGL("Reload settings/colors", - &handle_reload_settings, NULL, NULL));*/ - menu->append(new LLMenuItemCallGL("Reload personal setting overrides", - &reload_personal_settings_overrides, NULL, NULL, KEY_F12, MASK_CONTROL|MASK_SHIFT)); - - sub_menu = new LLMenuGL("HUD Info"); - { - sub_menu->append(new LLMenuItemCheckGL("Velocity", - &toggle_visibility, - NULL, - &get_visibility, - (void*)gVelocityBar)); - - sub_menu->append(new LLMenuItemToggleGL("Camera", &gDisplayCameraPos ) ); - sub_menu->append(new LLMenuItemToggleGL("Wind", &gDisplayWindInfo) ); - sub_menu->append(new LLMenuItemToggleGL("FOV", &gDisplayFOV ) ); - sub_menu->createJumpKeys(); - } - menu->appendMenu(sub_menu); - - menu->appendSeparator(); - - menu->append(new LLMenuItemCheckGL( "High-res Snapshot", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"HighResSnapshot")); - - menu->append(new LLMenuItemCheckGL( "Quiet Snapshots to Disk", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"QuietSnapshotsToDisk")); - - menu->append(new LLMenuItemCheckGL("Show Mouselook Crosshairs", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"ShowCrosshairs")); - - menu->append(new LLMenuItemCheckGL("Debug Permissions", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"DebugPermissions")); - - - -#ifdef TOGGLE_HACKED_GODLIKE_VIEWER - if (!LLViewerLogin::getInstance()->isInProductionGrid()) +}; +class LLAdvancedCheckConsole : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) { - menu->append(new LLMenuItemCheckGL("Hacked Godmode", - &handle_toggle_hacked_godmode, - NULL, - &check_toggle_hacked_godmode, - (void*)"HackedGodmode")); - } + std::string console_type = userdata.asString(); + bool new_value = false; + if ("texture" == console_type) + { + new_value = get_visibility( (void*)gTextureView ); + } + else if ("debug" == console_type) + { + new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) ); + } + else if ("fast timers" == console_type) + { + new_value = get_visibility( (void*)gDebugView->mFastTimerView ); + } +#if MEM_TRACK_MEM + else if ("memory view" == console_type) + { + new_value = get_visibility( (void*)gDebugView->mMemoryView ); + } #endif - menu->append(new LLMenuItemCallGL("Clear Group Cache", - LLGroupMgr::debugClearAllGroups)); - menu->appendSeparator(); - - sub_menu = new LLMenuGL("Rendering"); - init_debug_rendering_menu(sub_menu); - menu->appendMenu(sub_menu); - - sub_menu = new LLMenuGL("World"); - init_debug_world_menu(sub_menu); - menu->appendMenu(sub_menu); + return new_value; + } +}; - sub_menu = new LLMenuGL("UI"); - init_debug_ui_menu(sub_menu); - menu->appendMenu(sub_menu); - sub_menu = new LLMenuGL("XUI"); - init_debug_xui_menu(sub_menu); - menu->appendMenu(sub_menu); +////////////////////////// +// DUMP INFO TO CONSOLE // +////////////////////////// - sub_menu = new LLMenuGL("Character"); - init_debug_avatar_menu(sub_menu); - menu->appendMenu(sub_menu); +class LLAdvancedDumpInfoToConsole : public view_listener_t { - LLMenuGL* sub = NULL; - sub = new LLMenuGL("Network"); - - sub->append(new LLMenuItemCallGL("Enable Message Log", - &handle_viewer_enable_message_log, NULL)); - sub->append(new LLMenuItemCallGL("Disable Message Log", - &handle_viewer_disable_message_log, NULL)); - - sub->appendSeparator(); + bool handleEvent(const LLSD& userdata) + { + std::string info_type = userdata.asString(); + if ("region" == info_type) + { + handle_region_dump_settings(NULL); + } + else if ("group" == info_type) + { + handle_dump_group_info(NULL); + } + else if ("capabilities" == info_type) + { + handle_dump_capabilities_info(NULL); + } + return true; + } +}; - sub->append(new LLMenuItemCheckGL("Velocity Interpolate Objects", - &velocity_interpolate, - NULL, - &menu_check_control, - (void*)"VelocityInterpolate")); - sub->append(new LLMenuItemCheckGL("Ping Interpolate Object Positions", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"PingInterpolate")); - sub->appendSeparator(); +////////////// +// HUD INFO // +////////////// - sub->append(new LLMenuItemCallGL("Drop a Packet", - &drop_packet, NULL, NULL, - 'L', MASK_ALT | MASK_CONTROL)); - menu->appendMenu( sub ); - sub->createJumpKeys(); - } +class LLAdvancedToggleHUDInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) { - LLMenuGL* sub = NULL; - sub = new LLMenuGL("Recorder"); - - sub->append(new LLMenuItemCheckGL("Full Session Logging", &menu_toggle_control, NULL, &menu_check_control, (void*)"StatsSessionTrackFrameStats")); - - sub->append(new LLMenuItemCallGL("Start Logging", &LLFrameStats::startLogging, NULL)); - sub->append(new LLMenuItemCallGL("Stop Logging", &LLFrameStats::stopLogging, NULL)); - sub->append(new LLMenuItemCallGL("Log 10 Seconds", &LLFrameStats::timedLogging10, NULL)); - sub->append(new LLMenuItemCallGL("Log 30 Seconds", &LLFrameStats::timedLogging30, NULL)); - sub->append(new LLMenuItemCallGL("Log 60 Seconds", &LLFrameStats::timedLogging60, NULL)); - sub->appendSeparator(); - sub->append(new LLMenuItemCallGL("Start Playback", &LLAgentPilot::startPlayback, NULL)); - sub->append(new LLMenuItemCallGL("Stop Playback", &LLAgentPilot::stopPlayback, NULL)); - sub->append(new LLMenuItemToggleGL("Loop Playback", &LLAgentPilot::sLoop) ); - sub->append(new LLMenuItemCallGL("Start Record", &LLAgentPilot::startRecord, NULL)); - sub->append(new LLMenuItemCallGL("Stop Record", &LLAgentPilot::saveRecord, NULL)); + std::string info_type = userdata.asString(); - menu->appendMenu( sub ); - sub->createJumpKeys(); + if ("camera" == info_type) + { + gDisplayCameraPos = !(gDisplayCameraPos); + } + else if ("wind" == info_type) + { + gDisplayWindInfo = !(gDisplayWindInfo); + } + else if ("fov" == info_type) + { + gDisplayFOV = !(gDisplayFOV); + } + return true; } +}; - menu->appendSeparator(); - - menu->append(new LLMenuItemToggleGL("Show Updates", - &gShowObjectUpdates)); - - menu->appendSeparator(); - - menu->append(new LLMenuItemCallGL("Compress Images...", - &handle_compress_image, NULL, NULL)); - - menu->append(new LLMenuItemCheckGL("Limit Select Distance", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"LimitSelectDistance")); - - menu->append(new LLMenuItemCheckGL("Disable Camera Constraints", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"DisableCameraConstraints")); - - menu->append(new LLMenuItemCheckGL("Mouse Smoothing", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*) "MouseSmooth")); - menu->appendSeparator(); - - menu->append(new LLMenuItemCheckGL( "Console Window", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"ShowConsoleWindow")); - - if(gSavedSettings.getBOOL("QAMode")) - { - LLMenuGL* sub = NULL; - sub = new LLMenuGL("Debugging"); -#if LL_WINDOWS - sub->append(new LLMenuItemCallGL("Force Breakpoint", &force_error_breakpoint, NULL, NULL, 'B', MASK_CONTROL | MASK_ALT)); -#endif - sub->append(new LLMenuItemCallGL("Force LLError And Crash", &force_error_llerror)); - sub->append(new LLMenuItemCallGL("Force Bad Memory Access", &force_error_bad_memory_access)); - sub->append(new LLMenuItemCallGL("Force Infinite Loop", &force_error_infinite_loop)); - sub->append(new LLMenuItemCallGL("Force Driver Crash", &force_error_driver_crash)); - sub->append(new LLMenuItemCallGL("Force Disconnect Viewer", &handle_disconnect_viewer)); - // *NOTE:Mani this isn't handled yet... sub->append(new LLMenuItemCallGL("Force Software Exception", &force_error_unhandled_exception)); - sub->createJumpKeys(); - menu->appendMenu(sub); +class LLAdvancedCheckHUDInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string info_type = userdata.asString(); + bool new_value = false; + if ("camera" == info_type) + { + new_value = gDisplayCameraPos; + } + else if ("wind" == info_type) + { + new_value = gDisplayWindInfo; + } + else if ("fov" == info_type) + { + new_value = gDisplayFOV; + } + return new_value; } +}; - menu->append(new LLMenuItemCheckGL( "Output Debug Minidump", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"SaveMinidump")); - - menu->append(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); - menu->append(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT)); - - menu->append(new LLMenuItemCallGL("Request Admin Status", - &handle_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_CONTROL)); +/////////////////////// +// CLEAR GROUP CACHE // +/////////////////////// - menu->append(new LLMenuItemCallGL("Leave Admin Status", - &handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL)); +class LLAdvancedClearGroupCache : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLGroupMgr::debugClearAllGroups(NULL); + return true; + } +}; - menu->createJumpKeys(); -} -void init_debug_world_menu(LLMenuGL* menu) -{ -/* REMOVE mouse move sun from menu options - menu->append(new LLMenuItemCheckGL("Mouse Moves Sun", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"MouseSun", - 'M', MASK_CONTROL|MASK_ALT)); -*/ - menu->append(new LLMenuItemCheckGL("Sim Sun Override", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"SkyOverrideSimSunPosition")); - menu->append(new LLMenuItemCallGL("Dump Scripted Camera", - &handle_dump_followcam, NULL, NULL)); - menu->append(new LLMenuItemCheckGL("Fixed Weather", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"FixedWeather")); - menu->append(new LLMenuItemCallGL("Dump Region Object Cache", - &handle_dump_region_object_cache, NULL, NULL)); - menu->createJumpKeys(); -} -void handle_export_menus_to_xml(void*) +///////////////// +// RENDER TYPE // +///////////////// +U32 render_type_from_string(std::string render_type) { - - LLFilePicker& picker = LLFilePicker::instance(); - if(!picker.getSaveFile(LLFilePicker::FFSAVE_XML)) + if ("simple" == render_type) { - llwarns << "No file" << llendl; - return; + return LLPipeline::RENDER_TYPE_SIMPLE; + } + else if ("alpha" == render_type) + { + return LLPipeline::RENDER_TYPE_ALPHA; + } + else if ("tree" == render_type) + { + return LLPipeline::RENDER_TYPE_TREE; + } + else if ("character" == render_type) + { + return LLPipeline::RENDER_TYPE_AVATAR; + } + else if ("surfacePath" == render_type) + { + return LLPipeline::RENDER_TYPE_TERRAIN; + } + else if ("sky" == render_type) + { + return LLPipeline::RENDER_TYPE_SKY; + } + else if ("water" == render_type) + { + return LLPipeline::RENDER_TYPE_WATER; + } + else if ("ground" == render_type) + { + return LLPipeline::RENDER_TYPE_GROUND; + } + else if ("volume" == render_type) + { + return LLPipeline::RENDER_TYPE_VOLUME; + } + else if ("grass" == render_type) + { + return LLPipeline::RENDER_TYPE_GRASS; + } + else if ("clouds" == render_type) + { + return LLPipeline::RENDER_TYPE_CLOUDS; + } + else if ("particles" == render_type) + { + return LLPipeline::RENDER_TYPE_PARTICLES; + } + else if ("bump" == render_type) + { + return LLPipeline::RENDER_TYPE_BUMP; + } + else + { + return 0; } - std::string filename = picker.getFirstFile(); - - llofstream out(filename); - LLXMLNodePtr node = gMenuBarView->getXML(); - node->writeToOstream(out); - out.close(); } -extern BOOL gDebugClicks; -extern BOOL gDebugWindowProc; -extern BOOL gDebugTextEditorTips; -extern BOOL gDebugSelectMgr; - -void init_debug_ui_menu(LLMenuGL* menu) -{ - menu->append(new LLMenuItemCheckGL("Rotate Mini-Map", menu_toggle_control, NULL, menu_check_control, (void*)"MiniMapRotate")); - menu->append(new LLMenuItemCheckGL("Use default system color picker", menu_toggle_control, NULL, menu_check_control, (void*)"UseDefaultColorPicker")); - menu->append(new LLMenuItemCheckGL("Show search panel in overlay bar", menu_toggle_control, NULL, menu_check_control, (void*)"ShowSearchBar")); - menu->appendSeparator(); - - menu->append(new LLMenuItemCallGL("Web Browser Test", &handle_web_browser_test)); - // commented out until work is complete: DEV-32268 - // menu->append(new LLMenuItemCallGL("Buy Currency Test", &handle_buy_currency_test)); - menu->append(new LLMenuItemCallGL("Editable UI", &edit_ui)); - menu->append(new LLMenuItemCallGL( "Dump SelectMgr", &dump_select_mgr)); - menu->append(new LLMenuItemCallGL( "Dump Inventory", &dump_inventory)); - menu->append(new LLMenuItemCallGL( "Dump Focus Holder", &handle_dump_focus, NULL, NULL, 'F', MASK_ALT | MASK_CONTROL)); - menu->append(new LLMenuItemCallGL( "Print Selected Object Info", &print_object_info, NULL, NULL, 'P', MASK_CONTROL|MASK_SHIFT )); - menu->append(new LLMenuItemCallGL( "Print Agent Info", &print_agent_nvpairs, NULL, NULL, 'P', MASK_SHIFT )); - menu->append(new LLMenuItemCallGL( "Memory Stats", &output_statistics, NULL, NULL, 'M', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - menu->append(new LLMenuItemCheckGL("Double-Click Auto-Pilot", - menu_toggle_control, NULL, menu_check_control, - (void*)"DoubleClickAutoPilot")); - menu->appendSeparator(); -// menu->append(new LLMenuItemCallGL( "Print Packets Lost", &print_packets_lost, NULL, NULL, 'L', MASK_SHIFT )); - menu->append(new LLMenuItemToggleGL("Debug SelectMgr", &gDebugSelectMgr)); - menu->append(new LLMenuItemToggleGL("Debug Clicks", &gDebugClicks)); - menu->append(new LLMenuItemToggleGL("Debug Views", &LLView::sDebugRects)); - menu->append(new LLMenuItemCheckGL("Show Name Tooltips", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); - menu->append(new LLMenuItemToggleGL("Debug Mouse Events", &LLView::sDebugMouseHandling)); - menu->append(new LLMenuItemToggleGL("Debug Keys", &LLView::sDebugKeys)); - menu->append(new LLMenuItemToggleGL("Debug WindowProc", &gDebugWindowProc)); - menu->append(new LLMenuItemToggleGL("Debug Text Editor Tips", &gDebugTextEditorTips)); - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Show Time", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowTime")); - menu->append(new LLMenuItemCheckGL("Show Render Info", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderInfo")); - menu->append(new LLMenuItemCheckGL("Show Matrices", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderMatrices")); - menu->append(new LLMenuItemCheckGL("Show Color Under Cursor", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowColor")); - - menu->createJumpKeys(); -} -void init_debug_xui_menu(LLMenuGL* menu) +class LLAdvancedToggleRenderType : public view_listener_t { - menu->append(new LLMenuItemCallGL("Floater Test...", LLFloaterTest::show)); - menu->append(new LLMenuItemCallGL("Font Test...", LLFloaterFontTest::show)); - menu->append(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml)); - menu->append(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show)); - menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml)); - menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml)); - menu->append(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL)); + bool handleEvent(const LLSD& userdata) + { + U32 render_type = render_type_from_string( userdata.asString() ); + if ( render_type != 0 ) + { + LLPipeline::toggleRenderTypeControl( (void*)render_type ); + } + return true; + } +}; - //menu->append(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency)); - menu->createJumpKeys(); -} -void init_debug_rendering_menu(LLMenuGL* menu) +class LLAdvancedCheckRenderType : public view_listener_t { - LLMenuGL* sub_menu = NULL; - - /////////////////////////// - // - // Debug menu for types/pools - // - sub_menu = new LLMenuGL("Types"); - menu->appendMenu(sub_menu); - - sub_menu->append(new LLMenuItemCheckGL("Simple", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_SIMPLE, '1', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Alpha", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_ALPHA, '2', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Tree", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_TREE, '3', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Character", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_AVATAR, '4', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("SurfacePatch", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_TERRAIN, '5', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Sky", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_SKY, '6', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Water", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_WATER, '7', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Ground", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_GROUND, '8', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Volume", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_VOLUME, '9', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Grass", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_GRASS, '0', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Clouds", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_CLOUDS, '-', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Particles", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_PARTICLES, '`', MASK_ALT|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Bump", - &LLPipeline::toggleRenderTypeControl, NULL, - &LLPipeline::hasRenderTypeControl, - (void*)LLPipeline::RENDER_TYPE_BUMP, '\\', MASK_ALT|MASK_SHIFT)); - - sub_menu->createJumpKeys(); - sub_menu = new LLMenuGL("Features"); - menu->appendMenu(sub_menu); - sub_menu->append(new LLMenuItemCheckGL("UI", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_UI, KEY_F1, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Selected", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_SELECTED, KEY_F2, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Highlighted", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED, KEY_F3, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Dynamic Textures", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES, KEY_F4, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL( "Foot Shadows", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS, KEY_F5, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Fog", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FOG, KEY_F6, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL("Test FRInfo", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO, KEY_F8, MASK_CONTROL|MASK_SHIFT)); - sub_menu->append(new LLMenuItemCheckGL( "Flexible Objects", - &LLPipeline::toggleRenderDebugFeature, NULL, - &LLPipeline::toggleRenderDebugFeatureControl, - (void*)LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE, KEY_F9, MASK_CONTROL|MASK_SHIFT)); - sub_menu->createJumpKeys(); - - ///////////////////////////// - // - // Debug menu for info displays - // - sub_menu = new LLMenuGL("Info Displays"); - menu->appendMenu(sub_menu); - - sub_menu->append(new LLMenuItemCheckGL("Verify", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_VERIFY)); - sub_menu->append(new LLMenuItemCheckGL("BBoxes", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_BBOXES)); - sub_menu->append(new LLMenuItemCheckGL("Points", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_POINTS)); - sub_menu->append(new LLMenuItemCheckGL("Octree", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_OCTREE)); - sub_menu->append(new LLMenuItemCheckGL("Shadow Frusta", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)); - sub_menu->append(new LLMenuItemCheckGL("Occlusion", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_OCCLUSION)); - sub_menu->append(new LLMenuItemCheckGL("Render Batches", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_BATCH_SIZE)); - sub_menu->append(new LLMenuItemCheckGL("Animated Textures", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_TEXTURE_ANIM)); - sub_menu->append(new LLMenuItemCheckGL("Texture Priority", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)); - sub_menu->append(new LLMenuItemCheckGL("Avatar Rendering Cost", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_SHAME)); - sub_menu->append(new LLMenuItemCheckGL("Texture Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_TEXTURE_AREA)); - sub_menu->append(new LLMenuItemCheckGL("Face Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_FACE_AREA)); - sub_menu->append(new LLMenuItemCheckGL("Lights", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_LIGHTS)); - sub_menu->append(new LLMenuItemCheckGL("Particles", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_PARTICLES)); - sub_menu->append(new LLMenuItemCheckGL("Composition", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_COMPOSITION)); - sub_menu->append(new LLMenuItemCheckGL("Glow",&LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_GLOW)); - sub_menu->append(new LLMenuItemCheckGL("Raycasting", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_RAYCAST)); - sub_menu->append(new LLMenuItemCheckGL("Sculpt", &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_SCULPTED)); - - sub_menu->append(new LLMenuItemCallGL("Vectorize Perf Test", &run_vectorize_perf_test)); - - sub_menu = new LLMenuGL("Render Tests"); - - sub_menu->append(new LLMenuItemCheckGL("Camera Offset", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"CameraOffset")); - - sub_menu->append(new LLMenuItemToggleGL("Randomize Framerate", &gRandomizeFramerate)); - - sub_menu->append(new LLMenuItemToggleGL("Periodic Slow Frame", &gPeriodicSlowFrame)); - - sub_menu->append(new LLMenuItemToggleGL("Frame Test", &LLPipeline::sRenderFrameTest)); - - sub_menu->createJumpKeys(); - - menu->appendMenu( sub_menu ); + bool handleEvent(const LLSD& userdata) + { + U32 render_type = render_type_from_string( userdata.asString() ); + bool new_value = false; - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Axes", menu_toggle_control, NULL, menu_check_control, (void*)"ShowAxes")); -// menu->append(new LLMenuItemCheckGL("Cull Small Objects", toggle_cull_small, NULL, menu_check_control, (void*)"RenderCullBySize")); + if ( render_type != 0 ) + { + new_value = LLPipeline::hasRenderTypeControl( (void*)render_type ); + } - menu->appendSeparator(); - menu->append(new LLMenuItemToggleGL("Hide Selected", &gHideSelectedObjects)); - menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL("Tangent Basis", menu_toggle_control, NULL, menu_check_control, (void*)"ShowTangentBasis")); - menu->append(new LLMenuItemCallGL("Selected Texture Info", handle_selected_texture_info, NULL, NULL, 'T', MASK_CONTROL|MASK_SHIFT|MASK_ALT)); - //menu->append(new LLMenuItemCallGL("Dump Image List", handle_dump_image_list, NULL, NULL, 'I', MASK_CONTROL|MASK_SHIFT)); - - menu->append(new LLMenuItemToggleGL("Wireframe", &gUseWireframe, - 'R', MASK_CONTROL|MASK_SHIFT)); + return new_value; + } +}; - LLMenuItemCheckGL* item; - item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); - item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); - menu->append(item); - item = new LLMenuItemCheckGL("Debug GL", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugGL"); - menu->append(item); - - item = new LLMenuItemCheckGL("Debug Pipeline", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugPipeline"); - menu->append(item); - - item = new LLMenuItemCheckGL("Fast Alpha", menu_toggle_control, NULL, menu_check_control, (void*)"RenderFastAlpha"); - menu->append(item); - - item = new LLMenuItemCheckGL("Animate Textures", menu_toggle_control, NULL, menu_check_control, (void*)"AnimateTextures"); - menu->append(item); - - item = new LLMenuItemCheckGL("Disable Textures", menu_toggle_variable, NULL, menu_check_variable, (void*)&LLViewerImage::sDontLoadVolumeTextures); - menu->append(item); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - item = new LLMenuItemCheckGL("HTTP Get Textures", menu_toggle_control, NULL, menu_check_control, (void*)"ImagePipelineUseHTTP"); - menu->append(item); -#endif - - item = new LLMenuItemCheckGL("Run Multiple Threads", menu_toggle_control, NULL, menu_check_control, (void*)"RunMultipleThreads"); - menu->append(item); +///////////// +// FEATURE // +///////////// +U32 feature_from_string(std::string feature) +{ + if ("ui" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_UI; + } + else if ("selected" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_SELECTED; + } + else if ("highlighted" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED; + } + else if ("dynamic textures" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES; + } + else if ("foot shadows" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS; + } + else if ("fog" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_FOG; + } + else if ("fr info" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO; + } + else if ("flexible" == feature) + { + return LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE; + } + else + { + return 0; + } +}; - item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon"); - menu->append(item); - item = new LLMenuItemCheckGL("Attached Lights", menu_toggle_attached_lights, NULL, menu_check_control, (void*)"RenderAttachedLights"); - menu->append(item); +class LLAdvancedToggleFeature : public view_listener_t{ + bool handleEvent(const LLSD& userdata) + { + U32 feature = feature_from_string( userdata.asString() ); + if ( feature != 0 ) + { + LLPipeline::toggleRenderDebugFeature( (void*)feature ); + } + return true; + } +}; - item = new LLMenuItemCheckGL("Attached Particles", menu_toggle_attached_particles, NULL, menu_check_control, (void*)"RenderAttachedParticles"); - menu->append(item); +class LLAdvancedCheckFeature : public view_listener_t +{bool handleEvent(const LLSD& userdata) +{ + U32 feature = feature_from_string( userdata.asString() ); + bool new_value = false; -#ifndef LL_RELEASE_FOR_DOWNLOAD - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL)); -#else - if(gSavedSettings.getBOOL("QAMode")) + if ( feature != 0 ) { - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL("Memory Leaking Simulation", LLFloaterMemLeak::show, NULL, NULL)); + new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature ); } -#endif - - menu->createJumpKeys(); -} - -void init_debug_avatar_menu(LLMenuGL* menu) -{ - LLMenuGL* sub_menu = new LLMenuGL("Grab Baked Texture"); - init_debug_baked_texture_menu(sub_menu); - menu->appendMenu(sub_menu); - - sub_menu = new LLMenuGL("Character Tests"); - sub_menu->append(new LLMenuItemCheckGL("Go Away/AFK When Idle", - menu_toggle_control, - NULL, - menu_check_control, - (void*)"AllowIdleAFK")); - - sub_menu->append(new LLMenuItemCallGL("Appearance To XML", - &LLVOAvatar::dumpArchetypeXML)); - - // HACK for easy testing of avatar geometry - sub_menu->append(new LLMenuItemCallGL( "Toggle Character Geometry", - &handle_god_request_avatar_geometry, &enable_god_customer_service, NULL)); - - sub_menu->append(new LLMenuItemCallGL("Test Male", - handle_test_male)); - - sub_menu->append(new LLMenuItemCallGL("Test Female", - handle_test_female)); - - sub_menu->append(new LLMenuItemCallGL("Toggle PG", handle_toggle_pg)); - - sub_menu->append(new LLMenuItemToggleGL("Allow Select Avatar", &gAllowSelectAvatar)); - sub_menu->createJumpKeys(); - - menu->appendMenu(sub_menu); - - menu->append(new LLMenuItemCheckGL("Enable Lip Sync (Beta)", menu_toggle_control, NULL, menu_check_control, (void*)"LipSyncEnabled")); - menu->append(new LLMenuItemToggleGL("Tap-Tap-Hold To Run", &gAllowTapTapHoldRun)); - menu->append(new LLMenuItemCallGL("Force Params to Default", &LLAgent::clearVisualParams, NULL)); - menu->append(new LLMenuItemCallGL("Reload Vertex Shader", &reload_vertex_shader, NULL)); - menu->append(new LLMenuItemToggleGL("Animation Info", &LLVOAvatar::sShowAnimationDebug)); - menu->append(new LLMenuItemCallGL("Slow Motion Animations", &slow_mo_animations, NULL)); - menu->append(new LLMenuItemToggleGL("Show Look At", &LLHUDEffectLookAt::sDebugLookAt)); - menu->append(new LLMenuItemToggleGL("Show Point At", &LLHUDEffectPointAt::sDebugPointAt)); - menu->append(new LLMenuItemToggleGL("Debug Joint Updates", &LLVOAvatar::sJointDebug)); - menu->append(new LLMenuItemToggleGL("Disable LOD", &LLViewerJoint::sDisableLOD)); - menu->append(new LLMenuItemToggleGL("Debug Character Vis", &LLVOAvatar::sDebugInvisible)); - //menu->append(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints)); - //diabling collision plane due to DEV-14477 -brad - //menu->append(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane)); - menu->append(new LLMenuItemCheckGL("Show Collision Skeleton", - &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_AVATAR_VOLUME)); - menu->append(new LLMenuItemCheckGL("Display Agent Target", - &LLPipeline::toggleRenderDebug, NULL, - &LLPipeline::toggleRenderDebugControl, - (void*)LLPipeline::RENDER_DEBUG_AGENT_TARGET)); - menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); - menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); - menu->append(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); -#ifndef LL_RELEASE_FOR_DOWNLOAD - menu->append(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT)); - menu->append(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT )); -#endif - menu->createJumpKeys(); -} -void init_debug_baked_texture_menu(LLMenuGL* menu) -{ - menu->append(new LLMenuItemCallGL("Iris", handle_grab_texture, enable_grab_texture, (void*) TEX_EYES_BAKED)); - menu->append(new LLMenuItemCallGL("Head", handle_grab_texture, enable_grab_texture, (void*) TEX_HEAD_BAKED)); - menu->append(new LLMenuItemCallGL("Upper Body", handle_grab_texture, enable_grab_texture, (void*) TEX_UPPER_BAKED)); - menu->append(new LLMenuItemCallGL("Lower Body", handle_grab_texture, enable_grab_texture, (void*) TEX_LOWER_BAKED)); - menu->append(new LLMenuItemCallGL("Skirt", handle_grab_texture, enable_grab_texture, (void*) TEX_SKIRT_BAKED)); - menu->append(new LLMenuItemCallGL("Hair", handle_grab_texture, enable_grab_texture, (void*) TEX_HAIR_BAKED)); - menu->createJumpKeys(); + return new_value; } +}; -void init_server_menu(LLMenuGL* menu) + +////////////////// +// INFO DISPLAY // +////////////////// +U32 info_display_from_string(std::string info_display) +{ + if ("verify" == info_display) + { + return LLPipeline::RENDER_DEBUG_VERIFY; + } + else if ("bboxes" == info_display) + { + return LLPipeline::RENDER_DEBUG_BBOXES; + } + else if ("points" == info_display) + { + return LLPipeline::RENDER_DEBUG_POINTS; + } + else if ("octree" == info_display) + { + return LLPipeline::RENDER_DEBUG_OCTREE; + } + else if ("shadow frusta" == info_display) + { + return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA; + } + else if ("occlusion" == info_display) + { + return LLPipeline::RENDER_DEBUG_OCCLUSION; + } + else if ("render batches" == info_display) + { + return LLPipeline::RENDER_DEBUG_BATCH_SIZE; + } + else if ("texture anim" == info_display) + { + return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM; + } + else if ("texture priority" == info_display) + { + return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY; + } + else if ("shame" == info_display) + { + return LLPipeline::RENDER_DEBUG_SHAME; + } + else if ("texture area" == info_display) + { + return LLPipeline::RENDER_DEBUG_TEXTURE_AREA; + } + else if ("face area" == info_display) + { + return LLPipeline::RENDER_DEBUG_FACE_AREA; + } + else if ("lights" == info_display) + { + return LLPipeline::RENDER_DEBUG_LIGHTS; + } + else if ("particles" == info_display) + { + return LLPipeline::RENDER_DEBUG_PARTICLES; + } + else if ("composition" == info_display) + { + return LLPipeline::RENDER_DEBUG_COMPOSITION; + } + else if ("glow" == info_display) + { + return LLPipeline::RENDER_DEBUG_GLOW; + } + else if ("collision skeleton" == info_display) + { + return LLPipeline::RENDER_DEBUG_AVATAR_VOLUME; + } + else if ("agent target" == info_display) + { + return LLPipeline::RENDER_DEBUG_AGENT_TARGET; + } + else + { + return 0; + } +}; + +class LLAdvancedToggleInfoDisplay : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + U32 info_display = info_display_from_string( userdata.asString() ); + + if ( info_display != 0 ) + { + LLPipeline::toggleRenderDebug( (void*)info_display ); + } + + return true; + } +}; + + +class LLAdvancedCheckInfoDisplay : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + U32 info_display = info_display_from_string( userdata.asString() ); + bool new_value = false; + + if ( info_display != 0 ) + { + new_value = LLPipeline::toggleRenderDebugControl( (void*)info_display ); + } + + return new_value; + } +}; + + +/////////////////////////// +//// RANDOMIZE FRAMERATE // +/////////////////////////// + + +class LLAdvancedToggleRandomizeFramerate : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gRandomizeFramerate = !(gRandomizeFramerate); + return true; + } +}; + +class LLAdvancedCheckRandomizeFramerate : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = gRandomizeFramerate; + return new_value; + } +}; + +void run_vectorize_perf_test(void *) +{ + gSavedSettings.setBOOL("VectorizePerfTest", TRUE); +} + + +//////////////////////////////// +// RUN Vectorized Perform Test// +//////////////////////////////// + + +class LLAdvancedVectorizePerfTest : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + run_vectorize_perf_test(NULL); + return true; + } +}; + +/////////////////////////// +//// PERIODIC SLOW FRAME // +/////////////////////////// + + +class LLAdvancedTogglePeriodicSlowFrame : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gPeriodicSlowFrame = !(gPeriodicSlowFrame); + return true; + } +}; + +class LLAdvancedCheckPeriodicSlowFrame : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = gPeriodicSlowFrame; + return new_value; + } +}; + + + +//////////////// +// FRAME TEST // +//////////////// + + +class LLAdvancedToggleFrameTest : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLPipeline::sRenderFrameTest = !(LLPipeline::sRenderFrameTest); + return true; + } +}; + +class LLAdvancedCheckFrameTest : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLPipeline::sRenderFrameTest; + return new_value; + } +}; + + + // +///////////////////////////// +//// HIDE SELECTED OBJECTS // +///////////////////////////// +// +// +//class LLAdvancedToggleHideSelectedObjects : public view_listener_t +//{ +// bool handleEvent(const LLSD& userdata) +// { +// LLSelectMgr::sHideSelectedObjects = !(LLSelectMgr::sHideSelectedObjects); +// return true; +// } +//}; + // +//class LLAdvancedCheckHideSelectedObjects : public view_listener_t +//{ +// bool handleEvent(const LLSD& userdata) +// { +// bool new_value = gHideSelectedObjects; +// return new_value; +// } +//}; + +/////////////////////////// +// SELECTED TEXTURE INFO // +/////////////////////////// + + +class LLAdvancedSelectedTextureInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_selected_texture_info(NULL); + return true; + } +}; + +////////////////////// +// TOGGLE WIREFRAME // +////////////////////// + +class LLAdvancedToggleWireframe : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gUseWireframe = !(gUseWireframe); + return true; + } +}; + +class LLAdvancedCheckWireframe : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = gUseWireframe; + return new_value; + } +}; + +////////////////////// +// DISABLE TEXTURES // +////////////////////// + +class LLAdvancedToggleDisableTextures : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLViewerImage::sDontLoadVolumeTextures = !LLViewerImage::sDontLoadVolumeTextures; + return true; + } +}; + +class LLAdvancedCheckDisableTextures : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLViewerImage::sDontLoadVolumeTextures; // <-- make this using LLCacheControl + return new_value; + } +}; + +////////////////////////// +// DUMP SCRIPTED CAMERA // +////////////////////////// + +class LLAdvancedDumpScriptedCamera : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_dump_followcam(NULL); + return true; +} +}; + + + +////////////////////////////// +// DUMP REGION OBJECT CACHE // +////////////////////////////// + + +class LLAdvancedDumpRegionObjectCache : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) +{ + handle_dump_region_object_cache(NULL); + return true; + } +}; + +class LLAdvancedWebBrowserTest : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_web_browser_test(NULL); + return true; + } +}; + +class LLAdvancedBuyCurrencyTest : public view_listener_t + { + bool handleEvent(const LLSD& userdata) + { + handle_buy_currency_test(NULL); + return true; + } +}; + + +//////////////////////// +// TOGGLE EDITABLE UI // +//////////////////////// + + +class LLAdvancedToggleEditableUI : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + edit_ui(NULL); + return true; + } +}; + + +///////////////////// +// DUMP SELECT MGR // +///////////////////// + + +class LLAdvancedDumpSelectMgr : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + dump_select_mgr(NULL); + return true; + } +}; + + + +//////////////////// +// DUMP INVENTORY // +//////////////////// + + +class LLAdvancedDumpInventory : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + dump_inventory(NULL); + return true; + } +}; + + + +/////////////////////// +// DUMP FOCUS HOLDER // +/////////////////////// + + +class LLAdvancedDumpFocusHolder : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_dump_focus(NULL); + return true; + } +}; + + + +//////////////////////////////// +// PRINT SELECTED OBJECT INFO // +//////////////////////////////// + + +class LLAdvancedPrintSelectedObjectInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + print_object_info(NULL); + return true; + } +}; + + + +////////////////////// +// PRINT AGENT INFO // +////////////////////// + + +class LLAdvancedPrintAgentInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + print_agent_nvpairs(NULL); + return true; + } +}; + + + +//////////////////////////////// +// PRINT TEXTURE MEMORY STATS // +//////////////////////////////// + + +class LLAdvancedPrintTextureMemoryStats : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + output_statistics(NULL); + return true; + } +}; + +////////////////// +// DEBUG CLICKS // +////////////////// + + +class LLAdvancedToggleDebugClicks : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gDebugClicks = !(gDebugClicks); + return true; + } +}; + +class LLAdvancedCheckDebugClicks : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = gDebugClicks; + return new_value; + } +}; + + + +///////////////// +// DEBUG VIEWS // +///////////////// + + +class LLAdvancedToggleDebugViews : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLView::sDebugRects = !(LLView::sDebugRects); + return true; + } +}; + +class LLAdvancedCheckDebugViews : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLView::sDebugRects; + return new_value; + } +}; + + + +/////////////////////// +// XUI NAME TOOLTIPS // +/////////////////////// + + +class LLAdvancedToggleXUINameTooltips : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + toggle_show_xui_names(NULL); + return true; + } +}; + +class LLAdvancedCheckXUINameTooltips : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = check_show_xui_names(NULL); + return new_value; + } +}; + + + +//////////////////////// +// DEBUG MOUSE EVENTS // +//////////////////////// + + +class LLAdvancedToggleDebugMouseEvents : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLView::sDebugMouseHandling = !(LLView::sDebugMouseHandling); + return true; + } +}; + +class LLAdvancedCheckDebugMouseEvents : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLView::sDebugMouseHandling; + return new_value; + } +}; + + + +//////////////// +// DEBUG KEYS // +//////////////// + + +class LLAdvancedToggleDebugKeys : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLView::sDebugKeys = !(LLView::sDebugKeys); + return true; + } +}; + +class LLAdvancedCheckDebugKeys : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLView::sDebugKeys; + return new_value; + } +}; + + + +/////////////////////// +// DEBUG WINDOW PROC // +/////////////////////// + + +class LLAdvancedToggleDebugWindowProc : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gDebugWindowProc = !(gDebugWindowProc); + return true; + } +}; + +class LLAdvancedCheckDebugWindowProc : public view_listener_t + { + bool handleEvent(const LLSD& userdata) + { + bool new_value = gDebugWindowProc; + return new_value; + } +}; + +// ------------------------------XUI MENU --------------------------- + + +class LLAdvancedShowFontTest : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFloaterFontTest::show(NULL); + return true; + } +}; + +////////////////////// +// LOAD UI FROM XML // +////////////////////// + + +class LLAdvancedLoadUIFromXML : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_load_from_xml(NULL); + return true; +} +}; + + + +//////////////////// +// SAVE UI TO XML // +//////////////////// + + +class LLAdvancedSaveUIToXML : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_save_to_xml(NULL); + return true; +} +}; + + + +/////////////// +// XUI NAMES // +/////////////// + + +class LLAdvancedToggleXUINames : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + toggle_show_xui_names(NULL); + return true; + } +}; + +class LLAdvancedCheckXUINames : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = check_show_xui_names(NULL); + return new_value; + } +}; + + +//////////////////////// +// GRAB BAKED TEXTURE // +//////////////////////// + + +class LLAdvancedGrabBakedTexture : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string texture_type = userdata.asString(); + if ("iris" == texture_type) + { + handle_grab_texture( (void*)TEX_EYES_BAKED ); + } + else if ("head" == texture_type) + { + handle_grab_texture( (void*)TEX_HEAD_BAKED ); + } + else if ("upper" == texture_type) + { + handle_grab_texture( (void*)TEX_UPPER_BAKED ); + } + else if ("lower" == texture_type) + { + handle_grab_texture( (void*)TEX_SKIRT_BAKED ); + } + else if ("skirt" == texture_type) + { + handle_grab_texture( (void*)TEX_SKIRT_BAKED ); + } + else if ("hair" == texture_type) + { + handle_grab_texture( (void*)TEX_HAIR_BAKED ); +} + + return true; + } +}; + +class LLAdvancedEnableGrabBakedTexture : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) +{ + std::string texture_type = userdata.asString(); + bool new_value = false; + + if ("iris" == texture_type) + { + new_value = enable_grab_texture( (void*)TEX_EYES_BAKED ); + } + else if ("head" == texture_type) + { + new_value = enable_grab_texture( (void*)TEX_HEAD_BAKED ); + } + else if ("upper" == texture_type) + { + new_value = enable_grab_texture( (void*)TEX_UPPER_BAKED ); + } + else if ("lower" == texture_type) + { + new_value = enable_grab_texture( (void*)TEX_LOWER_BAKED ); + } + else if ("skirt" == texture_type) + { + new_value = enable_grab_texture( (void*)TEX_SKIRT_BAKED ); + } + + return new_value; +} +}; + +/////////////////////// +// APPEARANCE TO XML // +/////////////////////// + + +class LLAdvancedAppearanceToXML : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLVOAvatar::dumpArchetypeXML(NULL); + return true; + } +}; + + + +/////////////////////////////// +// TOGGLE CHARACTER GEOMETRY // +/////////////////////////////// + + +class LLAdvancedToggleCharacterGeometry : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_god_request_avatar_geometry(NULL); + return true; +} +}; + +class LLEnableGodCustomerService : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) +{ + bool new_value = enable_god_customer_service(NULL); + return new_value; + } +}; + + + + ///////////////////////////// +// TEST MALE / TEST FEMALE // +///////////////////////////// + +class LLAdvancedTestMale : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_test_male(NULL); + return true; + } +}; + + +class LLAdvancedTestFemale : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_test_female(NULL); + return true; + } +}; + + + +/////////////// +// TOGGLE PG // +/////////////// + + +class LLAdvancedTogglePG : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_toggle_pg(NULL); + return true; + } +}; + + + +//////////////////////////// +// ALLOW TAP-TAP-HOLD RUN // +//////////////////////////// + + +class LLAdvancedToggleAllowTapTapHoldRun : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gAllowTapTapHoldRun = !(gAllowTapTapHoldRun); + return true; + } +}; + +class LLAdvancedCheckAllowTapTapHoldRun : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = gAllowTapTapHoldRun; + return new_value; + } +}; + + + + + +class LLAdvancedForceParamsToDefault : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLAgent::clearVisualParams(NULL); + return true; + } +}; + + + +////////////////////////// +// RELOAD VERTEX SHADER // +////////////////////////// + + +class LLAdvancedReloadVertexShader : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + reload_vertex_shader(NULL); + return true; + } +}; + + + +//////////////////// +// ANIMATION INFO // +//////////////////// + + +class LLAdvancedToggleAnimationInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLVOAvatar::sShowAnimationDebug = !(LLVOAvatar::sShowAnimationDebug); + return true; + } +}; + +class LLAdvancedCheckAnimationInfo : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLVOAvatar::sShowAnimationDebug; + return new_value; + } +}; + + +////////////////// +// SHOW LOOK AT // +////////////////// + + +class LLAdvancedToggleShowLookAt : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLHUDEffectLookAt::sDebugLookAt = !(LLHUDEffectLookAt::sDebugLookAt); + return true; + } +}; + +class LLAdvancedCheckShowLookAt : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLHUDEffectLookAt::sDebugLookAt; + return new_value; + } +}; + + + +/////////////////// +// SHOW POINT AT // +/////////////////// + + +class LLAdvancedToggleShowPointAt : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLHUDEffectPointAt::sDebugPointAt = !(LLHUDEffectPointAt::sDebugPointAt); + return true; + } +}; + +class LLAdvancedCheckShowPointAt : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLHUDEffectPointAt::sDebugPointAt; + return new_value; + } +}; + + + +///////////////////////// +// DEBUG JOINT UPDATES // +///////////////////////// + + +class LLAdvancedToggleDebugJointUpdates : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLVOAvatar::sJointDebug = !(LLVOAvatar::sJointDebug); + return true; + } +}; + +class LLAdvancedCheckDebugJointUpdates : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLVOAvatar::sJointDebug; + return new_value; + } +}; + + + +///////////////// +// DISABLE LOD // +///////////////// + + +class LLAdvancedToggleDisableLOD : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLViewerJoint::sDisableLOD = !(LLViewerJoint::sDisableLOD); + return true; + } +}; + +class LLAdvancedCheckDisableLOD : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLViewerJoint::sDisableLOD; + return new_value; + } +}; + + + +///////////////////////// +// DEBUG CHARACTER VIS // +///////////////////////// + + +class LLAdvancedToggleDebugCharacterVis : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLVOAvatar::sDebugInvisible = !(LLVOAvatar::sDebugInvisible); + return true; + } +}; + +class LLAdvancedCheckDebugCharacterVis : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLVOAvatar::sDebugInvisible; + return new_value; + } +}; + + +////////////////////// +// DUMP ATTACHMENTS // +////////////////////// + + +class LLAdvancedDumpAttachments : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_dump_attachments(NULL); + return true; + } +}; + + + +///////////////////// +// REBAKE TEXTURES // +///////////////////// + + +class LLAdvancedRebakeTextures : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_rebake_textures(NULL); + return true; + } +}; + + +#ifndef LL_RELEASE_FOR_DOWNLOAD +/////////////////////////// +// DEBUG AVATAR TEXTURES // +/////////////////////////// + + +class LLAdvancedDebugAvatarTextures : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_debug_avatar_textures(NULL); + return true; + } +}; + +//////////////////////////////// +// DUMP AVATAR LOCAL TEXTURES // +//////////////////////////////// + + +class LLAdvancedDumpAvatarLocalTextures : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_dump_avatar_local_textures(NULL); + return true; + } +}; + +//////////////////////////////// +// Memory Leaking Simulation // +//////////////////////////////// +class LLAdvancedMemoryLeakingSimulation : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFloaterMemLeak::show(NULL); + return true; + } +}; + +#endif + +///////////////// +// MESSAGE LOG // +///////////////// + + +class LLAdvancedEnableMessageLog : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_viewer_enable_message_log(NULL); + return true; + } +}; + +class LLAdvancedDisableMessageLog : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_viewer_disable_message_log(NULL); + return true; + } +}; + +///////////////// +// DROP PACKET // +///////////////// + + +class LLAdvancedDropPacket : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gMessageSystem->mPacketRing.dropPackets(1); + return true; + } +}; + + + +///////////////// +// AGENT PILOT // +///////////////// + + +class LLAdvancedAgentPilot : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string command = userdata.asString(); + if ("start playback" == command) + { + LLAgentPilot::startPlayback(NULL); + } + else if ("stop playback" == command) + { + LLAgentPilot::stopPlayback(NULL); + } + else if ("start record" == command) + { + LLAgentPilot::startRecord(NULL); + } + else if ("stop record" == command) + { + LLAgentPilot::saveRecord(NULL); + } + + return true; + } +}; + + + +////////////////////// +// AGENT PILOT LOOP // +////////////////////// + + +class LLAdvancedToggleAgentPilotLoop : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLAgentPilot::sLoop = !(LLAgentPilot::sLoop); + return true; + } +}; + +class LLAdvancedCheckAgentPilotLoop : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = LLAgentPilot::sLoop; + return new_value; + } +}; + + +///////////////////////// +// SHOW OBJECT UPDATES // +///////////////////////// + + +class LLAdvancedToggleShowObjectUpdates : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + gShowObjectUpdates = !(gShowObjectUpdates); + return true; + } +}; + +class LLAdvancedCheckShowObjectUpdates : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = gShowObjectUpdates; + return new_value; + } +}; + + + +//////////////////// +// COMPRESS IMAGE // +//////////////////// + + +class LLAdvancedCompressImage : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_compress_image(NULL); + return true; + } +}; + + + +///////////////////////// +// SHOW DEBUG SETTINGS // +///////////////////////// + + +class LLAdvancedShowDebugSettings : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFloaterSettingsDebug::showInstance(userdata); + return true; + } +}; + + + +//////////////////////// +// VIEW ADMIN OPTIONS // +//////////////////////// + + +class LLAdvancedToggleViewAdminOptions : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_admin_override_toggle(NULL); + return true; + } +}; + +class LLAdvancedCheckViewAdminOptions : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = check_admin_override(NULL); + return new_value; + } +}; + +///////////////////////////////////// +// Enable Object Object Occlusion /// +///////////////////////////////////// +class LLAdvancedEnableObjectObjectOcclusion: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + + bool new_value = gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable(userdata.asString()); + return new_value; +} +}; + + + +////////////////// +// ADMIN STATUS // +////////////////// + + +class LLAdvancedRequestAdminStatus : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_god_mode(NULL); + return true; + } +}; + +class LLAdvancedLeaveAdminStatus : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_leave_god_mode(NULL); + return true; + } +}; + +////////////////////////// +// Advanced > Debugging // +////////////////////////// + + +class LLAdvancedForceErrorBreakpoint : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_breakpoint(NULL); + return true; + } +}; + +class LLAdvancedForceErrorLlerror : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_llerror(NULL); + return true; + } +}; +class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_bad_memory_access(NULL); + return true; + } +}; + +class LLAdvancedForceErrorInfiniteLoop : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_infinite_loop(NULL); + return true; + } +}; + +class LLAdvancedForceErrorSoftwareException : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_software_exception(NULL); + return true; + } +}; + +class LLAdvancedForceErrorDriverCrash : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_driver_crash(NULL); + return true; + } +}; + +class LLAdvancedForceErrorDisconnectViewer : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_disconnect_viewer(NULL); + return true; +} +}; + + +#ifdef TOGGLE_HACKED_GODLIKE_VIEWER + +class LLAdvancedHandleToggleHackedGodmode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_toggle_hacked_godmode(NULL); + return true; + } +}; + +class LLAdvancedCheckToggleHackedGodmode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + check_toggle_hacked_godmode(NULL); + return true; + } +}; + +class LLAdvancedEnableToggleHackedGodmode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = enable_toggle_hacked_godmode(NULL); + return new_value; + } +}; +#endif + + +// +////------------------------------------------------------------------- +//// Advanced menu +////------------------------------------------------------------------- + +////////////////// +// ADMIN MENU // +////////////////// + +// Admin > Object +class LLAdminForceTakeCopy : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_take_copy(NULL); + return true; + } +}; + +class LLAdminHandleObjectOwnerSelf : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_object_owner_self(NULL); + return true; + } +}; +class LLAdminHandleObjectOwnerPermissive : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_object_owner_permissive(NULL); + return true; + } +}; + +class LLAdminHandleForceDelete : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_force_delete(NULL); + return true; + } +}; + +class LLAdminHandleObjectLock : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_object_lock(NULL); + return true; + } +}; + +class LLAdminHandleObjectAssetIDs: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_object_asset_ids(NULL); + return true; + } +}; + +//Admin >Parcel +class LLAdminHandleForceParcelOwnerToMe: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_force_parcel_owner_to_me(NULL); + return true; + } +}; +class LLAdminHandleForceParcelToContent: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_force_parcel_to_content(NULL); + return true; + } +}; +class LLAdminHandleClaimPublicLand: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_claim_public_land(NULL); + return true; + } +}; + +// Admin > Region +class LLAdminHandleRegionDumpTempAssetData: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + handle_region_dump_temp_asset_data(NULL); + return true; + } +}; +//Admin (Top Level) +class LLAdminShowGodTools: public view_listener_t { + bool handleEvent(const LLSD& userdata) { - LLMenuGL* sub = new LLMenuGL("Object"); - menu->appendMenu(sub); - - sub->append(new LLMenuItemCallGL( "Take Copy", - &force_take_copy, &enable_god_customer_service, NULL, - 'O', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); -#ifdef _CORY_TESTING - sub->append(new LLMenuItemCallGL( "Export Copy", - &force_export_copy, NULL, NULL)); - sub->append(new LLMenuItemCallGL( "Import Geometry", - &force_import_geometry, NULL, NULL)); -#endif - //sub->append(new LLMenuItemCallGL( "Force Public", - // &handle_object_owner_none, NULL, NULL)); - //sub->append(new LLMenuItemCallGL( "Force Ownership/Permissive", - // &handle_object_owner_self_and_permissive, NULL, NULL, 'K', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->append(new LLMenuItemCallGL( "Force Owner To Me", - &handle_object_owner_self, &enable_god_customer_service)); - sub->append(new LLMenuItemCallGL( "Force Owner Permissive", - &handle_object_owner_permissive, &enable_god_customer_service)); - //sub->append(new LLMenuItemCallGL( "Force Totally Permissive", - // &handle_object_permissive)); - sub->append(new LLMenuItemCallGL( "Delete", - &handle_force_delete, &enable_god_customer_service, NULL, KEY_DELETE, MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->append(new LLMenuItemCallGL( "Lock", - &handle_object_lock, &enable_god_customer_service, NULL, 'L', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->append(new LLMenuItemCallGL( "Get Asset IDs", - &handle_object_asset_ids, &enable_god_customer_service, NULL, 'I', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->createJumpKeys(); - } - { - LLMenuGL* sub = new LLMenuGL("Parcel"); - menu->appendMenu(sub); - - sub->append(new LLMenuItemCallGL("Owner To Me", - &handle_force_parcel_owner_to_me, - &enable_god_customer_service, NULL)); - sub->append(new LLMenuItemCallGL("Set to Linden Content", - &handle_force_parcel_to_content, - &enable_god_customer_service, NULL, - 'C', MASK_SHIFT | MASK_ALT | MASK_CONTROL)); - sub->appendSeparator(); - sub->append(new LLMenuItemCallGL("Claim Public Land", - &handle_claim_public_land, &enable_god_customer_service)); - - sub->createJumpKeys(); - } - { - LLMenuGL* sub = new LLMenuGL("Region"); - menu->appendMenu(sub); - sub->append(new LLMenuItemCallGL("Dump Temp Asset Data", - &handle_region_dump_temp_asset_data, - &enable_god_customer_service, NULL)); - sub->createJumpKeys(); - } - menu->append(new LLMenuItemCallGL( "God Tools...", - &LLFloaterGodTools::show, &enable_god_basic, NULL)); - - menu->appendSeparator(); - - menu->append(new LLMenuItemCallGL("Save Region State", - &LLPanelRegionTools::onSaveState, &enable_god_customer_service, NULL)); + LLFloaterGodTools::showInstance(LLSD()); + return true; + } +}; -// menu->append(new LLMenuItemCallGL("Force Join Group", handle_force_join_group)); -// -// menu->appendSeparator(); -// -// menu->append(new LLMenuItemCallGL( "OverlayTitle", -// &handle_show_overlay_title, &enable_god_customer_service, NULL)); - menu->createJumpKeys(); +class LLAdminOnSaveState: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLPanelRegionTools::onSaveState(NULL); + return true; } +}; -static std::vector > sMenus; //----------------------------------------------------------------------------- // cleanup_menus() @@ -1513,8 +2461,6 @@ void cleanup_menus() delete gMenuHolder; gMenuHolder = NULL; - - sMenus.clear(); } //----------------------------------------------------------------------------- @@ -1523,7 +2469,7 @@ void cleanup_menus() class LLObjectReportAbuse : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (objectp) @@ -1537,17 +2483,16 @@ class LLObjectReportAbuse : public view_listener_t // Enabled it you clicked an object class LLObjectEnableReportAbuse : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 0; - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLObjectTouch : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (!object) return true; @@ -1598,44 +2543,41 @@ class LLObjectTouch : public view_listener_t // One object must have touch sensor class LLObjectEnableTouch : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); bool new_value = obj && obj->flagHandleTouch(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label based on the node touch name if available. - LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); - std::string touch_text; + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { - touch_text = node->mTouchName; + touch_text = node->mTouchName; } else { - touch_text = userdata["data"].asString(); + touch_text = userdata.asString(); } - gMenuHolder->childSetText("Object Touch", touch_text); gMenuHolder->childSetText("Attachment Object Touch", touch_text); - return true; + return new_value; } }; -void label_touch(std::string& label, void*) -{ - LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); - if (node && node->mValid && !node->mTouchName.empty()) - { - label.assign(node->mTouchName); - } - else - { - label.assign("Touch"); - } -} +//void label_touch(std::string& label, void*) +//{ +// LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); +// if (node && node->mValid && !node->mTouchName.empty()) +// { +// label.assign(node->mTouchName); +// } +// else +// { +// label.assign("Touch"); +// } +//} bool handle_object_open() { @@ -1648,7 +2590,7 @@ bool handle_object_open() class LLObjectOpen : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { return handle_object_open(); } @@ -1656,7 +2598,7 @@ class LLObjectOpen : public view_listener_t class LLObjectEnableOpen : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // Look for contents in root object, which is all the LLFloaterOpenObject // understands. @@ -1668,96 +2610,14 @@ class LLObjectEnableOpen : public view_listener_t if (!root) new_value = false; else new_value = root->allowOpen(); } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - - -class LLViewCheckBuildMode : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - bool new_value = LLToolMgr::getInstance()->inEdit(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - -bool toggle_build_mode() -{ - if (LLToolMgr::getInstance()->inBuildMode()) - { - if (gSavedSettings.getBOOL("EditCameraMovement")) - { - // just reset the view, will pull us out of edit mode - handle_reset_view(); - } - else - { - // manually disable edit mode, but do not affect the camera - gAgent.resetView(false); - gFloaterTools->close(); - gViewerWindow->showCursor(); - } - // avoid spurious avatar movements pulling out of edit mode - LLViewerJoystick::getInstance()->setNeedsReset(); - } - else - { - ECameraMode camMode = gAgent.getCameraMode(); - if (CAMERA_MODE_MOUSELOOK == camMode || CAMERA_MODE_CUSTOMIZE_AVATAR == camMode) - { - // pull the user out of mouselook or appearance mode when entering build mode - handle_reset_view(); - } - - if (gSavedSettings.getBOOL("EditCameraMovement")) - { - // camera should be set - if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { - handle_toggle_flycam(); - } - - if (gAgent.getFocusOnAvatar()) - { - // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis())); - gAgent.cameraZoomIn(0.666f); - gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD ); - } - } - - - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() ); - - // Could be first use - LLFirstUse::useBuild(); - - gAgent.resetView(false); - - // avoid spurious avatar movements - LLViewerJoystick::getInstance()->setNeedsReset(); - - } - return true; -} - -class LLViewBuildMode : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - return toggle_build_mode(); + return new_value; } }; class LLViewJoystickFlycam : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { handle_toggle_flycam(); return true; @@ -1766,31 +2626,13 @@ class LLViewJoystickFlycam : public view_listener_t class LLViewCheckJoystickFlycam : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) - { - bool new_val = LLViewerJoystick::getInstance()->getOverrideCamera(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_val); - return true; - } -}; - -class LLViewCommunicate : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - if (LLFloaterChatterBox::getInstance()->getFloaterCount() == 0) - { - LLFloaterMyFriends::toggleInstance(); - } - else + bool handleEvent(const LLSD& userdata) { - LLFloaterChatterBox::toggleInstance(); - } - return true; + bool new_value = LLViewerJoystick::getInstance()->getOverrideCamera(); + return new_value; } }; - void handle_toggle_flycam() { LLViewerJoystick::getInstance()->toggleFlycam(); @@ -1798,7 +2640,7 @@ void handle_toggle_flycam() class LLObjectBuild : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") ) { @@ -1826,7 +2668,7 @@ class LLObjectBuild : public view_listener_t class LLObjectEdit : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerParcelMgr::getInstance()->deselectLand(); @@ -1856,7 +2698,7 @@ class LLObjectEdit : public view_listener_t } } - gFloaterTools->open(); /* Flawfinder: ignore */ + LLFloaterReg::showInstance("build"); LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); @@ -1872,7 +2714,7 @@ class LLObjectEdit : public view_listener_t class LLObjectInspect : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLFloaterInspect::show(); return true; @@ -1885,7 +2727,7 @@ class LLObjectInspect : public view_listener_t //--------------------------------------------------------------------------- class LLLandBuild : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerParcelMgr::getInstance()->deselectLand(); @@ -1917,7 +2759,7 @@ class LLLandBuild : public view_listener_t class LLLandBuyPass : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLPanelLandGeneral::onClickBuyPass((void *)FALSE); return true; @@ -1926,11 +2768,10 @@ class LLLandBuyPass : public view_listener_t class LLLandEnableBuyPass : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLPanelLandGeneral::enableBuyPass(NULL); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -1966,7 +2807,7 @@ BOOL enable_object_build(void*) class LLEnableEdit : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // *HACK: The new "prelude" Help Islands have a build sandbox area, // so users need the Edit and Create pie menu options when they are @@ -1979,23 +2820,22 @@ class LLEnableEdit : public view_listener_t enable = LLViewerParcelMgr::getInstance()->agentCanBuild() || LLSelectMgr::getInstance()->getSelection()->isAttachment(); } - gMenuHolder->findControl(userdata["control"].asString())->setValue(enable); - return true; + return enable; } }; class LLSelfRemoveAllAttachments : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - LLAgent::userRemoveAllAttachments(NULL); + LLAgentWearables::userRemoveAllAttachments(NULL); return true; } }; class LLSelfEnableRemoveAllAttachments : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = false; if (gAgent.getAvatarObject()) @@ -2013,8 +2853,7 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t } } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -2027,19 +2866,19 @@ BOOL enable_has_attachments(void*) //--------------------------------------------------------------------------- // Avatar pie menu //--------------------------------------------------------------------------- -void handle_follow(void *userdata) -{ - // follow a given avatar by ID - LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (objectp) - { - gAgent.startFollowPilot(objectp->getID()); - } -} +//void handle_follow(void *userdata) +//{ +// // follow a given avatar by ID +// LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); +// if (objectp) +// { +// gAgent.startFollowPilot(objectp->getID()); +// } +//} class LLObjectEnableMute : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); bool new_value = (object != NULL); @@ -2055,14 +2894,13 @@ class LLObjectEnableMute : public view_listener_t new_value = !is_linden && !is_self; } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLObjectMute : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (!object) return true; @@ -2108,7 +2946,7 @@ class LLObjectMute : public view_listener_t else { LLMuteList::getInstance()->add(mute); - LLFloaterMute::showInstance(); + LLFloaterReg::showInstance("mute"); } return true; @@ -2148,12 +2986,26 @@ bool handle_go_to() class LLGoToObject : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { return handle_go_to(); } }; +class LLAvatarReportAbuse : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); + if(avatar) + { + LLFloaterReporter::showFromObject(avatar->getID()); + } + return true; + } +}; + + //--------------------------------------------------------------------------- // Parcel freeze, eject, etc. //--------------------------------------------------------------------------- @@ -2192,7 +3044,7 @@ bool callback_freeze(const LLSD& notification, const LLSD& response) class LLAvatarFreeze : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if( avatar ) @@ -2224,32 +3076,31 @@ class LLAvatarFreeze : public view_listener_t class LLAvatarVisibleDebug : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - bool new_value = gAgent.isGodlike(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return gAgent.isGodlike(); } }; class LLAvatarEnableDebug : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - bool new_value = gAgent.isGodlike(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return gAgent.isGodlike(); } }; class LLAvatarDebug : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if( avatar ) { - avatar->dumpLocalTextures(); + if (avatar->isSelf()) + { + ((LLVOAvatarSelf *)avatar)->dumpLocalTextures(); + } llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl; std::vector strings; strings.push_back(avatar->getID().asString()); @@ -2317,7 +3168,7 @@ bool callback_eject(const LLSD& notification, const LLSD& response) class LLAvatarEject : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if( avatar ) @@ -2376,7 +3227,7 @@ class LLAvatarEject : public view_listener_t class LLAvatarEnableFreezeEject : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); bool new_value = (avatar != NULL); @@ -2399,14 +3250,13 @@ class LLAvatarEnableFreezeEject : public view_listener_t } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLAvatarGiveCard : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { llinfos << "handle_give_card()" << llendl; LLViewerObject* dest = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); @@ -2461,7 +3311,7 @@ void login_done(S32 which, void *user) { llinfos << "Login done " << which << llendl; - LLPanelLogin::close(); + LLPanelLogin::closePanel(); } @@ -2477,22 +3327,12 @@ bool callback_leave_group(const LLSD& notification, const LLSD& response) msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_GroupData); - msg->addUUIDFast(_PREHASH_GroupID, gAgent.mGroupID ); + msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID() ); gAgent.sendReliableMessage(); } return false; } -void handle_leave_group(void *) -{ - if (gAgent.getGroupID() != LLUUID::null) - { - LLSD args; - args["GROUP"] = gAgent.mGroupName; - LLNotifications::instance().add("GroupLeaveConfirmMember", args, LLSD(), callback_leave_group); - } -} - void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt) { LLAggregatePermissions::EValue val = ag_perm.getValue(bit); @@ -2538,11 +3378,10 @@ BOOL enable_buy(void*) class LLObjectEnableBuy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = enable_buy(NULL); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -2624,18 +3463,9 @@ void handle_region_dump_settings(void*) } } -void handle_show_notifications_console(void *) -{ - LLFloaterNotificationConsole::showInstance(); -} - void handle_dump_group_info(void *) { - llinfos << "group " << gAgent.mGroupName << llendl; - llinfos << "ID " << gAgent.mGroupID << llendl; - llinfos << "powers " << gAgent.mGroupPowers << llendl; - llinfos << "title " << gAgent.mGroupTitle << llendl; - //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl; + gAgent.dumpGroupInfo(); } void handle_dump_capabilities_info(void *) @@ -2665,7 +3495,7 @@ void handle_dump_focus(void *) class LLSelfStandUp : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); return true; @@ -2674,11 +3504,10 @@ class LLSelfStandUp : public view_listener_t class LLSelfEnableStandUp : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting; - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -2740,7 +3569,6 @@ void set_god_level(U8 god_level) LLNotifications::instance().add("LeavingGodMode", args); } - // changing god-level can affect which menus we see show_debug_menus(); } @@ -2756,6 +3584,11 @@ BOOL check_toggle_hacked_godmode(void*) { return gHackGodmode; } + +bool enable_toggle_hacked_godmode(void*) +{ + return !LLViewerLogin::getInstance()->isInProductionGrid(); +} #endif void process_grant_godlike_powers(LLMessageSystem* msg, void**) @@ -2824,35 +3657,15 @@ BOOL is_agent_mappable(const LLUUID& agent_id) ); } -// Enable a menu item when you have someone's card. -/* -BOOL enable_have_card(void *userdata) -{ - LLUUID* avatar_id = (LLUUID *)userdata; - if (gAgent.isGodlike()) - { - return TRUE; - } - else if(avatar_id) - { - return is_agent_friend(*avatar_id); - } - else - { - return FALSE; - } -} -*/ // Enable a menu item when you don't have someone's card. class LLAvatarEnableAddFriend : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); bool new_value = avatar && !is_agent_friend(avatar->getID()); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -2875,7 +3688,7 @@ void request_friendship(const LLUUID& dest_id) } if (!fullname.empty()) { - LLPanelFriends::requestFriendshipDialog(dest_id, fullname); + LLFriendActions::requestFriendshipDialog(dest_id, fullname); } else { @@ -2887,13 +3700,10 @@ void request_friendship(const LLUUID& dest_id) class LLEditEnableCustomizeAvatar : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - bool new_value = (gAgent.getAvatarObject() && - gAgent.getAvatarObject()->isFullyLoaded() && - gAgent.areWearablesLoaded()); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + bool new_value = gAgentWearables.areWearablesLoaded(); + return new_value; } }; @@ -2917,6 +3727,7 @@ bool handle_sit_or_stand() if (object && object->getPCode() == LL_PCODE_VOLUME) { + gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit); gMessageSystem->nextBlockFast(_PREHASH_AgentData); gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -2932,7 +3743,7 @@ bool handle_sit_or_stand() class LLObjectSitOrStand : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { return handle_sit_or_stand(); } @@ -2952,7 +3763,7 @@ void near_sit_down_point(BOOL success, void *) class LLLandSit : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); LLViewerParcelMgr::getInstance()->deselectLand(); @@ -2973,137 +3784,6 @@ class LLLandSit : public view_listener_t } }; -void show_permissions_control(void*) -{ - LLFloaterPermissionsMgr* floaterp = LLFloaterPermissionsMgr::show(); - floaterp->mPermissions->addPermissionsData("foo1", LLUUID::null, 0); - floaterp->mPermissions->addPermissionsData("foo2", LLUUID::null, 0); - floaterp->mPermissions->addPermissionsData("foo3", LLUUID::null, 0); -} - - -class LLCreateLandmarkCallback : public LLInventoryCallback -{ -public: - /*virtual*/ void fire(const LLUUID& inv_item) - { - llinfos << "Created landmark with inventory id " << inv_item - << llendl; - } -}; - -void reload_ui(void *) -{ - LLUICtrlFactory::getInstance()->rebuild(); -} - -class LLWorldFly : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - gAgent.toggleFlying(); - return true; - } -}; - -class LLWorldEnableFly : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) - { - sitting = gAgent.getAvatarObject()->mIsSitting; - } - gMenuHolder->findControl(userdata["control"].asString())->setValue(!sitting); - return true; - } -}; - - -void handle_agent_stop_moving(void*) -{ - // stop agent - gAgent.setControlFlags(AGENT_CONTROL_STOP); - - // cancel autopilot - gAgent.stopAutoPilot(); -} - -void print_packets_lost(void*) -{ - LLWorld::getInstance()->printPacketsLost(); -} - - -void drop_packet(void*) -{ - gMessageSystem->mPacketRing.dropPackets(1); -} - - -void velocity_interpolate( void* data ) -{ - BOOL toggle = gSavedSettings.getBOOL("VelocityInterpolate"); - LLMessageSystem* msg = gMessageSystem; - if ( !toggle ) - { - msg->newMessageFast(_PREHASH_VelocityInterpolateOn); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gAgent.sendReliableMessage(); - llinfos << "Velocity Interpolation On" << llendl; - } - else - { - msg->newMessageFast(_PREHASH_VelocityInterpolateOff); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gAgent.sendReliableMessage(); - llinfos << "Velocity Interpolation Off" << llendl; - } - // BUG this is a hack because of the change in menu behavior. The - // old menu system would automatically change a control's value, - // but the new LLMenuGL system doesn't know what a control - // is. However, it's easy to distinguish between the two callers - // because LLMenuGL passes in the name of the user data (the - // control name) to the callback function, and the user data goes - // unused in the old menu code. Thus, if data is not null, then we - // need to swap the value of the control. - if( data ) - { - gSavedSettings.setBOOL( static_cast(data), !toggle ); - } -} - - -void toggle_wind_audio(void) -{ - if (gAudiop) - { - gAudiop->enableWind(!(gAudiop->isWindEnabled())); - } -} - - -// Callback for enablement -BOOL is_inventory_visible( void* user_data ) -{ - LLInventoryView* iv = reinterpret_cast(user_data); - if( iv ) - { - return iv->getVisible(); - } - return FALSE; -} - -void handle_show_newest_map(void*) -{ - LLFloaterWorldMap::show(NULL, FALSE); -} - //------------------------------------------------------------------- // Help menu functions //------------------------------------------------------------------- @@ -3111,24 +3791,24 @@ void handle_show_newest_map(void*) // // Major mode switching // -void reset_view_final( BOOL proceed, void* ); +void reset_view_final( BOOL proceed ); void handle_reset_view() { if( (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode()) && gFloaterCustomize ) { // Show dialog box if needed. - gFloaterCustomize->askToSaveIfDirty( reset_view_final, NULL ); + gFloaterCustomize->askToSaveIfDirty( reset_view_final ); } else { - reset_view_final( TRUE, NULL ); + reset_view_final( TRUE ); } } class LLViewResetView : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { handle_reset_view(); return true; @@ -3136,7 +3816,7 @@ class LLViewResetView : public view_listener_t }; // Note: extra parameters allow this function to be called from dialog. -void reset_view_final( BOOL proceed, void* ) +void reset_view_final( BOOL proceed ) { if( !proceed ) { @@ -3148,7 +3828,7 @@ void reset_view_final( BOOL proceed, void* ) class LLViewLookAtLastChatter : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gAgent.lookAtLastChat(); return true; @@ -3157,7 +3837,7 @@ class LLViewLookAtLastChatter : public view_listener_t class LLViewMouselook : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (!gAgent.cameraMouselook()) { @@ -3173,7 +3853,7 @@ class LLViewMouselook : public view_listener_t class LLViewFullscreen : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gViewerWindow->toggleFullscreen(TRUE); return true; @@ -3182,7 +3862,7 @@ class LLViewFullscreen : public view_listener_t class LLViewDefaultUISize : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gSavedSettings.setF32("UIScaleFactor", 1.0f); gSavedSettings.setBOOL("UIAutoScale", FALSE); @@ -3193,7 +3873,7 @@ class LLViewDefaultUISize : public view_listener_t class LLEditDuplicate : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if(LLEditMenuHandler::gEditMenuHandler) { @@ -3205,23 +3885,13 @@ class LLEditDuplicate : public view_listener_t class LLEditEnableDuplicate : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDuplicate(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; - -void disabled_duplicate(void*) -{ - if (LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()) - { - LLNotifications::instance().add("CopyFailed"); - } -} - void handle_duplicate_in_place(void*) { llinfos << "handle_duplicate_in_place" << llendl; @@ -3230,11 +3900,6 @@ void handle_duplicate_in_place(void*) LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE); } -void handle_repeat_duplicate(void*) -{ - LLSelectMgr::getInstance()->repeatDuplicate(); -} - /* dead code 30-apr-2008 void handle_deed_object_to_group(void*) { @@ -3381,42 +4046,11 @@ void handle_claim_public_land(void*) msg->nextBlock("ParamList"); msg->addString("Parameter", buffer); buffer = llformat( "%f", east_north.mV[VY]); - msg->nextBlock("ParamList"); - msg->addString("Parameter", buffer); - gAgent.sendReliableMessage(); -} - -void handle_god_request_havok(void *) -{ - if (gAgent.isGodlike()) - { - LLSelectMgr::getInstance()->sendGodlikeRequest("havok", "infoverbose"); - } + msg->nextBlock("ParamList"); + msg->addString("Parameter", buffer); + gAgent.sendReliableMessage(); } -//void handle_god_request_foo(void *) -//{ -// if (gAgent.isGodlike()) -// { -// LLSelectMgr::getInstance()->sendGodlikeRequest(GOD_WANTS_FOO); -// } -//} - -//void handle_god_request_terrain_save(void *) -//{ -// if (gAgent.isGodlike()) -// { -// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "save"); -// } -//} - -//void handle_god_request_terrain_load(void *) -//{ -// if (gAgent.isGodlike()) -// { -// LLSelectMgr::getInstance()->sendGodlikeRequest("terrain", "load"); -// } -//} // HACK for easily testing new avatar geometry @@ -3429,12 +4063,6 @@ void handle_god_request_avatar_geometry(void *) } -void handle_show_overlay_title(void*) -{ - gShowOverlayTitle = !gShowOverlayTitle; - gSavedSettings.setBOOL("ShowOverlayTitle", gShowOverlayTitle); -} - void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) { if(gAgent.cameraMouselook()) @@ -3590,7 +4218,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) class LLToolsTakeCopy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; @@ -3605,7 +4233,7 @@ class LLToolsTakeCopy : public view_listener_t // You can return an object to its owner if it is on your land. class LLObjectReturn : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; @@ -3638,7 +4266,7 @@ protected: // over land you own. class LLObjectEnableReturn : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { #ifdef HACKED_GODLIKE_VIEWER bool new_value = true; @@ -3675,8 +4303,7 @@ class LLObjectEnableReturn : public view_listener_t } } #endif - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -3767,8 +4394,8 @@ void handle_take() payload["folder_id"] = category_id; LLNotification::Params params("ConfirmObjectTakeLock"); - params.payload(payload) - .functor(confirm_take); + params.payload(payload); + params.functor.function(confirm_take); if(locked_but_takeable_object || !you_own_everything) @@ -3776,7 +4403,6 @@ void handle_take() if(locked_but_takeable_object && you_own_everything) { params.name("ConfirmObjectTakeLock"); - } else if(!locked_but_takeable_object && !you_own_everything) { @@ -3849,7 +4475,7 @@ BOOL enable_take() class LLToolsBuyOrTake : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) { @@ -3880,17 +4506,16 @@ class LLToolsBuyOrTake : public view_listener_t class LLToolsEnableBuyOrTake : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool is_buy = is_selection_buy_not_take(); bool new_value = is_buy ? enable_buy(NULL) : enable_take(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); // Update label std::string label; std::string buy_text; std::string take_text; - std::string param = userdata["data"].asString(); + std::string param = userdata.asString(); std::string::size_type offset = param.find(","); if (offset != param.npos) { @@ -3908,7 +4533,7 @@ class LLToolsEnableBuyOrTake : public view_listener_t gMenuHolder->childSetText("Pie Object Take", label); gMenuHolder->childSetText("Menu Object Take", label); - return true; + return new_value; } }; @@ -3963,42 +4588,36 @@ S32 selection_price() return total_price; } - +/* bool callback_show_buy_currency(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); if (0 == option) { - llinfos << "Loading page " << BUY_CURRENCY_URL << llendl; - LLWeb::loadURL(BUY_CURRENCY_URL); + llinfos << "Loading page " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL") << llendl; + LLWeb::loadURL(LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL")); } return false; } - +*/ void show_buy_currency(const char* extra) { // Don't show currency web page for branded clients. - +/* std::ostringstream mesg; if (extra != NULL) { mesg << extra << "\n \n"; } - mesg << "Go to " << BUY_CURRENCY_URL << "\nfor information on purchasing currency?"; - + mesg << "Go to " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL")<< "\nfor information on purchasing currency?"; +*/ LLSD args; if (extra != NULL) { args["EXTRA"] = extra; } - args["URL"] = BUY_CURRENCY_URL; - LLNotifications::instance().add("PromptGoToCurrencyPage", args, LLSD(), callback_show_buy_currency); -} - -void handle_buy_currency(void*) -{ -// LLFloaterBuyCurrency::buyCurrency(); + LLNotifications::instance().add("PromptGoToCurrencyPage", args);//, LLSD(), callback_show_buy_currency); } void handle_buy(void*) @@ -4021,7 +4640,7 @@ void handle_buy(void*) class LLObjectBuy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { handle_buy(NULL); return true; @@ -4057,9 +4676,21 @@ BOOL sitting_on_selection() return (avatar->mIsSitting && avatar->getRoot() == root_object); } +class LLToolsSaveToInventory : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + if(enable_save_into_inventory(NULL)) + { + derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null); + } + return true; + } +}; + class LLToolsSaveToObjectInventory : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if(node && (node->mValid) && (!node->mFromTaskID.isNull())) @@ -4074,7 +4705,7 @@ class LLToolsSaveToObjectInventory : public view_listener_t // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { F64 snap_size = (F64)gSavedSettings.getF32("GridResolution"); @@ -4128,7 +4759,7 @@ class LLToolsSnapObjectXY : public view_listener_t // reasonable expectation for the link to work, but it will fail. class LLToolsEnableLink : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = false; // check if there are at least 2 objects selected, and that the @@ -4150,14 +4781,13 @@ class LLToolsEnableLink : public view_listener_t new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLToolsLink : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if(!LLSelectMgr::getInstance()->selectGetAllRootsValid()) { @@ -4203,19 +4833,18 @@ class LLToolsLink : public view_listener_t class LLToolsEnableUnlink : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLToolsUnlink : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLSelectMgr::getInstance()->sendDelink(); return true; @@ -4225,7 +4854,7 @@ class LLToolsUnlink : public view_listener_t class LLToolsStopAllAnimations : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gAgent.stopCurrentAnimations(); return true; @@ -4234,7 +4863,7 @@ class LLToolsStopAllAnimations : public view_listener_t class LLToolsReleaseKeys : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gAgent.forceReleaseControls(); @@ -4244,58 +4873,25 @@ class LLToolsReleaseKeys : public view_listener_t class LLToolsEnableReleaseKeys : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - gMenuHolder->findControl(userdata["control"].asString())->setValue( gAgent.anyControlGrabbed() ); - return true; + return gAgent.anyControlGrabbed(); } }; -//void handle_hinge(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(1); -//} - -//void handle_ptop(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(2); -//} - -//void handle_lptop(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(3); -//} - -//void handle_wheel(void*) -//{ -// LLSelectMgr::getInstance()->sendHinge(4); -//} - -//void handle_dehinge(void*) -//{ -// LLSelectMgr::getInstance()->sendDehinge(); -//} - -//BOOL enable_dehinge(void*) -//{ -// LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject(); -// return obj && !obj->isAttachment(); -//} - class LLEditEnableCut : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCut(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditCut : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler ) { @@ -4307,17 +4903,16 @@ class LLEditCut : public view_listener_t class LLEditEnableCopy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canCopy(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditCopy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler ) { @@ -4329,17 +4924,16 @@ class LLEditCopy : public view_listener_t class LLEditEnablePaste : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canPaste(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditPaste : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler ) { @@ -4351,17 +4945,16 @@ class LLEditPaste : public view_listener_t class LLEditEnableDelete : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditDelete : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // If a text field can do a deletion, it gets precedence over deleting // an object in the world. @@ -4375,14 +4968,14 @@ class LLEditDelete : public view_listener_t // When deleting an object we may not actually be done // Keep selection so we know what to delete when confirmation is needed about the delete - gPieObject->hide(TRUE); + gPieObject->hide(); return true; } }; class LLObjectEnableDelete : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = #ifdef HACKED_GODLIKE_VIEWER @@ -4394,23 +4987,13 @@ class LLObjectEnableDelete : public view_listener_t # endif LLSelectMgr::getInstance()->canDoDelete(); #endif - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - -class LLEditSearch : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLFloaterDirectory::toggleFind(NULL); - return true; + return new_value; } }; class LLObjectDelete : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (LLSelectMgr::getInstance()) { @@ -4422,7 +5005,7 @@ class LLObjectDelete : public view_listener_t // When deleting an object we may not actually be done // Keep selection so we know what to delete when confirmation is needed about the delete - gPieObject->hide(TRUE); + gPieObject->hide(); return true; } }; @@ -4434,38 +5017,35 @@ void handle_force_delete(void*) class LLViewEnableJoystickFlycam : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = (gSavedSettings.getBOOL("JoystickEnabled") && gSavedSettings.getBOOL("JoystickFlycamEnabled")); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLViewEnableLastChatter : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // *TODO: add check that last chatter is in range bool new_value = (gAgent.cameraThirdPerson() && gAgent.getLastChatter().notNull()); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditEnableDeselect : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDeselect(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditDeselect : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler ) { @@ -4477,18 +5057,17 @@ class LLEditDeselect : public view_listener_t class LLEditEnableSelectAll : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canSelectAll(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditSelectAll : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler ) { @@ -4501,17 +5080,16 @@ class LLEditSelectAll : public view_listener_t class LLEditEnableUndo : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditUndo : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canUndo() ) { @@ -4523,17 +5101,16 @@ class LLEditUndo : public view_listener_t class LLEditEnableRedo : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditRedo : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canRedo() ) { @@ -4575,31 +5152,37 @@ void show_debug_menus() if ( gMenuBarView ) { BOOL debug = gSavedSettings.getBOOL("UseDebugMenus"); + + gMenuBarView->setItemVisible("Advanced", debug); + gMenuBarView->setItemEnabled("Advanced", debug); - if(debug) - { - LLFirstUse::useDebugMenus(); - } + gMenuBarView->setItemVisible("Debug", debug); + gMenuBarView->setItemEnabled("Debug", debug); - gMenuBarView->setItemVisible(CLIENT_MENU_NAME, debug); - gMenuBarView->setItemEnabled(CLIENT_MENU_NAME, debug); + gMenuBarView->setItemVisible("Develop", debug); + gMenuBarView->setItemEnabled("Develop", debug); // Server ('Admin') menu hidden when not in godmode. const bool show_server_menu = debug && (gAgent.getGodLevel() > GOD_NOT); - gMenuBarView->setItemVisible(SERVER_MENU_NAME, show_server_menu); - gMenuBarView->setItemEnabled(SERVER_MENU_NAME, show_server_menu); - - //gMenuBarView->setItemVisible("DebugOptions", visible); - //gMenuBarView->setItemVisible(std::string(AVI_TOOLS), visible); - - gMenuBarView->arrange(); // clean-up positioning - }; + gMenuBarView->setItemVisible("Admin", show_server_menu); + gMenuBarView->setItemEnabled("Admin", show_server_menu); + } + if (gLoginMenuBarView) + { + BOOL debug = gSavedSettings.getBOOL("UseDebugMenus"); + gLoginMenuBarView->setItemVisible("Debug", debug); + gLoginMenuBarView->setItemEnabled("Debug", debug); + } } void toggle_debug_menus(void*) { BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus"); gSavedSettings.setBOOL("UseDebugMenus", visible); + if(visible) + { + LLFirstUse::useDebugMenus(); + } show_debug_menus(); } @@ -4641,27 +5224,12 @@ void toggle_debug_menus(void*) // gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects..."); // } +// -BOOL menu_check_build_tool( void* user_data ) -{ - S32 index = (intptr_t) user_data; - return LLToolMgr::getInstance()->getCurrentToolset()->isToolSelected( index ); -} - -void handle_reload_settings(void*) -{ - gSavedSettings.resetToDefaults(); - gSavedSettings.loadFromFile(gSavedSettings.getString("ClientSettingsFile")); - - llinfos << "Loading colors from colors.xml" << llendl; - std::string color_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"colors.xml"); - gColors.resetToDefaults(); - gColors.loadFromFileLegacy(color_file, FALSE, TYPE_COL4U); -} class LLWorldSetHomeLocation : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // we just send the message and let the server check for failure cases // server will echo back a "Home position set." alert if it succeeds @@ -4673,7 +5241,7 @@ class LLWorldSetHomeLocation : public view_listener_t class LLWorldTeleportHome : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { gAgent.teleportHome(); return true; @@ -4682,7 +5250,7 @@ class LLWorldTeleportHome : public view_listener_t class LLWorldAlwaysRun : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // as well as altering the default walk-vs-run state, // we also change the *current* walk-vs-run state. @@ -4706,17 +5274,16 @@ class LLWorldAlwaysRun : public view_listener_t class LLWorldCheckAlwaysRun : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = gAgent.getAlwaysRun(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLWorldSetAway : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (gAgent.getAFK()) { @@ -4732,7 +5299,7 @@ class LLWorldSetAway : public view_listener_t class LLWorldSetBusy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (gAgent.getBusy()) { @@ -4750,14 +5317,14 @@ class LLWorldSetBusy : public view_listener_t bool can_create_landmark() { BOOL can = FALSE; - + LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (agent_parcel) - { +{ if (agent_parcel->getAllowLandmark() || LLViewerParcelMgr::isParcelOwnedByAgent(agent_parcel, GP_LAND_ALLOW_LANDMARK)) - { + { can = TRUE; } } @@ -4767,33 +5334,16 @@ bool can_create_landmark() class LLWorldCreateLandmark : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - if (!can_create_landmark()) - { - LLNotifications::instance().add("CannotCreateLandmarkNotOwner"); - return true; - } - - LLUUID folder_id; - folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); - std::string pos_string; - gAgent.buildLocationString(pos_string); - - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - folder_id, LLTransactionID::tnull, - pos_string, pos_string, // name, desc - LLAssetType::AT_LANDMARK, - LLInventoryType::IT_LANDMARK, - NOT_WEARABLE, PERM_ALL, - new LLCreateLandmarkCallback); + LLFloaterReg::showInstance("add_landmark"); return true; } }; class LLToolsLookAtSelection : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { const F32 PADDING_FACTOR = 2.f; BOOL zoom = (userdata.asString() == "zoom"); @@ -4828,10 +5378,10 @@ class LLToolsLookAtSelection : public view_listener_t } }; -void callback_invite_to_group(LLUUID group_id, void *user_data) +void callback_invite_to_group(LLUUID group_id, LLUUID dest_id) { std::vector agent_ids; - agent_ids.push_back(*(LLUUID *)user_data); + agent_ids.push_back(dest_id); LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); } @@ -4847,14 +5397,14 @@ void invite_to_group(const LLUUID& dest_id) { widget->center(); widget->setPowersMask(GP_MEMBER_INVITE); - widget->setSelectCallback(callback_invite_to_group, (void *)&dest_id); + widget->setSelectGroupCallback(boost::bind(callback_invite_to_group, _1, dest_id)); } } } class LLAvatarInviteToGroup : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(avatar) @@ -4867,7 +5417,7 @@ class LLAvatarInviteToGroup : public view_listener_t class LLAvatarAddFriend : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(avatar && !is_agent_friend(avatar->getID())) @@ -4917,7 +5467,7 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec bool handle_give_money_dialog() { LLNotification::Params params("BusyModePay"); - params.functor(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection())); + params.functor.function(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection())); if (gAgent.getBusy()) { @@ -4933,7 +5483,7 @@ bool handle_give_money_dialog() class LLPayObject : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { return handle_give_money_dialog(); } @@ -4941,7 +5491,7 @@ class LLPayObject : public view_listener_t class LLEnablePayObject : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); bool new_value = (avatar != NULL); @@ -4957,14 +5507,13 @@ class LLEnablePayObject : public view_listener_t } } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLObjectEnableSitOrStand : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = false; LLViewerObject* dest_object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); @@ -4976,13 +5525,11 @@ class LLObjectEnableSitOrStand : public view_listener_t new_value = true; } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - // Update label std::string label; std::string sit_text; std::string stand_text; - std::string param = userdata["data"].asString(); + std::string param = userdata.asString(); std::string::size_type offset = param.find(","); if (offset != param.npos) { @@ -5007,7 +5554,7 @@ class LLObjectEnableSitOrStand : public view_listener_t } gMenuHolder->childSetText("Object Sit", label); - return true; + return new_value; } }; @@ -5026,29 +5573,6 @@ void dump_inventory(void*) gInventory.dumpInventory(); } -// forcibly unlock an object -void handle_force_unlock(void*) -{ - // First, make it public. - LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null, TRUE); - - // Second, lie to the viewer and mark it editable and unowned - - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* object) - { - object->mFlags |= FLAGS_OBJECT_MOVE; - object->mFlags |= FLAGS_OBJECT_MODIFY; - object->mFlags |= FLAGS_OBJECT_COPY; - - object->mFlags &= ~FLAGS_OBJECT_ANY_OWNER; - object->mFlags &= ~FLAGS_OBJECT_YOU_OWNER; - return true; - } - } func; - LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func); -} void handle_dump_followcam(void*) { @@ -5065,10 +5589,9 @@ void handle_viewer_disable_message_log(void*) gMessageSystem->stopLogging(); } -// TomY TODO: Move! class LLShowFloater : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string floater_name = userdata.asString(); if (floater_name == "gestures") @@ -5077,38 +5600,18 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "appearance") { - if (gAgent.areWearablesLoaded()) + if (gAgentWearables.areWearablesLoaded()) { gAgent.changeCameraToCustomizeAvatar(); } } - else if (floater_name == "friends") - { - LLFloaterMyFriends::toggleInstance(0); - } - else if (floater_name == "preferences") - { - LLFloaterPreference::show(NULL); - } else if (floater_name == "toolbar") { LLToolBar::toggle(NULL); } - else if (floater_name == "chat history") - { - LLFloaterChat::toggleInstance(LLSD()); - } - else if (floater_name == "im") - { - LLFloaterChatterBox::toggleInstance(LLSD()); - } - else if (floater_name == "inventory") - { - LLInventoryView::toggleVisibility(NULL); - } else if (floater_name == "mute list") { - LLFloaterMute::toggleInstance(); + LLFloaterReg::toggleInstance("mute"); } else if (floater_name == "camera controls") { @@ -5118,18 +5621,6 @@ class LLShowFloater : public view_listener_t { LLFloaterMove::toggleInstance(); } - else if (floater_name == "world map") - { - LLFloaterWorldMap::toggle(NULL); - } - else if (floater_name == "mini map") - { - LLFloaterMap::toggleInstance(); - } - else if (floater_name == "stat bar") - { - LLFloaterStats::toggleInstance(); - } else if (floater_name == "my land") { LLFloaterLandHoldings::show(NULL); @@ -5143,6 +5634,10 @@ class LLShowFloater : public view_listener_t LLFloaterLand::showInstance(); } + else if (floater_name == "about region") + { + LLFloaterRegionInfo::showInstance(); + } else if (floater_name == "buy land") { if (LLViewerParcelMgr::getInstance()->selectionEmpty()) @@ -5152,13 +5647,9 @@ class LLShowFloater : public view_listener_t LLViewerParcelMgr::getInstance()->startBuyLand(); } - else if (floater_name == "about region") - { - LLFloaterRegionInfo::showInstance(); - } else if (floater_name == "grid options") { - LLFloaterBuildOptions::show(NULL); + LLFloaterBuildOptions::showInstance(); } else if (floater_name == "script errors") { @@ -5182,26 +5673,20 @@ class LLShowFloater : public view_listener_t { if (!gNoRender) { - LLFloaterBump::show(NULL); + LLFloaterBump::showInstance(); } } else if (floater_name == "lag meter") { LLFloaterLagMeter::showInstance(); } - else if (floater_name == "bug reporter") - { - // Prevent menu from appearing in screen shot. - gMenuHolder->hideMenus(); - LLFloaterReporter::showFromMenu(BUG_REPORT); - } else if (floater_name == "buy currency") { LLFloaterBuyCurrency::buyCurrency(); } else if (floater_name == "about") { - LLFloaterAbout::show(NULL); + LLFloaterReg::showInstance("sl_about"); } else if (floater_name == "active speakers") { @@ -5215,40 +5700,27 @@ class LLShowFloater : public view_listener_t { LLFloaterPerms::toggleInstance(LLSD()); } + else + { + LLFloaterReg::toggleInstance(floater_name); + } return true; } }; class LLFloaterVisible : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - std::string control_name = userdata["control"].asString(); - std::string floater_name = userdata["data"].asString(); + std::string floater_name = userdata.asString(); bool new_value = false; - if (floater_name == "friends") - { - new_value = LLFloaterMyFriends::instanceVisible(0); - } - else if (floater_name == "communicate") - { - new_value = LLFloaterChatterBox::instanceVisible(); - } - else if (floater_name == "toolbar") + if (floater_name == "toolbar") { new_value = LLToolBar::visible(NULL); } - else if (floater_name == "chat history") - { - new_value = LLFloaterChat::instanceVisible(); - } - else if (floater_name == "im") - { - new_value = LLFloaterMyFriends::instanceVisible(0); - } else if (floater_name == "mute list") { - new_value = LLFloaterMute::instanceVisible(); + new_value = LLFloaterReg::instanceVisible("mute"); } else if (floater_name == "camera controls") { @@ -5260,7 +5732,7 @@ class LLFloaterVisible : public view_listener_t } else if (floater_name == "stat bar") { - new_value = LLFloaterStats::instanceVisible(); + new_value = gSavedSettings.getBOOL("ShowDebugStats"); } else if (floater_name == "active speakers") { @@ -5270,13 +5742,11 @@ class LLFloaterVisible : public view_listener_t { new_value = LLFloaterBeacons::instanceVisible(LLSD()); } - else if (floater_name == "inventory") + else { - LLInventoryView* iv = LLInventoryView::getActiveInventory(); - new_value = (NULL != iv && TRUE == iv->getVisible()); + new_value = LLFloaterReg::instanceVisible(floater_name); } - gMenuHolder->findControl(control_name)->setValue(new_value); - return true; + return new_value; } }; @@ -5292,7 +5762,7 @@ bool callback_show_url(const LLSD& notification, const LLSD& response) class LLPromptShowURL : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string param = userdata.asString(); std::string::size_type offset = param.find(","); @@ -5332,7 +5802,7 @@ bool callback_show_file(const LLSD& notification, const LLSD& response) class LLPromptShowFile : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string param = userdata.asString(); std::string::size_type offset = param.find(","); @@ -5355,7 +5825,7 @@ class LLPromptShowFile : public view_listener_t class LLShowAgentProfile : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLUUID agent_id; if (userdata.asString() == "agent") @@ -5378,50 +5848,15 @@ class LLShowAgentProfile : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object(agent_id); if (avatar) { - LLFloaterAvatarInfo::show( avatar->getID() ); + LLFriendActions::showProfile(avatar->getID()); } return true; } }; -class LLShowAgentGroups : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLFloaterMyFriends::toggleInstance(1); - return true; - } -}; - -void handle_focus(void *) -{ - if (gDisconnected) - { - return; - } - - if (gAgent.getFocusOnAvatar()) - { - // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); - gAgent.cameraZoomIn(0.666f); - } - else - { - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); - } - - gViewerWindow->moveCursorToCenter(); - - // Switch to camera toolset -// LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCamera::getInstance() ); -} - class LLLandEdit : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if (gAgent.getFocusOnAvatar() && gSavedSettings.getBOOL("EditCameraMovement") ) { @@ -5441,7 +5876,7 @@ class LLLandEdit : public view_listener_t LLViewerParcelMgr::getInstance()->selectParcelAt( LLToolPie::getInstance()->getPick().mPosGlobal ); - gFloaterView->bringToFront( gFloaterTools ); + LLFloaterReg::showInstance("build"); // Switch to land edit toolset LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolSelectLand::getInstance() ); @@ -5451,15 +5886,14 @@ class LLLandEdit : public view_listener_t class LLWorldEnableBuyLand : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLViewerParcelMgr::getInstance()->canAgentBuyParcel( LLViewerParcelMgr::getInstance()->selectionEmpty() ? LLViewerParcelMgr::getInstance()->getAgentParcel() : LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -5470,26 +5904,6 @@ BOOL enable_buy_land(void*) } -void handle_move(void*) -{ - if (gAgent.getFocusOnAvatar()) - { - // zoom in if we're looking at the avatar - gAgent.setFocusOnAvatar(FALSE, ANIMATE); - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); - - gAgent.cameraZoomIn(0.666f); - } - else - { - gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick()); - } - - gViewerWindow->moveCursorToCenter(); - - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() ); -} class LLObjectAttachToAvatar : public view_listener_t { @@ -5497,7 +5911,7 @@ public: static void setObjectSelection(LLObjectSelectionHandle selection) { sObjectSelection = selection; } private: - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { setObjectSelection(LLSelectMgr::getInstance()->getSelection()); LLViewerObject* selectedObject = sObjectSelection->getFirstRootObject(); @@ -5580,7 +5994,7 @@ void confirm_replace_attachment(S32 option, void* user_data) class LLAttachmentDrop : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // Called when the user clicked on an object attached to them // and selected "Drop". @@ -5624,11 +6038,13 @@ class LLAttachmentDrop : public view_listener_t }; // called from avatar pie menu -void handle_detach_from_avatar(void* user_data) +class LLAttachmentDetachFromPoint : public view_listener_t { - LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; + bool handleEvent(const LLSD& user_data) +{ + LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL); - LLViewerObject* attached_object = attachment->getObject(); + LLViewerObject* attached_object = attachment ? attachment->getObject() : NULL; if (attached_object) { @@ -5641,31 +6057,20 @@ void handle_detach_from_avatar(void* user_data) gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, attached_object->getLocalID()); gMessageSystem->sendReliable( gAgent.getRegionHost() ); } + return true; } +}; -void attach_label(std::string& label, void* user_data) +static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data) { - LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data; - if (attachmentp) + std::string label; + LLMenuItemGL* menu = dynamic_cast(ctrl); + if (menu) { - label = attachmentp->getName(); - if (attachmentp->getObject()) - { - LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); - if (itemp) - { - label += std::string(" (") + itemp->getName() + std::string(")"); - } - } - } -} - -void detach_label(std::string& label, void* user_data) -{ - LLViewerJointAttachment* attachmentp = (LLViewerJointAttachment*)user_data; + LLViewerJointAttachment *attachmentp = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL); if (attachmentp) { - label = attachmentp->getName(); + label = data["label"].asString(); if (attachmentp->getObject()) { LLViewerInventoryItem* itemp = gInventory.getItem(attachmentp->getItemID()); @@ -5675,12 +6080,15 @@ void detach_label(std::string& label, void* user_data) } } } + menu->setLabel(label); +} + return true; } class LLAttachmentDetach : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // Called when the user clicked on an object attached to them // and selected "Detach". @@ -5749,7 +6157,7 @@ protected: // You can only drop items on parcels where you can build. class LLAttachmentEnableDrop : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->agentCanBuild()); @@ -5796,14 +6204,13 @@ class LLAttachmentEnableDrop : public view_listener_t } //now check to make sure that the item is actually in the inventory before we enable dropping it - bool new_value = enable_detach(NULL) && can_build && item; + bool new_value = enable_detach() && can_build && item; - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; -BOOL enable_detach(void*) +BOOL enable_detach(const LLSD&) { LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (!object) return FALSE; @@ -5827,18 +6234,16 @@ BOOL enable_detach(void*) class LLAttachmentEnableDetach : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - bool new_value = enable_detach(NULL); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + bool new_value = enable_detach(); + return new_value; } }; // Used to tell if the selected object can be attached to your avatar. -BOOL object_selected_and_point_valid(void *user_data) +BOOL object_selected_and_point_valid(const LLSD&) { - //LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::root_iterator iter = selection->root_begin(); iter != selection->root_end(); iter++) @@ -5867,7 +6272,7 @@ BOOL object_selected_and_point_valid(void *user_data) BOOL object_is_wearable() { - if (!object_selected_and_point_valid(NULL)) + if (!object_selected_and_point_valid(LLSD())) { return FALSE; } @@ -5892,25 +6297,29 @@ BOOL object_is_wearable() // Also for seeing if object can be attached. See above. class LLObjectEnableWear : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - bool is_wearable = object_selected_and_point_valid(NULL); - gMenuHolder->findControl(userdata["control"].asString())->setValue(is_wearable); - return TRUE; + return object_selected_and_point_valid(LLSD()); } }; - -BOOL object_attached(void *user_data) +class LLAttachmentPointFilled : public view_listener_t { - LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data; - - return attachment->getObject() != NULL; + bool handleEvent(const LLSD& user_data) + { + bool enable = false; + LLVOAvatar::attachment_map_t::iterator found_it = gAgent.getAvatarObject()->mAttachmentPoints.find(user_data.asInteger()); + if (found_it != gAgent.getAvatarObject()->mAttachmentPoints.end()) +{ + enable = found_it->second->getObject() != NULL; + } + return enable; } +}; class LLAvatarSendIM : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(avatar) @@ -5925,7 +6334,6 @@ class LLAvatarSendIM : public view_listener_t name.append( last->getString() ); } - gIMMgr->setFloaterOpen(TRUE); //EInstantMessage type = have_agent_callingcard(gLastHitObjectID) // ? IM_SESSION_ADD : IM_SESSION_CARDLESS_START; gIMMgr->addSession(name, @@ -5936,16 +6344,6 @@ class LLAvatarSendIM : public view_listener_t } }; - -void handle_activate(void*) -{ -} - -BOOL enable_activate(void*) -{ - return FALSE; -} - namespace { struct QueueObjects : public LLSelectedObjectFunctor @@ -5972,7 +6370,7 @@ namespace }; } -void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, const std::string& nomodmsg) +void queue_actions(LLFloaterScriptQueue* q, const std::string& msg) { QueueObjects func(q); LLSelectMgr *mgr = LLSelectMgr::getInstance(); @@ -5982,10 +6380,12 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons { if ( !func.scripted ) { + std::string noscriptmsg = std::string("Cannot") + msg + "SelectObjectsNoScripts"; LLNotifications::instance().add(noscriptmsg); } else if ( !func.modifiable ) { + std::string nomodmsg = std::string("Cannot") + msg + "SelectObjectsNoPermission"; LLNotifications::instance().add(nomodmsg); } else @@ -6002,62 +6402,51 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, cons } } -void handle_compile_queue(std::string to_lang) -{ - LLFloaterCompileQueue* queue; - if (to_lang == "mono") - { - queue = LLFloaterCompileQueue::create(TRUE); - } - else - { - queue = LLFloaterCompileQueue::create(FALSE); - } - queue_actions(queue, "CannotRecompileSelectObjectsNoScripts", "CannotRecompileSelectObjectsNoPermission"); -} - -void handle_reset_selection(void) -{ - LLFloaterResetQueue* queue = LLFloaterResetQueue::create(); - queue_actions(queue, "CannotResetSelectObjectsNoScripts", "CannotResetSelectObjectsNoPermission"); -} - -void handle_set_run_selection(void) -{ - LLFloaterRunQueue* queue = LLFloaterRunQueue::create(); - queue_actions(queue, "CannotSetRunningSelectObjectsNoScripts", "CannotSerRunningSelectObjectsNoPermission"); -} - -void handle_set_not_run_selection(void) -{ - LLFloaterNotRunQueue* queue = LLFloaterNotRunQueue::create(); - queue_actions(queue, "CannotSetRunningNotSelectObjectsNoScripts", "CannotSerRunningNotSelectObjectsNoPermission"); -} - class LLToolsSelectedScriptAction : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string action = userdata.asString(); + bool mono = false; + std::string msg, name; if (action == "compile mono") { - handle_compile_queue("mono"); + name = "compile_queue"; + mono = true; + msg = "Recompile"; } if (action == "compile lsl") { - handle_compile_queue("lsl"); + name = "compile_queue"; + msg = "Recompile"; } else if (action == "reset") { - handle_reset_selection(); + name = "reset_queue"; + msg = "Reset"; } else if (action == "start") { - handle_set_run_selection(); + name = "start_queue"; + msg = "Running"; } else if (action == "stop") { - handle_set_not_run_selection(); + name = "stop_queue"; + msg = "RunningNot"; + } + LLUUID id; id.generate(); + LLFloater* floater = LLFloaterReg::getInstance(name, LLSD(id)); + LLFloaterScriptQueue* queue = dynamic_cast(floater); + if (queue) + { + queue->setMono(mono); + queue_actions(queue, msg); + } + else + { + llwarns << "Failed to generate LLFloaterScriptQueue with action: " << action << llendl; + delete floater; } return true; } @@ -6112,11 +6501,6 @@ void handle_selected_texture_info(void*) } } -void handle_dump_image_list(void*) -{ - gImageList.dump(); -} - void handle_test_male(void*) { wear_outfit_by_name("Male Shape & Outfit"); @@ -6167,107 +6551,76 @@ void handle_dump_attachments(void*) } } -//--------------------------------------------------------------------- -// Callbacks for enabling/disabling items -//--------------------------------------------------------------------- - -BOOL menu_ui_enabled(void *user_data) -{ - BOOL high_res = gSavedSettings.getBOOL( "HighResSnapshot" ); - return !high_res; -} - -// TomY TODO DEPRECATE & REMOVE -void menu_toggle_control( void* user_data ) -{ - BOOL checked = gSavedSettings.getBOOL( static_cast(user_data) ); - if (std::string(static_cast(user_data)) == "HighResSnapshot" && !checked) - { - // High Res Snapshot active, must uncheck RenderUIInSnapshot - gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE ); - } - gSavedSettings.setBOOL( static_cast(user_data), !checked ); -} - // these are used in the gl menus to set control values. class LLToggleControl : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string control_name = userdata.asString(); BOOL checked = gSavedSettings.getBOOL( control_name ); - if (control_name == "HighResSnapshot" && !checked) - { - // High Res Snapshot active, must uncheck RenderUIInSnapshot - gSavedSettings.setBOOL( "RenderUIInSnapshot", FALSE ); - } gSavedSettings.setBOOL( control_name, !checked ); return true; } }; -BOOL menu_check_control( void* user_data) +class LLCheckControl : public view_listener_t { - return gSavedSettings.getBOOL((char*)user_data); + bool handleEvent( const LLSD& userdata) + { + std::string callback_data = userdata.asString(); + bool new_value = gSavedSettings.getBOOL(callback_data); + return new_value; } -// -void menu_toggle_variable( void* user_data ) -{ - BOOL checked = *(BOOL*)user_data; - *(BOOL*)user_data = !checked; -} +}; -BOOL menu_check_variable( void* user_data) +void menu_toggle_attached_lights(void* user_data) { - return *(BOOL*)user_data; + LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); } - -BOOL enable_land_selected( void* ) +void menu_toggle_attached_particles(void* user_data) { - return !(LLViewerParcelMgr::getInstance()->selectionEmpty()); + LLPipeline::sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); } -void menu_toggle_attached_lights(void* user_data) +class LLAdvancedHandleAttchedLightParticles: public view_listener_t { - menu_toggle_control(user_data); - LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); + bool handleEvent(const LLSD& userdata) + { + std::string control_name = userdata.asString(); + if (control_name == "RenderAttachedLights") +{ + menu_toggle_attached_lights(NULL); } - -void menu_toggle_attached_particles(void* user_data) + else if (control_name == "RenderAttachedParticles") { - menu_toggle_control(user_data); - LLPipeline::sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); + menu_toggle_attached_particles(NULL); } + return true; +} +}; class LLSomethingSelected : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = !(LLSelectMgr::getInstance()->getSelection()->isEmpty()); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLSomethingSelectedNoHUD : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); bool new_value = !(selection->isEmpty()) && !(selection->getSelectType() == SELECT_TYPE_HUD); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; -BOOL enable_more_than_one_selected(void* ) -{ - return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); -} - static bool is_editable_selected() { return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); @@ -6275,106 +6628,62 @@ static bool is_editable_selected() class LLEditableSelected : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - gMenuHolder->findControl(userdata["control"].asString())->setValue(is_editable_selected()); - return true; + return is_editable_selected(); } }; class LLEditableSelectedMono : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { + bool new_value = false; LLViewerRegion* region = gAgent.getRegion(); - if(region && gMenuHolder && gMenuHolder->findControl(userdata["control"].asString())) + if(region && gMenuHolder) { bool have_cap = (! region->getCapability("UpdateScriptTask").empty()); - bool selected = is_editable_selected() && have_cap; - gMenuHolder->findControl(userdata["control"].asString())->setValue(selected); - return true; + new_value = is_editable_selected() && have_cap; } - return false; + return new_value; } }; class LLToolsEnableTakeCopy : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool all_valid = false; if (LLSelectMgr::getInstance()) { if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) { - all_valid = true; + all_valid = true; #ifndef HACKED_GODLIKE_VIEWER # ifdef TOGGLE_HACKED_GODLIKE_VIEWER - if (LLViewerLogin::getInstance()->isInProductionGrid() - || !gAgent.isGodlike()) + if (LLViewerLogin::getInstance()->isInProductionGrid() + || !gAgent.isGodlike()) # endif + { + struct f : public LLSelectedObjectFunctor { - struct f : public LLSelectedObjectFunctor + virtual bool apply(LLViewerObject* obj) { - virtual bool apply(LLViewerObject* obj) - { - return (!obj->permCopy() || obj->isAttachment()); - } - } func; - const bool firstonly = true; - bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); - all_valid = !any_invalid; - } -#endif // HACKED_GODLIKE_VIEWER + return (!obj->permCopy() || obj->isAttachment()); + } + } func; + const bool firstonly = true; + bool any_invalid = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); + all_valid = !any_invalid; } +#endif // HACKED_GODLIKE_VIEWER + } } - gMenuHolder->findControl(userdata["control"].asString())->setValue(all_valid); - return true; + return all_valid; } }; -BOOL enable_selection_you_own_all(void*) -{ - if (LLSelectMgr::getInstance()) - { - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* obj) - { - return (!obj->permYouOwner()); - } - } func; - const bool firstonly = true; - bool no_perms = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); - if (no_perms) - { - return FALSE; - } - } - return TRUE; -} - -BOOL enable_selection_you_own_one(void*) -{ - if (LLSelectMgr::getInstance()) - { - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* obj) - { - return (obj->permYouOwner()); - } - } func; - const bool firstonly = true; - bool any_perms = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); - if (!any_perms) - { - return FALSE; - } - } - return TRUE; -} class LLHasAsset : public LLInventoryCollectFunctor { @@ -6436,6 +6745,15 @@ BOOL enable_save_into_inventory(void*) return FALSE; } +class LLToolsEnableSaveToInventory : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + bool new_value = enable_save_into_inventory(NULL); + return new_value; + } +}; + BOOL enable_save_into_task_inventory(void*) { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); @@ -6453,101 +6771,65 @@ BOOL enable_save_into_task_inventory(void*) class LLToolsEnableSaveToObjectInventory : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = enable_save_into_task_inventory(NULL); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; -BOOL enable_not_thirdperson(void*) -{ - return !gAgent.cameraThirdPerson(); -} - - -// BOOL enable_export_selected(void *) -// { -// if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) -// { -// return FALSE; -// } -// if (!gExporterRequestID.isNull()) -// { -// return FALSE; -// } -// if (!LLUploadDialog::modalUploadIsFinished()) -// { -// return FALSE; -// } -// return TRUE; -// } class LLViewEnableMouselook : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // You can't go directly from customize avatar to mouselook. // TODO: write code with appropriate dialogs to handle this transition. bool new_value = (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() && !gSavedSettings.getBOOL("FreezeTime")); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLToolsEnableToolNotPie : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = ( LLToolMgr::getInstance()->getBaseTool() != LLToolPie::getInstance() ); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLWorldEnableCreateLandmark : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = can_create_landmark(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - - return true; + return new_value; } }; class LLWorldEnableSetHomeLocation : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = gAgent.isGodlike() || (gAgent.getRegion() && gAgent.getRegion()->getAllowSetHome()); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLWorldEnableTeleportHome : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLViewerRegion* regionp = gAgent.getRegion(); bool agent_on_prelude = (regionp && regionp->isPrelude()); bool enable_teleport_home = gAgent.isGodlike() || !agent_on_prelude; - gMenuHolder->findControl(userdata["control"].asString())->setValue(enable_teleport_home); - return true; + return enable_teleport_home; } }; -BOOL enable_region_owner(void*) -{ - if(gAgent.getRegion() && gAgent.getRegion()->getOwner() == gAgent.getID()) - return TRUE; - return enable_god_customer_service(NULL); -} - BOOL enable_god_full(void*) { return gAgent.getGodLevel() >= GOD_FULL; @@ -6568,18 +6850,6 @@ BOOL enable_god_basic(void*) return gAgent.getGodLevel() > GOD_NOT; } -#if 0 // 1.9.2 -void toggle_vertex_shaders(void *) -{ - BOOL use_shaders = gPipeline.getUseVertexShaders(); - gPipeline.setUseVertexShaders(use_shaders); -} - -BOOL check_vertex_shaders(void *) -{ - return gPipeline.getUseVertexShaders(); -} -#endif void toggle_show_xui_names(void *) { @@ -6594,18 +6864,9 @@ BOOL check_show_xui_names(void *) return gSavedSettings.getBOOL("ShowXUINames"); } - - -void toggle_cull_small(void *) -{ -// gPipeline.mCullBySize = !gPipeline.mCullBySize; -// -// gSavedSettings.setBOOL("RenderCullBySize", gPipeline.mCullBySize); -} - class LLToolsSelectOnlyMyObjects : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { BOOL cur_val = gSavedSettings.getBOOL("SelectOwnedOnly"); @@ -6617,7 +6878,7 @@ class LLToolsSelectOnlyMyObjects : public view_listener_t class LLToolsSelectOnlyMovableObjects : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { BOOL cur_val = gSavedSettings.getBOOL("SelectMovableOnly"); @@ -6629,7 +6890,7 @@ class LLToolsSelectOnlyMovableObjects : public view_listener_t class LLToolsSelectBySurrounding : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLSelectMgr::sRectSelectInclusive = !LLSelectMgr::sRectSelectInclusive; @@ -6640,7 +6901,7 @@ class LLToolsSelectBySurrounding : public view_listener_t class LLToolsShowHiddenSelection : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // TomY TODO Merge these LLSelectMgr::sRenderHiddenSelections = !LLSelectMgr::sRenderHiddenSelections; @@ -6652,7 +6913,7 @@ class LLToolsShowHiddenSelection : public view_listener_t class LLToolsShowSelectionLightRadius : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // TomY TODO merge these LLSelectMgr::sRenderLightRadius = !LLSelectMgr::sRenderLightRadius; @@ -6664,7 +6925,7 @@ class LLToolsShowSelectionLightRadius : public view_listener_t class LLToolsEditLinkedParts : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { BOOL select_individuals = gSavedSettings.getBOOL("EditLinkedParts"); if (select_individuals) @@ -6679,40 +6940,14 @@ class LLToolsEditLinkedParts : public view_listener_t } }; -void reload_personal_settings_overrides(void *) -{ - llinfos << "Loading overrides from " << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml") << llendl; - - gSavedSettings.loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml")); -} - void reload_vertex_shader(void *) { //THIS WOULD BE AN AWESOME PLACE TO RELOAD SHADERS... just a thought - DaveP } -void slow_mo_animations(void*) -{ - static BOOL slow_mo = FALSE; - if (slow_mo) - { - gAgent.getAvatarObject()->setAnimTimeFactor(1.f); - slow_mo = FALSE; - } - else - { - gAgent.getAvatarObject()->setAnimTimeFactor(0.2f); - slow_mo = TRUE; - } -} - void handle_dump_avatar_local_textures(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( avatar ) - { - avatar->dumpLocalTextures(); - } + gAgent.getAvatarObject()->dumpLocalTextures(); } void handle_debug_avatar_textures(void*) @@ -6727,7 +6962,7 @@ void handle_debug_avatar_textures(void*) void handle_grab_texture(void* data) { ETextureIndex index = (ETextureIndex)((intptr_t)data); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + const LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if ( avatar ) { const LLUUID& asset_id = avatar->grabLocalTexture(index); @@ -6737,32 +6972,14 @@ void handle_grab_texture(void* data) LLUUID folder_id(gInventory.findCategoryUUIDForType(asset_type)); if(folder_id.notNull()) { - std::string name = "Baked "; - switch (index) + std::string name = "Unknown"; + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + if (texture_dict->mIsBakedTexture) { - case TEX_EYES_BAKED: - name.append("Iris"); - break; - case TEX_HEAD_BAKED: - name.append("Head"); - break; - case TEX_UPPER_BAKED: - name.append("Upper Body"); - break; - case TEX_LOWER_BAKED: - name.append("Lower Body"); - break; - case TEX_SKIRT_BAKED: - name.append("Skirt"); - break; - case TEX_HAIR_BAKED: - name.append("Hair"); - break; - default: - name.append("Unknown"); - break; + EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized; } - name.append(" Texture"); + name += " Texture"; LLUUID item_id; item_id.generate(); @@ -6820,7 +7037,7 @@ void handle_grab_texture(void* data) BOOL enable_grab_texture(void* data) { ETextureIndex index = (ETextureIndex)((intptr_t)data); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + const LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if ( avatar ) { return avatar->canGrabLocalTexture(index); @@ -6842,8 +7059,7 @@ LLVOAvatar* find_avatar_from_object( LLViewerObject* object ) } while( object && !object->isAvatar() ); } - else - if( !object->isAvatar() ) + else if( !object->isAvatar() ) { object = NULL; } @@ -6898,7 +7114,7 @@ void force_error_driver_crash(void *) class LLToolsUseSelectionForGrid : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLSelectMgr::getInstance()->clearGridObjects(); struct f : public LLSelectedObjectFunctor @@ -6931,10 +7147,6 @@ void handle_test_load_url(void*) // LLViewerMenuHolderGL // -LLViewerMenuHolderGL::LLViewerMenuHolderGL() : LLMenuHolderGL() -{ -} - BOOL LLViewerMenuHolderGL::hideMenus() { BOOL handled = LLMenuHolderGL::hideMenus(); @@ -6998,7 +7210,7 @@ void handle_load_from_xml(void*) if (picker.getOpenFile(LLFilePicker::FFLOAD_XML)) { std::string filename = picker.getFirstFile(); - LLFloater* floater = new LLFloater("sample_floater"); + LLFloater* floater = new LLFloater(); LLUICtrlFactory::getInstance()->buildFloater(floater, filename); } } @@ -7025,7 +7237,7 @@ void handle_buy_currency_test(void*) // *TODO: Replace with call to LLUI::getLanguage() after windows-setup // branch merges in. JC - std::string language = "en-us"; + std::string language = "en"; language = gSavedSettings.getString("Language"); if (language.empty() || language == "default") { @@ -7037,7 +7249,7 @@ void handle_buy_currency_test(void*) } if (language.empty() || language == "default") { - language = "en-us"; + language = "en"; } replace["[LANGUAGE]"] = language; @@ -7053,7 +7265,7 @@ void handle_buy_currency_test(void*) void handle_rebake_textures(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if (!avatar) return; // Slam pending upload count to "unstick" things @@ -7076,7 +7288,7 @@ BOOL get_visibility(void* user_data) // TomY TODO: Get rid of these? class LLViewShowHoverTips : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLHoverView::sShowHoverTips = !LLHoverView::sShowHoverTips; return true; @@ -7085,18 +7297,17 @@ class LLViewShowHoverTips : public view_listener_t class LLViewCheckShowHoverTips : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLHoverView::sShowHoverTips; - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; // TomY TODO: Get rid of these? class LLViewHighlightTransparent : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLDrawPoolAlpha::sShowDebugAlpha = !LLDrawPoolAlpha::sShowDebugAlpha; return true; @@ -7105,17 +7316,157 @@ class LLViewHighlightTransparent : public view_listener_t class LLViewCheckHighlightTransparent : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLDrawPoolAlpha::sShowDebugAlpha; - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + return new_value; + } +}; + +class LLViewBeaconWidth : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string width = userdata.asString(); + if(width == "1") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 1); + } + else if(width == "4") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 4); + } + else if(width == "16") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 16); + } + else if(width == "32") + { + gSavedSettings.setS32("DebugBeaconLineWidth", 32); + } + + return true; + } +}; + + +class LLViewToggleBeacon : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string beacon = userdata.asString(); + if (beacon == "scriptsbeacon") + { + LLPipeline::toggleRenderScriptedBeacons(NULL); + gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) ); + // toggle the other one off if it's on + if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL)) + { + LLPipeline::toggleRenderScriptedTouchBeacons(NULL); + gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) ); + } + } + else if (beacon == "physicalbeacon") + { + LLPipeline::toggleRenderPhysicalBeacons(NULL); + gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons(NULL) ); + } + else if (beacon == "soundsbeacon") + { + LLPipeline::toggleRenderSoundBeacons(NULL); + gSavedSettings.setBOOL( "soundsbeacon", LLPipeline::getRenderSoundBeacons(NULL) ); + } + else if (beacon == "particlesbeacon") + { + LLPipeline::toggleRenderParticleBeacons(NULL); + gSavedSettings.setBOOL( "particlesbeacon", LLPipeline::getRenderParticleBeacons(NULL) ); + } + else if (beacon == "scripttouchbeacon") + { + LLPipeline::toggleRenderScriptedTouchBeacons(NULL); + gSavedSettings.setBOOL( "scripttouchbeacon", LLPipeline::getRenderScriptedTouchBeacons(NULL) ); + // toggle the other one off if it's on + if (LLPipeline::getRenderScriptedBeacons(NULL) && LLPipeline::getRenderScriptedTouchBeacons(NULL)) + { + LLPipeline::toggleRenderScriptedBeacons(NULL); + gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons(NULL) ); + } + } + else if (beacon == "renderbeacons") + { + LLPipeline::toggleRenderBeacons(NULL); + gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) ); + // toggle the other one on if it's not + if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL)) + { + LLPipeline::toggleRenderHighlights(NULL); + gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) ); + } + } + else if (beacon == "renderhighlights") + { + LLPipeline::toggleRenderHighlights(NULL); + gSavedSettings.setBOOL( "renderhighlights", LLPipeline::getRenderHighlights(NULL) ); + // toggle the other one on if it's not + if (!LLPipeline::getRenderBeacons(NULL) && !LLPipeline::getRenderHighlights(NULL)) + { + LLPipeline::toggleRenderBeacons(NULL); + gSavedSettings.setBOOL( "renderbeacons", LLPipeline::getRenderBeacons(NULL) ); + } + } + return true; } }; +class LLViewCheckBeaconEnabled : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string beacon = userdata.asString(); + bool new_value = false; + if (beacon == "scriptsbeacon") + { + new_value = gSavedSettings.getBOOL( "scriptsbeacon"); + LLPipeline::setRenderScriptedBeacons(new_value); + } + else if (beacon == "physicalbeacon") + { + new_value = gSavedSettings.getBOOL( "physicalbeacon"); + LLPipeline::setRenderPhysicalBeacons(new_value); + } + else if (beacon == "soundsbeacon") + { + new_value = gSavedSettings.getBOOL( "soundsbeacon"); + LLPipeline::setRenderSoundBeacons(new_value); + } + else if (beacon == "particlesbeacon") + { + new_value = gSavedSettings.getBOOL( "particlesbeacon"); + LLPipeline::setRenderParticleBeacons(new_value); + } + else if (beacon == "scripttouchbeacon") + { + new_value = gSavedSettings.getBOOL( "scripttouchbeacon"); + LLPipeline::setRenderScriptedTouchBeacons(new_value); + } + else if (beacon == "renderbeacons") + { + new_value = gSavedSettings.getBOOL( "renderbeacons"); + LLPipeline::setRenderBeacons(new_value); + } + else if (beacon == "renderhighlights") + { + new_value = gSavedSettings.getBOOL( "renderhighlights"); + LLPipeline::setRenderHighlights(new_value); + } + return new_value; + } +}; + class LLViewToggleRenderType : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string type = userdata.asString(); if (type == "hideparticles") @@ -7128,22 +7479,21 @@ class LLViewToggleRenderType : public view_listener_t class LLViewCheckRenderType : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - std::string type = userdata["data"].asString(); + std::string type = userdata.asString(); bool new_value = false; if (type == "hideparticles") { new_value = LLPipeline::toggleRenderTypeControlNegated((void *)LLPipeline::RENDER_TYPE_PARTICLES); } - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLViewShowHUDAttachments : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLPipeline::sShowHUDAttachments = !LLPipeline::sShowHUDAttachments; return true; @@ -7152,123 +7502,127 @@ class LLViewShowHUDAttachments : public view_listener_t class LLViewCheckHUDAttachments : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = LLPipeline::sShowHUDAttachments; - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLEditEnableTakeOff : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { - std::string control_name = userdata["control"].asString(); - std::string clothing = userdata["data"].asString(); + std::string clothing = userdata.asString(); bool new_value = false; if (clothing == "shirt") { - new_value = LLAgent::selfHasWearable((void *)WT_SHIRT); + new_value = LLAgentWearables::selfHasWearable((void *)WT_SHIRT); } if (clothing == "pants") { - new_value = LLAgent::selfHasWearable((void *)WT_PANTS); + new_value = LLAgentWearables::selfHasWearable((void *)WT_PANTS); } if (clothing == "shoes") { - new_value = LLAgent::selfHasWearable((void *)WT_SHOES); + new_value = LLAgentWearables::selfHasWearable((void *)WT_SHOES); } if (clothing == "socks") { - new_value = LLAgent::selfHasWearable((void *)WT_SOCKS); + new_value = LLAgentWearables::selfHasWearable((void *)WT_SOCKS); } if (clothing == "jacket") { - new_value = LLAgent::selfHasWearable((void *)WT_JACKET); + new_value = LLAgentWearables::selfHasWearable((void *)WT_JACKET); } if (clothing == "gloves") { - new_value = LLAgent::selfHasWearable((void *)WT_GLOVES); + new_value = LLAgentWearables::selfHasWearable((void *)WT_GLOVES); } if (clothing == "undershirt") { - new_value = LLAgent::selfHasWearable((void *)WT_UNDERSHIRT); + new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERSHIRT); } if (clothing == "underpants") { - new_value = LLAgent::selfHasWearable((void *)WT_UNDERPANTS); + new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERPANTS); } if (clothing == "skirt") { - new_value = LLAgent::selfHasWearable((void *)WT_SKIRT); + new_value = LLAgentWearables::selfHasWearable((void *)WT_SKIRT); } - gMenuHolder->findControl(control_name)->setValue(new_value); - return true; + if (clothing == "alpha") + { + new_value = LLAgentWearables::selfHasWearable((void *)WT_ALPHA); + } + if (clothing == "tattoo") + { + new_value = LLAgentWearables::selfHasWearable((void *)WT_TATTOO); + } + return new_value; } }; class LLEditTakeOff : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string clothing = userdata.asString(); if (clothing == "shirt") { - LLAgent::userRemoveWearable((void*)WT_SHIRT); + LLAgentWearables::userRemoveWearable((void*)WT_SHIRT); } else if (clothing == "pants") { - LLAgent::userRemoveWearable((void*)WT_PANTS); + LLAgentWearables::userRemoveWearable((void*)WT_PANTS); } else if (clothing == "shoes") { - LLAgent::userRemoveWearable((void*)WT_SHOES); + LLAgentWearables::userRemoveWearable((void*)WT_SHOES); } else if (clothing == "socks") { - LLAgent::userRemoveWearable((void*)WT_SOCKS); + LLAgentWearables::userRemoveWearable((void*)WT_SOCKS); } else if (clothing == "jacket") { - LLAgent::userRemoveWearable((void*)WT_JACKET); + LLAgentWearables::userRemoveWearable((void*)WT_JACKET); } else if (clothing == "gloves") { - LLAgent::userRemoveWearable((void*)WT_GLOVES); + LLAgentWearables::userRemoveWearable((void*)WT_GLOVES); } else if (clothing == "undershirt") { - LLAgent::userRemoveWearable((void*)WT_UNDERSHIRT); + LLAgentWearables::userRemoveWearable((void*)WT_UNDERSHIRT); } else if (clothing == "underpants") { - LLAgent::userRemoveWearable((void*)WT_UNDERPANTS); + LLAgentWearables::userRemoveWearable((void*)WT_UNDERPANTS); } else if (clothing == "skirt") { - LLAgent::userRemoveWearable((void*)WT_SKIRT); + LLAgentWearables::userRemoveWearable((void*)WT_SKIRT); + } + else if (clothing == "alpha") + { + LLAgentWearables::userRemoveWearable((void*)WT_ALPHA); + } + else if (clothing == "tattoo") + { + LLAgentWearables::userRemoveWearable((void*)WT_TATTOO); } else if (clothing == "all") { - LLAgent::userRemoveAllClothes(NULL); + LLAgentWearables::userRemoveAllClothes(NULL); } return true; } }; -class LLWorldChat : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - handle_chat(NULL); - return true; - } -}; - class LLToolsSelectTool : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string tool_name = userdata.asString(); if (tool_name == "focus") @@ -7298,7 +7652,7 @@ class LLToolsSelectTool : public view_listener_t /// WINDLIGHT callbacks class LLWorldEnvSettings : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string tod = userdata.asString(); LLVector3 sun_direction; @@ -7314,7 +7668,7 @@ class LLWorldEnvSettings : public view_listener_t } else { - LLFloaterEnvSettings::instance()->close(); + LLFloaterEnvSettings::instance()->closeFloater(); } return true; } @@ -7375,7 +7729,7 @@ class LLWorldEnvSettings : public view_listener_t /// Water Menu callbacks class LLWorldWaterSettings : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { // if not there or is hidden, show it if( !LLFloaterWater::isOpen() || @@ -7386,7 +7740,7 @@ class LLWorldWaterSettings : public view_listener_t } else { - LLFloaterWater::instance()->close(); + LLFloaterWater::instance()->closeFloater(); } return true; } @@ -7395,7 +7749,7 @@ class LLWorldWaterSettings : public view_listener_t /// Post-Process callbacks class LLWorldPostProcess : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLFloaterPostProcess::show(); return true; @@ -7405,7 +7759,7 @@ class LLWorldPostProcess : public view_listener_t /// Day Cycle callbacks class LLWorldDayCycle : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLFloaterDayCycle::show(); return true; @@ -7414,12 +7768,6 @@ class LLWorldDayCycle : public view_listener_t -static void addMenu(view_listener_t *menu, const std::string& name) -{ - sMenus.push_back(menu); - menu->registerListener(gMenuHolder, name); -} - void initialize_menus() { // A parameterized event handler used as ctrl-8/9/0 zoom controls below. @@ -7428,7 +7776,7 @@ void initialize_menus() public: // The "mult" parameter says whether "val" is a multiplier or used to set the value. LLZoomer(F32 val, bool mult=true) : mVal(val), mMult(mult) {} - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { F32 new_fov_rad = mMult ? LLViewerCamera::getInstance()->getDefaultFOV() * mVal : mVal; LLViewerCamera::getInstance()->setDefaultFOV(new_fov_rad); @@ -7440,217 +7788,375 @@ void initialize_menus() bool mMult; }; - class LLAvatarReportAbuse : public view_listener_t - { - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if(avatar) - { - LLFloaterReporter::showFromObject(avatar->getID()); - } - return true; - } - }; + LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar(); + LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); + + // Enable God Mode + view_listener_t::addMenu(new LLEnableGodCustomerService(), "EnableGodCustomerService"); + + // Agent + commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); + enable.add("Agent.emableFlying", boost::bind(&LLAgent::enableFlying)); // File menu init_menu_file(); // Edit menu - addMenu(new LLEditUndo(), "Edit.Undo"); - addMenu(new LLEditRedo(), "Edit.Redo"); - addMenu(new LLEditCut(), "Edit.Cut"); - addMenu(new LLEditCopy(), "Edit.Copy"); - addMenu(new LLEditPaste(), "Edit.Paste"); - addMenu(new LLEditDelete(), "Edit.Delete"); - addMenu(new LLEditSearch(), "Edit.Search"); - addMenu(new LLEditSelectAll(), "Edit.SelectAll"); - addMenu(new LLEditDeselect(), "Edit.Deselect"); - addMenu(new LLEditDuplicate(), "Edit.Duplicate"); - addMenu(new LLEditTakeOff(), "Edit.TakeOff"); - - addMenu(new LLEditEnableUndo(), "Edit.EnableUndo"); - addMenu(new LLEditEnableRedo(), "Edit.EnableRedo"); - addMenu(new LLEditEnableCut(), "Edit.EnableCut"); - addMenu(new LLEditEnableCopy(), "Edit.EnableCopy"); - addMenu(new LLEditEnablePaste(), "Edit.EnablePaste"); - addMenu(new LLEditEnableDelete(), "Edit.EnableDelete"); - addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll"); - addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect"); - addMenu(new LLEditEnableDuplicate(), "Edit.EnableDuplicate"); - addMenu(new LLEditEnableTakeOff(), "Edit.EnableTakeOff"); - addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar"); + view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo"); + view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo"); + view_listener_t::addMenu(new LLEditCut(), "Edit.Cut"); + view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy"); + view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste"); + view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete"); + view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll"); + view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect"); + view_listener_t::addMenu(new LLEditDuplicate(), "Edit.Duplicate"); + view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff"); + + view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo"); + view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo"); + view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut"); + view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy"); + view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste"); + view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete"); + view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll"); + view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect"); + view_listener_t::addMenu(new LLEditEnableDuplicate(), "Edit.EnableDuplicate"); + view_listener_t::addMenu(new LLEditEnableTakeOff(), "Edit.EnableTakeOff"); + view_listener_t::addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar"); // View menu - addMenu(new LLViewMouselook(), "View.Mouselook"); - addMenu(new LLViewBuildMode(), "View.BuildMode"); - addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam"); - addMenu(new LLViewCommunicate(), "View.Communicate"); - addMenu(new LLViewResetView(), "View.ResetView"); - addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); - addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); - addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent"); - addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType"); - addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments"); - addMenu(new LLZoomer(1.2f), "View.ZoomOut"); - addMenu(new LLZoomer(1/1.2f), "View.ZoomIn"); - addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault"); - addMenu(new LLViewFullscreen(), "View.Fullscreen"); - addMenu(new LLViewDefaultUISize(), "View.DefaultUISize"); - - addMenu(new LLViewEnableMouselook(), "View.EnableMouselook"); - addMenu(new LLViewEnableJoystickFlycam(), "View.EnableJoystickFlycam"); - addMenu(new LLViewEnableLastChatter(), "View.EnableLastChatter"); - - addMenu(new LLViewCheckBuildMode(), "View.CheckBuildMode"); - addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam"); - addMenu(new LLViewCheckShowHoverTips(), "View.CheckShowHoverTips"); - addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent"); - addMenu(new LLViewCheckRenderType(), "View.CheckRenderType"); - addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments"); + view_listener_t::addMenu(new LLViewMouselook(), "View.Mouselook"); + view_listener_t::addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam"); + view_listener_t::addMenu(new LLViewResetView(), "View.ResetView"); + view_listener_t::addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); + view_listener_t::addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); + view_listener_t::addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent"); + view_listener_t::addMenu(new LLViewToggleRenderType(), "View.ToggleRenderType"); + view_listener_t::addMenu(new LLViewShowHUDAttachments(), "View.ShowHUDAttachments"); + view_listener_t::addMenu(new LLZoomer(1.2f), "View.ZoomOut"); + view_listener_t::addMenu(new LLZoomer(1/1.2f), "View.ZoomIn"); + view_listener_t::addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault"); + view_listener_t::addMenu(new LLViewFullscreen(), "View.Fullscreen"); + view_listener_t::addMenu(new LLViewDefaultUISize(), "View.DefaultUISize"); + + view_listener_t::addMenu(new LLViewEnableMouselook(), "View.EnableMouselook"); + view_listener_t::addMenu(new LLViewEnableJoystickFlycam(), "View.EnableJoystickFlycam"); + view_listener_t::addMenu(new LLViewEnableLastChatter(), "View.EnableLastChatter"); + + view_listener_t::addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam"); + view_listener_t::addMenu(new LLViewCheckShowHoverTips(), "View.CheckShowHoverTips"); + view_listener_t::addMenu(new LLViewCheckHighlightTransparent(), "View.CheckHighlightTransparent"); + view_listener_t::addMenu(new LLViewCheckRenderType(), "View.CheckRenderType"); + view_listener_t::addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments"); // World menu - addMenu(new LLWorldChat(), "World.Chat"); - addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun"); - addMenu(new LLWorldFly(), "World.Fly"); - addMenu(new LLWorldEnableFly(), "World.EnableFly"); - addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark"); - addMenu(new LLWorldSetHomeLocation(), "World.SetHomeLocation"); - addMenu(new LLWorldTeleportHome(), "World.TeleportHome"); - addMenu(new LLWorldSetAway(), "World.SetAway"); - addMenu(new LLWorldSetBusy(), "World.SetBusy"); - - addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); - addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); - addMenu(new LLWorldEnableTeleportHome(), "World.EnableTeleportHome"); - addMenu(new LLWorldEnableBuyLand(), "World.EnableBuyLand"); - - addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun"); + commit.add("World.Chat", boost::bind(&handle_chat, (void*)NULL)); + view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun"); + view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark"); + view_listener_t::addMenu(new LLWorldSetHomeLocation(), "World.SetHomeLocation"); + view_listener_t::addMenu(new LLWorldTeleportHome(), "World.TeleportHome"); + view_listener_t::addMenu(new LLWorldSetAway(), "World.SetAway"); + view_listener_t::addMenu(new LLWorldSetBusy(), "World.SetBusy"); + + view_listener_t::addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark"); + view_listener_t::addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation"); + view_listener_t::addMenu(new LLWorldEnableTeleportHome(), "World.EnableTeleportHome"); + view_listener_t::addMenu(new LLWorldEnableBuyLand(), "World.EnableBuyLand"); + + view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun"); - (new LLWorldEnvSettings())->registerListener(gMenuHolder, "World.EnvSettings"); - (new LLWorldWaterSettings())->registerListener(gMenuHolder, "World.WaterSettings"); - (new LLWorldPostProcess())->registerListener(gMenuHolder, "World.PostProcess"); - (new LLWorldDayCycle())->registerListener(gMenuHolder, "World.DayCycle"); + view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings"); + view_listener_t::addMenu(new LLWorldWaterSettings(), "World.WaterSettings"); + view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess"); + view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle"); // Tools menu - addMenu(new LLToolsSelectTool(), "Tools.SelectTool"); - addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects"); - addMenu(new LLToolsSelectOnlyMovableObjects(), "Tools.SelectOnlyMovableObjects"); - addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding"); - addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection"); - addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius"); - addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); - addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY"); - addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); - addMenu(new LLToolsLink(), "Tools.Link"); - addMenu(new LLToolsUnlink(), "Tools.Unlink"); - addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); - addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys"); - addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys"); - addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection"); - addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake"); - addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); - addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory"); - addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction"); - - addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie"); - addMenu(new LLToolsEnableLink(), "Tools.EnableLink"); - addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); - addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake"); - addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy"); - addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory"); - - /*addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject"); - addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/ + view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool"); + view_listener_t::addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects"); + view_listener_t::addMenu(new LLToolsSelectOnlyMovableObjects(), "Tools.SelectOnlyMovableObjects"); + view_listener_t::addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding"); + view_listener_t::addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection"); + view_listener_t::addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius"); + view_listener_t::addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); + view_listener_t::addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY"); + view_listener_t::addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); + view_listener_t::addMenu(new LLToolsLink(), "Tools.Link"); + view_listener_t::addMenu(new LLToolsUnlink(), "Tools.Unlink"); + view_listener_t::addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); + view_listener_t::addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys"); + view_listener_t::addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys"); + view_listener_t::addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection"); + view_listener_t::addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake"); + view_listener_t::addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy"); + view_listener_t::addMenu(new LLToolsSaveToInventory(), "Tools.SaveToInventory"); + view_listener_t::addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory"); + view_listener_t::addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction"); + + view_listener_t::addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie"); + view_listener_t::addMenu(new LLToolsEnableLink(), "Tools.EnableLink"); + view_listener_t::addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); + view_listener_t::addMenu(new LLToolsEnableBuyOrTake(), "Tools.EnableBuyOrTake"); + view_listener_t::addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy"); + view_listener_t::addMenu(new LLToolsEnableSaveToInventory(), "Tools.EnableSaveToInventory"); + view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory"); + + /*view_listener_t::addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject"); + view_listener_t::addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/ // Help menu // most items use the ShowFloater method + // Advance menu + view_listener_t::addMenu(new LLAdvancedToggleConsole(), "Advanced.ToggleConsole"); + view_listener_t::addMenu(new LLAdvancedCheckConsole(), "Advanced.CheckConsole"); + view_listener_t::addMenu(new LLAdvancedDumpInfoToConsole(), "Advanced.DumpInfoToConsole"); + // Advanced > HUD Info + view_listener_t::addMenu(new LLAdvancedToggleHUDInfo(), "Advanced.ToggleHUDInfo"); + view_listener_t::addMenu(new LLAdvancedCheckHUDInfo(), "Advanced.CheckHUDInfo"); + + // Advanced Other Settings + view_listener_t::addMenu(new LLAdvancedClearGroupCache(), "Advanced.ClearGroupCache"); + + // Advanced > Render > Types + view_listener_t::addMenu(new LLAdvancedToggleRenderType(), "Advanced.ToggleRenderType"); + view_listener_t::addMenu(new LLAdvancedCheckRenderType(), "Advanced.CheckRenderType"); + + //// Advanced > Render > Features + view_listener_t::addMenu(new LLAdvancedToggleFeature(), "Advanced.ToggleFeature"); + view_listener_t::addMenu(new LLAdvancedCheckFeature(), "Advanced.CheckFeature"); + // Advanced > Render > Info Displays + view_listener_t::addMenu(new LLAdvancedToggleInfoDisplay(), "Advanced.ToggleInfoDisplay"); + view_listener_t::addMenu(new LLAdvancedCheckInfoDisplay(), "Advanced.CheckInfoDisplay"); + view_listener_t::addMenu(new LLAdvancedSelectedTextureInfo(), "Advanced.SelectedTextureInfo"); + view_listener_t::addMenu(new LLAdvancedToggleWireframe(), "Advanced.ToggleWireframe"); + view_listener_t::addMenu(new LLAdvancedCheckWireframe(), "Advanced.CheckWireframe"); + view_listener_t::addMenu(new LLAdvancedToggleDisableTextures(), "Advanced.ToggleDisableTextures"); + view_listener_t::addMenu(new LLAdvancedCheckDisableTextures(), "Advanced.CheckDisableTextures"); + view_listener_t::addMenu(new LLAdvancedEnableObjectObjectOcclusion(), "Advanced.EnableObjectObjectOcclusion"); + view_listener_t::addMenu(new LLAdvancedToggleRandomizeFramerate(), "Advanced.ToggleRandomizeFramerate"); + view_listener_t::addMenu(new LLAdvancedCheckRandomizeFramerate(), "Advanced.CheckRandomizeFramerate"); + view_listener_t::addMenu(new LLAdvancedTogglePeriodicSlowFrame(), "Advanced.TogglePeriodicSlowFrame"); + view_listener_t::addMenu(new LLAdvancedCheckPeriodicSlowFrame(), "Advanced.CheckPeriodicSlowFrame"); + view_listener_t::addMenu(new LLAdvancedVectorizePerfTest(), "Advanced.VectorizePerfTest"); + view_listener_t::addMenu(new LLAdvancedToggleFrameTest(), "Advanced.ToggleFrameTest"); + view_listener_t::addMenu(new LLAdvancedCheckFrameTest(), "Advanced.CheckFrameTest"); + view_listener_t::addMenu(new LLAdvancedHandleAttchedLightParticles(), "Advanced.HandleAttchedLightParticles"); + + + #ifdef TOGGLE_HACKED_GODLIKE_VIEWER + view_listener_t::addMenu(new LLAdvancedHandleToggleHackedGodmode(), "Advanced.HandleToggleHackedGodmode"); + view_listener_t::addMenu(new LLAdvancedCheckToggleHackedGodmode(), "Advanced.CheckToggleHackedGodmode"); + view_listener_t::addMenu(new LLAdvancedEnableToggleHackedGodmode(), "Advanced.EnableToggleHackedGodmode"); + #endif + + // Advanced > World + view_listener_t::addMenu(new LLAdvancedDumpScriptedCamera(), "Advanced.DumpScriptedCamera"); + view_listener_t::addMenu(new LLAdvancedDumpRegionObjectCache(), "Advanced.DumpRegionObjectCache"); + + // Advanced > UI + view_listener_t::addMenu(new LLAdvancedWebBrowserTest(), "Advanced.WebBrowserTest"); + view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest"); + view_listener_t::addMenu(new LLAdvancedToggleEditableUI(), "Advanced.ToggleEditableUI"); + view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr"); + view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory"); + view_listener_t::addMenu(new LLAdvancedDumpFocusHolder(), "Advanced.DumpFocusHolder"); + view_listener_t::addMenu(new LLAdvancedPrintSelectedObjectInfo(), "Advanced.PrintSelectedObjectInfo"); + view_listener_t::addMenu(new LLAdvancedPrintAgentInfo(), "Advanced.PrintAgentInfo"); + view_listener_t::addMenu(new LLAdvancedPrintTextureMemoryStats(), "Advanced.PrintTextureMemoryStats"); + view_listener_t::addMenu(new LLAdvancedToggleDebugClicks(), "Advanced.ToggleDebugClicks"); + view_listener_t::addMenu(new LLAdvancedCheckDebugClicks(), "Advanced.CheckDebugClicks"); + view_listener_t::addMenu(new LLAdvancedCheckDebugViews(), "Advanced.CheckDebugViews"); + view_listener_t::addMenu(new LLAdvancedToggleDebugViews(), "Advanced.ToggleDebugViews"); + view_listener_t::addMenu(new LLAdvancedToggleXUINameTooltips(), "Advanced.ToggleXUINameTooltips"); + view_listener_t::addMenu(new LLAdvancedCheckXUINameTooltips(), "Advanced.CheckXUINameTooltips"); + view_listener_t::addMenu(new LLAdvancedToggleDebugMouseEvents(), "Advanced.ToggleDebugMouseEvents"); + view_listener_t::addMenu(new LLAdvancedCheckDebugMouseEvents(), "Advanced.CheckDebugMouseEvents"); + view_listener_t::addMenu(new LLAdvancedToggleDebugKeys(), "Advanced.ToggleDebugKeys"); + view_listener_t::addMenu(new LLAdvancedCheckDebugKeys(), "Advanced.CheckDebugKeys"); + view_listener_t::addMenu(new LLAdvancedToggleDebugWindowProc(), "Advanced.ToggleDebugWindowProc"); + view_listener_t::addMenu(new LLAdvancedCheckDebugWindowProc(), "Advanced.CheckDebugWindowProc"); + + + // Advanced > XUI + view_listener_t::addMenu(new LLAdvancedShowFontTest(), "Advanced.ShowFontTest"); + view_listener_t::addMenu(new LLAdvancedLoadUIFromXML(), "Advanced.LoadUIFromXML"); + view_listener_t::addMenu(new LLAdvancedSaveUIToXML(), "Advanced.SaveUIToXML"); + view_listener_t::addMenu(new LLAdvancedToggleXUINames(), "Advanced.ToggleXUINames"); + view_listener_t::addMenu(new LLAdvancedCheckXUINames(), "Advanced.CheckXUINames"); + + // Advanced > Character > Grab Baked Texture + view_listener_t::addMenu(new LLAdvancedGrabBakedTexture(), "Advanced.GrabBakedTexture"); + view_listener_t::addMenu(new LLAdvancedEnableGrabBakedTexture(), "Advanced.EnableGrabBakedTexture"); + + // Advanced > Character > Character Tests + view_listener_t::addMenu(new LLAdvancedAppearanceToXML(), "Advanced.AppearanceToXML"); + view_listener_t::addMenu(new LLAdvancedToggleCharacterGeometry(), "Advanced.ToggleCharacterGeometry"); + + view_listener_t::addMenu(new LLAdvancedTestMale(), "Advanced.TestMale"); + view_listener_t::addMenu(new LLAdvancedTestFemale(), "Advanced.TestFemale"); + view_listener_t::addMenu(new LLAdvancedTogglePG(), "Advanced.TogglePG"); + + // Advanced > Character (toplevel) + view_listener_t::addMenu(new LLAdvancedToggleAllowTapTapHoldRun(), "Advanced.ToggleAllowTapTapHoldRun"); + view_listener_t::addMenu(new LLAdvancedCheckAllowTapTapHoldRun(), "Advanced.CheckAllowTapTapHoldRun"); + view_listener_t::addMenu(new LLAdvancedForceParamsToDefault(), "Advanced.ForceParamsToDefault"); + view_listener_t::addMenu(new LLAdvancedReloadVertexShader(), "Advanced.ReloadVertexShader"); + view_listener_t::addMenu(new LLAdvancedToggleAnimationInfo(), "Advanced.ToggleAnimationInfo"); + view_listener_t::addMenu(new LLAdvancedCheckAnimationInfo(), "Advanced.CheckAnimationInfo"); + view_listener_t::addMenu(new LLAdvancedToggleShowLookAt(), "Advanced.ToggleShowLookAt"); + view_listener_t::addMenu(new LLAdvancedCheckShowLookAt(), "Advanced.CheckShowLookAt"); + view_listener_t::addMenu(new LLAdvancedToggleShowPointAt(), "Advanced.ToggleShowPointAt"); + view_listener_t::addMenu(new LLAdvancedCheckShowPointAt(), "Advanced.CheckShowPointAt"); + view_listener_t::addMenu(new LLAdvancedToggleDebugJointUpdates(), "Advanced.ToggleDebugJointUpdates"); + view_listener_t::addMenu(new LLAdvancedCheckDebugJointUpdates(), "Advanced.CheckDebugJointUpdates"); + view_listener_t::addMenu(new LLAdvancedToggleDisableLOD(), "Advanced.ToggleDisableLOD"); + view_listener_t::addMenu(new LLAdvancedCheckDisableLOD(), "Advanced.CheckDisableLOD"); + view_listener_t::addMenu(new LLAdvancedToggleDebugCharacterVis(), "Advanced.ToggleDebugCharacterVis"); + view_listener_t::addMenu(new LLAdvancedCheckDebugCharacterVis(), "Advanced.CheckDebugCharacterVis"); + view_listener_t::addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments"); + view_listener_t::addMenu(new LLAdvancedRebakeTextures(), "Advanced.RebakeTextures"); + #ifndef LL_RELEASE_FOR_DOWNLOAD + view_listener_t::addMenu(new LLAdvancedDebugAvatarTextures(), "Advanced.DebugAvatarTextures"); + view_listener_t::addMenu(new LLAdvancedDumpAvatarLocalTextures(), "Advanced.DumpAvatarLocalTextures"); + view_listener_t::addMenu(new LLAdvancedMemoryLeakingSimulation(), "Advanced.MemoryLeakingSimulation"); + #endif + // Advanced > Network + view_listener_t::addMenu(new LLAdvancedEnableMessageLog(), "Advanced.EnableMessageLog"); + view_listener_t::addMenu(new LLAdvancedDisableMessageLog(), "Advanced.DisableMessageLog"); + view_listener_t::addMenu(new LLAdvancedDropPacket(), "Advanced.DropPacket"); + + // Advanced > Recorder + view_listener_t::addMenu(new LLAdvancedAgentPilot(), "Advanced.AgentPilot"); + view_listener_t::addMenu(new LLAdvancedToggleAgentPilotLoop(), "Advanced.ToggleAgentPilotLoop"); + view_listener_t::addMenu(new LLAdvancedCheckAgentPilotLoop(), "Advanced.CheckAgentPilotLoop"); + + // Advanced > Debugging + view_listener_t::addMenu(new LLAdvancedForceErrorBreakpoint(), "Advanced.ForceErrorBreakpoint"); + view_listener_t::addMenu(new LLAdvancedForceErrorLlerror(), "Advanced.ForceErrorLlerror"); + view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccess(), "Advanced.ForceErrorBadMemoryAccess"); + view_listener_t::addMenu(new LLAdvancedForceErrorInfiniteLoop(), "Advanced.ForceErrorInfiniteLoop"); + view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareException(), "Advanced.ForceErrorSoftwareException"); + view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDriverCrash"); + view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDisconnectViewer"); + + // Advanced (toplevel) + view_listener_t::addMenu(new LLAdvancedToggleShowObjectUpdates(), "Advanced.ToggleShowObjectUpdates"); + view_listener_t::addMenu(new LLAdvancedCheckShowObjectUpdates(), "Advanced.CheckShowObjectUpdates"); + view_listener_t::addMenu(new LLAdvancedCompressImage(), "Advanced.CompressImage"); + view_listener_t::addMenu(new LLAdvancedShowDebugSettings(), "Advanced.ShowDebugSettings"); + view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions"); + view_listener_t::addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions"); + view_listener_t::addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus"); + view_listener_t::addMenu(new LLAdvancedLeaveAdminStatus(), "Advanced.LeaveAdminStatus"); + + + // Admin >Object + view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy"); + view_listener_t::addMenu(new LLAdminHandleObjectOwnerSelf(), "Admin.HandleObjectOwnerSelf"); + view_listener_t::addMenu(new LLAdminHandleObjectOwnerPermissive(), "Admin.HandleObjectOwnerPermissive"); + view_listener_t::addMenu(new LLAdminHandleForceDelete(), "Admin.HandleForceDelete"); + view_listener_t::addMenu(new LLAdminHandleObjectLock(), "Admin.HandleObjectLock"); + view_listener_t::addMenu(new LLAdminHandleObjectAssetIDs(), "Admin.HandleObjectAssetIDs"); + + // Admin >Parcel + view_listener_t::addMenu(new LLAdminHandleForceParcelOwnerToMe(), "Admin.HandleForceParcelOwnerToMe"); + view_listener_t::addMenu(new LLAdminHandleForceParcelToContent(), "Admin.HandleForceParcelToContent"); + view_listener_t::addMenu(new LLAdminHandleClaimPublicLand(), "Admin.HandleClaimPublicLand"); + + // Admin >Region + view_listener_t::addMenu(new LLAdminHandleRegionDumpTempAssetData(), "Admin.HandleRegionDumpTempAssetData"); + // Admin top level + view_listener_t::addMenu(new LLAdminShowGodTools(), "Admin.ShowGodTools"); + view_listener_t::addMenu(new LLAdminOnSaveState(), "Admin.OnSaveState"); + // Self pie menu - addMenu(new LLSelfStandUp(), "Self.StandUp"); - addMenu(new LLSelfRemoveAllAttachments(), "Self.RemoveAllAttachments"); + view_listener_t::addMenu(new LLSelfStandUp(), "Self.StandUp"); + view_listener_t::addMenu(new LLSelfRemoveAllAttachments(), "Self.RemoveAllAttachments"); - addMenu(new LLSelfEnableStandUp(), "Self.EnableStandUp"); - addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments"); + view_listener_t::addMenu(new LLSelfEnableStandUp(), "Self.EnableStandUp"); + view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments"); // Avatar pie menu - addMenu(new LLObjectMute(), "Avatar.Mute"); - addMenu(new LLAvatarAddFriend(), "Avatar.AddFriend"); - addMenu(new LLAvatarFreeze(), "Avatar.Freeze"); - addMenu(new LLAvatarDebug(), "Avatar.Debug"); - addMenu(new LLAvatarVisibleDebug(), "Avatar.VisibleDebug"); - addMenu(new LLAvatarEnableDebug(), "Avatar.EnableDebug"); - addMenu(new LLAvatarInviteToGroup(), "Avatar.InviteToGroup"); - addMenu(new LLAvatarGiveCard(), "Avatar.GiveCard"); - addMenu(new LLAvatarEject(), "Avatar.Eject"); - addMenu(new LLAvatarSendIM(), "Avatar.SendIM"); - addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); + view_listener_t::addMenu(new LLObjectMute(), "Avatar.Mute"); + view_listener_t::addMenu(new LLAvatarAddFriend(), "Avatar.AddFriend"); + view_listener_t::addMenu(new LLAvatarFreeze(), "Avatar.Freeze"); + view_listener_t::addMenu(new LLAvatarDebug(), "Avatar.Debug"); + view_listener_t::addMenu(new LLAvatarVisibleDebug(), "Avatar.VisibleDebug"); + view_listener_t::addMenu(new LLAvatarEnableDebug(), "Avatar.EnableDebug"); + view_listener_t::addMenu(new LLAvatarInviteToGroup(), "Avatar.InviteToGroup"); + view_listener_t::addMenu(new LLAvatarGiveCard(), "Avatar.GiveCard"); + view_listener_t::addMenu(new LLAvatarEject(), "Avatar.Eject"); + view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM"); + view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); - addMenu(new LLObjectEnableMute(), "Avatar.EnableMute"); - addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); - addMenu(new LLAvatarEnableFreezeEject(), "Avatar.EnableFreezeEject"); + view_listener_t::addMenu(new LLObjectEnableMute(), "Avatar.EnableMute"); + view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); + view_listener_t::addMenu(new LLAvatarEnableFreezeEject(), "Avatar.EnableFreezeEject"); // Object pie menu - addMenu(new LLObjectOpen(), "Object.Open"); - addMenu(new LLObjectBuild(), "Object.Build"); - addMenu(new LLObjectTouch(), "Object.Touch"); - addMenu(new LLObjectSitOrStand(), "Object.SitOrStand"); - addMenu(new LLObjectDelete(), "Object.Delete"); - addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar"); - addMenu(new LLObjectReturn(), "Object.Return"); - addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse"); - addMenu(new LLObjectMute(), "Object.Mute"); - addMenu(new LLObjectBuy(), "Object.Buy"); - addMenu(new LLObjectEdit(), "Object.Edit"); - addMenu(new LLObjectInspect(), "Object.Inspect"); - - addMenu(new LLObjectEnableOpen(), "Object.EnableOpen"); - addMenu(new LLObjectEnableTouch(), "Object.EnableTouch"); - addMenu(new LLObjectEnableSitOrStand(), "Object.EnableSitOrStand"); - addMenu(new LLObjectEnableDelete(), "Object.EnableDelete"); - addMenu(new LLObjectEnableWear(), "Object.EnableWear"); - addMenu(new LLObjectEnableReturn(), "Object.EnableReturn"); - addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse"); - addMenu(new LLObjectEnableMute(), "Object.EnableMute"); - addMenu(new LLObjectEnableBuy(), "Object.EnableBuy"); - - /*addMenu(new LLObjectVisibleTouch(), "Object.VisibleTouch"); - addMenu(new LLObjectVisibleCustomTouch(), "Object.VisibleCustomTouch"); - addMenu(new LLObjectVisibleStandUp(), "Object.VisibleStandUp"); - addMenu(new LLObjectVisibleSitHere(), "Object.VisibleSitHere"); - addMenu(new LLObjectVisibleCustomSit(), "Object.VisibleCustomSit");*/ + view_listener_t::addMenu(new LLObjectOpen(), "Object.Open"); + view_listener_t::addMenu(new LLObjectBuild(), "Object.Build"); + view_listener_t::addMenu(new LLObjectTouch(), "Object.Touch"); + view_listener_t::addMenu(new LLObjectSitOrStand(), "Object.SitOrStand"); + view_listener_t::addMenu(new LLObjectDelete(), "Object.Delete"); + view_listener_t::addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar"); + view_listener_t::addMenu(new LLObjectReturn(), "Object.Return"); + view_listener_t::addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse"); + view_listener_t::addMenu(new LLObjectMute(), "Object.Mute"); + view_listener_t::addMenu(new LLObjectBuy(), "Object.Buy"); + view_listener_t::addMenu(new LLObjectEdit(), "Object.Edit"); + view_listener_t::addMenu(new LLObjectInspect(), "Object.Inspect"); + + view_listener_t::addMenu(new LLObjectEnableOpen(), "Object.EnableOpen"); + view_listener_t::addMenu(new LLObjectEnableTouch(), "Object.EnableTouch"); + view_listener_t::addMenu(new LLObjectEnableSitOrStand(), "Object.EnableSitOrStand"); + view_listener_t::addMenu(new LLObjectEnableDelete(), "Object.EnableDelete"); + view_listener_t::addMenu(new LLObjectEnableWear(), "Object.EnableWear"); + view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn"); + view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse"); + view_listener_t::addMenu(new LLObjectEnableMute(), "Object.EnableMute"); + view_listener_t::addMenu(new LLObjectEnableBuy(), "Object.EnableBuy"); + + /*view_listener_t::addMenu(new LLObjectVisibleTouch(), "Object.VisibleTouch"); + view_listener_t::addMenu(new LLObjectVisibleCustomTouch(), "Object.VisibleCustomTouch"); + view_listener_t::addMenu(new LLObjectVisibleStandUp(), "Object.VisibleStandUp"); + view_listener_t::addMenu(new LLObjectVisibleSitHere(), "Object.VisibleSitHere"); + view_listener_t::addMenu(new LLObjectVisibleCustomSit(), "Object.VisibleCustomSit");*/ // Attachment pie menu - addMenu(new LLAttachmentDrop(), "Attachment.Drop"); - addMenu(new LLAttachmentDetach(), "Attachment.Detach"); - - addMenu(new LLAttachmentEnableDrop(), "Attachment.EnableDrop"); - addMenu(new LLAttachmentEnableDetach(), "Attachment.EnableDetach"); + enable.add("Attachment.Label", boost::bind(&onEnableAttachmentLabel, _1, _2)); + view_listener_t::addMenu(new LLAttachmentDrop(), "Attachment.Drop"); + view_listener_t::addMenu(new LLAttachmentDetachFromPoint(), "Attachment.DetachFromPoint"); + view_listener_t::addMenu(new LLAttachmentDetach(), "Attachment.Detach"); + view_listener_t::addMenu(new LLAttachmentPointFilled(), "Attachment.PointFilled"); + view_listener_t::addMenu(new LLAttachmentEnableDrop(), "Attachment.EnableDrop"); + view_listener_t::addMenu(new LLAttachmentEnableDetach(), "Attachment.EnableDetach"); // Land pie menu - addMenu(new LLLandBuild(), "Land.Build"); - addMenu(new LLLandSit(), "Land.Sit"); - addMenu(new LLLandBuyPass(), "Land.BuyPass"); - addMenu(new LLLandEdit(), "Land.Edit"); + view_listener_t::addMenu(new LLLandBuild(), "Land.Build"); + view_listener_t::addMenu(new LLLandSit(), "Land.Sit"); + view_listener_t::addMenu(new LLLandBuyPass(), "Land.BuyPass"); + view_listener_t::addMenu(new LLLandEdit(), "Land.Edit"); - addMenu(new LLLandEnableBuyPass(), "Land.EnableBuyPass"); + view_listener_t::addMenu(new LLLandEnableBuyPass(), "Land.EnableBuyPass"); // Generic actions - addMenu(new LLShowFloater(), "ShowFloater"); - addMenu(new LLPromptShowURL(), "PromptShowURL"); - addMenu(new LLShowAgentProfile(), "ShowAgentProfile"); - addMenu(new LLShowAgentGroups(), "ShowAgentGroups"); - addMenu(new LLToggleControl(), "ToggleControl"); - - addMenu(new LLGoToObject(), "GoToObject"); - addMenu(new LLPayObject(), "PayObject"); - - addMenu(new LLEnablePayObject(), "EnablePayObject"); - addMenu(new LLEnableEdit(), "EnableEdit"); - - addMenu(new LLFloaterVisible(), "FloaterVisible"); - addMenu(new LLSomethingSelected(), "SomethingSelected"); - addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); - addMenu(new LLEditableSelected(), "EditableSelected"); - addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); + view_listener_t::addMenu(new LLShowFloater(), "ShowFloater"); + view_listener_t::addMenu(new LLPromptShowURL(), "PromptShowURL"); + view_listener_t::addMenu(new LLShowAgentProfile(), "ShowAgentProfile"); + view_listener_t::addMenu(new LLToggleControl(), "ToggleControl"); + view_listener_t::addMenu(new LLCheckControl(), "CheckControl"); + view_listener_t::addMenu(new LLGoToObject(), "GoToObject"); + view_listener_t::addMenu(new LLPayObject(), "PayObject"); + + view_listener_t::addMenu(new LLEnablePayObject(), "EnablePayObject"); + view_listener_t::addMenu(new LLEnableEdit(), "EnableEdit"); + + view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); + view_listener_t::addMenu(new LLSomethingSelected(), "SomethingSelected"); + view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); + view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); + view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); + } diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index e9fedf37d8..99994bdf5b 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -34,6 +34,7 @@ #define LL_LLVIEWERMENU_H #include "llmenugl.h" +#include "llsafehandle.h" //newview includes #include "llfilepicker.h" @@ -44,7 +45,6 @@ class LLParcelSelection; class LLObjectSelection; -void pre_init_menus(); void init_menus(); void cleanup_menus(); @@ -79,26 +79,22 @@ BOOL enable_redo(void*); BOOL is_agent_friend(const LLUUID& agent_id); BOOL is_agent_mappable(const LLUUID& agent_id); -void menu_toggle_control( void* user_data ); void confirm_replace_attachment(S32 option, void* user_data); -void handle_detach_from_avatar(void* user_data); -void attach_label(std::string& label, void* user_data); -void detach_label(std::string& label, void* user_data); -BOOL object_selected_and_point_valid(void* user_data); -BOOL object_attached(void* user_data); +void handle_detach_from_avatar(const LLSD& user_data); +void attach_label(std::string& label, const LLSD&); +void detach_label(std::string& label, const LLSD&); +BOOL object_selected_and_point_valid(const LLSD&); void handle_detach(void*); BOOL enable_god_full(void* user_data); BOOL enable_god_liaison(void* user_data); BOOL enable_god_customer_service(void* user_data); BOOL enable_god_basic(void* user_data); -void handle_show_newest_map(void*); void set_underclothes_menu_options(); void exchange_callingcard(const LLUUID& dest_id); void handle_gestures(void*); void handle_sit_down(void*); -bool toggle_build_mode(); void handle_object_build(void*); void handle_save_snapshot(void *); void handle_toggle_flycam(); @@ -119,8 +115,6 @@ class LLPermissions; class LLViewerMenuHolderGL : public LLMenuHolderGL { public: - LLViewerMenuHolderGL(); - virtual BOOL hideMenus(); void setParcelSelection(LLSafeHandle selection); @@ -142,30 +136,31 @@ extern LLViewerMenuHolderGL* gMenuHolder; extern LLMenuBarGL* gLoginMenuBarView; // Pie menus -extern LLPieMenu *gPieSelf; -extern LLPieMenu *gPieAvatar; -extern LLPieMenu *gPieObject; -extern LLPieMenu *gPieAttachment; -extern LLPieMenu *gPieLand; -extern LLPieMenu* gPieRate; +extern LLContextMenu *gPieSelf; +extern LLContextMenu *gPieAvatar; +extern LLContextMenu *gPieObject; +extern LLContextMenu *gPieAttachment; + +extern LLContextMenu *gPieLand; +extern LLContextMenu *gPieRate; // Pie menus -extern LLPieMenu *gPieSelfSimple; -extern LLPieMenu *gPieAvatarSimple; -extern LLPieMenu *gPieObjectSimple; -extern LLPieMenu *gPieAttachmentSimple; -extern LLPieMenu *gPieLandSimple; +extern LLContextMenu *gPieSelfSimple; +extern LLContextMenu *gPieAvatarSimple; +extern LLContextMenu *gPieObjectSimple; +extern LLContextMenu *gPieAttachmentSimple; +extern LLContextMenu *gPieLandSimple; // Needed to build menus when attachment site list available extern LLMenuGL* gAttachSubMenu; extern LLMenuGL* gDetachSubMenu; extern LLMenuGL* gTakeOffClothes; -extern LLPieMenu* gAttachScreenPieMenu; -extern LLPieMenu* gDetachScreenPieMenu; -extern LLPieMenu* gAttachPieMenu; -extern LLPieMenu* gDetachPieMenu; -extern LLPieMenu* gAttachBodyPartPieMenus[8]; -extern LLPieMenu* gDetachBodyPartPieMenus[8]; +extern LLContextMenu* gAttachScreenPieMenu; +extern LLContextMenu* gDetachScreenPieMenu; +extern LLContextMenu* gAttachPieMenu; +extern LLContextMenu* gDetachPieMenu; +extern LLContextMenu* gAttachBodyPartPieMenus[8]; +extern LLContextMenu* gDetachBodyPartPieMenus[8]; extern LLMenuItemCallGL* gAFKMenu; extern LLMenuItemCallGL* gBusyMenu; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index d1f50212db..6576ea81ed 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -49,19 +49,20 @@ #include "llviewercontrol.h" // gSavedSettings #include "llviewerimagelist.h" #include "lluictrlfactory.h" +#include "llviewerinventory.h" #include "llviewermenu.h" // gMenuHolder #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerwindow.h" #include "llappviewer.h" #include "lluploaddialog.h" +#include "lltrans.h" // linden libraries #include "llassetuploadresponders.h" #include "lleconomy.h" #include "llhttpclient.h" -#include "llmemberlistener.h" #include "llsdserialize.h" #include "llstring.h" #include "lltransactiontypes.h" @@ -71,28 +72,21 @@ // system libraries #include -using namespace LLOldEvents; - -typedef LLMemberListener view_listener_t; - - class LLFileEnableSaveAs : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = gFloaterView->getFrontmost() && gFloaterView->getFrontmost()->canSaveAs(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLFileEnableUpload : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; @@ -255,7 +249,7 @@ const std::string upload_pick(void* data) class LLFileUploadImage : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string filename = upload_pick((void *)LLFilePicker::FFLOAD_IMAGE); if (!filename.empty()) @@ -269,7 +263,7 @@ class LLFileUploadImage : public view_listener_t class LLFileUploadSound : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_WAV); if (!filename.empty()) @@ -284,7 +278,7 @@ class LLFileUploadSound : public view_listener_t class LLFileUploadAnim : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ANIM); if (!filename.empty()) @@ -298,7 +292,7 @@ class LLFileUploadAnim : public view_listener_t class LLFileUploadBulk : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { if( gAgent.cameraMouselook() ) { @@ -360,19 +354,16 @@ void upload_error(const std::string& error_message, const std::string& label, co class LLFileEnableCloseWindow : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool new_value = NULL != LLFloater::getClosableFloaterFromFocus(); - - // horrendously opaque, this code - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; + return new_value; } }; class LLFileCloseWindow : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLFloater::closeFocusedFloater(); @@ -382,17 +373,16 @@ class LLFileCloseWindow : public view_listener_t class LLFileEnableCloseAllWindows : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool open_children = gFloaterView->allChildrenClosed(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(!open_children); - return true; + return !open_children; } }; class LLFileCloseAllWindows : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { bool app_quitting = false; gFloaterView->closeAllChildren(app_quitting); @@ -403,7 +393,7 @@ class LLFileCloseAllWindows : public view_listener_t class LLFileSaveTexture : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLFloater* top = gFloaterView->getFrontmost(); if (top) @@ -414,18 +404,9 @@ class LLFileSaveTexture : public view_listener_t } }; -class LLFileTakeSnapshot : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLFloaterSnapshot::show(NULL); - return true; - } -}; - class LLFileTakeSnapshotToDisk : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLPointer raw = new LLImageRaw; @@ -477,23 +458,13 @@ class LLFileTakeSnapshotToDisk : public view_listener_t class LLFileQuit : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) + bool handleEvent(const LLSD& userdata) { LLAppViewer::instance()->userQuit(); return true; } }; -void handle_upload(void* data) -{ - const std::string filename = upload_pick(data); - if (!filename.empty()) - { - LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_name_description.xml"); - floaterp->childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() )); - } -} void handle_compress_image(void*) { @@ -777,8 +748,7 @@ void upload_new_resource(const std::string& src_filename, std::string name, else { // Unknown extension - // *TODO: Translate? - error_message = llformat("Unknown file extension .%s\nExpected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh", exten.c_str()); + error_message = llformat(LLTrans::getString("UnknownFileExtension").c_str(), exten.c_str()); error = TRUE;; } @@ -858,9 +828,9 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt if(!(can_afford_transaction(expected_upload_cost))) { LLFloaterBuyCurrency::buyCurrency( - llformat("Uploading %s costs", - data->mAssetInfo.getName().c_str()), // *TODO: Translate - expected_upload_cost); + llformat(LLTrans::getString("UploadingCosts").c_str(), + data->mAssetInfo.getName().c_str()), + expected_upload_cost); is_balance_sufficient = FALSE; } else if(region) @@ -1075,22 +1045,20 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty } } - void init_menu_file() { - (new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage"); - (new LLFileUploadSound())->registerListener(gMenuHolder, "File.UploadSound"); - (new LLFileUploadAnim())->registerListener(gMenuHolder, "File.UploadAnim"); - (new LLFileUploadBulk())->registerListener(gMenuHolder, "File.UploadBulk"); - (new LLFileCloseWindow())->registerListener(gMenuHolder, "File.CloseWindow"); - (new LLFileCloseAllWindows())->registerListener(gMenuHolder, "File.CloseAllWindows"); - (new LLFileEnableCloseWindow())->registerListener(gMenuHolder, "File.EnableCloseWindow"); - (new LLFileEnableCloseAllWindows())->registerListener(gMenuHolder, "File.EnableCloseAllWindows"); - (new LLFileSaveTexture())->registerListener(gMenuHolder, "File.SaveTexture"); - (new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot"); - (new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk"); - (new LLFileQuit())->registerListener(gMenuHolder, "File.Quit"); - - (new LLFileEnableUpload())->registerListener(gMenuHolder, "File.EnableUpload"); - (new LLFileEnableSaveAs())->registerListener(gMenuHolder, "File.EnableSaveAs"); + view_listener_t::addCommit(new LLFileUploadImage(), "File.UploadImage"); + view_listener_t::addCommit(new LLFileUploadSound(), "File.UploadSound"); + view_listener_t::addCommit(new LLFileUploadAnim(), "File.UploadAnim"); + view_listener_t::addCommit(new LLFileUploadBulk(), "File.UploadBulk"); + view_listener_t::addCommit(new LLFileCloseWindow(), "File.CloseWindow"); + view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows"); + view_listener_t::addEnable(new LLFileEnableCloseWindow(), "File.EnableCloseWindow"); + view_listener_t::addEnable(new LLFileEnableCloseAllWindows(), "File.EnableCloseAllWindows"); + view_listener_t::addCommit(new LLFileSaveTexture(), "File.SaveTexture"); + view_listener_t::addCommit(new LLFileTakeSnapshotToDisk(), "File.TakeSnapshotToDisk"); + view_listener_t::addCommit(new LLFileQuit(), "File.Quit"); + + view_listener_t::addEnable(new LLFileEnableUpload(), "File.EnableUpload"); + view_listener_t::addEnable(new LLFileEnableSaveAs(), "File.EnableSaveAs"); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index bbfd480e0b..a62e59bc10 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -48,6 +48,7 @@ #include "lldbstrings.h" #include "lleconomy.h" #include "llfilepicker.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "llfollowcamparams.h" #include "llinstantmessage.h" @@ -125,7 +126,7 @@ #include "llviewerthrottle.h" #include "llviewerwindow.h" #include "llvlmanager.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvotextbubble.h" #include "llweb.h" #include "llworld.h" @@ -136,6 +137,7 @@ #include "llkeythrottle.h" #include +#include #if LL_WINDOWS // For Windows specific error handler #include "llwindebug.h" // For the invalid message handler @@ -160,7 +162,7 @@ void open_offer(const std::vector& items, const std::string& from_name); bool check_offer_throttle(const std::string& from_name, bool check_only); void callbackCacheEstateOwnerName(const LLUUID& id, const std::string& first, const std::string& last, - BOOL is_group, void*); + BOOL is_group); //inventory offer throttle globals LLFrameTimer gThrottleTimer; @@ -867,13 +869,14 @@ void open_offer(const std::vector& items, const std::string& from_name) LLInventoryItem* item; for(; it != end; ++it) { - item = gInventory.getItem(*it); + const LLUUID& id = *it; + item = gInventory.getItem(id); if(!item) { - LL_WARNS("Messaging") << "Unable to show inventory item: " << *it << LL_ENDL; + LL_WARNS("Messaging") << "Unable to show inventory item: " << id << LL_ENDL; continue; } - if(gInventory.isObjectDescendentOf(*it, trash_id)) + if(gInventory.isObjectDescendentOf(id, trash_id)) { continue; } @@ -882,40 +885,50 @@ void open_offer(const std::vector& items, const std::string& from_name) //if we are throttled, don't display them if (check_offer_throttle(from_name, false)) { - // I'm not sure this is a good idea. - bool show_keep_discard = item->getPermissions().getCreator() != gAgent.getID(); - //bool show_keep_discard = true; + // If we opened this ourselves, focus it + BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO; switch(asset_type) { - case LLAssetType::AT_NOTECARD: - open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, show_keep_discard, LLUUID::null, FALSE); + case LLAssetType::AT_NOTECARD: + LLFloaterReg::showInstance("preview_notecard", LLSD(id), take_focus); break; - case LLAssetType::AT_LANDMARK: - open_landmark((LLViewerInventoryItem*)item, std::string("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); + case LLAssetType::AT_LANDMARK: + { + // *TODO: Embed a link to the Places panel so that user can edit the landmark right away. + LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID()); + LLSD args; + args["LANDMARK_NAME"] = item->getName(); + args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unnkown"); + LLNotifications::instance().add("LandmarkCreated", args); + } break; - case LLAssetType::AT_TEXTURE: - open_texture(*it, std::string("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); + case LLAssetType::AT_TEXTURE: + LLFloaterReg::showInstance("preview_texture", LLSD(id), take_focus); break; - default: + default: break; } } //highlight item, if it's not in the trash or lost+found // Don't auto-open the inventory floater - LLInventoryView* view = LLInventoryView::getActiveInventory(); - if(!view) - { - return; - } - + LLInventoryView* view = NULL; if(gSavedSettings.getBOOL("ShowInInventory") && asset_type != LLAssetType::AT_CALLINGCARD && item->getInventoryType() != LLInventoryType::IT_ATTACHMENT && !from_name.empty()) { - LLInventoryView::showAgentInventory(TRUE); + view = LLInventoryView::showAgentInventory(); } + else + { + view = LLInventoryView::getActiveInventory(); + } + if(!view) + { + return; + } + //Trash Check LLUUID trash_id; trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); @@ -941,17 +954,19 @@ void open_offer(const std::vector& items, const std::string& from_name) LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID() << LL_ENDL; //highlight item - LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); - view->getPanel()->setSelection(item->getUUID(), TAKE_FOCUS_NO); - gFocusMgr.setKeyboardFocus(focus_ctrl); + if (view->getPanel()) + { + LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); + view->getPanel()->setSelection(item->getUUID(), TAKE_FOCUS_NO); + gFocusMgr.setKeyboardFocus(focus_ctrl); + } } } void inventory_offer_mute_callback(const LLUUID& blocked_id, const std::string& first_name, const std::string& last_name, - BOOL is_group, - void* user_data) + BOOL is_group) { std::string from_name; LLMute::EType type; @@ -970,8 +985,8 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, LLMute mute(blocked_id, from_name, type); if (LLMuteList::getInstance()->add(mute)) { - LLFloaterMute::showInstance(); - LLFloaterMute::getInstance()->selectMute(blocked_id); + LLFloaterReg::showInstance("mute"); + LLFloaterReg::getTypedInstance("mute")->selectMute(blocked_id); } // purge the message queue of any previously queued inventory offers from the same source. @@ -1040,7 +1055,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // * we can't build two messages at once. if (2 == button) { - gCacheName->get(mFromID, mFromGroup, inventory_offer_mute_callback, this); + gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback); } LLMessageSystem* msg = gMessageSystem; @@ -1070,7 +1085,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID); } - // *TODO:translate std::string from_string; // Used in the pop-up. std::string chatHistory_string; // Used in chat history. if (mFromObject == TRUE) @@ -1080,13 +1094,18 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& std::string group_name; if (gCacheName->getGroupName(mFromID, group_name)) { - from_string = std::string("An object named '") + mFromName + "' owned by the group '" + group_name + "'"; - chatHistory_string = mFromName + " owned by the group '" + group_name + "'"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" + + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup") + + " "+ "'" + group_name + "'"; + + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup") + + " " + group_name + "'"; } else { - from_string = std::string("An object named '") + mFromName + "' owned by an unknown group"; - chatHistory_string = mFromName + " owned by an unknown group"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" + + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); } } else @@ -1094,13 +1113,15 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& std::string first_name, last_name; if (gCacheName->getName(mFromID, first_name, last_name)) { - from_string = std::string("An object named '") + mFromName + "' owned by " + first_name + " " + last_name; - chatHistory_string = mFromName + " owned by " + first_name + " " + last_name; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName + + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + first_name + " " + last_name; + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + first_name + " " + last_name; } else { - from_string = std::string("An object named '") + mFromName + "' owned by an unknown user"; - chatHistory_string = mFromName + " owned by an unknown user"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'") + + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser"); } } } @@ -1128,7 +1149,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& //don't spam them if they are getting flooded if (check_offer_throttle(mFromName, true)) { - log_message = chatHistory_string + " gave you " + mDesc + "."; + log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); chat.mText = log_message; LLFloaterChat::addChatHistory(chat); } @@ -1191,7 +1212,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // send the message msg->sendReliable(mHost); - log_message = "You decline " + mDesc + " from " + mFromName + "."; + log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; chat.mText = log_message; if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 { @@ -1232,10 +1253,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& gInventory.addObserver(opener); } - // Allow these to stack up, but once you deal with one, reset the - // position. - gFloaterView->resetStartingFloaterPosition(); - delete this; return false; } @@ -1329,7 +1346,7 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) args["NAME"] = info->mFromName; LLNotification::Params p("ObjectGiveItem"); - p.substitutions(args).payload(payload).functor(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2)); + p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2)); if (from_task) { @@ -1415,7 +1432,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLChat chat; std::string buffer; - // *TODO:translate - need to fix the full name to first/last (maybe) + // *TODO: Translate - need to fix the full name to first/last (maybe) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id); msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group); msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, to_id); @@ -1466,7 +1483,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_CONSOLE_AND_CHAT_HISTORY: // These are used for system messages, hence don't need the name, // as it is always "Second Life". - // *TODO:translate + // *TODO: Translate args["MESSAGE"] = message; // Note: don't put the message in the IM history, even though was sent @@ -1611,7 +1628,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_MESSAGEBOX: { // This is a block, modeless dialog. - //*TODO:translate + //*TODO: Translate args["MESSAGE"] = message; LLNotifications::instance().add("SystemMessage", args); } @@ -1969,7 +1986,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) else { LLSD args; - // *TODO:translate -> [FIRST] [LAST] (maybe) + // *TODO: Translate -> [FIRST] [LAST] (maybe) args["NAME"] = name; args["MESSAGE"] = message; LLSD payload; @@ -2396,8 +2413,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // T * * * F Yes Yes chat.mMuted = is_muted && !is_linden; - - + if (!visible_in_chat_bubble && (is_linden || !is_busy || is_owned_by_me)) { @@ -2430,7 +2446,7 @@ void process_teleport_start(LLMessageSystem *msg, void**) } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); // *TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); } // Freeze the UI and show progress bar @@ -2465,7 +2481,7 @@ void process_teleport_progress(LLMessageSystem* msg, void**) } else { - gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); //TODO: Translate + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); } std::string buffer; msg->getString("Info", "Message", buffer); @@ -2880,12 +2896,45 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) { LLSD payload; payload["message"] = version_channel; - LLNotifications::instance().add("ServerVersionChanged", LLSD(), payload); + LLNotifications::instance().add("ServerVersionChanged", LLSD(), payload, server_version_changed_callback); } gLastVersionChannel = version_channel; } +bool server_version_changed_callback(const LLSD& notification, const LLSD& response) +{ + if(notification["payload"]["message"].asString() =="") + return false; + std::string url ="http://wiki.secondlife.com/wiki/Release_Notes/"; + //parse the msg string + std::string server_version = notification["payload"]["message"].asString(); + std::vector s_vect; + boost::algorithm::split(s_vect, server_version, isspace); + for(U32 i = 0; i < s_vect.size(); i++) + { + if (i != (s_vect.size() - 1)) + { + if(i != (s_vect.size() - 2)) + { + url += s_vect[i] + "_"; + } + else + { + url += s_vect[i] + "/"; + } + } + else + { + url += s_vect[i].substr(0,4); + } + } + + LLWeb::loadURL(url); + return false; +} + + void process_crossed_region(LLMessageSystem* msg, void**) { LLUUID agent_id; @@ -3782,7 +3831,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) gAgent.setSitCamera(sitObjectID, camera_eye, camera_at); } - gAgent.mForceMouselook = force_mouselook; + gAgent.setForceMouselook(force_mouselook); LLViewerObject* object = gObjectList.findObject(sitObjectID); if (object) @@ -4094,7 +4143,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) { // Make the user confirm the transaction, since they might // have missed something during an event. - // *TODO:translate + // *TODO: Translate LLSD args; args["MESSAGE"] = desc; LLNotifications::instance().add("SystemMessage", args); @@ -4170,7 +4219,7 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock) bool attempt_standard_notification(LLMessageSystem* msgsystem) { // if we have additional alert data - if (msgsystem->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0) + if (msgsystem->has(_PREHASH_AlertInfo) && msgsystem->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0) { // notification was specified using the new mechanism, so we can just handle it here std::string notificationID; @@ -4316,21 +4365,21 @@ void process_alert_core(const std::string& message, BOOL modal) } else { - // *TODO:translate + // *TODO: Translate args["MESSAGE"] = text; LLNotifications::instance().add("SystemMessage", args); } } else if (modal) { - // *TODO:translate + // *TODO: Translate LLSD args; args["ERROR_MESSAGE"] = message; LLNotifications::instance().add("ErrorMessage", args); } else { - // *TODO:translate + // *TODO: Translate LLSD args; args["MESSAGE"] = message; LLNotifications::instance().add("SystemMessageTip", args); @@ -4347,10 +4396,10 @@ void handle_show_mean_events(void *) return; } - LLFloaterBump::show(NULL); + LLFloaterBump::showInstance(); } -void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false, void* data) +void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false) { if (gNoRender) { @@ -4428,7 +4477,7 @@ void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **use LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag); gMeanCollisionList.push_front(mcd); const BOOL is_group = FALSE; - gCacheName->get(perp, is_group, mean_name_callback); + gCacheName->get(perp, is_group, &mean_name_callback); } } } @@ -4480,7 +4529,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp // located in [REGIONNAME] at [REGIONPOS], // has been permission to: [PERMISSIONS]." - LLUIString notice(LLFloaterChat::getInstance()->getString(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied")); + LLUIString notice(LLTrans::getString(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied")); // always include the object name and owner name notice.setArg("[OBJECTNAME]", notification["payload"]["object_name"].asString()); @@ -4534,7 +4583,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp perms.append(", "); } - perms.append(LLFloaterChat::getInstance()->getString(SCRIPT_QUESTIONS[i])); + perms.append(LLTrans::getString(SCRIPT_QUESTIONS[i])); } } @@ -4628,7 +4677,7 @@ static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestio void process_script_question(LLMessageSystem *msg, void **user_data) { - // *TODO:translate owner name -> [FIRST] [LAST] + // *TODO: Translate owner name -> [FIRST] [LAST] LLHost sender = msg->getSender(); @@ -4696,7 +4745,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) if (questions & LSCRIPTRunTimePermissionBits[i]) { count++; - script_question += " " + LLFloaterChat::getInstance()->getString(SCRIPT_QUESTIONS[i]) + "\n"; + script_question += " " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n"; // check whether permission question should cause special caution dialog caution |= (SCRIPT_QUESTION_IS_CAUTION[i]); @@ -4752,7 +4801,7 @@ void container_inventory_arrived(LLViewerObject* object, LLUUID cat_id; cat_id = gInventory.createNewCategory(gAgent.getInventoryRootID(), LLAssetType::AT_NONE, - std::string("Acquired Items")); //TODO: Translate + LLTrans::getString("AcquiredItems")); InventoryObjectList::const_iterator it = inventory->begin(); InventoryObjectList::const_iterator end = inventory->end(); @@ -4846,10 +4895,18 @@ void container_inventory_arrived(LLViewerObject* object, // method to format the time. std::string formatted_time(const time_t& the_time) { - char buffer[30]; /* Flawfinder: ignore */ - LLStringUtil::copy(buffer, ctime(&the_time), 30); - buffer[24] = '\0'; - return std::string(buffer); + std::string dateStr = "["+LLTrans::getString("LTimeWeek")+"] [" + +LLTrans::getString("LTimeMonth")+"] [" + +LLTrans::getString("LTimeDay")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+"]:[" + +LLTrans::getString("LTimeSec")+"] [" + +LLTrans::getString("LTimeYear")+"]"; + + LLSD substitution; + substitution["datetime"] = (S32) the_time; + LLStringUtil::format (dateStr, substitution); + return dateStr; } @@ -4860,7 +4917,7 @@ void process_teleport_failed(LLMessageSystem *msg, void**) LLSD args; // if we have additional alert data - if (msg->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0) + if (msg->has(_PREHASH_AlertInfo) && msg->getSizeFast(_PREHASH_AlertInfo, _PREHASH_Message) > 0) { // Get the message ID msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, reason); @@ -4917,6 +4974,9 @@ void process_teleport_failed(LLMessageSystem *msg, void**) LLNotifications::instance().add("CouldNotTeleportReason", args); + // Let the interested parties know that teleport failed. + LLViewerParcelMgr::getInstance()->onTeleportFailed(); + if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE ) { gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); @@ -4946,6 +5006,9 @@ void process_teleport_local(LLMessageSystem *msg,void**) gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); } + // Let the interested parties know we've teleported. + LLViewerParcelMgr::getInstance()->onTeleportFinished(); + // Sim tells us whether the new position is off the ground if (teleport_flags & TELEPORT_FLAGS_IS_FLYING) { @@ -5073,13 +5136,13 @@ void handle_lure(const LLUUID& invitee) } // Prompt for a message to the invited user. -void handle_lure(LLDynamicArray& ids) +void handle_lure(const std::vector& ids) { LLSD edit_args; edit_args["REGION"] = gAgent.getRegion()->getName(); LLSD payload; - for (LLDynamicArray::iterator it = ids.begin(); + for (LLDynamicArray::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -5298,7 +5361,7 @@ static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", ca // We've got the name of the person who owns the object hurling the url. // Display confirmation dialog. -void callback_load_url_name(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) +void callback_load_url_name(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) { std::vector::iterator it; for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) @@ -5311,7 +5374,7 @@ void callback_load_url_name(const LLUUID& id, const std::string& first, const st std::string owner_name; if (is_group) { - owner_name = first + " (group)"; + owner_name = first + LLTrans::getString("Group"); } else { @@ -5375,7 +5438,7 @@ void process_load_url(LLMessageSystem* msg, void**) // Add to list of pending name lookups gLoadUrlList.push_back(payload); - gCacheName->get(owner_id, owner_is_group, callback_load_url_name); + gCacheName->get(owner_id, owner_is_group, &callback_load_url_name); } @@ -5431,12 +5494,13 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) msg->getVector3("Data", "SimPosition", pos); msg->getVector3("Data", "LookAt", look_at); - gFloaterWorldMap->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]); - LLFloaterWorldMap::show(NULL, TRUE); + LLFloaterWorldMap::getInstance()->trackURL( + sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]); + LLFloaterReg::showInstance("world_map", "center"); // remove above two lines and replace with below line // to re-enable parcel browser for llMapDestination() - // LLURLDispatcher::dispatch(LLURLDispatcher::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE); + // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE); } @@ -5458,18 +5522,28 @@ void process_covenant_reply(LLMessageSystem* msg, void**) std::string last_modified; if (covenant_timestamp == 0) { - last_modified = LLTrans::getString("covenant_never_modified"); + last_modified = LLTrans::getString("covenant_last_modified")+LLTrans::getString("never_text"); } else { - last_modified = LLTrans::getString("covenant_modified") + " " + formatted_time((time_t)covenant_timestamp); + last_modified = LLTrans::getString("covenant_last_modified")+"[" + +LLTrans::getString("LTimeWeek")+"] [" + +LLTrans::getString("LTimeMonth")+"] [" + +LLTrans::getString("LTimeDay")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+"]:[" + +LLTrans::getString("LTimeSec")+"] [" + +LLTrans::getString("LTimeYear")+"]"; + LLSD substitution; + substitution["datetime"] = (S32) covenant_timestamp; + LLStringUtil::format (last_modified, substitution); } LLPanelEstateCovenant::updateLastModified(last_modified); LLPanelLandCovenant::updateLastModified(last_modified); LLFloaterBuyLand::updateLastModified(last_modified); - gCacheName->getName(estate_owner_id, callbackCacheEstateOwnerName); + gCacheName->get(estate_owner_id, false, &callbackCacheEstateOwnerName); // load the actual covenant asset data const BOOL high_priority = TRUE; @@ -5491,11 +5565,11 @@ void process_covenant_reply(LLMessageSystem* msg, void**) if (estate_owner_id.isNull()) { // mainland - covenant_text = "There is no Covenant provided for this Estate."; + covenant_text = LLTrans::getString("RegionNoCovenant"); } else { - covenant_text = "There is no Covenant provided for this Estate. The land on this estate is being sold by the Estate owner, not Linden Lab. Please contact the Estate Owner for sales details."; + covenant_text = LLTrans::getString("RegionNoCovenantOtherOwner"); } LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id); LLPanelLandCovenant::updateCovenantText(covenant_text); @@ -5505,13 +5579,13 @@ void process_covenant_reply(LLMessageSystem* msg, void**) void callbackCacheEstateOwnerName(const LLUUID& id, const std::string& first, const std::string& last, - BOOL is_group, void*) + BOOL is_group) { std::string name; if (id.isNull()) { - name = "(none)"; + name = LLTrans::getString("none_text"); } else { @@ -5542,10 +5616,10 @@ void onCovenantLoadComplete(LLVFS *vfs, if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) { - LLViewerTextEditor* editor = - new LLViewerTextEditor(std::string("temp"), - LLRect(0,0,0,0), - file_length+1); + LLViewerTextEditor::Params params; + params.name("temp"); + params.max_text_length(file_length+1); + LLViewerTextEditor * editor = LLUICtrlFactory::create (params); if( !editor->importBuffer( &buffer[0], file_length+1 ) ) { LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; @@ -5620,6 +5694,6 @@ void invalid_message_callback(LLMessageSystem* msg, void LLOfferInfo::forceResponse(InventoryOfferResponse response) { LLNotification::Params params("UserGiveItem"); - params.functor(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2)); + params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2)); LLNotifications::instance().forceResponse(params, response); } diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index e7a4303a8e..90a54e2b9c 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -130,6 +130,7 @@ void container_inventory_arrived(LLViewerObject* object, // agent movement void send_complete_agent_movement(const LLHost& sim_host); void process_agent_movement_complete(LLMessageSystem* msg, void**); +bool server_version_changed_callback(const LLSD& notification, const LLSD& response); void process_crossed_region(LLMessageSystem* msg, void**); void process_teleport_start(LLMessageSystem* msg, void**); void process_teleport_progress(LLMessageSystem* msg, void**); @@ -151,7 +152,7 @@ void send_group_notice(const LLUUID& group_id, const LLInventoryItem* item); void handle_lure(const LLUUID& invitee); -void handle_lure(LLDynamicArray& ids); +void handle_lure(const std::vector& ids); // always from gAgent and // routes through the gAgent's current simulator diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index 8719557cbc..918b15ef09 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -218,7 +218,7 @@ void LLViewerLogin::setGridChoice(const std::string& grid_name) void LLViewerLogin::resetURIs() { // Clear URIs when picking a new server - gSavedSettings.setValue("CmdLineLoginURI", LLSD::emptyArray()); + gSavedSettings.setLLSD("CmdLineLoginURI", LLSD::emptyArray()); gSavedSettings.setString("CmdLineHelperURI", ""); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index d4e594656b..dc4f2b2990 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -79,6 +79,7 @@ #include "llviewertextureanim.h" #include "llviewerwindow.h" // For getSpinAxis #include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoclouds.h" #include "llvograss.h" #include "llvoground.h" @@ -97,6 +98,7 @@ #include "llviewernetwork.h" #include "llvowlsky.h" #include "llmanip.h" +#include "lltrans.h" //#define DEBUG_UPDATE_TYPE @@ -123,7 +125,18 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco case LL_PCODE_VOLUME: res = new LLVOVolume(id, pcode, regionp); break; case LL_PCODE_LEGACY_AVATAR: - res = new LLVOAvatar(id, pcode, regionp); break; + { + if (id == gAgentID) + { + res = new LLVOAvatarSelf(id, pcode, regionp); + } + else + { + res = new LLVOAvatar(id, pcode, regionp); + } + static_cast(res)->initInstance(); + break; + } case LL_PCODE_LEGACY_GRASS: res = new LLVOGrass(id, pcode, regionp); break; case LL_PCODE_LEGACY_PART_SYS: @@ -2461,7 +2474,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) LLPointer obj; obj = new LLInventoryObject(object->mID, LLUUID::null, LLAssetType::AT_CATEGORY, - std::string("Contents")); + LLTrans::getString("ViewerObjectContents").c_str()); object->mInventory->push_front(obj); object->doInventoryCallback(); delete ft; @@ -2528,6 +2541,7 @@ void LLViewerObject::loadTaskInvFile(const std::string& filename) { LLPointer inv = new LLInventoryObject; inv->importLegacyStream(ifs); + inv->rename(LLTrans::getString("ViewerObjectContents").c_str()); mInventory->push_front(inv); } else @@ -2587,11 +2601,6 @@ void LLViewerObject::removeInventory(const LLUUID& item_id) msg->sendReliable(mRegionp->getHost()); deleteInventoryItem(item_id); ++mInventorySerialNum; - - // The viewer object should not refresh UI since this is a utility - // function. The UI functionality that called this method should - // refresh the views if necessary. - //gBuildView->refresh(); } void LLViewerObject::updateInventory( @@ -2748,7 +2757,7 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) F32 mid_scale = getMidScale(); F32 min_scale = getMinScale(); - // IW: esitmate - when close to large objects, computing range based on distance from center is no good + // IW: estimate - when close to large objects, computing range based on distance from center is no good // to try to get a min distance from face, subtract min_scale/2 from the range. // This means we'll load too much detail sometimes, but that's better than not enough // I don't think there's a better way to do this without calculating distance per-poly @@ -3733,7 +3742,6 @@ S32 LLViewerObject::setTEColor(const U8 te, const LLColor4& color) else if (color != tep->getColor()) { retval = LLPrimitive::setTEColor(te, color); - //setChanged(TEXTURE); if (mDrawable.notNull() && retval) { // These should only happen on updates which are not the initial update. @@ -3780,6 +3788,22 @@ S32 LLViewerObject::setTETexGen(const U8 te, const U8 texgen) return retval; } +S32 LLViewerObject::setTEMediaTexGen(const U8 te, const U8 media) +{ + S32 retval = 0; + const LLTextureEntry *tep = getTE(te); + if (!tep) + { + llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + } + else if (media != tep->getMediaTexGen()) + { + retval = LLPrimitive::setTEMediaTexGen(te, media); + setChanged(TEXTURE); + } + return retval; +} + S32 LLViewerObject::setTEShiny(const U8 te, const U8 shiny) { S32 retval = 0; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 16a3b98d12..21a99c58d9 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -40,7 +40,7 @@ #include "llhudtext.h" #include "llhudicon.h" #include "llinventory.h" -#include "llmemory.h" +#include "llrefcount.h" #include "llmemtype.h" #include "llprimitive.h" #include "lluuid.h" @@ -305,6 +305,7 @@ public: /*virtual*/ S32 setTERotation(const U8 te, const F32 r); /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump ); /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen ); + /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media ); // *FIXME: this confusingly acts upon a superset of setTETexGen's flags without absorbing its semantics /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny ); /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright ); /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags ); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index e0741e7233..8e9c798aca 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -38,6 +38,7 @@ #include "timing.h" #include "llfasttimer.h" #include "llrender.h" +#include "llwindow.h" // decBusyCount() #include "llviewercontrol.h" #include "llface.h" @@ -60,6 +61,7 @@ #include "llresmgr.h" #include "llviewerregion.h" #include "llviewerstats.h" +#include "llvoavatarself.h" #include "lltoolmgr.h" #include "lltoolpie.h" #include "llkeyboard.h" @@ -210,6 +212,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, LLDataPacker* dpp, BOOL just_created) { + LLMemType mt(LLMemType::MTYPE_OBJECT_PROCESS_UPDATE_CORE); LLMessageSystem* msg = gMessageSystem; // ignore returned flags @@ -251,7 +254,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, objectp->mCreateSelected = false; gViewerWindow->getWindow()->decBusyCount(); - gViewerWindow->getWindow()->setCursor( UI_CURSOR_ARROW ); + gViewerWindow->setCursor( UI_CURSOR_ARROW ); } } @@ -260,6 +263,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, const EObjectUpdateType update_type, bool cached, bool compressed) { + LLMemType mt(LLMemType::MTYPE_OBJECT_PROCESS_UPDATE); LLFastTimer t(LLFastTimer::FTM_PROCESS_OBJECTS); LLVector3d camera_global = gAgent.getCameraPositionGlobal(); @@ -768,10 +772,10 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) } */ - mNumObjectsStat.addValue(mObjects.count()); - mNumActiveObjectsStat.addValue(num_active_objects); - mNumSizeCulledStat.addValue(mNumSizeCulled); - mNumVisCulledStat.addValue(mNumVisCulled); + LLViewerStats::getInstance()->mNumObjectsStat.addValue(mObjects.count()); + LLViewerStats::getInstance()->mNumActiveObjectsStat.addValue(num_active_objects); + LLViewerStats::getInstance()->mNumSizeCulledStat.addValue(mNumSizeCulled); + LLViewerStats::getInstance()->mNumVisCulledStat.addValue(mNumVisCulled); } void LLViewerObjectList::clearDebugText() @@ -1016,16 +1020,16 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset) void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { - LLColor4 above_water_color = gColors.getColor( "NetMapOtherOwnAboveWater" ); - LLColor4 below_water_color = gColors.getColor( "NetMapOtherOwnBelowWater" ); + LLColor4 above_water_color = gSavedSkinSettings.getColor( "NetMapOtherOwnAboveWater" ); + LLColor4 below_water_color = gSavedSkinSettings.getColor( "NetMapOtherOwnBelowWater" ); LLColor4 you_own_above_water_color = - gColors.getColor( "NetMapYouOwnAboveWater" ); + gSavedSkinSettings.getColor( "NetMapYouOwnAboveWater" ); LLColor4 you_own_below_water_color = - gColors.getColor( "NetMapYouOwnBelowWater" ); + gSavedSkinSettings.getColor( "NetMapYouOwnBelowWater" ); LLColor4 group_own_above_water_color = - gColors.getColor( "NetMapGroupOwnAboveWater" ); + gSavedSkinSettings.getColor( "NetMapGroupOwnAboveWater" ); LLColor4 group_own_below_water_color = - gColors.getColor( "NetMapGroupOwnBelowWater" ); + gSavedSkinSettings.getColor( "NetMapGroupOwnBelowWater" ); for (S32 i = 0; i < mMapObjects.count(); i++) diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index ba31f70c3d..0f906a4d7f 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -150,19 +150,8 @@ public: U32 mCurBin; // Current bin we're working on... - ////////////////////// - // - // Statistics data - // - // - LLStat mNumObjectsStat; - LLStat mNumActiveObjectsStat; - LLStat mNumNewObjectsStat; - LLStat mNumSizeCulledStat; - LLStat mNumVisCulledStat; - + // Statistics data (see also LLViewerStats) S32 mNumNewObjects; - S32 mNumSizeCulled; S32 mNumVisCulled; diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index b98f418d49..08e03c97f2 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -166,7 +166,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel) } // First use warning - if( gSavedSettings.getWarning("FirstStreamingVideo") ) + if( gWarningSettings.getBOOL("FirstStreamingVideo") ) { LLNotifications::instance().add("ParcelCanPlayMedia", LLSD(), LLSD(), boost::bind(callback_play_media, _1, _2, parcel)); @@ -189,9 +189,9 @@ void LLViewerParcelMedia::update(LLParcel* parcel) std::string mediaUrl = std::string ( parcel->getMediaURL () ); if (!mediaUrl.empty ()) { - if (gSavedSettings.getWarning("QuickTimeInstalled")) + if (gWarningSettings.getBOOL("QuickTimeInstalled")) { - gSavedSettings.setWarning("QuickTimeInstalled", FALSE); + gWarningSettings.setBOOL("QuickTimeInstalled", FALSE); LLNotifications::instance().add("NoQuickTime" ); }; @@ -395,7 +395,7 @@ bool callback_play_media(const LLSD& notification, const LLSD& response, LLParce { gSavedSettings.setBOOL("AudioStreamingVideo", FALSE); } - gSavedSettings.setWarning("FirstStreamingVideo", FALSE); + gWarningSettings.setBOOL("FirstStreamingVideo", FALSE); return false; } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 193dfaae96..8aa1663bc1 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -155,6 +155,8 @@ LLViewerParcelMgr::LLViewerParcelMgr() { mAgentParcelOverlay[i] = 0; } + + mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport } @@ -646,7 +648,7 @@ LLParcel *LLViewerParcelMgr::getAgentParcel() const } // Return whether the agent can build on the land they are on -BOOL LLViewerParcelMgr::agentCanBuild() const +bool LLViewerParcelMgr::agentCanBuild() const { if (mAgentParcel) { @@ -938,7 +940,7 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id) payload["parcel_local_id"] = mCurrentParcel->getLocalID(); payload["region_host"] = region->getHost().getIPandPort(); LLNotification::Params params("ForceOwnerAuctionWarning"); - params.payload(payload).functor(callback_god_force_owner); + params.payload(payload).functor.function(callback_god_force_owner); if(mCurrentParcel->getAuctionID()) { @@ -1513,6 +1515,17 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use LLViewerParcelMgr::getInstance()->writeAgentParcelFromBitmap(bitmap); delete[] bitmap; + + // Let interesting parties know about agent parcel change. + LLViewerParcelMgr* instance = LLViewerParcelMgr::getInstance(); + + instance->mAgentParcelChangedSignal(); + + if (instance->mTeleportInProgress) + { + instance->mTeleportInProgress = FALSE; + instance->mTeleportFinishedSignal(); + } } } @@ -2378,3 +2391,34 @@ LLViewerImage* LLViewerParcelMgr::getPassImage() const { return sPassImage; } + +boost::signals::connection LLViewerParcelMgr::setAgentParcelChangedCallback(parcel_changed_callback_t cb) +{ + return mAgentParcelChangedSignal.connect(cb); +} + +boost::signals::connection LLViewerParcelMgr::setTeleportFinishedCallback(parcel_changed_callback_t cb) +{ + return mTeleportFinishedSignal.connect(cb); +} + +boost::signals::connection LLViewerParcelMgr::setTeleportFailedCallback(parcel_changed_callback_t cb) +{ + return mTeleportFailedSignal.connect(cb); +} + +/* Ok, we're notified that teleport has been finished. + * We should now propagate the notification via mTeleportFinishedSignal + * to all interested parties. + * However the agent parcel data has not been updated yet. + * Let's wait for the update and then emit the signal. + */ +void LLViewerParcelMgr::onTeleportFinished() +{ + mTeleportInProgress = TRUE; +} + +void LLViewerParcelMgr::onTeleportFailed() +{ + mTeleportFailedSignal(); +} diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 9f762a186c..4bed1c0486 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -36,10 +36,14 @@ #include "v3dmath.h" #include "lldarray.h" #include "llframetimer.h" -#include "llmemory.h" +#include "llsingleton.h" #include "llparcelselection.h" #include "llui.h" +#include +#include +#include + class LLUUID; class LLMessageSystem; class LLParcel; @@ -79,6 +83,9 @@ class LLViewerParcelMgr : public LLSingleton { public: + typedef boost::function parcel_changed_callback_t; + typedef boost::signal parcel_changed_signal_t; + LLViewerParcelMgr(); ~LLViewerParcelMgr(); @@ -163,7 +170,7 @@ public: BOOL agentCanTakeDamage() const; BOOL agentCanFly() const; F32 agentDrawDistance() const; - BOOL agentCanBuild() const; + bool agentCanBuild() const; F32 getHoverParcelWidth() const { return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); } @@ -256,6 +263,12 @@ public: // the agent is banned or not in the allowed group BOOL isCollisionBanned(); + boost::signals::connection setAgentParcelChangedCallback(parcel_changed_callback_t cb); + boost::signals::connection setTeleportFinishedCallback(parcel_changed_callback_t cb); + boost::signals::connection setTeleportFailedCallback(parcel_changed_callback_t cb); + void onTeleportFinished(); + void onTeleportFailed(); + static BOOL isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power); static BOOL isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power); @@ -303,6 +316,11 @@ private: LLDynamicArray mObservers; + BOOL mTeleportInProgress; + parcel_changed_signal_t mTeleportFinishedSignal; + parcel_changed_signal_t mTeleportFailedSignal; + parcel_changed_signal_t mAgentParcelChangedSignal; + // Array of pieces of parcel edges to potentially draw // Has (parcels_per_edge + 1) * (parcels_per_edge + 1) elements so // we can represent edges of the grid. diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 866c2a91eb..5b60ed5a27 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -36,6 +36,7 @@ // indra includes #include "llparcel.h" +#include "llfloaterreg.h" #include "llgl.h" #include "llrender.h" #include "v4color.h" @@ -205,13 +206,12 @@ void LLViewerParcelOverlay::updateOverlayTexture() { return; } - // Can do this because gColors are actually stored as LLColor4U - const LLColor4U avail = gColors.getColor4U("PropertyColorAvail"); - const LLColor4U owned = gColors.getColor4U("PropertyColorOther"); - const LLColor4U group = gColors.getColor4U("PropertyColorGroup"); - const LLColor4U self = gColors.getColor4U("PropertyColorSelf"); - const LLColor4U for_sale = gColors.getColor4U("PropertyColorForSale"); - const LLColor4U auction = gColors.getColor4U("PropertyColorAuction"); + const LLColor4U avail = gSavedSkinSettings.getColor4("PropertyColorAvail"); + const LLColor4U owned = gSavedSkinSettings.getColor4("PropertyColorOther"); + const LLColor4U group = gSavedSkinSettings.getColor4("PropertyColorGroup"); + const LLColor4U self = gSavedSkinSettings.getColor4("PropertyColorSelf"); + const LLColor4U for_sale = gSavedSkinSettings.getColor4("PropertyColorForSale"); + const LLColor4U auction = gSavedSkinSettings.getColor4("PropertyColorAuction"); // Create the base texture. U8 *raw = mImageRaw->getData(); @@ -224,7 +224,7 @@ void LLViewerParcelOverlay::updateOverlayTexture() { U8 ownership = mOwnership[i]; - U8 r,g,b,a; + F32 r,g,b,a; // Color stored in low three bits switch( ownership & 0x7 ) @@ -273,10 +273,10 @@ void LLViewerParcelOverlay::updateOverlayTexture() break; } - raw[pixel_index + 0] = r; - raw[pixel_index + 1] = g; - raw[pixel_index + 2] = b; - raw[pixel_index + 3] = a; + raw[pixel_index + 0] = (U8)r; + raw[pixel_index + 1] = (U8)g; + raw[pixel_index + 2] = (U8)b; + raw[pixel_index + 3] = (U8)a; pixel_index += OVERLAY_IMG_COMPONENTS; } @@ -314,12 +314,11 @@ void LLViewerParcelOverlay::updatePropertyLines() S32 row, col; - // Can do this because gColors are actually stored as LLColor4U - const LLColor4U self_coloru = gColors.getColor4U("PropertyColorSelf"); - const LLColor4U other_coloru = gColors.getColor4U("PropertyColorOther"); - const LLColor4U group_coloru = gColors.getColor4U("PropertyColorGroup"); - const LLColor4U for_sale_coloru = gColors.getColor4U("PropertyColorForSale"); - const LLColor4U auction_coloru = gColors.getColor4U("PropertyColorAuction"); + const LLColor4U self_coloru = gSavedSkinSettings.getColor4("PropertyColorSelf"); + const LLColor4U other_coloru = gSavedSkinSettings.getColor4("PropertyColorOther"); + const LLColor4U group_coloru = gSavedSkinSettings.getColor4("PropertyColorGroup"); + const LLColor4U for_sale_coloru = gSavedSkinSettings.getColor4("PropertyColorForSale"); + const LLColor4U auction_coloru = gSavedSkinSettings.getColor4("PropertyColorAuction"); // Build into dynamic arrays, then copy into static arrays. LLDynamicArray new_vertex_array; @@ -713,6 +712,7 @@ void LLViewerParcelOverlay::setDirty() void LLViewerParcelOverlay::idleUpdate(bool force_update) { + LLMemType mt_iup(LLMemType::MTYPE_IDLE_UPDATE_PARCEL_OVERLAY); if (gGLManager.mIsDisabled) { return; @@ -841,8 +841,8 @@ S32 LLViewerParcelOverlay::renderPropertyLines () drawn += vertex_per_edge; gGL.end(); - - if (LLSelectMgr::sRenderHiddenSelections && gFloaterTools && gFloaterTools->getVisible()) + + if (LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build")) { LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); diff --git a/indra/newview/llviewerpartsim.h b/indra/newview/llviewerpartsim.h index 21bc37f891..208675e7bf 100644 --- a/indra/newview/llviewerpartsim.h +++ b/indra/newview/llviewerpartsim.h @@ -35,7 +35,7 @@ #include "lldarrayptr.h" #include "llframetimer.h" -#include "llmemory.h" +#include "llpointer.h" #include "llpartdata.h" #include "llviewerpartsource.h" diff --git a/indra/newview/llviewerpartsource.h b/indra/newview/llviewerpartsource.h index 4258b9170f..31e671af3a 100644 --- a/indra/newview/llviewerpartsource.h +++ b/indra/newview/llviewerpartsource.h @@ -33,8 +33,9 @@ #ifndef LL_LLVIEWERPARTSOURCE_H #define LL_LLVIEWERPARTSOURCE_H -#include "llmemory.h" +#include "llrefcount.h" #include "llpartdata.h" +#include "llpointer.h" #include "llquaternion.h" #include "v3math.h" diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 49319b13b1..0296327378 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -69,18 +69,20 @@ // Library headers from llcommon project: #include "bitpack.h" +#include "lldeleteutils.h" #include "imageids.h" #include "indra_constants.h" //#include "linden_common.h" //#include "llpreprocessor.h" +#include "llallocator.h" #include "llapp.h" #include "llapr.h" #include "llcriticaldamp.h" -#include "lldarray.h" -#include "lldarrayptr.h" +//#include "lldarray.h" +//#include "lldarrayptr.h" #include "lldefs.h" #include "lldepthstack.h" -#include "lldqueueptr.h" +//#include "lldqueueptr.h" #include "llendianswizzle.h" #include "llerror.h" #include "llfasttimer.h" @@ -89,11 +91,16 @@ #include "llhash.h" #include "lllocalidhashmap.h" #include "llmap.h" -#include "llmemory.h" +//#include "llmemory.h" #include "llnametable.h" +#include "llpointer.h" #include "llpriqueuemap.h" #include "llprocessor.h" +#include "llrefcount.h" +#include "llsafehandle.h" //#include "llsecondlifeurls.h" +#include "llsd.h" +#include "llsingleton.h" #include "llstack.h" #include "llstat.h" #include "llstl.h" @@ -114,20 +121,13 @@ #include "u64.h" // Library includes from llimage -//#include "kdc_flow_control.h" -//#include "kde_flow_control.h" -//#include "kdu_image.h" -//#include "kdu_image_local.h" //#include "llblockdata.h" -//#include "llblockdecoder.h" -//#include "llblockencoder.h" #include "llimage.h" #include "llimagebmp.h" #include "llimagepng.h" #include "llimagej2c.h" #include "llimagejpeg.h" #include "llimagetga.h" -//#include "llkdumem.h" #include "llmapimagetype.h" // Library includes from llmath project @@ -220,9 +220,6 @@ #include "llvolumemgr.h" #include "material_codes.h" -// Library includes from llxml -#include "llxmlnode.h" - // Library includes from llvfs #include "llassettype.h" #include "lldir.h" @@ -232,4 +229,8 @@ #include "llvfile.h" #include "llvfs.h" +// Library includes from llui +// In skinning-7, llui.h dependencies are changing too often. +//#include "llui.h" + #endif diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d4ee7a7e50..fd3dc16745 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -35,6 +35,7 @@ #include "llviewerregion.h" #include "indra_constants.h" +#include "llfloaterreg.h" #include "llmath.h" #include "llhttpclient.h" #include "llregionflags.h" @@ -638,6 +639,7 @@ void LLViewerRegion::dirtyHeights() BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { + LLMemType mt_ivr(LLMemType::MTYPE_IDLE_UPDATE_VIEWER_REGION); // did_update returns TRUE if we did at least one significant update BOOL did_update = mLandp->idleUpdate(max_update_time); @@ -779,11 +781,6 @@ void LLViewerRegion::calculateCameraDistance() mCameraDistanceSquared = (F32)(gAgent.getCameraPositionGlobal() - getCenterGlobal()).magVecSquared(); } -U32 LLViewerRegion::getNetDetailsForLCD() -{ - return mPingDelay; -} - std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion) { s << "{ "; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 4d345c811a..35f374a4c8 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -288,9 +288,6 @@ public: /// implements LLCapabilityProvider virtual std::string getDescription() const; - // used by LCD to get details for debug screen - U32 getNetDetailsForLCD(); - LLSpatialPartition* getSpatialPartition(U32 type); public: struct CompareDistance diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 648fbd4714..c79ded1dce 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -36,6 +36,8 @@ #include "llviewerthrottle.h" #include "message.h" +#include "llfloaterreg.h" +#include "llmemory.h" #include "lltimer.h" #include "llappviewer.h" @@ -45,6 +47,7 @@ #include "llviewerobjectlist.h" #include "llviewerimagelist.h" #include "lltexlayer.h" +#include "lltexlayerparams.h" #include "llsurface.h" #include "llvlmanager.h" #include "llagent.h" @@ -55,14 +58,12 @@ #include "llfasttimerview.h" #include "llviewerregion.h" #include "llvoavatar.h" +#include "llvoavatarself.h" #include "llfloaterhtml.h" #include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llworld.h" #include "llfeaturemanager.h" #include "llviewernetwork.h" -#if LL_LCD_COMPILE -#include "lllcd.h" -#endif class StatAttributes @@ -199,16 +200,76 @@ const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = // ST_TEX_BAKES StatAttributes("Texture Bakes", FALSE, FALSE), // ST_TEX_REBAKES - StatAttributes("Texture Rebakes", FALSE, FALSE), - - // ST_LOGITECH_KEYBOARD - StatAttributes("Logitech LCD", FALSE, FALSE) + StatAttributes("Texture Rebakes", FALSE, FALSE) }; -LLViewerStats::LLViewerStats() - : mPacketsLostPercentStat(64), - mLastTimeDiff(0.0) +LLViewerStats::LLViewerStats() : + mKBitStat("kbitstat"), + mLayersKBitStat("layerskbitstat"), + mObjectKBitStat("objectkbitstat"), + mAssetKBitStat("assetkbitstat"), + mTextureKBitStat("texturekbitstat"), + mVFSPendingOperations("vfspendingoperations"), + mObjectsDrawnStat("objectsdrawnstat"), + mObjectsCulledStat("objectsculledstat"), + mObjectsTestedStat("objectstestedstat"), + mObjectsComparedStat("objectscomparedstat"), + mObjectsOccludedStat("objectsoccludedstat"), + mFPSStat("fpsstat"), + mPacketsInStat("packetsinstat"), + mPacketsLostStat("packetsloststat"), + mPacketsOutStat("packetsoutstat"), + mPacketsLostPercentStat("packetslostpercentstat", 64), + mTexturePacketsStat("texturepacketsstat"), + mActualInKBitStat("actualinkbitstat"), + mActualOutKBitStat("actualoutkbitstat"), + mTrianglesDrawnStat("trianglesdrawnstat"), + mSimTimeDilation("simtimedilation"), + mSimFPS("simfps"), + mSimPhysicsFPS("simphysicsfps"), + mSimAgentUPS("simagentups"), + mSimScriptEPS("simscripteps"), + mSimFrameMsec("simframemsec"), + mSimNetMsec("simnetmsec"), + mSimSimOtherMsec("simsimothermsec"), + mSimSimPhysicsMsec("simsimphysicsmsec"), + mSimSimPhysicsStepMsec("simsimphysicsstepmsec"), + mSimSimPhysicsShapeUpdateMsec("simsimphysicsshapeupdatemsec"), + mSimSimPhysicsOtherMsec("simsimphysicsothermsec"), + mSimAgentMsec("simagentmsec"), + mSimImagesMsec("simimagesmsec"), + mSimScriptMsec("simscriptmsec"), + mSimSpareMsec("simsparemsec"), + mSimSleepMsec("simsleepmsec"), + mSimPumpIOMsec("simpumpiomsec"), + mSimMainAgents("simmainagents"), + mSimChildAgents("simchildagents"), + mSimObjects("simobjects"), + mSimActiveObjects("simactiveobjects"), + mSimActiveScripts("simactivescripts"), + mSimInPPS("siminpps"), + mSimOutPPS("simoutpps"), + mSimPendingDownloads("simpendingdownloads"), + mSimPendingUploads("simpendinguploads"), + mSimPendingLocalUploads("simpendinglocaluploads"), + mSimTotalUnackedBytes("simtotalunackedbytes"), + mPhysicsPinnedTasks("physicspinnedtasks"), + mPhysicsLODTasks("physicslodtasks"), + mPhysicsMemoryAllocated("physicsmemoryallocated"), + mSimPingStat("simpingstat"), + mNumImagesStat("numimagesstat", 32, TRUE), + mNumRawImagesStat("numrawimagesstat", 32, TRUE), + mGLTexMemStat("gltexmemstat", 32, TRUE), + mGLBoundMemStat("glboundmemstat", 32, TRUE), + mRawMemStat("rawmemstat", 32, TRUE), + mFormattedMemStat("formattedmemstat", 32, TRUE), + mNumObjectsStat("numobjectsstat"), + mNumActiveObjectsStat("numactiveobjectsstat"), + mNumNewObjectsStat("numnewobjectsstat"), + mNumSizeCulledStat("numsizeculledstat"), + mNumVisCulledStat("numvisculledstat"), + mLastTimeDiff(0.0) { for (S32 i = 0; i < ST_COUNT; i++) { @@ -353,7 +414,6 @@ void reset_statistics() { if (LLSurface::sTextureUpdateTime) { - LLSurface::sTexelsUpdatedPerSecStat.addValue(0.001f*(LLSurface::sTexelsUpdated / LLSurface::sTextureUpdateTime)); LLSurface::sTexelsUpdated = 0; LLSurface::sTextureUpdateTime = 0.f; } @@ -365,8 +425,8 @@ void output_statistics(void*) llinfos << "Number of orphans: " << gObjectList.getOrphanCount() << llendl; llinfos << "Number of dead objects: " << gObjectList.mNumDeadObjects << llendl; llinfos << "Num images: " << gImageList.getNumImages() << llendl; - llinfos << "Texture usage: " << LLImageGL::sGlobalTextureMemory << llendl; - llinfos << "Texture working set: " << LLImageGL::sBoundTextureMemory << llendl; + llinfos << "Texture usage: " << LLImageGL::sGlobalTextureMemoryInBytes << llendl; + llinfos << "Texture working set: " << LLImageGL::sBoundTextureMemoryInBytes << llendl; llinfos << "Raw usage: " << LLImageRaw::sGlobalRawMemory << llendl; llinfos << "Formatted usage: " << LLImageFormatted::sGlobalFormattedMemory << llendl; llinfos << "Zombie Viewer Objects: " << LLViewerObject::getNumZombieObjects() << llendl; @@ -449,10 +509,10 @@ void output_statistics(void*) llinfos << "--------------------------------" << llendl; llinfos << "Avatar Memory (partly overlaps with above stats):" << llendl; - gTexStaticImageList.dumpByteCount(); - LLVOAvatar::dumpScratchTextureByteCount(); + LLTexLayerStaticImageList::getInstance()->dumpByteCount(); + LLVOAvatarSelf::dumpScratchTextureByteCount(); LLTexLayerSetBuffer::dumpTotalByteCount(); - LLVOAvatar::dumpTotalLocalTextureByteCount(); + LLVOAvatarSelf::dumpTotalLocalTextureByteCount(); LLTexLayerParamAlpha::dumpCacheByteCount(); LLVOAvatar::dumpBakedStatus(); @@ -507,7 +567,7 @@ void update_statistics(U32 frame_count) { gTotalWorldBytes += gVLManager.getTotalBytes(); gTotalObjectBytes += gObjectBits / 8; - gTotalTextureBytes += LLViewerImageList::sTextureBits / 8; + gTotalTextureBytes += gImageList.mTextureBits / 8; // make sure we have a valid time delta for this frame if (gFrameIntervalSeconds > 0.f) @@ -520,7 +580,7 @@ void update_statistics(U32 frame_count) { LLViewerStats::getInstance()->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds); } - else if (gFloaterTools && gFloaterTools->getVisible()) + else if (LLFloaterReg::instanceVisible("build")) { LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TOOLBOX_SECONDS, gFrameIntervalSeconds); } @@ -534,7 +594,7 @@ void update_statistics(U32 frame_count) LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_AVATAR, (F64)gSavedSettings.getBOOL("VertexShaderLevelAvatar")); LLViewerStats::getInstance()->setStat(LLViewerStats::ST_SHADER_ENVIRONMENT, (F64)gSavedSettings.getBOOL("VertexShaderLevelEnvironment")); #endif - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_FRAME)); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime(LLFastTimer::NamedTimer::getRootNamedTimer().getFrameState())); F64 idle_secs = gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_IDLE); F64 network_secs = gDebugView->mFastTimerView->getTime(LLFastTimer::FTM_NETWORK); LLViewerStats::getInstance()->setStat(LLViewerStats::ST_UPDATE_SECS, idle_secs - network_secs); @@ -559,7 +619,7 @@ void update_statistics(U32 frame_count) F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); LLViewerStats::getInstance()->mLayersKBitStat.addValue(layer_bits/1024.f); LLViewerStats::getInstance()->mObjectKBitStat.addValue(gObjectBits/1024.f); - LLViewerStats::getInstance()->mTextureKBitStat.addValue(LLViewerImageList::sTextureBits/1024.f); + LLViewerStats::getInstance()->mTextureKBitStat.addValue(gImageList.mTextureBits/1024.f); LLViewerStats::getInstance()->mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); LLViewerStats::getInstance()->mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); gTransferManager.resetTransferBitsIn(LLTCT_ASSET); @@ -573,7 +633,7 @@ void update_statistics(U32 frame_count) gDebugTimers[0].unpause(); } - LLViewerStats::getInstance()->mTexturePacketsStat.addValue(LLViewerImageList::sTexturePackets); + LLViewerStats::getInstance()->mTexturePacketsStat.addValue(gImageList.mTexturePackets); { static F32 visible_avatar_frames = 0.f; @@ -594,15 +654,9 @@ void update_statistics(U32 frame_count) gObjectBits = 0; // gDecodedBits = 0; - LLViewerImageList::sTextureBits = 0; - LLViewerImageList::sTexturePackets = 0; + gImageList.mTextureBits = 0; + gImageList.mTexturePackets = 0; -#if LL_LCD_COMPILE - bool LCDenabled = gLcdScreen->Enabled(); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, LCDenabled); -#else - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_LOGITECH_LCD, false); -#endif } class ViewerStatsResponder : public LLHTTPClient::Responder @@ -692,7 +746,7 @@ void send_stats() agent["ping"] = gAvgSimPing; agent["meters_traveled"] = gAgent.getDistanceTraveled(); agent["regions_visited"] = gAgent.getRegionsVisited(); - agent["mem_use"] = getCurrentRSS() / 1024.0; + agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0; LLSD &system = body["system"]; diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index d3fd4f2466..ba89fbf02a 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -57,6 +57,7 @@ public: LLStat mTexturePacketsStat; LLStat mActualInKBitStat; // From the packet ring (when faking a bad connection) LLStat mActualOutKBitStat; // From the packet ring (when faking a bad connection) + LLStat mTrianglesDrawnStat; // Simulator stats LLStat mSimTimeDilation; @@ -98,15 +99,22 @@ public: LLStat mPhysicsPinnedTasks; LLStat mPhysicsLODTasks; LLStat mPhysicsMemoryAllocated; - /* - LLStat mSimCPUUsageStat; - LLStat mSimMemTotalStat; - LLStat mSimMemRSSStat; - */ - LLStat mSimPingStat; + LLStat mNumImagesStat; + LLStat mNumRawImagesStat; + LLStat mGLTexMemStat; + LLStat mGLBoundMemStat; + LLStat mRawMemStat; + LLStat mFormattedMemStat; + + LLStat mNumObjectsStat; + LLStat mNumActiveObjectsStat; + LLStat mNumNewObjectsStat; + LLStat mNumSizeCulledStat; + LLStat mNumVisCulledStat; + void resetStats(); public: // If you change this, please also add a corresponding text label @@ -171,9 +179,8 @@ public: ST_WINDOW_HEIGHT = 55, ST_TEX_BAKES = 56, ST_TEX_REBAKES = 57, - ST_LOGITECH_LCD = 58, - ST_COUNT = 59 + ST_COUNT = 58 }; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index d64700b523..f4989ec4fe 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -32,13 +32,14 @@ #include "llviewerprecompiledheaders.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "audioengine.h" #include "llagent.h" #include "llinventory.h" +#include "llinventorybridge.h" #include "llinventorymodel.h" #include "llinventoryview.h" -#include "llinventorybridge.h" // for landmark prefix string #include "llviewertexteditor.h" @@ -51,6 +52,7 @@ #include "llpreviewlandmark.h" #include "llscrollbar.h" #include "lltooldraganddrop.h" +#include "lltrans.h" #include "llviewercontrol.h" #include "llviewerimagelist.h" #include "llviewerwindow.h" @@ -62,7 +64,7 @@ #include "llappviewer.h" // for gPacificDaylightTime -static LLRegisterWidget r("text_editor"); +static LLDefaultWidgetRegistry::Register r("text_editor"); ///---------------------------------------------------------------------------- /// Class LLEmbeddedNotecardOpener @@ -96,31 +98,9 @@ public: } else { - // See if we can bring an existing preview to the front - if(!LLPreview::show(item->getUUID(), true)) + if(!gSavedSettings.getBOOL("ShowNewInventory")) { - if(!gSavedSettings.getBOOL("ShowNewInventory")) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("NotecardEditorRect"); - rect.translate(left - rect.mLeft, top - rect.mTop); - LLPreviewNotecard* preview; - preview = new LLPreviewNotecard("preview notecard", - rect, - std::string("Embedded Note: ") + item->getName(), - item->getUUID(), - LLUUID::null, - item->getAssetUUID(), - true, - (LLViewerInventoryItem*)item); - preview->setSourceID(LLUUID::null); - preview->setFocus(TRUE); - - // Force to be entirely onscreen. - gFloaterView->adjustToFitScreen(preview, FALSE); - } + LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); } } } @@ -430,6 +410,8 @@ void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const case LLAssetType::AT_BODYPART: img_name = "inv_item_skin.tga"; break; case LLAssetType::AT_ANIMATION: img_name = "inv_item_animation.tga";break; case LLAssetType::AT_GESTURE: img_name = "inv_item_gesture.tga"; break; + //TODO need img_name + case LLAssetType::AT_FAVORITE: img_name = "inv_item_landmark.tga"; break; default: llassert(0); continue; } @@ -561,33 +543,15 @@ struct LLNotecardCopyInfo // // Member functions // - -LLViewerTextEditor::LLViewerTextEditor(const std::string& name, - const LLRect& rect, - S32 max_length, - const std::string& default_text, - const LLFontGL* font, - BOOL allow_embedded_items) - : LLTextEditor(name, rect, max_length, default_text, font, allow_embedded_items), - mDragItemChar(0), - mDragItemSaved(FALSE), - mInventoryCallback(new LLEmbeddedNotecardOpener) +LLViewerTextEditor::LLViewerTextEditor(const LLViewerTextEditor::Params& p) +: LLTextEditor(p), + mDragItemChar(0), + mDragItemSaved(FALSE), + mInventoryCallback(new LLEmbeddedNotecardOpener) { + mParseHTML = p.allow_html; mEmbeddedItemList = new LLEmbeddedItems(this); mInventoryCallback->setEditor(this); - - // *TODO: Add right click menus for SLURLs - // Build the right click menu - // make the popup menu available - - //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_slurl.xml", this); - //if (!menu) - //{ - // menu = new LLMenuGL(LLStringUtil::null); - //} - //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); - //// menu->setVisible(FALSE); - //mPopupMenuHandle = menu->getHandle(); } LLViewerTextEditor::~LLViewerTextEditor() @@ -781,6 +745,7 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) { + static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); BOOL handled = FALSE; if (!mDragItem) @@ -825,7 +790,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) LLAssetType::lookupDragAndDropType( mDragItem->getType() ), mDragItem->getUUID(), LLToolDragAndDrop::SOURCE_NOTECARD, - getSourceID(), mObjectID); + mPreviewID, mObjectID); return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); } @@ -878,7 +843,7 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask) if( !handled ) { lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; - if (!mScrollbar->getVisible() || x < getRect().getWidth() - SCROLLBAR_SIZE) + if (!mScrollbar->getVisible() || x < getRect().getWidth() - scrollbar_size) { getWindow()->setCursor(UI_CURSOR_IBEAM); } @@ -1134,6 +1099,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, *accept = ACCEPT_NO; if (tooltip_msg.empty()) { + // *TODO: Translate tooltip_msg.assign("Only items with unrestricted\n" "'next owner' permissions \n" "can be attached to notecards."); @@ -1246,18 +1212,16 @@ std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); + std::string timeStr ="[["+ LLTrans::getString("TimeHour")+"]:[" + +LLTrans::getString("TimeMin")+"]] "; - // There's only one internal tm buffer. - struct tm* timep; - - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); + LLSD substitution; - std::string text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); - appendColoredText(text, false, prepend_newline, LLColor4::grey); + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + appendColoredText(timeStr, false, prepend_newline, LLColor4::grey); - return text; + return timeStr; } //---------------------------------------------------------------------------- @@ -1370,29 +1334,16 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, llwchar wc) void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item, llwchar wc ) { - // See if we can bring an existing preview to the front // *NOTE: Just for embedded Texture , we should use getAssetUUID(), // not getUUID(), because LLPreviewTexture pass in AssetUUID into // LLPreview constructor ItemUUID parameter. - - if( !LLPreview::show( item->getAssetUUID() ) ) + if (!item) + return; + LLPreviewTexture* preview = LLFloaterReg::showTypedInstance("preview_texture", LLSD(item->getAssetUUID()), TAKE_FOCUS_YES); + if (preview) { - // There isn't one, so make a new preview - if(item) - { - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); - rect.translate( left - rect.mLeft, top - rect.mTop ); - - LLPreviewTexture* preview = new LLPreviewTexture("preview texture", - rect, - item->getName(), - item->getAssetUUID(), - TRUE); - preview->setAuxItem( item ); - preview->setNotecardInfo(mNotecardInventoryID, mObjectID); - } + preview->setAuxItem( item ); + preview->setNotecardInfo(mNotecardInventoryID, mObjectID); } } @@ -1411,9 +1362,13 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item, llwchar wc ) void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc ) { - std::string title = - std::string(" ") + LLLandmarkBridge::prefix() + item->getName(); - open_landmark((LLViewerInventoryItem*)item, title, FALSE, item->getUUID(), TRUE); + if (!item) + return; + LLPreviewLandmark* preview = LLFloaterReg::showTypedInstance("preview_landmark", LLSD(item->getUUID()), TAKE_FOCUS_YES); + if (preview) + { + preview->setItem( item ); + } } void LLViewerTextEditor::openEmbeddedNotecard( LLInventoryItem* item, llwchar wc ) @@ -1435,9 +1390,11 @@ bool LLViewerTextEditor::onNotecardDialog(const LLSD& notification, const LLSD& S32 option = LLNotification::getSelectedOption(notification, response); if( option == 0 ) { - // itemptr is deleted by LLPreview::save - LLPointer* itemptr = new LLPointer(gInventory.getItem(notification["payload"]["item_id"].asUUID())); - LLPreview::save( notification["payload"]["notecard_id"].asUUID() , itemptr); + LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance("preview_notecard", notification["payload"]["notecard_id"]);; + if (preview) + { + preview->saveItem(); + } } return false; } @@ -1541,61 +1498,3 @@ BOOL LLViewerTextEditor::exportBuffer( std::string& buffer ) return TRUE; } -LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string name("text_editor"); - node->getAttributeString("name", name); - - LLRect rect; - createRect(node, rect, parent, LLRect()); - - U32 max_text_length = 255; - node->getAttributeU32("max_length", max_text_length); - - BOOL allow_embedded_items = FALSE; - node->getAttributeBOOL("embedded_items", allow_embedded_items); - - LLFontGL* font = LLView::selectFont(node); - - // std::string text = node->getValue(); - std::string text = node->getTextContents().substr(0, max_text_length - 1); - - if (text.size() > max_text_length) - { - // Erase everything from max_text_length on. - text.erase(max_text_length); - } - - LLViewerTextEditor* text_editor = new LLViewerTextEditor(name, - rect, - max_text_length, - LLStringUtil::null, - font, - allow_embedded_items); - - BOOL ignore_tabs = text_editor->tabsToNextField(); - node->getAttributeBOOL("ignore_tab", ignore_tabs); - text_editor->setTabsToNextField(ignore_tabs); - - text_editor->setTextEditorParameters(node); - - BOOL hide_scrollbar = FALSE; - node->getAttributeBOOL("hide_scrollbar",hide_scrollbar); - text_editor->setHideScrollbarForShortDocs(hide_scrollbar); - - BOOL hide_border = !text_editor->isBorderVisible(); - node->getAttributeBOOL("hide_border", hide_border); - text_editor->setBorderVisible(!hide_border); - - BOOL parse_html = text_editor->mParseHTML; - node->getAttributeBOOL("allow_html", parse_html); - text_editor->setParseHTML(parse_html); - text_editor->setParseHighlights(TRUE); - - text_editor->initFromXML(node, parent); - - // add text after all parameters have been set - text_editor->appendStyledText(text, FALSE, FALSE); - - return text_editor; -} diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h index f29caee602..bc373c858a 100644 --- a/indra/newview/llviewertexteditor.h +++ b/indra/newview/llviewertexteditor.h @@ -41,21 +41,27 @@ // class LLViewerTextEditor : public LLTextEditor { - public: - LLViewerTextEditor(const std::string& name, - const LLRect& rect, - S32 max_length, - const std::string& default_text = std::string(), - const LLFontGL* glfont = NULL, - BOOL allow_embedded_items = FALSE); + struct Params : public LLInitParam::Block + { + Optional allow_html; + + Params() + : allow_html("allow_html", false) + { + name = "text_editor"; + } + }; +protected: + LLViewerTextEditor(const Params&); + friend class LLUICtrlFactory; + +public: virtual ~LLViewerTextEditor(); virtual void makePristine(); - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - // mousehandler overrides virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -74,10 +80,11 @@ public: virtual BOOL importBuffer(const char* buffer, S32 length); virtual bool importStream(std::istream& str); virtual BOOL exportBuffer(std::string& buffer); - void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id) + void setNotecardInfo(const LLUUID& notecard_item_id, const LLUUID& object_id, const LLUUID& preview_id) { mNotecardInventoryID = notecard_item_id; mObjectID = object_id; + mPreviewID = preview_id; } void setASCIIEmbeddedText(const std::string& instr); @@ -126,6 +133,7 @@ private: LLUUID mObjectID; LLUUID mNotecardInventoryID; + LLUUID mPreviewID; LLPointer mInventoryCallback; diff --git a/indra/newview/llviewervisualparam.cpp b/indra/newview/llviewervisualparam.cpp index 8c7700eb65..7d717ed6dc 100644 --- a/indra/newview/llviewervisualparam.cpp +++ b/indra/newview/llviewervisualparam.cpp @@ -76,7 +76,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node) static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable"); if( node->getFastAttributeString( wearable_string, wearable) ) { - mWearableType = LLWearable::typeNameToType( wearable ); + mWearableType = LLWearableDictionary::typeNameToType( wearable ); } static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group"); @@ -119,12 +119,6 @@ LLViewerVisualParam::LLViewerVisualParam() { } -/* -//============================================================================= -// These virtual functions should always be overridden, -// but are included here for use as templates -//============================================================================= - //----------------------------------------------------------------------------- // setInfo() //----------------------------------------------------------------------------- @@ -140,6 +134,12 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info) return TRUE; } +/* +//============================================================================= +// These virtual functions should always be overridden, +// but are included here for use as templates +//============================================================================= + //----------------------------------------------------------------------------- // parseData() //----------------------------------------------------------------------------- diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h index 48d28cebf3..77a95db564 100644 --- a/indra/newview/llviewervisualparam.h +++ b/indra/newview/llviewervisualparam.h @@ -90,7 +90,7 @@ public: virtual const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; // interface methods - F32 getDisplayOrder() { return getInfo()->mEditGroupDisplayOrder; } + F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; } S32 getWearableType() const { return getInfo()->mWearableType; } const std::string& getEditGroup() const { return getInfo()->mEditGroup; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index f2fcad8861..cb2a8771fa 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -36,7 +36,9 @@ #include #include #include +#include +#include "llfloaterreg.h" #include "llpanellogin.h" #include "llviewerkeyboard.h" #include "llviewerwindow.h" @@ -48,7 +50,6 @@ #include "llvoiceclient.h" // for push-to-talk button handling - // // TODO: Many of these includes are unnecessary. Remove them. // @@ -57,6 +58,7 @@ #include "audioengine.h" // mute on minimize #include "indra_constants.h" #include "llassetstorage.h" +#include "llerrorcontrol.h" #include "llfontgl.h" #include "llmousehandler.h" #include "llrect.h" @@ -98,16 +100,15 @@ #include "llfloaterchat.h" #include "llfloaterchatterbox.h" #include "llfloatercustomize.h" -#include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor #include "llfloaterland.h" #include "llfloaterinspect.h" +#include "llfloatermap.h" #include "llfloaternamedesc.h" #include "llfloaterpreference.h" #include "llfloatersnapshot.h" #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llfocusmgr.h" -#include "llframestatview.h" #include "llgesturemgr.h" #include "llglheaders.h" #include "llhoverview.h" @@ -122,13 +123,15 @@ #include "llmodaldialog.h" #include "llmorphview.h" #include "llmoveview.h" +#include "llnavigationbar.h" #include "llnotify.h" #include "lloverlaybar.h" #include "llpreviewtexture.h" #include "llprogressview.h" #include "llresmgr.h" -#include "llrootview.h" +#include "llsidetray.h" #include "llselectmgr.h" +#include "llrootview.h" #include "llrendersphere.h" #include "llstartup.h" #include "llstatusbar.h" @@ -151,9 +154,8 @@ #include "lltoolmgr.h" #include "lltoolmorph.h" #include "lltoolpie.h" -#include "lltoolplacer.h" #include "lltoolselectland.h" -#include "lltoolview.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "lluploaddialog.h" #include "llurldispatcher.h" // SLURL from other app instance @@ -170,7 +172,7 @@ #include "llviewerregion.h" #include "llviewershadermgr.h" #include "llviewerstats.h" -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" #include "llworldmapview.h" @@ -182,10 +184,12 @@ #include "llviewerjoystick.h" #include "llviewernetwork.h" #include "llpostprocess.h" +#include "llbottomtray.h" -#include "llfloatertest.h" // HACK! #include "llfloaternotificationsconsole.h" +#include "llnearbychathistory.h" + #if LL_WINDOWS #include // For Unicode conversion methods #endif @@ -194,7 +198,6 @@ // Globals // void render_ui(F32 zoom_factor = 1.f, int subfield = 0); -LLBottomPanel* gBottomPanel = NULL; extern BOOL gDebugClicks; extern BOOL gDisplaySwapBuffers; @@ -203,7 +206,6 @@ extern BOOL gResizeScreenTexture; extern S32 gJamesInt; LLViewerWindow *gViewerWindow = NULL; -LLVelocityBar *gVelocityBar = NULL; BOOL gDebugSelect = FALSE; @@ -249,7 +251,27 @@ std::string LLViewerWindow::sMovieBaseName; extern void toggle_debug_menus(void*); +class RecordToChatConsole : public LLError::Recorder, public LLSingleton +{ +public: + virtual void recordMessage(LLError::ELevel level, + const std::string& message) + { + // only log warnings to chat console + if (level == LLError::LEVEL_WARN) + { + LLFloaterChat* chat_floater = LLFloaterReg::getTypedInstance("chat"); + if (chat_floater && gSavedSettings.getBOOL("WarningsAsChat")) + { + LLChat chat; + chat.mText = message; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + chat_floater->addChat(chat, FALSE, FALSE); + } + } + } +}; //////////////////////////////////////////////////////////////////////////// // @@ -557,7 +579,7 @@ public: const Line& line = *iter; LLFontGL::getFontMonospace()->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor, LLFontGL::LEFT, LLFontGL::TOP, - LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE); + LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); } mLineList.clear(); } @@ -1186,6 +1208,27 @@ void LLViewerWindow::handlePauseWatchdog(LLWindow *window) LLAppViewer::instance()->pauseMainloopTimeout(); } +//virtual +std::string LLViewerWindow::translateString(const char* tag) +{ + return LLTrans::getString( std::string(tag) ); +} + +//virtual +std::string LLViewerWindow::translateString(const char* tag, + const std::map& args) +{ + // LLTrans uses a special subclass of std::string for format maps, + // but we must use std::map<> in these callbacks, otherwise we create + // a dependency between LLWindow and LLFormatMapString. So copy the data. + LLStringUtil::format_map_t args_copy; + std::map::const_iterator it = args.begin(); + for ( ; it != args.end(); ++it) + { + args_copy[it->first] = it->second; + } + return LLTrans::getString( std::string(tag), args_copy); +} // // Classes @@ -1196,11 +1239,13 @@ LLViewerWindow::LLViewerWindow( S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth) : + mWindow(NULL), mActive(TRUE), mWantFullscreen(fullscreen), mShowFullscreenProgress(FALSE), mWindowRect(0, height, width, 0), mVirtualWindowRect(0, height, width, 0), + mWorldViewRect(0, height, width, 0), mLeftMouseDown(FALSE), mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), @@ -1231,7 +1276,7 @@ LLViewerWindow::LLViewerWindow( resetSnapshotLoc(); // create window - mWindow = LLWindowManager::createWindow( + mWindow = LLWindowManager::createWindow(this, title, name, x, y, width, height, 0, fullscreen, gNoRender, @@ -1306,26 +1351,31 @@ LLViewerWindow::LLViewerWindow( mInitAlert = "DisplaySettingsNoShaders"; LLFeatureManager::getInstance()->setGraphicsLevel(0, false); gSavedSettings.setU32("RenderQualityPerformance", 0); - } - // set callbacks - mWindow->setCallbacks(this); - // Init the image list. Must happen after GL is initialized and before the images that // LLViewerWindow needs are requested. gImageList.init(); LLViewerImage::initClass(); gBumpImageList.init(); - + + // Init font system, but don't actually load the fonts yet + // because our window isn't onscreen and they take several + // seconds to parse. + LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), + mDisplayScale.mV[VX], + mDisplayScale.mV[VY], + gDirUtilp->getAppRODataDir(), + LLUI::getXUIPaths()); + // Create container for all sub-views - mRootView = new LLRootView("root", mVirtualWindowRect, FALSE); - - if (!gNoRender) - { - // Init default fonts - initFonts(); - } + LLView::Params rvp; + rvp.name("root"); + rvp.rect(mVirtualWindowRect); + rvp.mouse_opaque(false); + rvp.follows.flags(FOLLOWS_NONE); + mRootView = LLUICtrlFactory::create(rvp); + LLUI::setRootView(mRootView); // Make avatar head look forward at start mCurrentMousePoint.mX = getWindowWidth() / 2; @@ -1381,8 +1431,6 @@ void LLViewerWindow::initBase() LLRect full_window(0, height, width, 0); - adjustRectanglesForFirstUse(full_window); - //////////////////// // // Set the gamma @@ -1402,41 +1450,57 @@ void LLViewerWindow::initBase() // Constrain floaters to inside the menu and status bar regions. LLRect floater_view_rect = full_window; - // make space for menu bar if we have one + // make space for menu bar floater_view_rect.mTop -= MENU_BAR_HEIGHT; - // TODO: Eliminate magic constants - please used named constants if changing this - floater_view_rect.mBottom += STATUS_BAR_HEIGHT + 12 + 16 + 2; - - // Check for non-first startup - S32 floater_view_bottom = gSavedSettings.getS32("FloaterViewBottom"); - if (floater_view_bottom >= 0) - { - floater_view_rect.mBottom = floater_view_bottom; - } - gFloaterView = new LLFloaterView("Floater View", floater_view_rect ); - gFloaterView->setVisible(TRUE); - - gSnapshotFloaterView = new LLSnapshotFloaterView("Snapshot Floater View", full_window); + LLFloaterView::Params fvparams; + fvparams.name("Floater View"); + fvparams.rect(floater_view_rect); + fvparams.mouse_opaque(false); + fvparams.follows.flags(FOLLOWS_ALL); + fvparams.tab_stop(false); + gFloaterView = LLUICtrlFactory::create (fvparams); + + LLSnapshotFloaterView::Params snapParams; + snapParams.name("Snapshot Floater View"); + snapParams.rect(full_window); + snapParams.enabled(false); + gSnapshotFloaterView = LLUICtrlFactory::create (snapParams); + // Snapshot floater must start invisible otherwise it eats all // the tooltips. JC gSnapshotFloaterView->setVisible(FALSE); // Console llassert( !gConsole ); - gConsole = new LLConsole( - "console", - gSavedSettings.getS32("ConsoleBufferSize"), - getChatConsoleRect(), - gSavedSettings.getS32("ChatFontSize"), - gSavedSettings.getF32("ChatPersistTime") ); - gConsole->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM); + LLConsole::Params cp; + cp.name("console"); + cp.max_lines(gSavedSettings.getS32("ConsoleBufferSize")); + cp.rect(getChatConsoleRect()); + cp.persist_time(gSavedSettings.getF32("ChatPersistTime")); + cp.font_size_index(gSavedSettings.getS32("ChatFontSize")); + cp.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM); + gConsole = LLUICtrlFactory::create(cp); mRootView->addChild(gConsole); + // optionally forward warnings to chat console/chat floater + // for qa runs and dev builds +#if !LL_RELEASE_FOR_DOWNLOAD + LLError::addRecorder(RecordToChatConsole::getInstance()); +#else + if(gSavedSettings.getBOOL("QAMode")) + { + LLError::addRecorder(RecordToChatConsole::getInstance()); + } +#endif + // Debug view over the console - gDebugView = new LLDebugView("gDebugView", full_window); - gDebugView->setFollowsAll(); - gDebugView->setVisible(TRUE); + LLDebugView::Params debug_p; + debug_p.name("DebugView"); + debug_p.rect(full_window); + debug_p.follows.flags(FOLLOWS_ALL); + debug_p.visible(true); + gDebugView = LLUICtrlFactory::create(debug_p); mRootView->addChild(gDebugView); // Add floater view at the end so it will be on top, and give it tab priority over others @@ -1444,278 +1508,154 @@ void LLViewerWindow::initBase() mRootView->addChild(gSnapshotFloaterView); // notify above floaters! - LLRect notify_rect = full_window; - //notify_rect.mTop -= 24; - notify_rect.mBottom += STATUS_BAR_HEIGHT; - gNotifyBoxView = new LLNotifyBoxView("notify_container", notify_rect, FALSE, FOLLOWS_ALL); + LLRect notify_rect = floater_view_rect; + LLNotifyBoxView::Params p; + p.name("notify_container"); + p.rect(notify_rect); + p.mouse_opaque(false); + p.follows.flags(FOLLOWS_ALL); + gNotifyBoxView = LLUICtrlFactory::create (p); mRootView->addChild(gNotifyBoxView, -2); // Tooltips go above floaters - mToolTip = new LLTextBox( std::string("tool tip"), LLRect(0, 1, 1, 0 ) ); - mToolTip->setHPad( 4 ); - mToolTip->setVPad( 2 ); - mToolTip->setColor( gColors.getColor( "ToolTipTextColor" ) ); - mToolTip->setBorderColor( gColors.getColor( "ToolTipBorderColor" ) ); - mToolTip->setBorderVisible( FALSE ); - mToolTip->setBackgroundColor( gColors.getColor( "ToolTipBgColor" ) ); - mToolTip->setBackgroundVisible( TRUE ); - mToolTip->setFontStyle(LLFontGL::NORMAL); - mToolTip->setBorderDropshadowVisible( TRUE ); - mToolTip->setVisible( FALSE ); + LLTextBox::Params params; + params.text("tool tip"); + params.name(params.text); + params.rect(LLRect (0, 1, 1, 0)); + params.h_pad(4); + params.v_pad(2); + params.text_color(gSavedSkinSettings.getColor( "ToolTipTextColor" )); + params.border_color(gSavedSkinSettings.getColor( "ToolTipBorderColor" )); + params.border_visible(false); + params.background_color(gSavedSkinSettings.getColor( "ToolTipBgColor" )); + params.bg_visible(true); + params.font.style("NORMAL"); + params.border_drop_shadow_visible(true); + params.visible(false); + mToolTip = LLUICtrlFactory::create (params); // Add the progress bar view (startup view), which overrides everything - mProgressView = new LLProgressView(std::string("ProgressView"), full_window); + mProgressView = new LLProgressView(full_window); mRootView->addChild(mProgressView); setShowProgress(FALSE); setProgressCancelButtonVisible(FALSE); } - -void adjust_rect_top_left(const std::string& control, const LLRect& window) -{ - LLRect r = gSavedSettings.getRect(control); - if (r.mLeft == 0 && r.mBottom == 0) - { - r.setLeftTopAndSize(0, window.getHeight(), r.getWidth(), r.getHeight()); - gSavedSettings.setRect(control, r); - } -} - -void adjust_rect_top_center(const std::string& control, const LLRect& window) +void LLViewerWindow::initWorldUI() { - LLRect r = gSavedSettings.getRect(control); - if (r.mLeft == 0 && r.mBottom == 0) - { - r.setLeftTopAndSize( window.getWidth()/2 - r.getWidth()/2, - window.getHeight(), - r.getWidth(), - r.getHeight() ); - gSavedSettings.setRect(control, r); - } -} + S32 height = mRootView->getRect().getHeight(); + S32 width = mRootView->getRect().getWidth(); + LLRect full_window(0, height, width, 0); -void adjust_rect_top_right(const std::string& control, const LLRect& window) -{ - LLRect r = gSavedSettings.getRect(control); - if (r.mLeft == 0 && r.mBottom == 0) - { - r.setLeftTopAndSize(window.getWidth() - r.getWidth(), - window.getHeight(), - r.getWidth(), - r.getHeight()); - gSavedSettings.setRect(control, r); - } -} + gIMMgr = LLIMMgr::getInstance(); -// *TODO: Adjust based on XUI XML -const S32 TOOLBAR_HEIGHT = 64; + // new bottom panel + LLRect rc = LLBottomTray::getInstance()->getRect(); + rc.mLeft = 0; + rc.mRight = mRootView->getRect().getWidth(); + mRootView->addChild(LLBottomTray::getInstance()); + LLBottomTray::getInstance()->reshape(rc.getWidth(),rc.getHeight(),FALSE); + LLBottomTray::getInstance()->setRect(rc); -void adjust_rect_bottom_left(const std::string& control, const LLRect& window) -{ - LLRect r = gSavedSettings.getRect(control); - if (r.mLeft == 0 && r.mBottom == 0) + // Updating of bottom boundary of gConsole to avoid overlapping + if (gConsole) { - r.setOriginAndSize(0, TOOLBAR_HEIGHT, r.getWidth(), r.getHeight()); - gSavedSettings.setRect(control, r); + LLRect cr = gConsole->getRect(); + cr.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); + gConsole->setRect(cr); } -} -void adjust_rect_bottom_center(const std::string& control, const LLRect& window) -{ - LLRect r = gSavedSettings.getRect(control); - if (r.mLeft == 0 && r.mBottom == 0) - { - r.setOriginAndSize( - window.getWidth()/2 - r.getWidth()/2, - TOOLBAR_HEIGHT, - r.getWidth(), - r.getHeight()); - gSavedSettings.setRect(control, r); - } -} + // View for hover information + LLHoverView::Params hvp; + hvp.name("gHoverview"); + hvp.rect(full_window); + gHoverView = LLUICtrlFactory::create(hvp); + mRootView->addChild(gHoverView); -void adjust_rect_centered_partial_zoom(const std::string& control, - const LLRect& window) -{ - LLRect rect = gSavedSettings.getRect(control); - // Only adjust on first use - if (rect.mLeft == 0 && rect.mBottom == 0) + // Pre initialize instance communicate instance; + // currently needs to happen before initializing chat or IM + LLFloaterReg::getInstance("communicate"); + + if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) { - S32 width = window.getWidth(); - S32 height = window.getHeight(); - rect.set(0, height-STATUS_BAR_HEIGHT, width, TOOL_BAR_HEIGHT); - // Make floater fill 80% of window, leaving 20% padding on - // the sides. - const F32 ZOOM_FRACTION = 0.8f; - S32 dx = (S32)(width * (1.f - ZOOM_FRACTION)); - S32 dy = (S32)(height * (1.f - ZOOM_FRACTION)); - rect.stretch(-dx/2, -dy/2); - gSavedSettings.setRect(control, rect); + LLFloaterChat::loadHistory(); } -} - - -// Many rectangles can't be placed until we know the screen size. -// These rectangles have their bottom-left corner as 0,0 -void LLViewerWindow::adjustRectanglesForFirstUse(const LLRect& window) -{ - LLRect r; - // *NOTE: The width and height of these floaters must be - // identical in settings.xml and their relevant floater.xml - // files, otherwise the window construction will get - // confused. JC - adjust_rect_bottom_center("FloaterMoveRect2", window); + LLRect morph_view_rect = full_window; + morph_view_rect.stretch( -STATUS_BAR_HEIGHT ); + morph_view_rect.mTop = full_window.mTop - 32; + LLMorphView::Params mvp; + mvp.name("MorphView"); + mvp.rect(morph_view_rect); + mvp.visible(false); + gMorphView = LLUICtrlFactory::create(mvp); + mRootView->addChild(gMorphView); - adjust_rect_top_center("FloaterCameraRect3", window); + // Make space for nav bar. + LLRect floater_view_rect = gFloaterView->getRect(); + LLRect notify_view_rect = gNotifyBoxView->getRect(); + floater_view_rect.mTop -= NAVIGATION_BAR_HEIGHT; + floater_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); + notify_view_rect.mTop -= NAVIGATION_BAR_HEIGHT; + notify_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); + gFloaterView->setRect(floater_view_rect); + gNotifyBoxView->setRect(notify_view_rect); - adjust_rect_top_left("FloaterCustomizeAppearanceRect", window); + // *Note: this is where gFloaterMute used to be initialized. - adjust_rect_top_left("FloaterLandRect5", window); - - adjust_rect_top_left("FloaterFindRect2", window); - - adjust_rect_top_left("FloaterGestureRect2", window); - - adjust_rect_top_right("FloaterMiniMapRect", window); + LLWorldMapView::initClass(); - adjust_rect_top_right("FloaterLagMeter", window); - - adjust_rect_top_left("FloaterBuildOptionsRect", window); - - adjust_rect_bottom_left("FloaterActiveSpeakersRect", window); - - adjust_rect_bottom_left("FloaterBumpRect", window); - - adjust_rect_bottom_left("FloaterRegionInfo", window); - - adjust_rect_bottom_left("FloaterEnvRect", window); - - adjust_rect_bottom_left("FloaterAdvancedSkyRect", window); - - adjust_rect_bottom_left("FloaterAdvancedWaterRect", window); - - adjust_rect_bottom_left("FloaterDayCycleRect", window); - - adjust_rect_top_right("FloaterStatisticsRect", window); - - - // bottom-right - r = gSavedSettings.getRect("FloaterInventoryRect"); - if (r.mLeft == 0 && r.mBottom == 0) - { - r.setOriginAndSize( - window.getWidth() - r.getWidth(), - 0, - r.getWidth(), - r.getHeight()); - gSavedSettings.setRect("FloaterInventoryRect", r); - } + // Force gFloaterWorldMap to initialize + LLFloaterReg::getInstance("world_map"); + LLFloaterReg::hideInstance("world_map"); + + // Force gFloaterTools to initialize + LLFloaterReg::getInstance("build"); + LLFloaterReg::hideInstance("build"); + + // Status bar + S32 menu_bar_height = gMenuBarView->getRect().getHeight(); + LLRect root_rect = getRootView()->getRect(); + LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height); + gStatusBar = new LLStatusBar(status_rect); + gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); + + gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); + gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight()); + // sync bg color with menu bar + gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() ); + + // Navigation bar + + LLNavigationBar* navbar = LLNavigationBar::getInstance(); + navbar->reshape(root_rect.getWidth(), navbar->getRect().getHeight(), TRUE); // *TODO: redundant? + navbar->translate(0, root_rect.getHeight() - menu_bar_height - navbar->getRect().getHeight()); // FIXME + navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); -// adjust_rect_top_left("FloaterHUDRect2", window); - - // slightly off center to be left of the avatar. - r = gSavedSettings.getRect("FloaterHUDRect2"); - if (r.mLeft == 0 && r.mBottom == 0) - { - r.setOriginAndSize( - window.getWidth()/4 - r.getWidth()/2, - 2*window.getHeight()/3 - r.getHeight()/2, - r.getWidth(), - r.getHeight()); - gSavedSettings.setRect("FloaterHUDRect2", r); - } -} - -//Rectangles need to be adjusted after the window is constructed -//in order for proper centering to take place -void LLViewerWindow::adjustControlRectanglesForFirstUse(const LLRect& window) -{ - adjust_rect_bottom_center("FloaterMoveRect2", window); - adjust_rect_top_center("FloaterCameraRect3", window); -} - -void LLViewerWindow::initWorldUI() -{ - pre_init_menus(); - - S32 height = mRootView->getRect().getHeight(); - S32 width = mRootView->getRect().getWidth(); - LLRect full_window(0, height, width, 0); - - if ( gBottomPanel == NULL ) // Don't re-enter if objects are alreay created - { - // panel containing chatbar, toolbar, and overlay, over floaters - gBottomPanel = new LLBottomPanel(mRootView->getRect()); - mRootView->addChild(gBottomPanel); - - // View for hover information - gHoverView = new LLHoverView(std::string("gHoverView"), full_window); - gHoverView->setVisible(TRUE); - mRootView->addChild(gHoverView); - - gIMMgr = LLIMMgr::getInstance(); - - if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) - { - LLFloaterChat::getInstance(LLSD())->loadHistory(); - } - - LLRect morph_view_rect = full_window; - morph_view_rect.stretch( -STATUS_BAR_HEIGHT ); - morph_view_rect.mTop = full_window.mTop - 32; - gMorphView = new LLMorphView(std::string("gMorphView"), morph_view_rect ); - mRootView->addChild(gMorphView); - gMorphView->setVisible(FALSE); - - // *Note: this is where gFloaterMute used to be initialized. + getRootView()->addChild(gStatusBar); + getRootView()->addChild(navbar); - LLWorldMapView::initClass(); + // side tray + getRootView()->addChild(LLSideTray::getInstance()); - adjust_rect_centered_partial_zoom("FloaterWorldMapRect2", full_window); - - gFloaterWorldMap = new LLFloaterWorldMap(); - gFloaterWorldMap->setVisible(FALSE); - - // - // Tools for building - // - - // Toolbox floater - init_menus(); - - gFloaterTools = new LLFloaterTools(); - gFloaterTools->setVisible(FALSE); - - // Status bar - S32 menu_bar_height = gMenuBarView->getRect().getHeight(); - LLRect root_rect = getRootView()->getRect(); - LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height); - gStatusBar = new LLStatusBar(std::string("status"), status_rect); - gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); - - gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); - gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight()); - // sync bg color with menu bar - gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() ); - - LLFloaterChatterBox::createInstance(LLSD()); - - getRootView()->addChild(gStatusBar); - - // menu holder appears on top to get first pass at all mouse events - getRootView()->sendChildToFront(gMenuHolder); - } + //sidetray + //then notify area + //then menu + getRootView()->sendChildToFront(LLSideTray::getInstance()); + getRootView()->sendChildToFront(gNotifyBoxView); + // menu holder appears on top to get first pass at all mouse events + getRootView()->sendChildToFront(gMenuHolder); } // Destroy the UI void LLViewerWindow::shutdownViews() { + // clean up warning logger + LLError::removeRecorder(RecordToChatConsole::getInstance()); + delete mDebugText; mDebugText = NULL; - gSavedSettings.setS32("FloaterViewBottom", gFloaterView->getRect().mBottom); - // Cleanup global views if (gMorphView) { @@ -1727,7 +1667,6 @@ void LLViewerWindow::shutdownViews() mRootView = NULL; // Automatically deleted as children of mRootView. Fix the globals. - gFloaterTools = NULL; gStatusBar = NULL; gIMMgr = NULL; gHoverView = NULL; @@ -1829,8 +1768,8 @@ void LLViewerWindow::sendShapeToSim() msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode); msg->nextBlockFast(_PREHASH_HeightWidthBlock); msg->addU32Fast(_PREHASH_GenCounter, 0); - U16 height16 = (U16) mWindowRect.getHeight(); - U16 width16 = (U16) mWindowRect.getWidth(); + U16 height16 = (U16) mWorldViewRect.getHeight(); + U16 width16 = (U16) mWorldViewRect.getWidth(); msg->addU16Fast(_PREHASH_Height, height16); msg->addU16Fast(_PREHASH_Width, width16); gAgent.sendReliableMessage(); @@ -1851,25 +1790,18 @@ void LLViewerWindow::reshape(S32 width, S32 height) return; } - glViewport(0, 0, width, height ); + // update our window rectangle + mWindowRect.mRight = mWindowRect.mLeft + width; + mWindowRect.mTop = mWindowRect.mBottom + height; + + //glViewport(0, 0, width, height ); if (height > 0) { - LLViewerCamera::getInstance()->setViewHeightInPixels( height ); - if (mWindow->getFullscreen()) - { - // force to 4:3 aspect for odd resolutions - LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() ); - } - else - { - LLViewerCamera::getInstance()->setAspect( width / (F32) height); - } + LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() ); + LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); } - // update our window rectangle - mWindowRect.mRight = mWindowRect.mLeft + width; - mWindowRect.mTop = mWindowRect.mBottom + height; calcDisplayScale(); BOOL display_scale_changed = mDisplayScale != LLUI::sGLScaleFactor; @@ -1879,7 +1811,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) mVirtualWindowRect.mRight = mVirtualWindowRect.mLeft + llround((F32)width / mDisplayScale.mV[VX]); mVirtualWindowRect.mTop = mVirtualWindowRect.mBottom + llround((F32)height / mDisplayScale.mV[VY]); - setupViewport(); + setup2DViewport(); // Inform lower views of the change // round up when converting coordinates to make sure there are no gaps at edge of window @@ -1897,7 +1829,7 @@ void LLViewerWindow::reshape(S32 width, S32 height) // store the mode the user wants (even if not there yet) - gSavedSettings.setBOOL("FullScreen", mWantFullscreen); + gSavedSettings.setBOOL("NotFullScreen", !mWantFullscreen); // store new settings for the mode we are in, regardless if (!mWindow->getFullscreen()) @@ -1917,7 +1849,6 @@ void LLViewerWindow::reshape(S32 width, S32 height) LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width); LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height); - gResizeScreenTexture = TRUE; } } @@ -1925,11 +1856,8 @@ void LLViewerWindow::reshape(S32 width, S32 height) // Hide normal UI when a logon fails void LLViewerWindow::setNormalControlsVisible( BOOL visible ) { - if ( gBottomPanel ) - { - gBottomPanel->setVisible( visible ); - gBottomPanel->setEnabled( visible ); - } + LLBottomTray::getInstance()->setVisible(visible); + LLBottomTray::getInstance()->setEnabled(visible); if ( gMenuBarView ) { @@ -1946,6 +1874,12 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) gStatusBar->setVisible( visible ); gStatusBar->setEnabled( visible ); } + + LLNavigationBar* navbarp = LLUI::getRootView()->findChild("navigation_bar"); + if (navbarp) + { + navbarp->setVisible( visible ); + } } void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) @@ -1955,19 +1889,19 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) { - new_bg_color = gColors.getColor( "MenuBarGodBgColor" ); + new_bg_color = gSavedSkinSettings.getColor( "MenuBarGodBgColor" ); } else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid()) { - new_bg_color = gColors.getColor( "MenuNonProductionGodBgColor" ); + new_bg_color = gSavedSkinSettings.getColor( "MenuNonProductionGodBgColor" ); } else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid()) { - new_bg_color = gColors.getColor( "MenuNonProductionBgColor" ); + new_bg_color = gSavedSkinSettings.getColor( "MenuNonProductionBgColor" ); } else { - new_bg_color = gColors.getColor( "MenuBarBgColor" ); + new_bg_color = gSavedSkinSettings.getColor( "MenuBarBgColor" ); } if(gMenuBarView) @@ -1978,6 +1912,7 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) if(gStatusBar) { gStatusBar->setBackgroundColor( new_bg_color ); + gStatusBar->getChild("HealthText")->setBackgroundColor(new_bg_color); } } @@ -2021,7 +1956,7 @@ void LLViewerWindow::draw() glLoadIdentity(); microsecondsToTimecodeString(gFrameTime,text); - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLFontGL::getFontSansSerif(); font->renderUTF8(text, 0, llround((getWindowWidth()/2)-100.f), llround((getWindowHeight()-60.f)), @@ -2126,6 +2061,9 @@ void LLViewerWindow::draw() #if LL_DEBUG LLView::sIsDrawing = FALSE; #endif + + // UI post-draw Updates + gNotifyBoxView->updateNotifyBoxView(); } // Takes a single keydown event, usually when UI is visible @@ -2144,14 +2082,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } - // HACK look for UI editing keys - if (LLView::sEditingUI) - { - if (LLFloaterEditUI::processKeystroke(key, mask)) - { - return TRUE; - } - } + //// HACK look for UI editing keys + //if (LLView::sEditingUI) + //{ + // if (LLFloaterEditUI::processKeystroke(key, mask)) + // { + // return TRUE; + // } + //} // Hide tooltips on keypress mToolTipBlocked = TRUE; // block until next time mouse is moved @@ -2434,8 +2372,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) void LLViewerWindow::moveCursorToCenter() { - S32 x = mVirtualWindowRect.getWidth() / 2; - S32 y = mVirtualWindowRect.getHeight() / 2; + S32 x = mWorldViewRect.getWidth() / 2; + S32 y = mWorldViewRect.getHeight() / 2; //on a forced move, all deltas get zeroed out to prevent jumping mCurrentMousePoint.set(x,y); @@ -2452,103 +2390,131 @@ void LLViewerWindow::moveCursorToCenter() // Update UI based on stored mouse position from mouse-move // event processing. -BOOL LLViewerWindow::handlePerFrameHover() +void LLViewerWindow::updateUI() { static std::string last_handle_msg; + updateWorldViewRect(); + LLView::sMouseHandlerMessage.clear(); S32 x = mCurrentMousePoint.mX; S32 y = mCurrentMousePoint.mY; MASK mask = gKeyboard->currentMask(TRUE); - //RN: fix for asynchronous notification of mouse leaving window not working - LLCoordWindow mouse_pos; - mWindow->getCursorPosition(&mouse_pos); - if (mouse_pos.mX < 0 || - mouse_pos.mY < 0 || - mouse_pos.mX > mWindowRect.getWidth() || - mouse_pos.mY > mWindowRect.getHeight()) - { - mMouseInWindow = FALSE; - } - else + if (gNoRender) { - mMouseInWindow = TRUE; + return; } + updateMouseDelta(); + updateKeyboardFocus(); - S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); - S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); - - LLVector2 mouse_vel; + BOOL handled = FALSE; - if (gSavedSettings.getBOOL("MouseSmooth")) - { - static F32 fdx = 0.f; - static F32 fdy = 0.f; + BOOL handled_by_top_ctrl = FALSE; + LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); - F32 amount = 16.f; - fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f); - fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f); + //build set of views containing mouse cursor by traversing UI hierarchy and testing + //screen rect against mouse cursor + view_handle_set_t mouse_hover_set; - mCurrentMouseDelta.set(llround(fdx), llround(fdy)); - mouse_vel.setVec(fdx,fdy); - } - else + // start at current mouse captor (if is a view) or UI root + LLView* root_view = NULL; + root_view = dynamic_cast(mouse_captor); + if (!root_view) { - mCurrentMouseDelta.set(dx, dy); - mouse_vel.setVec((F32) dx, (F32) dy); + root_view = mRootView; } - - mMouseVelocityStat.addValue(mouse_vel.magVec()); - if (gNoRender) + // walk UI tree in depth-first order + LLView::tree_iterator_t end_it; + for (LLView::tree_iterator_t it = root_view->beginTree(); + it != end_it; + ++it) { - return TRUE; + LLView* viewp = *it; + // calculating the screen rect involves traversing the parent, so this is less than optimal + if (!viewp->getVisible() + || !viewp->calcScreenBoundingRect().pointInRect(x, y)) + { + // skip this view and all of its children + it.skipDescendants(); + continue; + } + + // if this view is mouse opaque, nothing behind it should be in mouse_hover_set + if (viewp->getMouseOpaque()) + { + // constrain further iteration to children of this widget + it = viewp->beginTree(); + } + + // we have a view that contains the mouse, add it to the set + mouse_hover_set.insert(viewp->getHandle()); } - // clean up current focus - LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); - if (cur_focus) + // now do the same aggregation for the "top" ctrl, whose parent does not necessarily contain the mouse + if (top_ctrl) { - if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain()) + for (LLView::tree_iterator_t it = top_ctrl->beginTree(); + it != root_view->endTree(); + ++it) { - gFocusMgr.releaseFocusIfNeeded(cur_focus); - - LLUICtrl* parent = cur_focus->getParentUICtrl(); - const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); - while(parent) + LLView* viewp = *it; + if (!viewp->getVisible() + || !viewp->calcScreenBoundingRect().pointInRect(x, y)) { - if (parent->isCtrl() && - (parent->hasTabStop() || parent == focus_root) && - !parent->getIsChrome() && - parent->isInVisibleChain() && - parent->isInEnabledChain()) - { - if (!parent->focusFirstItem()) - { - parent->setFocus(TRUE); - } - break; - } - parent = parent->getParentUICtrl(); + // skip this view and all of its children + it.skipDescendants(); + continue; } + + // we have a view that contains the mouse, add it to the set + mouse_hover_set.insert(viewp->getHandle()); } - else if (cur_focus->isFocusRoot()) + } + + typedef std::vector > view_handle_list_t; + + // call onMouseEnter() on all views which contain the mouse cursor but did not before + view_handle_list_t mouse_enter_views; + std::set_difference(mouse_hover_set.begin(), mouse_hover_set.end(), + mMouseHoverViews.begin(), mMouseHoverViews.end(), + std::back_inserter(mouse_enter_views)); + for (view_handle_list_t::iterator it = mouse_enter_views.begin(); + it != mouse_enter_views.end(); + ++it) + { + LLView* viewp = it->get(); + if (viewp) { - // focus roots keep trying to delegate focus to their first valid descendant - // this assumes that focus roots are not valid focus holders on their own - cur_focus->focusFirstItem(); + LLRect view_screen_rect = viewp->calcScreenRect(); + viewp->onMouseEnter(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask); } } - BOOL handled = FALSE; + // call onMouseLeave() on all views which no longer contain the mouse cursor + view_handle_list_t mouse_leave_views; + std::set_difference(mMouseHoverViews.begin(), mMouseHoverViews.end(), + mouse_hover_set.begin(), mouse_hover_set.end(), + std::back_inserter(mouse_leave_views)); + for (view_handle_list_t::iterator it = mouse_leave_views.begin(); + it != mouse_leave_views.end(); + ++it) + { + LLView* viewp = it->get(); + if (viewp) + { + LLRect view_screen_rect = viewp->calcScreenRect(); + viewp->onMouseLeave(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask); + } + } - BOOL handled_by_top_ctrl = FALSE; - LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); + // store resulting hover set for next frame + swap(mMouseHoverViews, mouse_hover_set); - LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); if( mouse_captor ) { // Pass hover events to object capturing mouse events. @@ -2691,114 +2657,194 @@ BOOL LLViewerWindow::handlePerFrameHover() } } - if (tool && tool != gToolNull && tool != LLToolCompInspect::getInstance() && tool != LLToolDragAndDrop::getInstance() && !gSavedSettings.getBOOL("FreezeTime")) - { - LLMouseHandler *captor = gFocusMgr.getMouseCapture(); - // With the null, inspect, or drag and drop tool, don't muck - // with visibility. + updateLayout(); - if (gFloaterTools->isMinimized() || - (tool != LLToolPie::getInstance() // not default tool - && tool != LLToolCompGun::getInstance() // not coming out of mouselook - && !mSuppressToolbox // not override in third person - && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode - && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset - && (!captor || captor->isView())) // not dragging - ) - { - // Force floater tools to be visible (unless minimized) - if (!gFloaterTools->getVisible()) - { - gFloaterTools->open(); /* Flawfinder: ignore */ - } - // Update the location of the blue box tool popup - LLCoordGL select_center_screen; - gFloaterTools->updatePopup( select_center_screen, mask ); - } - else - { - gFloaterTools->setVisible(FALSE); - } - // In the future we may wish to hide the tools menu unless you - // are building. JC - //gMenuBarView->setItemVisible("Tools", gFloaterTools->getVisible()); - //gMenuBarView->arrange(); + mLastMousePoint = mCurrentMousePoint; + + // cleanup unused selections when no modal dialogs are open + if (LLModalDialog::activeCount() == 0) + { + LLViewerParcelMgr::getInstance()->deselectUnused(); + } + + if (LLModalDialog::activeCount() == 0) + { + LLSelectMgr::getInstance()->deselectUnused(); } - if (gToolBar) + + updatePicking(x, y, mask); +} + +void LLViewerWindow::updatePicking(S32 x, S32 y, MASK mask) +{ + // per frame picking - for tooltips and changing cursor over interactive objects + static S32 previous_x = -1; + static S32 previous_y = -1; + static BOOL mouse_moved_since_pick = FALSE; + + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST)) + { + gDebugRaycastFaceHit = -1; + gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, + &gDebugRaycastFaceHit, + &gDebugRaycastIntersection, + &gDebugRaycastTexCoord, + &gDebugRaycastNormal, + &gDebugRaycastBinormal); + } + + + if ((previous_x != x) || (previous_y != y)) + mouse_moved_since_pick = TRUE; + + BOOL do_pick = FALSE; + + F32 picks_moving = gSavedSettings.getF32("PicksPerSecondMouseMoving"); + if ((mouse_moved_since_pick) && (picks_moving > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_moving)) { - gToolBar->refresh(); + do_pick = TRUE; } - if (gChatBar) + F32 picks_stationary = gSavedSettings.getF32("PicksPerSecondMouseStationary"); + if ((!mouse_moved_since_pick) && (picks_stationary > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_stationary)) { - gChatBar->refresh(); + do_pick = TRUE; } - if (gOverlayBar) + if (getCursorHidden()) { - gOverlayBar->refresh(); + do_pick = FALSE; } - // Update rectangles for the various toolbars - if (gOverlayBar && gNotifyBoxView && gConsole && gToolBar) + if (do_pick) { - LLRect bar_rect(-1, STATUS_BAR_HEIGHT, getWindowWidth()+1, -1); + mouse_moved_since_pick = FALSE; + mPickTimer.reset(); + pickAsync(getCurrentMouseX(), getCurrentMouseY(), mask, hoverPickCallback, TRUE); + } - LLRect notify_box_rect = gNotifyBoxView->getRect(); - notify_box_rect.mBottom = bar_rect.mBottom; - gNotifyBoxView->reshape(notify_box_rect.getWidth(), notify_box_rect.getHeight()); - gNotifyBoxView->setRect(notify_box_rect); + previous_x = x; + previous_y = y; +} - // make sure floaters snap to visible rect by adjusting floater view rect - LLRect floater_rect = gFloaterView->getRect(); - if (floater_rect.mBottom != bar_rect.mBottom+1) - { - floater_rect.mBottom = bar_rect.mBottom+1; - // Don't bounce the floaters up and down. - gFloaterView->reshapeFloater(floater_rect.getWidth(), floater_rect.getHeight(), - TRUE, ADJUST_VERTICAL_NO); - gFloaterView->setRect(floater_rect); - } +void LLViewerWindow::updateLayout() +{ + LLTool* tool = LLToolMgr::getInstance()->getCurrentTool(); + if (gFloaterTools != NULL + && tool != NULL + && tool != gToolNull + && tool != LLToolCompInspect::getInstance() + && tool != LLToolDragAndDrop::getInstance() + && !gSavedSettings.getBOOL("FreezeTime")) + { + LLMouseHandler *captor = gFocusMgr.getMouseCapture(); + // With the null, inspect, or drag and drop tool, don't muck + // with visibility. - // snap floaters to top of chat bar/button strip - LLView* chatbar_and_buttons = gOverlayBar->getChild("chatbar_and_buttons", TRUE); - // find top of chatbar and state buttons, if either are visible - if (chatbar_and_buttons && !chatbar_and_buttons->getLocalBoundingRect().isNull()) + if (gFloaterTools->isMinimized() + || (tool != LLToolPie::getInstance() // not default tool + && tool != LLToolCompGun::getInstance() // not coming out of mouselook + && !mSuppressToolbox // not override in third person + && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode + && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset + && (!captor || captor->isView()))) // not dragging { - // convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates - S32 top, left; - chatbar_and_buttons->localPointToOtherView( - chatbar_and_buttons->getLocalBoundingRect().mLeft, - chatbar_and_buttons->getLocalBoundingRect().mTop, - &left, - &top, - gFloaterView); - gFloaterView->setSnapOffsetBottom(top); - } - else if (gToolBar->getVisible()) - { - S32 top, left; - gToolBar->localPointToOtherView( - gToolBar->getLocalBoundingRect().mLeft, - gToolBar->getLocalBoundingRect().mTop, - &left, - &top, - gFloaterView); - gFloaterView->setSnapOffsetBottom(top); + // Force floater tools to be visible (unless minimized) + if (!gFloaterTools->getVisible()) + { + gFloaterTools->openFloater(); + } + // Update the location of the blue box tool popup + LLCoordGL select_center_screen; + gFloaterTools->updatePopup( select_center_screen, gKeyboard->currentMask(TRUE) ); } else { - gFloaterView->setSnapOffsetBottom(0); + gFloaterTools->setVisible(FALSE); } + gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible()); + } +} - // Always update console - LLRect console_rect = getChatConsoleRect(); - console_rect.mBottom = gHUDView->getRect().mBottom + getChatConsoleBottomPad(); - gConsole->reshape(console_rect.getWidth(), console_rect.getHeight()); - gConsole->setRect(console_rect); +void LLViewerWindow::updateMouseDelta() +{ + S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); + S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); + + //RN: fix for asynchronous notification of mouse leaving window not working + LLCoordWindow mouse_pos; + mWindow->getCursorPosition(&mouse_pos); + if (mouse_pos.mX < 0 || + mouse_pos.mY < 0 || + mouse_pos.mX > mWindowRect.getWidth() || + mouse_pos.mY > mWindowRect.getHeight()) + { + mMouseInWindow = FALSE; + } + else + { + mMouseInWindow = TRUE; } - mLastMousePoint = mCurrentMousePoint; + LLVector2 mouse_vel; + + if (gSavedSettings.getBOOL("MouseSmooth")) + { + static F32 fdx = 0.f; + static F32 fdy = 0.f; + + F32 amount = 16.f; + fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f); + fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f); + + mCurrentMouseDelta.set(llround(fdx), llround(fdy)); + mouse_vel.setVec(fdx,fdy); + } + else + { + mCurrentMouseDelta.set(dx, dy); + mouse_vel.setVec((F32) dx, (F32) dy); + } + + mMouseVelocityStat.addValue(mouse_vel.magVec()); +} + +void LLViewerWindow::updateKeyboardFocus() +{ + // clean up current focus + LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); + if (cur_focus) + { + if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain()) + { + gFocusMgr.releaseFocusIfNeeded(cur_focus); + + LLUICtrl* parent = cur_focus->getParentUICtrl(); + const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); + while(parent) + { + if (parent->isCtrl() && + (parent->hasTabStop() || parent == focus_root) && + !parent->getIsChrome() && + parent->isInVisibleChain() && + parent->isInEnabledChain()) + { + if (!parent->focusFirstItem()) + { + parent->setFocus(TRUE); + } + break; + } + parent = parent->getParentUICtrl(); + } + } + else if (cur_focus->isFocusRoot()) + { + // focus roots keep trying to delegate focus to their first valid descendant + // this assumes that focus roots are not valid focus holders on their own + cur_focus->focusFirstItem(); + } + } // last ditch force of edit menu to selection manager if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) @@ -2832,6 +2878,10 @@ BOOL LLViewerWindow::handlePerFrameHover() gFloaterView->syncFloaterTabOrder(); } + if(LLSideTray::instanceCreated())//just getInstance will create sidetray. we don't want this + LLSideTray::getInstance()->highlightFocused(); + + if (gSavedSettings.getBOOL("ChatBarStealsFocus") && gChatBar && gFocusMgr.getKeyboardFocus() == NULL @@ -2840,70 +2890,28 @@ BOOL LLViewerWindow::handlePerFrameHover() gChatBar->startChat(NULL); } - // cleanup unused selections when no modal dialogs are open - if (LLModalDialog::activeCount() == 0) - { - LLViewerParcelMgr::getInstance()->deselectUnused(); - } - if (LLModalDialog::activeCount() == 0) - { - LLSelectMgr::getInstance()->deselectUnused(); - } - - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST)) - { - gDebugRaycastFaceHit = -1; - gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, - &gDebugRaycastFaceHit, - &gDebugRaycastIntersection, - &gDebugRaycastTexCoord, - &gDebugRaycastNormal, - &gDebugRaycastBinormal); - } - - - // per frame picking - for tooltips and changing cursor over interactive objects - static S32 previous_x = -1; - static S32 previous_y = -1; - static BOOL mouse_moved_since_pick = FALSE; - - if ((previous_x != x) || (previous_y != y)) - mouse_moved_since_pick = TRUE; - - BOOL do_pick = FALSE; +} - F32 picks_moving = gSavedSettings.getF32("PicksPerSecondMouseMoving"); - if ((mouse_moved_since_pick) && (picks_moving > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_moving)) - { - do_pick = TRUE; - } +void LLViewerWindow::updateWorldViewRect() +{ + if (!LLSideTray::instanceCreated()) return; - F32 picks_stationary = gSavedSettings.getF32("PicksPerSecondMouseStationary"); - if ((!mouse_moved_since_pick) && (picks_stationary > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_stationary)) + LLRect new_world_rect = mWindowRect; + LLSideTray* sidetray = LLSideTray::getInstance(); + if (sidetray->getVisible()) { - do_pick = TRUE; + new_world_rect.mRight -= llround((F32)sidetray->getTrayWidth() * mDisplayScale.mV[VX]); } - - if (getCursorHidden()) + if (mWorldViewRect != new_world_rect) { - do_pick = FALSE; - } - - if (do_pick) - { - mouse_moved_since_pick = FALSE; - mPickTimer.reset(); - pickAsync(getCurrentMouseX(), getCurrentMouseY(), mask, hoverPickCallback, TRUE); + mWorldViewRect = new_world_rect; + gResizeScreenTexture = TRUE; + LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() ); + LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); } - - previous_x = x; - previous_y = y; - - return handled; } - /* static */ void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info) { @@ -3164,7 +3172,7 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback } // push back pick info object - BOOL in_build_mode = gFloaterTools && gFloaterTools->getVisible(); + BOOL in_build_mode = LLFloaterReg::instanceVisible("build"); if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha) { // build mode allows interaction with all transparent objects @@ -3179,10 +3187,10 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback { mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER); - if (mPickScreenRegion.mLeft < 0) mPickScreenRegion.translate(-mPickScreenRegion.mLeft, 0); - if (mPickScreenRegion.mBottom < 0) mPickScreenRegion.translate(0, -mPickScreenRegion.mBottom); - if (mPickScreenRegion.mRight > mWindowRect.getWidth() ) mPickScreenRegion.translate(mWindowRect.getWidth() - mPickScreenRegion.mRight, 0); - if (mPickScreenRegion.mTop > mWindowRect.getHeight() ) mPickScreenRegion.translate(0, mWindowRect.getHeight() - mPickScreenRegion.mTop); + if (mPickScreenRegion.mLeft < mWorldViewRect.mLeft) mPickScreenRegion.translate(mWorldViewRect.mLeft - mPickScreenRegion.mLeft, 0); + if (mPickScreenRegion.mBottom < mWorldViewRect.mBottom) mPickScreenRegion.translate(0, mWorldViewRect.mBottom - mPickScreenRegion.mBottom); + if (mPickScreenRegion.mRight > mWorldViewRect.mRight ) mPickScreenRegion.translate(mWorldViewRect.mRight - mPickScreenRegion.mRight, 0); + if (mPickScreenRegion.mTop > mWorldViewRect.mTop ) mPickScreenRegion.translate(0, mWorldViewRect.mTop - mPickScreenRegion.mTop); } // set frame buffer region for picking results @@ -3210,77 +3218,6 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info) llassert_always(pick_info.mScreenRegion.notNull()); mPicks.push_back(pick_info); - /*S32 scaled_x = llround((F32)pick_info.mMousePt.mX * mDisplayScale.mV[VX]); - S32 scaled_y = llround((F32)pick_info.mMousePt.mY * mDisplayScale.mV[VY]); - - // Default to not hitting anything - LLCamera pick_camera; - pick_camera.setOrigin(LLViewerCamera::getInstance()->getOrigin()); - pick_camera.setOriginAndLookAt(LLViewerCamera::getInstance()->getOrigin(), - LLViewerCamera::getInstance()->getUpAxis(), - LLViewerCamera::getInstance()->getOrigin() + mouseDirectionGlobal(pick_info.mMousePt.mX, pick_info.mMousePt.mY)); - pick_camera.setView(0.5f*DEG_TO_RAD); - pick_camera.setNear(LLViewerCamera::getInstance()->getNear()); - pick_camera.setFar(LLViewerCamera::getInstance()->getFar()); - pick_camera.setAspect(1.f); - - // save our drawing state - // *TODO: should we be saving using the new method here using - // glh_get_current_projection/glh_set_current_projection? -brad - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - - // clear work area - { - LLGLState scissor_state(GL_SCISSOR_TEST); - scissor_state.enable(); - glScissor(pick_info.mScreenRegion.mLeft, pick_info.mScreenRegion.mBottom, pick_info.mScreenRegion.getWidth(), pick_info.mScreenRegion.getHeight()); - glClearColor(0.f, 0.f, 0.f, 0.f); - glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - //glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - } - - // build perspective transform and picking viewport - // Perform pick on a PICK_DIAMETER x PICK_DIAMETER pixel region around cursor point. - // Don't limit the select distance for this pick. - LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, scaled_x - PICK_HALF_WIDTH, scaled_y - PICK_HALF_WIDTH, PICK_DIAMETER, PICK_DIAMETER, FALSE); - - // render for object picking - - // make viewport big enough to handle antialiased frame buffers - gGLViewport[0] = pick_info.mScreenRegion.mLeft; - gGLViewport[1] = pick_info.mScreenRegion.mBottom; - gGLViewport[2] = pick_info.mScreenRegion.getWidth(); - gGLViewport[3] = pick_info.mScreenRegion.getHeight(); - - glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); - LLViewerCamera::updateFrustumPlanes(pick_camera); - stop_glerror(); - - // Draw the objects so the user can select them. - // The starting ID is 1, since land is zero. - LLRect pick_region; - pick_region.setOriginAndSize(pick_info.mMousePt.mX - PICK_HALF_WIDTH, - pick_info.mMousePt.mY - PICK_HALF_WIDTH, PICK_DIAMETER, PICK_DIAMETER); - gObjectList.renderObjectsForSelect(pick_camera, pick_region, FALSE, pick_info.mPickTransparent); - - stop_glerror(); - - // restore drawing state - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - - setup3DRender(); - setup2DRender(); - setupViewport();*/ - // delay further event processing until we receive results of pick mWindow->delayInputProcessing(); } @@ -3449,16 +3386,16 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const // find vertical field of view F32 fov = LLViewerCamera::getInstance()->getView(); - // find screen resolution - S32 height = getWindowHeight(); - S32 width = getWindowWidth(); + // find world view center + F32 center_x = (F32)getWorldViewRect().getCenterX(); + F32 center_y = (F32)getWorldViewRect().getCenterY(); // calculate pixel distance to screen - F32 distance = (height / 2.f) / (tan(fov / 2.f)); + F32 distance = (getWorldViewHeight() / 2.f) / (tan(fov / 2.f)); // calculate click point relative to middle of screen - F32 click_x = x - width / 2.f; - F32 click_y = y - height / 2.f; + F32 click_x = x - center_x; + F32 click_y = y - center_y; // compute mouse vector LLVector3 mouse_vector = distance * LLViewerCamera::getInstance()->getAtAxis() @@ -3473,12 +3410,15 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const { // find screen resolution - S32 height = getWindowHeight(); - S32 width = getWindowWidth(); + S32 height = getWorldViewHeight(); + + // find world view center + F32 center_x = (F32)getWorldViewRect().getCenterX(); + F32 center_y = (F32)getWorldViewRect().getCenterY(); // remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5 - F32 hud_x = -((F32)x - (F32)width/2.f) / height; - F32 hud_y = ((F32)y - (F32)height/2.f) / height; + F32 hud_x = -((F32)x - center_x) / height; + F32 hud_y = ((F32)y - center_y) / height; return LLVector3(0.f, hud_x/gAgent.mHUDCurZoom, hud_y/gAgent.mHUDCurZoom); } @@ -3492,12 +3432,16 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect(); // find screen resolution - S32 height = getWindowHeight(); - S32 width = getWindowWidth(); + S32 height = getWorldViewHeight(); + S32 width = getWorldViewWidth(); + + // find world view center + F32 center_x = (F32)getWorldViewRect().getCenterX(); + F32 center_y = (F32)getWorldViewRect().getCenterY(); // calculate click point relative to middle of screen - F32 click_x = (((F32)x / (F32)width) - 0.5f) * fov_width * -1.f; - F32 click_y = (((F32)y / (F32)height) - 0.5f) * fov_height; + F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f; + F32 click_y = (((F32)y - center_y) / (F32)height) * fov_height; // compute mouse vector LLVector3 mouse_vector = LLVector3(0.f, 0.f, -1.f); @@ -3841,7 +3785,6 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p glClearColor(0.f, 0.f, 0.f, 0.f); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); setup3DRender(); - setupViewport(); LLFontGL::setFontDisplay(FALSE) ; LLHUDText::setDisplayText(FALSE) ; @@ -3902,7 +3845,6 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p mDisplayScale.setVec(display_scale) ; mWindowRect = window_rect; setup3DRender(); - setupViewport(); gDisplaySwapBuffers = FALSE; gDepthDirty = TRUE; @@ -4070,7 +4012,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei LLViewerCamera::getInstance()->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor))); setup3DRender(); - setupViewport(); gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE); } else @@ -4215,14 +4156,14 @@ void LLViewerWindow::destroyWindow() void LLViewerWindow::drawMouselookInstructions() { // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.) - const std::string instructions = "Press ESC to leave Mouselook."; - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const std::string instructions = LLTrans::getString("LeaveMouselook"); + const LLFontGL* font = LLFontGL::getFontSansSerif(); const S32 INSTRUCTIONS_PAD = 5; LLRect instructions_rect; instructions_rect.setLeftTopAndSize( - INSTRUCTIONS_PAD, - getWindowHeight() - INSTRUCTIONS_PAD, + mWorldViewRect.mLeft + INSTRUCTIONS_PAD, + mWorldViewRect.mTop - INSTRUCTIONS_PAD, font->getWidth( instructions ) + 2 * INSTRUCTIONS_PAD, llround(font->getLineHeight() + 2 * INSTRUCTIONS_PAD)); @@ -4251,6 +4192,46 @@ S32 LLViewerWindow::getWindowWidth() const return mVirtualWindowRect.getWidth(); } +void* LLViewerWindow::getPlatformWindow() const +{ + return mWindow->getPlatformWindow(); +} + +void* LLViewerWindow::getMediaWindow() const +{ + return mWindow->getMediaWindow(); +} + +void LLViewerWindow::focusClient() const +{ + return mWindow->focusClient(); +} + +LLRootView* LLViewerWindow::getRootView() const +{ + return mRootView; +} + +LLRect LLViewerWindow::getVirtualWorldViewRect() const +{ + LLRect world_view_rect = mWorldViewRect; + world_view_rect.mLeft = llround((F32)world_view_rect.mLeft / mDisplayScale.mV[VX]); + world_view_rect.mRight = llround((F32)world_view_rect.mRight / mDisplayScale.mV[VX]); + world_view_rect.mBottom = llround((F32)world_view_rect.mBottom / mDisplayScale.mV[VY]); + world_view_rect.mTop = llround((F32)world_view_rect.mTop / mDisplayScale.mV[VY]); + return world_view_rect; +} + +S32 LLViewerWindow::getWorldViewHeight() const +{ + return mWorldViewRect.getHeight(); +} + +S32 LLViewerWindow::getWorldViewWidth() const +{ + return mWorldViewRect.getWidth(); +} + S32 LLViewerWindow::getWindowDisplayHeight() const { return mWindowRect.getHeight(); @@ -4261,27 +4242,48 @@ S32 LLViewerWindow::getWindowDisplayWidth() const return mWindowRect.getWidth(); } -void LLViewerWindow::setupViewport(S32 x_offset, S32 y_offset) +void LLViewerWindow::setup2DRender() +{ + // setup ortho camera + gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight()); + setup2DViewport(); +} + +void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset) { - gGLViewport[0] = x_offset; - gGLViewport[1] = y_offset; + gGLViewport[0] = mWindowRect.mLeft + x_offset; + gGLViewport[1] = mWindowRect.mBottom + y_offset; gGLViewport[2] = mWindowRect.getWidth(); gGLViewport[3] = mWindowRect.getHeight(); glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); } + void LLViewerWindow::setup3DRender() { - LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, 0, 0, mWindowRect.getWidth(), mWindowRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); + // setup perspective camera + LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRect.mLeft, mWorldViewRect.mBottom, mWorldViewRect.getWidth(), mWorldViewRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f); + setup3DViewport(); } -void LLViewerWindow::setup2DRender() +void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset) { - gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight()); + if (LLRenderTarget::getCurrentBoundTarget() != NULL) + { + // don't use translation component of mWorldViewRect, as we are already in a properly sized render target + gGLViewport[0] = x_offset; + gGLViewport[1] = y_offset; + } + else + { + gGLViewport[0] = mWorldViewRect.mLeft + x_offset; + gGLViewport[1] = mWorldViewRect.mBottom + y_offset; + } + gGLViewport[2] = mWorldViewRect.getWidth(); + gGLViewport[3] = mWorldViewRect.getHeight(); + glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); } - - void LLViewerWindow::setShowProgress(const BOOL show) { if (mProgressView) @@ -4295,6 +4297,10 @@ BOOL LLViewerWindow::getShowProgress() const return (mProgressView && mProgressView->getVisible()); } +void LLViewerWindow::handleLoginComplete() +{ + LLNavigationBar::getInstance()->handleLoginComplete(); +} void LLViewerWindow::moveProgressViewToFront() { @@ -4405,7 +4411,7 @@ void LLViewerWindow::stopGL(BOOL save_state) gGLManager.mIsDisabled = TRUE; stop_glerror(); - llinfos << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemory << " bytes" << llendl; + llinfos << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemoryInBytes << " bytes" << llendl; } } @@ -4463,12 +4469,16 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) void LLViewerWindow::initFonts(F32 zoom_factor) { LLFontGL::destroyAllGL(); - LLFontGL::initDefaultFonts( gSavedSettings.getF32("FontScreenDPI"), + // Initialize with possibly different zoom factor + LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), mDisplayScale.mV[VX] * zoom_factor, mDisplayScale.mV[VY] * zoom_factor, gDirUtilp->getAppRODataDir(), - LLUICtrlFactory::getXUIPaths()); + LLUI::getXUIPaths()); + // Force font reloads, which can be very slow + LLFontGL::loadDefaultFonts(); } + void LLViewerWindow::toggleFullscreen(BOOL show_progress) { if (mWindow) @@ -4501,6 +4511,11 @@ void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height) } } +void LLViewerWindow::requestResolutionUpdate() +{ + mResDirty = true; +} + void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked) { mResDirty = true; @@ -4534,7 +4549,7 @@ BOOL LLViewerWindow::checkSettings() // force aspect ratio if (mIsFullscreenChecked) { - LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() ); + LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); } mResDirty = false; @@ -4605,9 +4620,9 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized"); mWantFullscreen = fullscreen; mShowFullscreenProgress = show_progress_bar; - gSavedSettings.setBOOL("FullScreen", mWantFullscreen); + gSavedSettings.setBOOL("NotFullScreen", !mWantFullscreen); - gResizeScreenTexture = TRUE; + //gResizeScreenTexture = TRUE; BOOL old_fullscreen = mWindow->getFullscreen(); if (!old_fullscreen && fullscreen && !LLStartUp::canGoFullscreen()) @@ -4635,7 +4650,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, } // Close floaters that don't handle settings change - LLFloaterSnapshot::hide(0); + LLFloaterReg::hideInstance("snapshot"); BOOL result_first_try = FALSE; BOOL result_second_try = FALSE; @@ -4753,6 +4768,21 @@ F32 LLViewerWindow::getDisplayAspectRatio() const } +F32 LLViewerWindow::getWorldViewAspectRatio() const +{ + F32 world_aspect = (F32)mWorldViewRect.getWidth() / (F32)mWorldViewRect.getHeight(); + //F32 window_aspect = (F32)mWindowRect.getWidth() / (F32)mWindowRect.getHeight(); + if (mWindow->getFullscreen()) + { + return world_aspect * mWindow->getPixelAspectRatio(); + } + else + { + llinfos << "World aspect ratio: " << world_aspect << llendl; + return world_aspect; + } +} + void LLViewerWindow::drawPickBuffer() const { mHoverPick.drawPickBuffer(); @@ -4795,6 +4825,8 @@ void LLViewerWindow::calcDisplayScale() } } +S32 TOOL_BAR_HEIGHT = 20; // *TODO:Skinning Fix + S32 LLViewerWindow::getChatConsoleBottomPad() { S32 offset = 0; @@ -4857,63 +4889,6 @@ bool LLViewerWindow::onAlert(const LLSD& notify) } //////////////////////////////////////////////////////////////////////////// - -LLBottomPanel::LLBottomPanel(const LLRect &rect) : - LLPanel(LLStringUtil::null, rect, FALSE), - mIndicator(NULL) -{ - // bottom panel is focus root, so Tab moves through the toolbar and button bar, and overlay - setFocusRoot(TRUE); - // flag this panel as chrome so buttons don't grab keyboard focus - setIsChrome(TRUE); - - mFactoryMap["toolbar"] = LLCallbackMap(createToolBar, NULL); - mFactoryMap["overlay"] = LLCallbackMap(createOverlayBar, NULL); - mFactoryMap["hud"] = LLCallbackMap(createHUD, NULL); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_bars.xml", &getFactoryMap()); - - setOrigin(rect.mLeft, rect.mBottom); - reshape(rect.getWidth(), rect.getHeight()); -} - -void LLBottomPanel::setFocusIndicator(LLView * indicator) -{ - mIndicator = indicator; -} - -void LLBottomPanel::draw() -{ - if(mIndicator) - { - BOOL hasFocus = gFocusMgr.childHasKeyboardFocus(this); - mIndicator->setVisible(hasFocus); - mIndicator->setEnabled(hasFocus); - } - LLPanel::draw(); -} - -void* LLBottomPanel::createHUD(void* data) -{ - delete gHUDView; - gHUDView = new LLHUDView(); - return gHUDView; -} - - -void* LLBottomPanel::createOverlayBar(void* data) -{ - delete gOverlayBar; - gOverlayBar = new LLOverlayBar(); - return gOverlayBar; -} - -void* LLBottomPanel::createToolBar(void* data) -{ - delete gToolBar; - gToolBar = new LLToolBar(); - return gToolBar; -} - // // LLPickInfo // @@ -4985,8 +4960,8 @@ void LLPickInfo::fetchResults() // find pick region that is fully onscreen LLCoordGL scaled_pick_point;; - scaled_pick_point.mX = llclamp(llround((F32)mMousePt.mX * gViewerWindow->getDisplayScale().mV[VX]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayWidth() - PICK_HALF_WIDTH); - scaled_pick_point.mY = llclamp(llround((F32)mMousePt.mY * gViewerWindow->getDisplayScale().mV[VY]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayHeight() - PICK_HALF_WIDTH); + scaled_pick_point.mX = llclamp(llround((F32)mMousePt.mX * gViewerWindow->getDisplayScale().mV[VX]), PICK_HALF_WIDTH, gViewerWindow->getWorldViewWidth() - PICK_HALF_WIDTH); + scaled_pick_point.mY = llclamp(llround((F32)mMousePt.mY * gViewerWindow->getDisplayScale().mV[VY]), PICK_HALF_WIDTH, gViewerWindow->getWorldViewHeight() - PICK_HALF_WIDTH); //S32 pixel_index = PICK_HALF_WIDTH * PICK_DIAMETER + PICK_HALF_WIDTH; //S32 pick_id = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2]; //F32 depth = mPickDepthBuffer[pixel_index]; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 509a7c4884..eae1bf0343 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -44,12 +44,12 @@ #include "v3dmath.h" #include "v2math.h" -#include "llwindow.h" +#include "llwindowcallbacks.h" #include "lltimer.h" #include "llstat.h" -#include "llalertdialog.h" #include "llnotifications.h" #include "llmousehandler.h" +#include "llcursortypes.h" class LLView; class LLViewerObject; @@ -60,6 +60,8 @@ class LLVelocityBar; class LLTextBox; class LLImageRaw; class LLHUDIcon; +class LLWindow; +class LLRootView; #define PICK_HALF_WIDTH 5 #define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1) @@ -181,15 +183,22 @@ public: /*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg); /*virtual*/ void handlePauseWatchdog(LLWindow *window); /*virtual*/ void handleResumeWatchdog(LLWindow *window); - + /*virtual*/ std::string translateString(const char* tag); + /*virtual*/ std::string translateString(const char* tag, + const std::map& args); // // ACCESSORS // - LLView* getRootView() const { return mRootView; } + LLRootView* getRootView() const; // Window in raw pixels as seen on screen. const LLRect& getWindowRect() const { return mWindowRect; }; + // portion of window that shows 3d world + const LLRect& getWorldViewRect() const { return mWorldViewRect; }; + LLRect getVirtualWorldViewRect() const; + S32 getWorldViewHeight() const; + S32 getWorldViewWidth() const; S32 getWindowDisplayHeight() const; S32 getWindowDisplayWidth() const; @@ -200,9 +209,9 @@ public: S32 getWindowWidth() const; LLWindow* getWindow() const { return mWindow; } - void* getPlatformWindow() const { return mWindow->getPlatformWindow(); } - void* getMediaWindow() const { return mWindow->getMediaWindow(); } - void focusClient() const { return mWindow->focusClient(); }; + void* getPlatformWindow() const; + void* getMediaWindow() const; + void focusClient() const; LLCoordGL getLastMouse() const { return mLastMousePoint; } S32 getLastMouseX() const { return mLastMousePoint.mX; } @@ -221,7 +230,8 @@ public: const LLPickInfo& getLastPick() const { return mLastPick; } const LLPickInfo& getHoverPick() const { return mHoverPick; } - void setupViewport(S32 x_offset = 0, S32 y_offset = 0); + void setup2DViewport(S32 x_offset = 0, S32 y_offset = 0); + void setup3DViewport(S32 x_offset = 0, S32 y_offset = 0); void setup3DRender(); void setup2DRender(); @@ -258,10 +268,17 @@ public: void setProgressMessage(const std::string& msg); void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null ); LLProgressView *getProgressView() const; + void handleLoginComplete(); void updateObjectUnderCursor(); - BOOL handlePerFrameHover(); // Once per frame, update UI based on mouse position + void updateUI(); // Once per frame, update UI based on mouse position, calls following update* functions + void updateLayout(); + void updateMouseDelta(); + void updateKeyboardFocus(); + void updatePicking(S32 x, S32 y, MASK mask); + + void updateWorldViewRect(); BOOL handleKey(KEY key, MASK mask); void handleScrollWheel (S32 clicks); @@ -349,11 +366,13 @@ public: // handle shutting down GL and bringing it back up void requestResolutionUpdate(bool fullscreen_checked); + void requestResolutionUpdate(); // doesn't affect fullscreen BOOL checkSettings(); void restartDisplay(BOOL show_progress_bar); BOOL changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar); BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; } F32 getDisplayAspectRatio() const; + F32 getWorldViewAspectRatio() const; const LLVector2& getDisplayScale() const { return mDisplayScale; } void calcDisplayScale(); @@ -382,7 +401,8 @@ protected: BOOL mShowFullscreenProgress; LLRect mWindowRect; LLRect mVirtualWindowRect; - LLView* mRootView; // a view of size mWindowRect, containing all child views + LLRect mWorldViewRect; // specifies area of screen where we render the 3D world + LLRootView* mRootView; // a view of size mWindowRect, containing all child views LLVector2 mDisplayScale; LLCoordGL mCurrentMousePoint; // last mouse position in GL coords @@ -401,6 +421,8 @@ protected: BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse. BOOL mFocusCycleMode; + typedef std::set > view_handle_set_t; + view_handle_set_t mMouseHoverViews; // Variables used for tool override switching based on modifier keys. JC MASK mLastMask; // used to detect changes in modifier mask @@ -435,36 +457,16 @@ protected: static std::string sMovieBaseName; }; -class LLBottomPanel : public LLPanel -{ -public: - LLBottomPanel(const LLRect& rect); - void setFocusIndicator(LLView * indicator); - LLView * getFocusIndicator() { return mIndicator; } - /*virtual*/ void draw(); - - static void* createHUD(void* data); - static void* createOverlayBar(void* data); - static void* createToolBar(void* data); - -protected: - LLView * mIndicator; -}; -extern LLBottomPanel * gBottomPanel; - void toggle_flying(void*); void toggle_first_person(); void toggle_build(void*); void reset_viewer_state_on_sim(void); void update_saved_window_size(const std::string& control,S32 delta_width, S32 delta_height); - - // // Globals // -extern LLVelocityBar* gVelocityBar; extern LLViewerWindow* gViewerWindow; extern LLFrameTimer gMouseIdleTimer; // how long has it been since the mouse last moved? diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 168b0056e5..176f8fb37b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1,5 +1,5 @@ /** - * @file llvoavatar.cpp + * @File llvoavatar.cpp * @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject * * $LicenseInfo:firstyear=2001&license=viewergpl$ @@ -41,6 +41,8 @@ #include "noise.h" #include "llagent.h" // Get state values from here +#include "llagentwearables.h" +#include "llanimationstates.h" #include "llviewercontrol.h" #include "lldrawpoolavatar.h" #include "lldriverparam.h" @@ -63,8 +65,6 @@ #include "llsprite.h" #include "lltargetingmotion.h" #include "lltexlayer.h" -#include "lltoolgrab.h" // for needsRenderBeam -#include "lltoolmgr.h" // for needsRenderBeam #include "lltoolmorph.h" #include "llviewercamera.h" #include "llviewerimagelist.h" @@ -72,12 +72,15 @@ #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewerstats.h" +#include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" #include "pipeline.h" #include "llviewershadermgr.h" #include "llsky.h" #include "llanimstatelabels.h" +#include "lltrans.h" + #include "llgesturemgr.h" //needed to trigger the voice gesticulations #include "llvoiceclient.h" #include "llvoicevisualizer.h" // Ventrella @@ -136,8 +139,7 @@ const S32 MIN_REQUIRED_PIXEL_AREA_PELVIS_FIX = 40; const S32 TEX_IMAGE_SIZE_SELF = 512; const S32 TEX_IMAGE_AREA_SELF = TEX_IMAGE_SIZE_SELF * TEX_IMAGE_SIZE_SELF; -const S32 TEX_IMAGE_SIZE_OTHER = TEX_IMAGE_SIZE_SELF / 4; // The size of local textures for other (!mIsSelf) avatars -const S32 TEX_IMAGE_AREA_OTHER = TEX_IMAGE_SIZE_OTHER * TEX_IMAGE_SIZE_OTHER; +const S32 TEX_IMAGE_SIZE_OTHER = 512 / 4; // The size of local textures for other (!isSelf()) avatars const F32 HEAD_MOVEMENT_AVG_TIME = 0.9f; @@ -175,25 +177,20 @@ enum ERenderName //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- -struct LLAvatarTexData -{ - LLAvatarTexData( const LLUUID& id, ETextureIndex index ) - : mAvatarID(id), mIndex(index) {} - LLUUID mAvatarID; - ETextureIndex mIndex; -}; struct LLTextureMaskData { - LLTextureMaskData( const LLUUID& id ) - : mAvatarID(id), mLastDiscardLevel(S32_MAX) {} + LLTextureMaskData( const LLUUID& id ) : + mAvatarID(id), + mLastDiscardLevel(S32_MAX) + {} LLUUID mAvatarID; S32 mLastDiscardLevel; }; /********************************************************************************* ** ** - ** Begin LLVOAvatar Support classes + ** Begin private LLVOAvatar Support classes ** **/ @@ -249,85 +246,6 @@ private: bone_info_list_t mBoneInfoList; }; - -//------------------------------------------------------------------------ -// LLVOAvatarXmlInfo -// One instance (in LLVOAvatar) with common data parsed from the XML files -//------------------------------------------------------------------------ -class LLVOAvatarXmlInfo -{ - friend class LLVOAvatar; -public: - LLVOAvatarXmlInfo(); - ~LLVOAvatarXmlInfo(); - -private: - BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); - BOOL parseXmlMeshNodes(LLXmlTreeNode* root); - BOOL parseXmlColorNodes(LLXmlTreeNode* root); - BOOL parseXmlLayerNodes(LLXmlTreeNode* root); - BOOL parseXmlDriverNodes(LLXmlTreeNode* root); - - struct LLVOAvatarMeshInfo - { - typedef std::pair morph_info_pair_t; - typedef std::vector morph_info_list_t; - - LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} - ~LLVOAvatarMeshInfo() - { - morph_info_list_t::iterator iter; - for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) - { - delete iter->first; - } - mPolyMorphTargetInfoList.clear(); - } - - std::string mType; - S32 mLOD; - std::string mMeshFileName; - std::string mReferenceMeshName; - F32 mMinPixelArea; - morph_info_list_t mPolyMorphTargetInfoList; - }; - typedef std::vector mesh_info_list_t; - mesh_info_list_t mMeshInfoList; - - typedef std::vector skeletal_distortion_info_list_t; - skeletal_distortion_info_list_t mSkeletalDistortionInfoList; - - struct LLVOAvatarAttachmentInfo - { - LLVOAvatarAttachmentInfo() - : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), - mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} - std::string mName; - std::string mJointName; - LLVector3 mPosition; - LLVector3 mRotationEuler; - S32 mGroup; - S32 mAttachmentID; - S32 mPieMenuSlice; - BOOL mVisibleFirstPerson; - BOOL mIsHUDAttachment; - BOOL mHasPosition; - BOOL mHasRotation; - }; - typedef std::vector attachment_info_list_t; - attachment_info_list_t mAttachmentInfoList; - - LLTexGlobalColorInfo *mTexSkinColorInfo; - LLTexGlobalColorInfo *mTexHairColorInfo; - LLTexGlobalColorInfo *mTexEyeColorInfo; - - typedef std::vector layer_info_list_t; - layer_info_list_t mLayerInfoList; - - typedef std::vector driver_info_list_t; - driver_info_list_t mDriverInfoList; -}; - //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -492,7 +410,7 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character) { mCharacter = character; - bool success = true; + BOOL success = true; if ( !mChestState->setJoint( character->getJoint( "mChest" ) ) ) { success = false; } @@ -651,15 +569,11 @@ private: //----------------------------------------------------------------------------- LLXmlTree LLVOAvatar::sXMLTree; LLXmlTree LLVOAvatar::sSkeletonXMLTree; -BOOL LLVOAvatar::sDebugAvatarRotation = FALSE; LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; -LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; +LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; S32 LLVOAvatar::sMaxVisible = 50; -LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames; -LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime; -S32 LLVOAvatar::sScratchTexBytes = 0; F32 LLVOAvatar::sRenderDistance = 256.f; S32 LLVOAvatar::sNumVisibleAvatars = 0; S32 LLVOAvatar::sNumLODChangesThisFrame = 0; @@ -730,8 +644,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNameMute(FALSE), mRenderGroupTitles(sRenderGroupTitles), mNameAppearance(FALSE), - mLastRegionHandle(0), - mRegionCrossingCount(0), mFirstTEMessageReceived( FALSE ), mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), @@ -742,36 +654,29 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNeedsSkin(FALSE), mUpdatePeriod(1), mFullyLoadedInitialized(FALSE), - mHasBakedHair( FALSE ) + mSupportsAlphaLayers(FALSE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline - const bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job + const BOOL needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; mPelvisp = NULL; - for( S32 i=0; igetMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - iter++) - { - const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second; - - LLViewerJoint* joint = new LLViewerJoint(); - joint->setName(mesh_dict->mName); - joint->setMeshID(mesh_index); - mMeshLOD.push_back(joint); - - /* mHairLOD.setName("mHairLOD"); - mHairMesh0.setName("mHairMesh0"); - mHairMesh0.setMeshID(MESH_ID_HAIR); - mHairMesh1.setName("mHairMesh1"); */ - for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) - { - LLViewerJointMesh* mesh = new LLViewerJointMesh(); - std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); - // We pre-pended an m - need to capitalize first character for camelCase - mesh_name[1] = toupper(mesh_name[1]); - mesh->setName(mesh_name); - mesh->setMeshID(mesh_index); - mesh->setPickName(mesh_dict->mPickName); - switch((int)mesh_index) - { - case MESH_ID_HAIR: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_SKIRT: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_EYEBALL_LEFT: - case MESH_ID_EYEBALL_RIGHT: - mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); - break; - } - - joint->mMeshParts.push_back(mesh); - } - } - - //------------------------------------------------------------------------- - // associate baked textures with meshes - //------------------------------------------------------------------------- - for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - iter++) - { - const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second; - const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; - - // Skip it if there's no associated baked texture. - if (baked_texture_index == BAKED_NUM_INDICES) continue; - - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); - iter != mMeshLOD[mesh_index]->mMeshParts.end(); iter++) - { - LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; - mBakedTextureData[(int)baked_texture_index].mMeshes.push_back(mesh); - } - } - - - //------------------------------------------------------------------------- - // register motions - //------------------------------------------------------------------------- - if (LLCharacter::sInstances.size() == 1) - { - LLKeyframeMotion::setVFS(gStaticVFS); - registerMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); - registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); - registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); - registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create ); - registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create ); - registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); - - // motions without a start/stop bit - registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); - registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); - registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); - registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); - registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create ); - registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); - registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); - registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); - registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create ); - registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); - registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); - registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); - - } - - if (gNoRender) - { - return; - } - buildCharacter(); - - // preload specific motions here - createMotion( ANIM_AGENT_CUSTOMIZE); - createMotion( ANIM_AGENT_CUSTOMIZE_DONE); - - //VTPause(); // VTune - - mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) ); mCurrentGesticulationLevel = 0; + } //------------------------------------------------------------------------ @@ -986,46 +741,43 @@ LLVOAvatar::~LLVOAvatar() { lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - if (mIsSelf) + if (isSelf()) { gAgent.setAvatarObject(NULL); } mRoot.removeAllChildren(); - delete [] mSkeleton; - mSkeleton = NULL; - - delete mScreenp; - mScreenp = NULL; - - delete [] mCollisionVolumes; - mCollisionVolumes = NULL; - + deleteAndClearArray(mSkeleton); + deleteAndClearArray(mCollisionVolumes); mNumJoints = 0; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - delete mBakedTextureData[i].mTexLayerSet; - mBakedTextureData[i].mTexLayerSet = NULL; + deleteAndClear(mBakedTextureDatas[i].mTexLayerSet); + mBakedTextureDatas[i].mMeshes.clear(); + + for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin(); + iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++) + { + LLMaskedMorph* masked_morph = (*iter2); + delete masked_morph; + } } std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); - delete mTexSkinColor; - mTexSkinColor = NULL; - delete mTexHairColor; - mTexHairColor = NULL; - delete mTexEyeColor; - mTexEyeColor = NULL; + deleteAndClear(mTexSkinColor); + deleteAndClear(mTexHairColor); + deleteAndClear(mTexEyeColor); std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); mMeshes.clear(); for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); jointIter++) + jointIter != mMeshLOD.end(); jointIter++) { LLViewerJoint* joint = (LLViewerJoint *) *jointIter; std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); @@ -1036,9 +788,6 @@ LLVOAvatar::~LLVOAvatar() mDead = TRUE; - // Clean up class data - LLVOAvatar::cullAvatarsByPixelArea(); - mAnimationSources.clear(); lldebugs << "LLVOAvatar Destructor end" << llendl; @@ -1052,10 +801,7 @@ void LLVOAvatar::markDead() mNameText = NULL; sNumVisibleChatBubbles--; } - mVoiceVisualizer->markDead(); - - mBeam = NULL; LLViewerObject::markDead(); } @@ -1065,9 +811,9 @@ BOOL LLVOAvatar::isFullyBaked() if (mIsDummy) return TRUE; if (getNumTEs() == 0) return FALSE; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (!isTextureDefined(mBakedTextureData[i].mTextureIndex) + if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex) && ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) ) { return FALSE; @@ -1078,19 +824,21 @@ BOOL LLVOAvatar::isFullyBaked() void LLVOAvatar::deleteLayerSetCaches(bool clearAll) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (mBakedTextureData[i].mTexLayerSet) + if (mBakedTextureDatas[i].mTexLayerSet) { - if ((i != BAKED_HAIR || mIsSelf) && !clearAll) // Backwards compatibility - can be removed after hair baking is mandatory on the grid + // ! BACKWARDS COMPATIBILITY ! + // Can be removed after hair baking is mandatory on the grid + if ((i != BAKED_HAIR || isSelf()) && !clearAll) { - mBakedTextureData[i].mTexLayerSet->deleteCaches(); + mBakedTextureDatas[i].mTexLayerSet->deleteCaches(); } } - if (mBakedTextureData[i].mMaskTexName) + if (mBakedTextureDatas[i].mMaskTexName) { - glDeleteTextures(1, (GLuint*)&(mBakedTextureData[i].mMaskTexName)); - mBakedTextureData[i].mMaskTexName = 0 ; + glDeleteTextures(1, (GLuint*)&(mBakedTextureDatas[i].mMaskTexName)); + mBakedTextureDatas[i].mMaskTexName = 0 ; } } } @@ -1101,20 +849,14 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) BOOL res = TRUE; grey_avatars = 0; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; if( inst->isDead() ) { continue; } -// else -// if( inst->getPixelArea() < MIN_PIXEL_AREA_FOR_COMPOSITE ) -// { -// return res; // Assumes sInstances is sorted by pixel area. -// } - else - if( !inst->isFullyBaked() ) + else if( !inst->isFullyBaked() ) { res = FALSE; if (inst->mHasGrey) @@ -1126,19 +868,13 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) return res; } -// static -void LLVOAvatar::dumpScratchTextureByteCount() -{ - llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl; -} - // static void LLVOAvatar::dumpBakedStatus() { LLVector3d camera_pos_global = gAgent.getCameraPositionGlobal(); for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; llinfos << "Avatar "; @@ -1190,18 +926,17 @@ void LLVOAvatar::dumpBakedStatus() { llcont << " Unbaked ("; - for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); iter++) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second; const ETextureIndex index = baked_dict->mTextureIndex; if (!inst->isTextureDefined(index)) { llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName; } } - llcont << " ) " << inst->getUnbakedPixelAreaRank(); if( inst->isCulled() ) { @@ -1215,17 +950,15 @@ void LLVOAvatar::dumpBakedStatus() //static void LLVOAvatar::restoreGL() { - for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + LLVOAvatar* self = gAgent.getAvatarObject(); + if (!self) + return; + self->setCompositeUpdatesEnabled(TRUE); + for (U32 i = 0; i < self->mBakedTextureDatas.size(); i++) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; - inst->setCompositeUpdatesEnabled( TRUE ); - for (U32 i = 0; i < inst->mBakedTextureData.size(); i++) - { - inst->invalidateComposite( inst->mBakedTextureData[i].mTexLayerSet, FALSE ); - } - inst->updateMeshTextures(); + self->invalidateComposite(self->mBakedTextureDatas[i].mTexLayerSet, FALSE); } + self->updateMeshTextures(); } //static @@ -1240,7 +973,7 @@ void LLVOAvatar::destroyGL() void LLVOAvatar::resetImpostors() { for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* avatar = (LLVOAvatar*) *iter; avatar->mImpostor.release(); @@ -1254,33 +987,15 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) { lldebugs << "Deleting layer set caches" << llendl; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->deleteLayerSetCaches(clearAll); } LLTexLayerSet::sHasCaches = FALSE; } - - for( LLGLuint* namep = sScratchTexNames.getFirstData(); - namep; - namep = sScratchTexNames.getNextData() ) - { - LLImageGL::deleteTextures(1, (U32 *)namep ); - stop_glerror(); - } - - if( sScratchTexBytes ) - { - lldebugs << "Clearing Scratch Textures " << (sScratchTexBytes/1024) << "KB" << llendl; - - sScratchTexNames.deleteAllData(); - LLVOAvatar::sScratchTexLastBindTime.deleteAllData(); - LLImageGL::sGlobalTextureMemory -= sScratchTexBytes; - sScratchTexBytes = 0; - } - - gTexStaticImageList.deleteCachedImages(); + LLVOAvatarSelf::deleteScratchTextures(); + LLTexLayerStaticImageList::getInstance()->deleteCachedImages(); } @@ -1382,59 +1097,207 @@ void LLVOAvatar::initClass() { llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; } - + if (!sAvatarXmlInfo->parseXmlMorphNodes(root)) + { + llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + } } void LLVOAvatar::cleanupClass() { - delete sAvatarXmlInfo; - sAvatarXmlInfo = NULL; - delete sAvatarSkeletonInfo; - sAvatarSkeletonInfo = NULL; + deleteAndClear(sAvatarXmlInfo); sSkeletonXMLTree.cleanup(); sXMLTree.cleanup(); } -const LLVector3 LLVOAvatar::getRenderPosition() const -{ - if (mDrawable.isNull() || mDrawable->getGeneration() < 0) - { - return getPositionAgent(); - } - else if (isRoot()) - { - return mDrawable->getPositionAgent(); - } - else - { - return getPosition() * mDrawable->getParent()->getRenderMatrix(); - } -} - -void LLVOAvatar::updateDrawable(BOOL force_damped) -{ - clearChanged(SHIFTED); -} - -void LLVOAvatar::onShift(const LLVector3& shift_vector) -{ - mLastAnimExtents[0] += shift_vector; - mLastAnimExtents[1] += shift_vector; - mNeedsImpostorUpdate = TRUE; - mNeedsAnimUpdate = TRUE; -} - -void LLVOAvatar::updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax) +void LLVOAvatar::initInstance(void) { - if (isImpostor() && !needsImpostorUpdate()) + //------------------------------------------------------------------------- + // initialize joint, mesh and shape members + //------------------------------------------------------------------------- + mRoot.setName( "mRoot" ); + + for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); + iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + iter++) { - LLVector3 delta = getRenderPosition() - - ((LLVector3(mDrawable->getPositionGroup())-mImpostorOffset)); - - newMin = mLastAnimExtents[0] + delta; - newMax = mLastAnimExtents[1] + delta; - } + const EMeshIndex mesh_index = iter->first; + const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + LLViewerJoint* joint = new LLViewerJoint(); + joint->setName(mesh_dict->mName); + joint->setMeshID(mesh_index); + mMeshLOD.push_back(joint); + + /* mHairLOD.setName("mHairLOD"); + mHairMesh0.setName("mHairMesh0"); + mHairMesh0.setMeshID(MESH_ID_HAIR); + mHairMesh1.setName("mHairMesh1"); */ + for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) + { + LLViewerJointMesh* mesh = new LLViewerJointMesh(); + std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); + // We pre-pended an m - need to capitalize first character for camelCase + mesh_name[1] = toupper(mesh_name[1]); + mesh->setName(mesh_name); + mesh->setMeshID(mesh_index); + mesh->setPickName(mesh_dict->mPickName); + mesh->setIsTransparent(FALSE); + switch((int)mesh_index) + { + case MESH_ID_HAIR: + mesh->setIsTransparent(TRUE); + break; + case MESH_ID_SKIRT: + mesh->setIsTransparent(TRUE); + break; + case MESH_ID_EYEBALL_LEFT: + case MESH_ID_EYEBALL_RIGHT: + mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); + break; + } + + joint->mMeshParts.push_back(mesh); + } + } + + //------------------------------------------------------------------------- + // associate baked textures with meshes + //------------------------------------------------------------------------- + for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); + iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + iter++) + { + const EMeshIndex mesh_index = iter->first; + const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; + // Skip it if there's no associated baked texture. + if (baked_texture_index == BAKED_NUM_INDICES) continue; + + for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); + iter != mMeshLOD[mesh_index]->mMeshParts.end(); iter++) + { + LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; + mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); + } + } + + + //------------------------------------------------------------------------- + // register motions + //------------------------------------------------------------------------- + if (LLCharacter::sInstances.size() == 1) + { + LLKeyframeMotion::setVFS(gStaticVFS); + registerMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); + registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); + registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create ); + registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); + + // motions without a start/stop bit + registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); + registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); + registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); + registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); + registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); + registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); + registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); + registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create ); + registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); + registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); + registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); + + } + + if (gNoRender) + { + return; + } + + buildCharacter(); + + if (gNoRender) + { + return; + } + + // preload specific motions here + createMotion( ANIM_AGENT_CUSTOMIZE); + createMotion( ANIM_AGENT_CUSTOMIZE_DONE); + + //VTPause(); // VTune + + mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) ); +} + +const LLVector3 LLVOAvatar::getRenderPosition() const +{ + if (mDrawable.isNull() || mDrawable->getGeneration() < 0) + { + return getPositionAgent(); + } + else if (isRoot()) + { + return mDrawable->getPositionAgent(); + } + else + { + return getPosition() * mDrawable->getParent()->getRenderMatrix(); + } +} + +void LLVOAvatar::updateDrawable(BOOL force_damped) +{ + clearChanged(SHIFTED); +} + +void LLVOAvatar::onShift(const LLVector3& shift_vector) +{ + mLastAnimExtents[0] += shift_vector; + mLastAnimExtents[1] += shift_vector; + mNeedsImpostorUpdate = TRUE; + mNeedsAnimUpdate = TRUE; +} + +void LLVOAvatar::updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax) +{ + if (isImpostor() && !needsImpostorUpdate()) + { + LLVector3 delta = getRenderPosition() - + ((LLVector3(mDrawable->getPositionGroup())-mImpostorOffset)); + + newMin = mLastAnimExtents[0] + delta; + newMax = mLastAnimExtents[1] + delta; + } else { getSpatialExtents(newMin,newMax); @@ -1461,7 +1324,7 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) { update_min_max(newMin, newMax, - mesh->mJointRenderData[joint_num]->mWorldMatrix->getTranslation()); + mesh->mJointRenderData[joint_num]->mWorldMatrix->getTranslation()); } } @@ -1469,8 +1332,8 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) //stretch bounding box by attachments for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) + iter != mAttachmentPoints.end(); + ++iter) { LLViewerJointAttachment* attachment = iter->second; @@ -1535,11 +1398,9 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e LLVector3* intersection, LLVector2* tex_coord, LLVector3* normal, - LLVector3* bi_normal - ) + LLVector3* bi_normal) { - - if (mIsSelf && !gAgent.needsRenderAvatar() || !LLPipeline::sPickAvatar) + if (isSelf() && !gAgent.needsRenderAvatar() || !LLPipeline::sPickAvatar) { return FALSE; } @@ -1668,7 +1529,6 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent return FALSE; } joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); - joint->setName( info->mName ); } @@ -1679,10 +1539,8 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent } joint->setPosition(info->mPos); - joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY], info->mRot.mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info->mScale); @@ -1751,18 +1609,6 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) } } - // add special-purpose "screen" joint - if (mIsSelf) - { - mScreenp = new LLViewerJoint("mScreen", NULL); - // for now, put screen at origin, as it is only used during special - // HUD rendering mode - F32 aspect = LLViewerCamera::getInstance()->getAspect(); - LLVector3 scale(1.f, aspect, 1.f); - mScreenp->setScale(scale); - mScreenp->setWorldPosition(LLVector3::zero); - } - return TRUE; } @@ -1811,11 +1657,11 @@ void LLVOAvatar::buildCharacter() // clear mesh data //------------------------------------------------------------------------- for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); jointIter++) + jointIter != mMeshLOD.end(); jointIter++) { LLViewerJoint* joint = (LLViewerJoint*) *jointIter; for (std::vector::iterator meshIter = joint->mMeshParts.begin(); - meshIter != joint->mMeshParts.end(); meshIter++) + meshIter != joint->mMeshParts.end(); meshIter++) { LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter; mesh->setMesh(NULL); @@ -1839,9 +1685,9 @@ void LLVOAvatar::buildCharacter() // gPrintMessagesThisFrame = TRUE; lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl; - if ( ! status ) + if (!status) { - if ( mIsSelf ) + if (isSelf()) { llerrs << "Unable to load user's avatar" << llendl; } @@ -1878,23 +1724,23 @@ void LLVOAvatar::buildCharacter() // Make sure "well known" pointers exist //------------------------------------------------------------------------- if (!(mPelvisp && - mTorsop && - mChestp && - mNeckp && - mHeadp && - mSkullp && - mHipLeftp && - mHipRightp && - mKneeLeftp && - mKneeRightp && - mAnkleLeftp && - mAnkleRightp && - mFootLeftp && - mFootRightp && - mWristLeftp && - mWristRightp && - mEyeLeftp && - mEyeRightp)) + mTorsop && + mChestp && + mNeckp && + mHeadp && + mSkullp && + mHipLeftp && + mHipRightp && + mKneeLeftp && + mKneeRightp && + mAnkleLeftp && + mAnkleRightp && + mFootLeftp && + mFootRightp && + mWristLeftp && + mWristRightp && + mEyeLeftp && + mEyeRightp)) { llerrs << "Failed to create avatar." << llendl; return; @@ -1940,241 +1786,50 @@ void LLVOAvatar::buildCharacter() mIsBuilt = TRUE; stop_glerror(); - //------------------------------------------------------------------------- - // build the attach and detach menus - //------------------------------------------------------------------------- - if (mIsSelf) - { - // *TODO: Translate - gAttachBodyPartPieMenus[0] = NULL; - gAttachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); - gAttachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); - gAttachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); - gAttachBodyPartPieMenus[4] = NULL; - gAttachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); - gAttachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); - gAttachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); - - gDetachBodyPartPieMenus[0] = NULL; - gDetachBodyPartPieMenus[1] = new LLPieMenu(std::string("Right Arm >")); - gDetachBodyPartPieMenus[2] = new LLPieMenu(std::string("Head >")); - gDetachBodyPartPieMenus[3] = new LLPieMenu(std::string("Left Arm >")); - gDetachBodyPartPieMenus[4] = NULL; - gDetachBodyPartPieMenus[5] = new LLPieMenu(std::string("Left Leg >")); - gDetachBodyPartPieMenus[6] = new LLPieMenu(std::string("Torso >")); - gDetachBodyPartPieMenus[7] = new LLPieMenu(std::string("Right Leg >")); - - for (S32 i = 0; i < 8; i++) - { - if (gAttachBodyPartPieMenus[i]) - { - gAttachPieMenu->appendPieMenu( gAttachBodyPartPieMenus[i] ); - } - else - { - BOOL attachment_found = FALSE; - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getGroup() == i) - { - LLMenuItemCallGL* item; - item = new LLMenuItemCallGL(attachment->getName(), - NULL, - object_selected_and_point_valid); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); - - gAttachPieMenu->append(item); - - attachment_found = TRUE; - break; - - } - } + mMeshValid = TRUE; +} - if (!attachment_found) - { - gAttachPieMenu->appendSeparator(); - } - } - if (gDetachBodyPartPieMenus[i]) - { - gDetachPieMenu->appendPieMenu( gDetachBodyPartPieMenus[i] ); - } - else - { - BOOL attachment_found = FALSE; - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getGroup() == i) - { - gDetachPieMenu->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, object_attached, attachment)); +//----------------------------------------------------------------------------- +// releaseMeshData() +//----------------------------------------------------------------------------- +void LLVOAvatar::releaseMeshData() +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) + { + return; + } - attachment_found = TRUE; - break; - } - } + //llinfos << "Releasing" << llendl; - if (!attachment_found) - { - gDetachPieMenu->appendSeparator(); - } - } - } + // cleanup mesh data + for (std::vector::iterator iter = mMeshLOD.begin(); + iter != mMeshLOD.end(); iter++) + { + LLViewerJoint* joint = (LLViewerJoint*) *iter; + joint->setValid(FALSE, TRUE); + } - // add screen attachments - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + //cleanup data + if (mDrawable.notNull()) + { + LLFace* facep = mDrawable->getFace(0); + facep->setSize(0, 0); + for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getGroup() == 8) - { - LLMenuItemCallGL* item; - item = new LLMenuItemCallGL(attachment->getName(), - NULL, - object_selected_and_point_valid); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); - gAttachScreenPieMenu->append(item); - gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, object_attached, attachment)); - } + facep = mDrawable->getFace(i); + facep->setSize(0, 0); } - - for (S32 pass = 0; pass < 2; pass++) - { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getIsHUDAttachment() != (pass == 1)) - { - continue; - } - LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), - NULL, &object_selected_and_point_valid, - &attach_label, attachment); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", curiter->first); - gAttachSubMenu->append(item); - - gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, object_attached, &detach_label, attachment)); - - } - if (pass == 0) - { - // put separator between non-hud and hud attachments - gAttachSubMenu->appendSeparator(); - gDetachSubMenu->appendSeparator(); - } - } - - for (S32 group = 0; group < 8; group++) - { - // skip over groups that don't have sub menus - if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group]) - { - continue; - } - - std::multimap attachment_pie_menu_map; - - // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if(attachment->getGroup() == group) - { - // use multimap to provide a partial order off of the pie slice key - S32 pie_index = attachment->getPieSlice(); - attachment_pie_menu_map.insert(std::make_pair(pie_index, curiter->first)); - } - } - - // add in requested order to pie menu, inserting separators as necessary - S32 cur_pie_slice = 0; - for (std::multimap::iterator attach_it = attachment_pie_menu_map.begin(); - attach_it != attachment_pie_menu_map.end(); ++attach_it) - { - S32 requested_pie_slice = attach_it->first; - S32 attach_index = attach_it->second; - while (cur_pie_slice < requested_pie_slice) - { - gAttachBodyPartPieMenus[group]->appendSeparator(); - gDetachBodyPartPieMenus[group]->appendSeparator(); - cur_pie_slice++; - } - - LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); - if (attachment) - { - LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(), - NULL, object_selected_and_point_valid); - gAttachBodyPartPieMenus[group]->append(item); - item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", attach_index); - gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(), - &handle_detach_from_avatar, - object_attached, attachment)); - cur_pie_slice++; - } - } - } - } - - mMeshValid = TRUE; -} - - -//----------------------------------------------------------------------------- -// releaseMeshData() -//----------------------------------------------------------------------------- -void LLVOAvatar::releaseMeshData() -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) - { - return; - } - - //llinfos << "Releasing" << llendl; - - // cleanup mesh data - for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); iter++) - { - LLViewerJoint* joint = (LLViewerJoint*) *iter; - joint->setValid(FALSE, TRUE); - } - - //cleanup data - if (mDrawable.notNull()) - { - LLFace* facep = mDrawable->getFace(0); - facep->setSize(0, 0); - for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++) - { - facep = mDrawable->getFace(i); - facep->setSize(0, 0); - } - } - - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (!attachment->getIsHUDAttachment()) + } + + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (!attachment->getIsHUDAttachment()) { attachment->setAttachmentVisibility(FALSE); } @@ -2185,29 +1840,24 @@ void LLVOAvatar::releaseMeshData() //----------------------------------------------------------------------------- // restoreMeshData() //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::restoreMeshData() { + llassert(!isSelf()); LLMemType mt(LLMemType::MTYPE_AVATAR); //llinfos << "Restoring" << llendl; mMeshValid = TRUE; updateJointLODs(); - if (mIsSelf) - { - updateAttachmentVisibility(gAgent.getCameraMode()); - } - else + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (!attachment->getIsHUDAttachment()) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (!attachment->getIsHUDAttachment()) - { - attachment->setAttachmentVisibility(TRUE); - } + attachment->setAttachmentVisibility(TRUE); } } @@ -2393,9 +2043,9 @@ void LLVOAvatar::computeBodySize() // LLVOAvatar::processUpdateMessage() //------------------------------------------------------------------------ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, - void **user_data, - U32 block_num, const EObjectUpdateType update_type, - LLDataPacker *dp) + void **user_data, + U32 block_num, const EObjectUpdateType update_type, + LLDataPacker *dp) { LLMemType mt(LLMemType::MTYPE_AVATAR); @@ -2434,9 +2084,6 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) } } - -// setTEImage - //------------------------------------------------------------------------ // idleUpdate() //------------------------------------------------------------------------ @@ -2491,7 +2138,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // set alpha flag depending on state //-------------------------------------------------------------------- - if (mIsSelf) + if (isSelf()) { LLViewerObject::idleUpdate(agent, world, time); @@ -2515,8 +2162,8 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // animate the character // store off last frame's root position to be consistent with camera position LLVector3 root_pos_last = mRoot.getWorldPosition(); - bool detailed_update = updateCharacter(agent); - bool voice_enabled = gVoiceClient->getVoiceEnabled( mID ) && gVoiceClient->inProximalChannel(); + BOOL detailed_update = updateCharacter(agent); + BOOL voice_enabled = gVoiceClient->getVoiceEnabled( mID ) && gVoiceClient->inProximalChannel(); if (gNoRender) { @@ -2539,13 +2186,13 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { // disable voice visualizer when in mouselook - mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(mIsSelf && gAgent.cameraMouselook()) ); + mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(isSelf() && gAgent.cameraMouselook()) ); if ( voice_enabled ) { //---------------------------------------------------------------- // Only do gesture triggering for your own avatar, and only when you're in a proximal channel. //---------------------------------------------------------------- - if( mIsSelf ) + if( isSelf() ) { //---------------------------------------------------------------------------------------- // The following takes the voice signal and uses that to trigger gesticulations. @@ -2571,7 +2218,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) } } - } //if( mIsSelf ) + } //if( isSelf() ) //----------------------------------------------------------------------------------------------------------------- // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer. @@ -2580,9 +2227,9 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. //----------------------------------------------------------------------------------------------------------------- - if ( gVoiceClient->getIsSpeaking( mID ) ) + if (gVoiceClient->getIsSpeaking( mID )) { - if ( ! mVoiceVisualizer->getCurrentlySpeaking() ) + if (!mVoiceVisualizer->getCurrentlySpeaking()) { mVoiceVisualizer->setStartSpeaking(); @@ -2591,7 +2238,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) ); - if( mIsSelf ) + if( isSelf() ) { gAgent.clearAFK(); } @@ -2654,8 +2301,8 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) LLViewerObject *attached_object = attachment->getObject(); BOOL visibleAttachment = visible || (attached_object && - !(attached_object->mDrawable->getSpatialBridge() && - attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0)); + !(attached_object->mDrawable->getSpatialBridge() && + attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0)); if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid()) { @@ -2751,7 +2398,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } } updateVisualParams(); - if (mIsSelf) + if (isSelf()) { gAgent.sendAgentSetAppearance(); } @@ -2947,16 +2594,16 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) BOOL visible_avatar = isVisible() || mNeedsAnimUpdate; BOOL visible_chat = gSavedSettings.getBOOL("UseChatBubbles") && (mChats.size() || mTyping); BOOL render_name = visible_chat || - (visible_avatar && - ((sRenderName == RENDER_NAME_ALWAYS) || - (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); + (visible_avatar && + ((sRenderName == RENDER_NAME_ALWAYS) || + (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); // If it's your own avatar, don't draw in mouselook, and don't // draw if we're specifically hiding our own name. - if (mIsSelf) + if (isSelf()) { render_name = render_name - && !gAgent.cameraMouselook() - && (visible_chat || !gSavedSettings.getBOOL("RenderNameHideSelf")); + && !gAgent.cameraMouselook() + && (visible_chat || !gSavedSettings.getBOOL("RenderNameHideSelf")); } if ( render_name ) @@ -3013,7 +2660,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - LLColor4 avatar_name_color = gColors.getColor( "AvatarNameColor" ); + LLColor4 avatar_name_color = gSavedSkinSettings.getColor( "AvatarNameColor" ); avatar_name_color.setAlpha(alpha); mNameText->setColor(avatar_name_color); @@ -3056,7 +2703,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); BOOL is_muted; - if (mIsSelf) + if (isSelf()) { is_muted = FALSE; } @@ -3101,7 +2748,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += " ("; if (is_away) { - line += "Away"; + line += LLTrans::getString("AvatarAway"); need_comma = TRUE; } if (is_busy) @@ -3110,7 +2757,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) { line += ", "; } - line += "Busy"; + line += LLTrans::getString("AvatarBusy"); need_comma = TRUE; } if (is_muted) @@ -3119,7 +2766,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) { line += ", "; } - line += "Muted"; + line += LLTrans::getString("AvatarMuted"); need_comma = TRUE; } line += ")"; @@ -3127,7 +2774,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) if (is_appearance) { line += "\n"; - line += "(Editing Appearance)"; + line += LLTrans::getString("AvatarEditingAppearance"); } mNameAway = is_away; mNameBusy = is_busy; @@ -3155,7 +2802,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) std::deque::iterator chat_iter = mChats.begin(); mNameText->clearString(); - LLColor4 new_chat = gColors.getColor( "AvatarNameColor" ); + LLColor4 new_chat = gSavedSkinSettings.getColor( "AvatarNameColor" ); LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) @@ -3169,15 +2816,15 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) LLFontGL::StyleFlags style; switch(chat_iter->mChatType) { - case CHAT_TYPE_WHISPER: - style = LLFontGL::ITALIC; - break; - case CHAT_TYPE_SHOUT: - style = LLFontGL::BOLD; - break; - default: - style = LLFontGL::NORMAL; - break; + case CHAT_TYPE_WHISPER: + style = LLFontGL::ITALIC; + break; + case CHAT_TYPE_SHOUT: + style = LLFontGL::BOLD; + break; + default: + style = LLFontGL::NORMAL; + break; } if (chat_fade_amt < 1.f) { @@ -3202,15 +2849,15 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; switch(dot_count) { - case 1: - mNameText->addLine(".", new_chat); - break; - case 2: - mNameText->addLine("..", new_chat); - break; - case 3: - mNameText->addLine("...", new_chat); - break; + case 1: + mNameText->addLine(".", new_chat); + break; + case 2: + mNameText->addLine("..", new_chat); + break; + case 3: + mNameText->addLine("...", new_chat); + break; } } @@ -3244,75 +2891,12 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } } +//-------------------------------------------------------------------- +// draw tractor beam when editing objects +//-------------------------------------------------------------------- +// virtual void LLVOAvatar::idleUpdateTractorBeam() { - //-------------------------------------------------------------------- - // draw tractor beam when editing objects - //-------------------------------------------------------------------- - if (!mIsSelf) - { - return; - } - - // This is only done for yourself (maybe it should be in the agent?) - if (!needsRenderBeam() || !mIsBuilt) - { - mBeam = NULL; - } - else if (!mBeam || mBeam->isDead()) - { - // VEFFECT: Tractor Beam - mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); - mBeam->setColor(LLColor4U(gAgent.getEffectColor())); - mBeam->setSourceObject(this); - mBeamTimer.reset(); - } - - if (!mBeam.isNull()) - { - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if (gAgent.mPointAt.notNull()) - { - // get point from pointat effect - mBeam->setPositionGlobal(gAgent.mPointAt->getPointAtPosGlobal()); - mBeam->triggerLocal(); - } - else if (selection->getFirstRootObject() && - selection->getSelectType() != SELECT_TYPE_HUD) - { - LLViewerObject* objectp = selection->getFirstRootObject(); - mBeam->setTargetObject(objectp); - } - else - { - mBeam->setTargetObject(NULL); - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - if (tool->isEditing()) - { - if (tool->getEditingObject()) - { - mBeam->setTargetObject(tool->getEditingObject()); - } - else - { - mBeam->setPositionGlobal(tool->getEditingPointGlobal()); - } - } - else - { - const LLPickInfo& pick = gViewerWindow->getLastPick(); - mBeam->setPositionGlobal(pick.mPosGlobal); - } - - } - if (mBeamTimer.getElapsedTimeF32() > 0.25f) - { - mBeam->setColor(LLColor4U(gAgent.getEffectColor())); - mBeam->setNeedsSendToSim(TRUE); - mBeamTimer.reset(); - } - } } void LLVOAvatar::idleUpdateBelowWater() @@ -3344,16 +2928,6 @@ void LLVOAvatar::slamPosition() BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { LLMemType mt(LLMemType::MTYPE_AVATAR); - // update screen joint size - - if (mScreenp) - { - F32 aspect = LLViewerCamera::getInstance()->getAspect(); - LLVector3 scale(1.f, aspect, 1.f); - mScreenp->setScale(scale); - mScreenp->updateWorldMatrixChildren(); - resetHUDAttachments(); - } // clear debug text mDebugText.clear(); @@ -3386,7 +2960,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (gNoRender) { // Hack if we're running drones... - if (mIsSelf) + if (isSelf()) { gAgent.setPositionAgent(getPositionAgent()); } @@ -3415,7 +2989,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // the rest should only be done occasionally for far away avatars //-------------------------------------------------------------------- - if (visible && !mIsSelf && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) + if (visible && !isSelf() && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) { F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); if (LLMuteList::getInstance()->isMuted(getID())) @@ -3457,7 +3031,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } // change animation time quanta based on avatar render load - if (!mIsSelf && !mIsDummy) + if (!isSelf() && !mIsDummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -3526,7 +3100,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3d root_pos; LLVector3d ground_under_pelvis; - if (mIsSelf) + if (isSelf()) { gAgent.setPositionAgent(getRenderPosition()); } @@ -3535,8 +3109,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) resolveHeightGlobal(root_pos, ground_under_pelvis, normal); F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); - BOOL in_air = ( (!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || - foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); + BOOL in_air = ((!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || + foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); if (in_air && !mInAir) { @@ -3571,7 +3145,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // more than 90 from the view, if necessary, flip the velocity vector. LLVector3 primDir; - if (mIsSelf) + if (isSelf()) { primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector()); primDir.normalize(); @@ -3591,7 +3165,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } LLVector3 fwdDir = lerp(primDir, velDir, clamp_rescale(speed, 0.5f, 2.0f, 0.0f, 1.0f)); - if (mIsSelf && gAgent.cameraMouselook()) + if (isSelf() && gAgent.cameraMouselook()) { // make sure fwdDir stays in same general direction as primdir if (gAgent.getFlying()) @@ -3619,18 +3193,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) F32 root_roll, root_pitch, root_yaw; root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw); - if (sDebugAvatarRotation) - { - llinfos << "root_roll " << RAD_TO_DEG * root_roll - << " root_pitch " << RAD_TO_DEG * root_pitch - << " root_yaw " << RAD_TO_DEG * root_yaw - << llendl; - } - // When moving very slow, the pelvis is allowed to deviate from the // forward direction to allow it to hold it's position while the torso // and head turn. Once in motion, it must conform however. - BOOL self_in_mouselook = mIsSelf && gAgent.cameraMouselook(); + BOOL self_in_mouselook = isSelf() && gAgent.cameraMouselook(); LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST); @@ -3647,7 +3213,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // from the forward direction, but if roll or pitch are off even // a little bit we need to correct the rotation. if(root_roll < 1.f * DEG_TO_RAD - && root_pitch < 5.f * DEG_TO_RAD) + && root_pitch < 5.f * DEG_TO_RAD) { // smaller correction vector means pelvis follows prim direction more closely if (!mTurning && angle > pelvis_rot_threshold*0.75f) @@ -3681,7 +3247,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) fwdDir = leftDir % upDir; LLQuaternion wQv( fwdDir, leftDir, upDir ); - if (mIsSelf && mTurning) + if (isSelf() && mTurning) { if ((fwdDir % pelvisDir) * upDir > 0.f) { @@ -3890,9 +3456,9 @@ void LLVOAvatar::updateVisibility() visible = FALSE; } - if( mIsSelf ) + if(isSelf()) { - if( !gAgent.areWearablesLoaded()) + if (!gAgentWearables.areWearablesLoaded()) { visible = FALSE; } @@ -3997,27 +3563,6 @@ void LLVOAvatar::updateVisibility() mVisible = visible; } -//------------------------------------------------------------------------ -// needsRenderBeam() -//------------------------------------------------------------------------ -BOOL LLVOAvatar::needsRenderBeam() -{ - if (gNoRender) - { - return FALSE; - } - LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); - - BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); - if (LLToolGrab::getInstance()->getEditingObject() && - LLToolGrab::getInstance()->getEditingObject()->isAttachment()) - { - // don't render selection beam on hud objects - is_touching_or_grabbing = FALSE; - } - return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); -} - //----------------------------------------------------------------------------- // renderSkinned() //----------------------------------------------------------------------------- @@ -4051,7 +3596,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); } - if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { mMeshLOD[MESH_ID_EYELASH]->updateJointGeometry(); mMeshLOD[MESH_ID_HEAD]->updateJointGeometry(); @@ -4101,7 +3646,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) return num_indices; } - if (mIsSelf && !gAgent.needsRenderAvatar()) + if (isSelf() && !gAgent.needsRenderAvatar()) { return num_indices; } @@ -4151,17 +3696,10 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) if (pass == AVATAR_RENDER_PASS_SINGLE) { - const bool should_alpha_mask = mHasBakedHair && isTextureDefined(TEX_HEAD_BAKED) && isTextureDefined(TEX_UPPER_BAKED) - && isTextureDefined(TEX_LOWER_BAKED) - && mBakedTextureData[BAKED_HEAD].mIsLoaded - && mBakedTextureData[BAKED_UPPER].mIsLoaded && mBakedTextureData[BAKED_LOWER].mIsLoaded - && mBakedTextureData[BAKED_HEAD].mIsUsed - && mBakedTextureData[BAKED_UPPER].mIsUsed && mBakedTextureData[BAKED_LOWER].mIsUsed - && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked - && !(isSelf() && gAgent.cameraCustomizeAvatar()); // don't alpha mask if in customize mode + const bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha; // Don't alpha mask if "Highlight Transparent" checked LLGLState test(GL_ALPHA_TEST, should_alpha_mask); - + if (should_alpha_mask) { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); @@ -4170,7 +3708,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) BOOL first_pass = TRUE; if (!LLDrawPoolAvatar::sSkipOpaque) { - if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) { @@ -4221,7 +3759,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } - if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) { @@ -4235,7 +3773,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); - if (getTEImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) + if (getImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) { num_indices += mMeshLOD[MESH_ID_HAIR]->render(mAdjustedPixelArea, first_pass, mIsDummy); first_pass = FALSE; @@ -4261,7 +3799,7 @@ U32 LLVOAvatar::renderRigid() return 0; } - if (mIsSelf && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) + if (isSelf() && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) { return 0; } @@ -4274,10 +3812,7 @@ U32 LLVOAvatar::renderRigid() if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) { // If the meshes need to be drawn, enable alpha masking but not blending - bool should_alpha_mask = mHasBakedHair - && mBakedTextureData[BAKED_EYES].mIsLoaded - && mBakedTextureData[BAKED_EYES].mIsUsed - && !(isSelf() && gAgent.cameraCustomizeAvatar()); + bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha; LLGLState test(GL_ALPHA_TEST, should_alpha_mask); @@ -4304,7 +3839,7 @@ U32 LLVOAvatar::renderFootShadows() return 0; } - if (mIsSelf && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) + if (isSelf() && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) { return 0; } @@ -4316,7 +3851,7 @@ U32 LLVOAvatar::renderFootShadows() // Don't render foot shadows if your lower body is completely invisible. // (non-humanoid avatars rule!) - if (! isTextureVisible(TEX_LOWER_BAKED)) + if (!isTextureVisible(TEX_LOWER_BAKED)) { return 0; } @@ -4391,7 +3926,7 @@ void LLVOAvatar::updateTextures(LLAgent &agent) return; } - if( mIsSelf ) + if( isSelf() ) { render_avatar = TRUE; } @@ -4400,66 +3935,32 @@ void LLVOAvatar::updateTextures(LLAgent &agent) render_avatar = isVisible() && !mCulled; } - std::vector layer_baked; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + std::vector layer_baked; + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - layer_baked.push_back(isTextureDefined(mBakedTextureData[i].mTextureIndex)); + layer_baked.push_back(isTextureDefined(mBakedTextureDatas[i].mTextureIndex)); // bind the texture so that they'll be decoded slightly // inefficient, we can short-circuit this if we have to - if( render_avatar && !gGLManager.mIsDisabled ) - { - if (layer_baked[i] && !mBakedTextureData[i].mIsLoaded) - { - gGL.getTexUnit(0)->bind(getTEImage( mBakedTextureData[i].mTextureIndex )); - } - } - } - - /* - // JAMESDEBUG - if (mIsSelf) - { - S32 null_count = 0; - S32 default_count = 0; - for (U32 i = 0; i < getNumTEs(); i++) + if (render_avatar && !gGLManager.mIsDisabled) { - const LLTextureEntry* te = getTE(i); - if (te) + if (layer_baked[i] && !mBakedTextureDatas[i].mIsLoaded) { - if (te->getID() == LLUUID::null) - { - null_count++; - } - else if (te->getID() == IMG_DEFAULT_AVATAR) - { - default_count++; - } + gGL.getTexUnit(0)->bind(getImage(mBakedTextureDatas[i].mTextureIndex)); } } - llinfos << "JAMESDEBUG my avatar TE null " << null_count << " default " << default_count << llendl; } - */ mMaxPixelArea = 0.f; mMinPixelArea = 99999999.f; mHasGrey = FALSE; // debug for (U32 index = 0; index < getNumTEs(); index++) { - LLViewerImage *imagep = getTEImage(index); + LLViewerImage *imagep = getImage(index); if (imagep) { - // Debugging code - maybe non-self avatars are downloading textures? - //llinfos << "avatar self " << mIsSelf << " tex " << i - // << " decode " << imagep->getDecodePriority() - // << " boost " << boost_avatar - // << " size " << imagep->getWidth() << "x" << imagep->getHeight() - // << " discard " << imagep->getDiscardLevel() - // << " desired " << imagep->getDesiredDiscardLevel() - // << llendl; - const LLTextureEntry *te = getTE(index); - F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); - S32 boost_level = mIsSelf ? LLViewerImage::BOOST_AVATAR_BAKED_SELF : LLViewerImage::BOOST_AVATAR_BAKED; + const F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); + const S32 boost_level = getAvatarBakedBoostLevel(); // Spam if this is a baked texture, not set to default image, without valid host info if (isIndexBakedTexture((ETextureIndex)index) @@ -4467,15 +3968,15 @@ void LLVOAvatar::updateTextures(LLAgent &agent) && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " - << imagep->getID() << " for avatar " - << (mIsSelf ? "" : getID().asString()) - << " on host " << getRegion()->getHost() << llendl; + << imagep->getID() << " for avatar " + << (isSelf() ? "" : getID().asString()) + << " on host " << getRegion()->getHost() << llendl; } /* switch(index) case TEX_HEAD_BODYPAINT: addLocalTextureStats( LOCTEX_HEAD_BODYPAINT, imagep, texel_area_ratio, render_avatar, head_baked ); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index); + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index); if (texture_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; @@ -4506,38 +4007,11 @@ void LLVOAvatar::updateTextures(LLAgent &agent) } -void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked ) +void LLVOAvatar::addLocalTextureStats(ETextureIndex idx, LLViewerImage* imagep, + F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked, U32 index) { - if (!isIndexLocalTexture(idx)) return; - - if (!covered_by_baked && render_avatar) // render_avatar is always true if mIsSelf - { - if (getLocalTextureID(idx) != IMG_DEFAULT_AVATAR) - { - F32 desired_pixels; - if( mIsSelf ) - { - desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); - imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR_SELF); - } - else - { - desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_OTHER ); - imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR); - } - imagep->addTextureStats( desired_pixels / texel_area_ratio ); - if (imagep->getDiscardLevel() < 0) - { - mHasGrey = TRUE; // for statistics gathering - } - } - else - { - // texture asset is missing - mHasGrey = TRUE; // for statistics gathering - } - } + // No local texture stats for non-self avatars + return; } @@ -4549,6 +4023,29 @@ void LLVOAvatar::addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F3 imagep->setBoostLevel(boost_level); } +//virtual +void LLVOAvatar::setImage(const U8 te, LLViewerImage *imagep) +{ + setTEImage(te, imagep); +} + +//virtual +LLViewerImage* LLVOAvatar::getImage(const U8 te) const +{ + return getTEImage(te); +} +//virtual +const LLTextureEntry* LLVOAvatar::getTexEntry(const U8 te_num) const +{ + return getTE(te_num); +} + +//virtual +void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) +{ + setTE(index, te); +} + //----------------------------------------------------------------------------- // resolveHeight() //----------------------------------------------------------------------------- @@ -4690,7 +4187,7 @@ void LLVOAvatar::processAnimationStateChanges() } // clear source information for animations which have been stopped - if (mIsSelf) + if (isSelf()) { AnimSourceIterator source_it = mAnimationSources.begin(); @@ -4732,7 +4229,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL { // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed // to support both spatialized and non-spatialized instances of the same sound - //if (mIsSelf) + //if (isSelf()) //{ // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); //} @@ -4775,7 +4272,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL //----------------------------------------------------------------------------- // isAnyAnimationSignaled() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) +BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const { for (S32 i = 0; i < num_anims; i++) { @@ -4818,7 +4315,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) } } - if (mIsSelf && id == ANIM_AGENT_AWAY) + if (isSelf() && id == ANIM_AGENT_AWAY) { gAgent.setAFK(); } @@ -4831,7 +4328,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) //----------------------------------------------------------------------------- BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) { - if (mIsSelf) + if (isSelf()) { gAgent.onAnimStop(id); } @@ -4851,25 +4348,9 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) //----------------------------------------------------------------------------- // stopMotionFromSource() //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) { - if (!mIsSelf) - { - return; - } - AnimSourceIterator motion_it; - - for(motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end();) - { - gAgent.sendAnimationRequest( motion_it->second, ANIM_REQUEST_STOP ); - mAnimationSources.erase(motion_it++); - } - - LLViewerObject* object = gObjectList.findObject(source_id); - if (object) - { - object->mFlags &= ~FLAGS_ANIM_SOURCE; - } } //----------------------------------------------------------------------------- @@ -4917,7 +4398,7 @@ S32 LLVOAvatar::getCollisionVolumeID(std::string &name) //----------------------------------------------------------------------------- // addDebugText() //----------------------------------------------------------------------------- - void LLVOAvatar::addDebugText(const std::string& text) +void LLVOAvatar::addDebugText(const std::string& text) { mDebugText.append(1, '\n'); mDebugText.append(text); @@ -4937,15 +4418,7 @@ const LLUUID& LLVOAvatar::getID() // RN: avatar joints are multi-rooted to include screen-based attachments LLJoint *LLVOAvatar::getJoint( const std::string &name ) { - LLJoint* jointp = NULL; - if (mScreenp) - { - jointp = mScreenp->findJoint(name); - } - if (!jointp) - { - jointp = mRoot.findJoint(name); - } + LLJoint* jointp = mRoot.findJoint(name); return jointp; } @@ -5075,8 +4548,7 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) //----------------------------------------------------------------------------- BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) { - delete [] mSkeleton; - mSkeleton = NULL; + deleteAndClearArray(mSkeleton); mNumJoints = 0; mSkeleton = new LLViewerJoint[num]; @@ -5100,8 +4572,7 @@ BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) //----------------------------------------------------------------------------- BOOL LLVOAvatar::allocateCollisionVolumes( U32 num ) { - delete [] mCollisionVolumes; - mCollisionVolumes = NULL; + deleteAndClearArray(mCollisionVolumes); mNumCollisionVolumes = 0; mCollisionVolumes = new LLViewerJointCollisionVolume[num]; @@ -5131,14 +4602,10 @@ LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) //----------------------------------------------------------------------------- // requestStopMotion() //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::requestStopMotion( LLMotion* motion ) { // Only agent avatars should handle the stop motion notifications. - if ( mIsSelf ) - { - // Notify agent that motion has stopped - gAgent.requestStopMotion( motion ); - } } //----------------------------------------------------------------------------- @@ -5217,62 +4684,55 @@ BOOL LLVOAvatar::loadAvatar() if (sAvatarXmlInfo->mLayerInfoList.empty()) { llwarns << "avatar file: missing node" << llendl; + return FALSE; } - else + + if (sAvatarXmlInfo->mMorphMaskInfoList.empty()) + { + llwarns << "avatar file: missing node" << llendl; + return FALSE; + } + + // avatar_lad.xml : + for (LLVOAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin(); + iter != sAvatarXmlInfo->mMorphMaskInfoList.end(); + iter++) { - LLVOAvatarXmlInfo::layer_info_list_t::iterator iter; - for (iter = sAvatarXmlInfo->mLayerInfoList.begin(); - iter != sAvatarXmlInfo->mLayerInfoList.end(); iter++) + LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter; + + EBakedTextureIndex baked = LLVOAvatarDictionary::findBakedByRegionName(info->mRegion); + if (baked != BAKED_NUM_INDICES) { - LLTexLayerSetInfo *info = *iter; - LLTexLayerSet* layer_set = new LLTexLayerSet( this ); - if (!layer_set->setInfo(info)) - { - stop_glerror(); - delete layer_set; - llwarns << "avatar file: layer_set->parseData() failed" << llendl; - return FALSE; - } - bool found_baked_entry = false; - for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); - baked_iter++) + LLPolyMorphTarget *morph_param; + const std::string *name = &info->mName; + morph_param = (LLPolyMorphTarget *)(getVisualParam(name->c_str())); + if (morph_param) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; - if (layer_set->isBodyRegion(baked_dict->mName)) - { - mBakedTextureData[baked_iter->first].mTexLayerSet = layer_set; - found_baked_entry = true; - break; - } - } - if (!found_baked_entry) - { - llwarns << " has invalid body_region attribute" << llendl; - delete layer_set; - return FALSE; + BOOL invert = info->mInvert; + addMaskedMorph(baked, morph_param, invert, info->mLayer); } } + } + + loadLayersets(); // avatar_lad.xml : + for (LLVOAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin(); + iter != sAvatarXmlInfo->mDriverInfoList.end(); + iter++) { - LLVOAvatarXmlInfo::driver_info_list_t::iterator iter; - for (iter = sAvatarXmlInfo->mDriverInfoList.begin(); - iter != sAvatarXmlInfo->mDriverInfoList.end(); iter++) + LLDriverParamInfo *info = *iter; + LLDriverParam* driver_param = new LLDriverParam( this ); + if (driver_param->setInfo(info)) { - LLDriverParamInfo *info = *iter; - LLDriverParam* driver_param = new LLDriverParam( this ); - if (driver_param->setInfo(info)) - { - addVisualParam( driver_param ); - } - else - { - delete driver_param; - llwarns << "avatar file: driver_param->parseData() failed" << llendl; - return FALSE; - } + addVisualParam( driver_param ); + } + else + { + delete driver_param; + llwarns << "avatar file: driver_param->parseData() failed" << llendl; + return FALSE; } } @@ -5287,7 +4747,7 @@ BOOL LLVOAvatar::loadSkeletonNode () mRoot.addChild( &mSkeleton[0] ); for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); iter++) + iter != mMeshLOD.end(); iter++) { LLViewerJoint *joint = (LLViewerJoint *) *iter; joint->mUpdateXform = FALSE; @@ -5438,12 +4898,12 @@ BOOL LLVOAvatar::loadMeshNodes() switch(lod) case 0: mesh = &mHairMesh0; */ - for (LLVOAvatarDictionary::mesh_map_t::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); + for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); mesh_iter++) { const EMeshIndex mesh_index = mesh_iter->first; - const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = mesh_iter->second; + const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second; if (type.compare(mesh_dict->mName) == 0) { mesh_id = mesh_index; @@ -5539,15 +4999,32 @@ BOOL LLVOAvatar::loadMeshNodes() } //----------------------------------------------------------------------------- -// updateVisualParams() +// loadLayerSets() //----------------------------------------------------------------------------- -void LLVOAvatar::updateVisualParams() +BOOL LLVOAvatar::loadLayersets() { - if (gNoRender) + BOOL success = TRUE; + for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin(); + layerset_iter != sAvatarXmlInfo->mLayerInfoList.end(); + layerset_iter++) { - return; + // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. + LLTexLayerSetInfo *layerset_info = *layerset_iter; + layerset_info->createVisualParams(this); } - + return success; +} + +//----------------------------------------------------------------------------- +// updateVisualParams() +//----------------------------------------------------------------------------- +void LLVOAvatar::updateVisualParams() +{ + if (gNoRender) + { + return; + } + setSex( (getVisualParamWeight( "male" ) > 0.5f) ? SEX_MALE : SEX_FEMALE ); LLCharacter::updateVisualParams(); @@ -5602,9 +5079,9 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) } // We always want to look good to ourselves - if( mIsSelf ) + if( isSelf() ) { - mPixelArea = llmax( mPixelArea, F32(TEX_IMAGE_SIZE_SELF / 16) ); + mPixelArea = llmax( mPixelArea, F32(getTexImageSize() / 16) ); } } @@ -5620,7 +5097,7 @@ BOOL LLVOAvatar::updateJointLODs() F32 area_scale = 0.16f; { - if (mIsSelf) + if (isSelf()) { if(gAgent.cameraCustomizeAvatar() || gAgent.cameraMouselook()) { @@ -5749,7 +5226,7 @@ void LLVOAvatar::updateShadowFaces() // this only does a ray straight down from the foot, as our client-side ray-tracing is very limited now // but we make an explicit ray trace call in expectation of future improvements resolveRayCollisionAgent(gAgent.getPosGlobalFromAgent(joint_world_pos), - gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal); + gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal); shadow_pos_agent = gAgent.getPosAgentFromGlobal(shadow_pos); foot_height = joint_world_pos.mV[VZ] - shadow_pos_agent.mV[VZ]; @@ -5758,7 +5235,7 @@ void LLVOAvatar::updateShadowFaces() // Render sprite sprite.setNormal(normal); - if (mIsSelf && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (isSelf() && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) { sprite.setColor(0.f, 0.f, 0.f, 0.f); } @@ -5782,7 +5259,7 @@ void LLVOAvatar::updateShadowFaces() // this only does a ray straight down from the foot, as our client-side ray-tracing is very limited now // but we make an explicit ray trace call in expectation of future improvements resolveRayCollisionAgent(gAgent.getPosGlobalFromAgent(joint_world_pos), - gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal); + gAgent.getPosGlobalFromAgent(gSky.getSunDirection() + joint_world_pos), shadow_pos, normal); shadow_pos_agent = gAgent.getPosAgentFromGlobal(shadow_pos); foot_height = joint_world_pos.mV[VZ] - shadow_pos_agent.mV[VZ]; @@ -5791,7 +5268,7 @@ void LLVOAvatar::updateShadowFaces() // Render sprite sprite.setNormal(normal); - if (mIsSelf && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (isSelf() && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) { sprite.setColor(0.f, 0.f, 0.f, 0.f); } @@ -5816,9 +5293,9 @@ void LLVOAvatar::updateShadowFaces() //----------------------------------------------------------------------------- void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user ) { - invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user ); updateMeshTextures(); } @@ -5838,27 +5315,6 @@ void LLVOAvatar::hideSkirt() mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE); } - -//----------------------------------------------------------------------------- -// requestLayerSetUpdate() -//----------------------------------------------------------------------------- -void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index ) -{ - /* switch(index) - case LOCTEX_UPPER_BODYPAINT: - case LOCTEX_UPPER_SHIRT: - if( mUpperBodyLayerSet ) - mUpperBodyLayerSet->requestUpdate(); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); - if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) - return; - const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - if (mBakedTextureData[baked_index].mTexLayerSet) - { - mBakedTextureData[baked_index].mTexLayerSet->requestUpdate(); - } -} - void LLVOAvatar::setParent(LLViewerObject* parent) { if (parent == NULL) @@ -5913,13 +5369,13 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi //----------------------------------------------------------------------------- // attachObject() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) +LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_object) { LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object); if (!attachment || !attachment->addObject(viewer_object)) { - return FALSE; + return 0; } if (viewer_object->isSelected()) @@ -5928,16 +5384,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) LLSelectMgr::getInstance()->updatePointAt(); } - if (mIsSelf) - { - updateAttachmentVisibility(gAgent.getCameraMode()); - - // Then make sure the inventory is in sync with the avatar. - gInventory.addChangedMask( LLInventoryObserver::LABEL, attachment->getItemID() ); - gInventory.notifyObservers(); - } - - return TRUE; + return attachment; } //----------------------------------------------------------------------------- @@ -5995,7 +5442,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) { LLUUID item_id = attachment->getItemID(); attachment->removeObject(viewer_object); - if (mIsSelf) + if (isSelf()) { // the simulator should automatically handle // permission revocation @@ -6017,7 +5464,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) } lldebugs << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << llendl; - if (mIsSelf) + if (isSelf()) { // Then make sure the inventory is in sync with the avatar. gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); @@ -6027,7 +5474,6 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) } } - return FALSE; } @@ -6057,7 +5503,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) stopMotion(ANIM_AGENT_BODY_NOISE); - if (mIsSelf) + if (isSelf()) { // Might be first sit LLFirstUse::useSit(); @@ -6069,7 +5515,10 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) // make sure we are not trying to autopilot gAgent.stopAutoPilot(); gAgent.setupSitCamera(); - if (gAgent.mForceMouselook) gAgent.changeCameraToMouselook(); + if (gAgent.getForceMouselook()) + { + gAgent.changeCameraToMouselook(); + } } } @@ -6119,7 +5568,7 @@ void LLVOAvatar::getOffObject() startMotion(ANIM_AGENT_BODY_NOISE); - if (mIsSelf) + if (isSelf()) { LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion(); LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT; @@ -6160,146 +5609,24 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) return NULL; } -//----------------------------------------------------------------------------- -// isWearingAttachment() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::isWearingAttachment( const LLUUID& inv_item_id ) -{ - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if( attachment->getItemID() == inv_item_id ) - { - return TRUE; - } - } - return FALSE; -} - -//----------------------------------------------------------------------------- -// getWornAttachment() -//----------------------------------------------------------------------------- -LLViewerObject* LLVOAvatar::getWornAttachment( const LLUUID& inv_item_id ) -{ - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if( attachment->getItemID() == inv_item_id ) - { - return attachment->getObject(); - } - } - return NULL; -} - -const std::string LLVOAvatar::getAttachedPointName(const LLUUID& inv_item_id) -{ - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if( attachment->getItemID() == inv_item_id ) - { - return attachment->getName(); - } - } - - return LLStringUtil::null; -} - - -//----------------------------------------------------------------------------- -// static -// onLocalTextureLoaded() -//----------------------------------------------------------------------------- - -void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) -{ - //llinfos << "onLocalTextureLoaded: " << src_vi->getID() << llendl; - - const LLUUID& src_id = src_vi->getID(); - LLAvatarTexData *data = (LLAvatarTexData *)userdata; - if (success) - { - LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); - if (self) - { - ETextureIndex index = data->mIndex; - if (!self->isIndexLocalTexture(index)) return; - LocalTextureData &local_tex_data = self->mLocalTextureData[index]; - if(!local_tex_data.mIsBakedReady && - local_tex_data.mImage.notNull() && - (local_tex_data.mImage->getID() == src_id) && - discard_level < local_tex_data.mDiscard) - { - local_tex_data.mDiscard = discard_level; - if ( self->isSelf() && !gAgent.cameraCustomizeAvatar() ) - { - self->requestLayerSetUpdate( index ); - } - else if( self->isSelf() && gAgent.cameraCustomizeAvatar() ) - { - LLVisualParamHint::requestHintUpdates(); - } - self->updateMeshTextures(); - } - } - } - else if (final) - { - LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); - if (self) - { - ETextureIndex index = data->mIndex; - if (!self->isIndexLocalTexture(index)) return; - LocalTextureData &local_tex_data = self->mLocalTextureData[index]; - // Failed: asset is missing - if(!local_tex_data.mIsBakedReady && - local_tex_data.mImage.notNull() && - local_tex_data.mImage->getID() == src_id) - { - local_tex_data.mDiscard = 0; - self->requestLayerSetUpdate( index ); - self->updateMeshTextures(); - } - } - } - - if( final || !success ) - { - delete data; - } -} - -void LLVOAvatar::updateComposites() +// warning: order(N) not order(1) +S32 LLVOAvatar::getAttachmentCount() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - if ( mBakedTextureData[i].mTexLayerSet - && ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) ) - { - mBakedTextureData[i].mTexLayerSet->updateComposite(); - } - } + S32 count = mAttachmentPoints.size(); + return count; } -LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) +LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const { - if( color_name=="skin_color" && mTexSkinColor ) + if (color_name=="skin_color" && mTexSkinColor) { return mTexSkinColor->getColor(); } - else - if( color_name=="hair_color" && mTexHairColor ) + else if(color_name=="hair_color" && mTexHairColor) { return mTexHairColor->getColor(); } - if( color_name=="eye_color" && mTexEyeColor ) + if(color_name=="eye_color" && mTexEyeColor) { return mTexEyeColor->getColor(); } @@ -6310,282 +5637,64 @@ LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) } } - +// virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ) { - if( !layerset || !layerset->getUpdatesEnabled() ) - { - return; - } - - /* Debug spam. JC - const char* layer_name = ""; - if (layerset == mHeadLayerSet) - { - layer_name = "head"; - } - else if (layerset == mUpperBodyLayerSet) - { - layer_name = "upperbody"; - } - else if (layerset == mLowerBodyLayerSet) - { - layer_name = "lowerbody"; - } - else if (layerset == mEyesLayerSet) - { - layer_name = "eyes"; - } - else if (layerset == mHairLayerSet) - { - layer_name = "hair"; - } - else if (layerset == mSkirtLayerSet) - { - layer_name = "skirt"; - } - else - { - layer_name = "unknown"; - } - llinfos << "LLVOAvatar::invalidComposite() " << layer_name << llendl; - */ - - layerset->requestUpdate(); - - if( set_by_user ) - { - llassert( mIsSelf ); - - ETextureIndex baked_te = getBakedTE( layerset ); - setTEImage( baked_te, gImageList.getImage(IMG_DEFAULT_AVATAR) ); - layerset->requestUpload(); - } } void LLVOAvatar::invalidateAll() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - invalidateComposite(mBakedTextureData[i].mTexLayerSet, TRUE); - } - updateMeshTextures(); } -void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user ) +// virtual +void LLVOAvatar::setCompositeUpdatesEnabled( BOOL b ) { - if( global_color == mTexSkinColor ) +} + +void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user ) +{ + if (global_color == mTexSkinColor) { -// llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl; - invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user ); } - else - if( global_color == mTexHairColor ) + else if (global_color == mTexHairColor) { -// llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl; - invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_HAIR].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, set_by_user ); // ! BACKWARDS COMPATIBILITY ! // Fix for dealing with avatars from viewers that don't bake hair. - if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) + if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex)) { LLColor4 color = mTexHairColor->getColor(); - for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); } } - } - else - if( global_color == mTexEyeColor ) + } + else if (global_color == mTexEyeColor) { // llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; - invalidateComposite( mBakedTextureData[BAKED_EYES].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet, set_by_user ); } updateMeshTextures(); } -void LLVOAvatar::forceBakeAllTextures(bool slam_for_debug) -{ - llinfos << "TAT: forced full rebake. " << llendl; - - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - ETextureIndex baked_index = mBakedTextureData[i].mTextureIndex; - LLTexLayerSet* layer_set = getLayerSet(baked_index); - if (layer_set) - { - if (slam_for_debug) - { - layer_set->setUpdatesEnabled(TRUE); - layer_set->cancelUpload(); - } - - BOOL set_by_user = TRUE; - invalidateComposite(layer_set, set_by_user); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); - } - else - { - llwarns << "TAT: NO LAYER SET FOR " << (S32)baked_index << llendl; - } - } - - // Don't know if this is needed - updateMeshTextures(); -} - - -// static -void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) -{ - LLUUID texture_id; - msg->getUUID("TextureData", "TextureID", texture_id); - - LLVOAvatar* self = gAgent.getAvatarObject(); - if (!self) return; - - // If this is a texture corresponding to one of our baked entries, - // just rebake that layer set. - BOOL found = FALSE; - - /* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] = - TEX_HEAD_BAKED, - TEX_UPPER_BAKED, */ - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - iter++) - { - const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; - if (text_dict->mIsBakedTexture) - { - if (texture_id == self->getTEImage(index)->getID()) - { - LLTexLayerSet* layer_set = self->getLayerSet(index); - if (layer_set) - { - llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; - // Apparently set_by_user == force upload - BOOL set_by_user = TRUE; - self->invalidateComposite(layer_set, set_by_user); - found = TRUE; - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); - } - } - } - } - - // If texture not found, rebake all entries. - if (!found) - { - self->forceBakeAllTextures(); - } - else - { - // Not sure if this is necessary, but forceBakeAllTextures() does it. - self->updateMeshTextures(); - } -} - - -BOOL LLVOAvatar::getLocalTextureRaw(ETextureIndex index, LLImageRaw* image_raw) -{ - if (!isIndexLocalTexture(index)) return FALSE; - - BOOL success = FALSE; - - if (getLocalTextureID(index) == IMG_DEFAULT_AVATAR) - { - success = TRUE; - } - else - { - LocalTextureData &local_tex_data = mLocalTextureData[index]; - if(local_tex_data.mImage->readBackRaw(-1, image_raw, false)) - { - success = TRUE; - } - else - { - // No data loaded yet - setLocalTexture( (ETextureIndex)index, getTEImage( index ), FALSE ); - } - } - return success; -} - -BOOL LLVOAvatar::getLocalTextureGL(ETextureIndex index, LLImageGL** image_gl_pp) -{ - if (!isIndexLocalTexture(index)) return FALSE; - - BOOL success = FALSE; - *image_gl_pp = NULL; - - if (getLocalTextureID(index) == IMG_DEFAULT_AVATAR) - { - success = TRUE; - } - else - { - LocalTextureData &local_tex_data = mLocalTextureData[index]; - *image_gl_pp = local_tex_data.mImage; - success = TRUE; - } - - if( !success ) - { -// llinfos << "getLocalTextureGL(" << index << ") had no data" << llendl; - } - return success; -} - -const LLUUID& LLVOAvatar::getLocalTextureID(ETextureIndex index) -{ - if (!isIndexLocalTexture(index)) return IMG_DEFAULT_AVATAR; - - if (mLocalTextureData[index].mImage.notNull()) - { - return mLocalTextureData[index].mImage->getID(); - } - else - { - return IMG_DEFAULT_AVATAR; - } -} - -// static -void LLVOAvatar::dumpTotalLocalTextureByteCount() -{ - S32 total_gl_bytes = 0; - for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) - { - LLVOAvatar* cur = (LLVOAvatar*) *iter; - S32 gl_bytes = 0; - cur->getLocalTextureByteCount(&gl_bytes ); - total_gl_bytes += gl_bytes; - } - llinfos << "Total Avatar LocTex GL:" << (total_gl_bytes/1024) << "KB" << llendl; -} - -BOOL LLVOAvatar::isVisible() +BOOL LLVOAvatar::isVisible() const { return mDrawable.notNull() && (mDrawable->isVisible() || mIsDummy); } - // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() { // a "heuristic" to determine if we have enough avatar data to render // (to avoid rendering a "Ruth" - DEV-3168) - BOOL loading = FALSE; // do we have a shape? @@ -6594,48 +5703,18 @@ BOOL LLVOAvatar::updateIsFullyLoaded() loading = TRUE; } - // - if (mIsSelf) - { - if (!isTextureDefined(TEX_HAIR)) - { - loading = TRUE; - } - } - else if (!isTextureDefined(TEX_LOWER_BAKED) || !isTextureDefined(TEX_UPPER_BAKED) || !isTextureDefined(TEX_HEAD_BAKED)) + if (!isTextureDefined(TEX_LOWER_BAKED) || + !isTextureDefined(TEX_UPPER_BAKED) || + !isTextureDefined(TEX_HEAD_BAKED)) { loading = TRUE; } - // special case to keep nudity off orientation island - - // this is fragilely dependent on the compositing system, - // which gets available textures in the following order: - // - // 1) use the baked texture - // 2) use the layerset - // 3) use the previously baked texture - // - // on orientation island case (3) can show naked skin. - // so we test for that here: - // - // if we were previously unloaded, and we don't have enough - // texture info for our shirt/pants, stay unloaded: - if (!mPreviousFullyLoaded) - { - if ((!isLocalTextureDataAvailable(mBakedTextureData[BAKED_LOWER].mTexLayerSet)) && - (!isTextureDefined(TEX_LOWER_BAKED))) - { - loading = TRUE; - } - - if ((!isLocalTextureDataAvailable(mBakedTextureData[BAKED_UPPER].mTexLayerSet)) && - (!isTextureDefined(TEX_UPPER_BAKED))) - { - loading = TRUE; - } - } + return processFullyLoadedChange(loading); +} - +BOOL LLVOAvatar::processFullyLoadedChange(bool loading) +{ // we wait a little bit before giving the all clear, // to let textures settle down const F32 PAUSE = 1.f; @@ -6659,8 +5738,7 @@ BOOL LLVOAvatar::updateIsFullyLoaded() return changed; } - -BOOL LLVOAvatar::isFullyLoaded() +BOOL LLVOAvatar::isFullyLoaded() const { if (gSavedSettings.getBOOL("RenderUnloadedAvatar")) return TRUE; @@ -6672,177 +5750,11 @@ BOOL LLVOAvatar::isFullyLoaded() //----------------------------------------------------------------------------- // findMotion() //----------------------------------------------------------------------------- -LLMotion* LLVOAvatar::findMotion(const LLUUID& id) +LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const { return mMotionController.findMotion(id); } -// Counts the memory footprint of local textures. -void LLVOAvatar::getLocalTextureByteCount( S32* gl_bytes ) -{ - *gl_bytes = 0; - for( S32 i = 0; i < TEX_NUM_INDICES; i++ ) - { - if (!isIndexLocalTexture((ETextureIndex)i)) continue; - LLViewerImage* image_gl = mLocalTextureData[(ETextureIndex)i].mImage; - if( image_gl ) - { - S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); - - if( image_gl->getHasGLTexture() ) - { - *gl_bytes += bytes; - } - } - } -} - - -BOOL LLVOAvatar::bindScratchTexture( LLGLenum format ) -{ - U32 texture_bytes = 0; - GLuint gl_name = getScratchTexName( format, &texture_bytes ); - if( gl_name ) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); - stop_glerror(); - - F32* last_bind_time = LLVOAvatar::sScratchTexLastBindTime.getIfThere( format ); - if( last_bind_time ) - { - if( *last_bind_time != LLImageGL::sLastFrameTime ) - { - *last_bind_time = LLImageGL::sLastFrameTime; - LLImageGL::updateBoundTexMem(texture_bytes); - } - } - else - { - LLImageGL::updateBoundTexMem(texture_bytes); - LLVOAvatar::sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); - } - - - return TRUE; - } - else - { - return FALSE; - } -} - - -LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) -{ - S32 components; - GLenum internal_format; - switch( format ) - { - case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; - case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; - case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; - case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; - case GL_RGB: components = 3; internal_format = GL_RGB8; break; - case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; - default: llassert(0); components = 4; internal_format = GL_RGBA8; break; - } - - *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT; - - if( LLVOAvatar::sScratchTexNames.checkData( format ) ) - { - return *( LLVOAvatar::sScratchTexNames.getData( format ) ); - } - else - { - - LLGLSUIDefault gls_ui; - - U32 name = 0; - LLImageGL::generateTextures(1, &name ); - stop_glerror(); - - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); - stop_glerror(); - - LLImageGL::setManualImage( - GL_TEXTURE_2D, 0, internal_format, - SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT, - format, GL_UNSIGNED_BYTE, NULL ); - stop_glerror(); - - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - stop_glerror(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - stop_glerror(); - - LLVOAvatar::sScratchTexNames.addData( format, new LLGLuint( name ) ); - - LLVOAvatar::sScratchTexBytes += *texture_bytes; - LLImageGL::sGlobalTextureMemory += *texture_bytes; - return name; - } -} - - - -//----------------------------------------------------------------------------- -// setLocalTextureTE() -//----------------------------------------------------------------------------- -void LLVOAvatar::setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user ) -{ - if( !mIsSelf ) - { - llassert( 0 ); - return; - } - - if( te >= TEX_NUM_INDICES ) - { - llassert(0); - return; - } - - if( getTEImage( te )->getID() == image->getID() ) - { - return; - } - - if (isIndexBakedTexture((ETextureIndex)te)) - { - llassert(0); - return; - } - - LLTexLayerSet* layer_set = getLayerSet((ETextureIndex)te); - if (layer_set) - { - invalidateComposite(layer_set, set_by_user); - } - - setTEImage( te, image ); - updateMeshTextures(); - - if( gAgent.cameraCustomizeAvatar() ) - { - LLVisualParamHint::requestHintUpdates(); - } -} - -void LLVOAvatar::setupComposites() -{ - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); - if (mBakedTextureData[i].mTexLayerSet) - { - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( !layer_baked ); - } - } -} - //----------------------------------------------------------------------------- // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. @@ -6855,25 +5767,25 @@ void LLVOAvatar::updateMeshTextures() // if user has never specified a texture, assign the default for (U32 i=0; i < getNumTEs(); i++) { - const LLViewerImage* te_image = getTEImage(i); + const LLViewerImage* te_image = getImage(i); if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT)) { - setTEImage(i, gImageList.getImage(i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR)); // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + setImage(i, gImageList.getImage(i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR)); // IMG_DEFAULT_AVATAR = a special texture that's never rendered. } } - const BOOL self_customizing = mIsSelf && gAgent.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures - const BOOL other_culled = !mIsSelf && mCulled; + const BOOL self_customizing = isSelf() && gAgent.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures + const BOOL other_culled = !isSelf() && mCulled; - std::vector is_layer_baked; - is_layer_baked.resize(mBakedTextureData.size(), false); + std::vector is_layer_baked; + is_layer_baked.resize(mBakedTextureDatas.size(), false); - std::vector use_lkg_baked_layer; // lkg = "last known good" - use_lkg_baked_layer.resize(mBakedTextureData.size(), false); + std::vector use_lkg_baked_layer; // lkg = "last known good" + use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); - for (U32 i=0; i < mBakedTextureData.size(); i++) + for (U32 i=0; i < mBakedTextureDatas.size(); i++) { - is_layer_baked[i] = isTextureDefined(mBakedTextureData[i].mTextureIndex); + is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); if (!other_culled) { @@ -6881,21 +5793,21 @@ void LLVOAvatar::updateMeshTextures() // use the last-known good baked texture until it finish the first // render of the new layerset. use_lkg_baked_layer[i] = (!is_layer_baked[i] - && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) - && mBakedTextureData[i].mTexLayerSet - && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized()); + && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) + && mBakedTextureDatas[i].mTexLayerSet + && !mBakedTextureDatas[i].mTexLayerSet->getComposite()->isInitialized()); if (use_lkg_baked_layer[i]) { - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled(TRUE); + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE); } } else { use_lkg_baked_layer[i] = (!is_layer_baked[i] - && mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); - if (mBakedTextureData[i].mTexLayerSet) + && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); + if (mBakedTextureDatas[i].mTexLayerSet) { - mBakedTextureData[i].mTexLayerSet->destroyComposite(); + mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } } @@ -6908,28 +5820,28 @@ void LLVOAvatar::updateMeshTextures() llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; } - for (U32 i=0; i < mBakedTextureData.size(); i++) + for (U32 i=0; i < mBakedTextureDatas.size(); i++) { if (use_lkg_baked_layer[i] && !self_customizing ) { - LLViewerImage* baked_img = gImageList.getImageFromHost( mBakedTextureData[i].mLastTextureIndex, target_host ); - mBakedTextureData[i].mIsUsed = TRUE; - for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) + LLViewerImage* baked_img = gImageList.getImageFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + mBakedTextureDatas[i].mIsUsed = TRUE; + for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureData[i].mMeshes[k]->setTexture( baked_img ); + mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); } } else if (!self_customizing && is_layer_baked[i]) { - LLViewerImage* baked_img = getTEImage( mBakedTextureData[i].mTextureIndex ); - if( baked_img->getID() == mBakedTextureData[i].mLastTextureIndex ) + LLViewerImage* baked_img = getImage( mBakedTextureDatas[i].mTextureIndex ); + if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) { // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). useBakedTexture( baked_img->getID() ); } else { - mBakedTextureData[i].mIsLoaded = FALSE; + mBakedTextureDatas[i].mIsLoaded = FALSE; if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); @@ -6937,133 +5849,63 @@ void LLVOAvatar::updateMeshTextures() baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) ); } } - else if (mBakedTextureData[i].mTexLayerSet + else if (mBakedTextureDatas[i].mTexLayerSet && !other_culled - && (i != BAKED_HAIR || is_layer_baked[i] || mIsSelf)) // ! BACKWARDS COMPATIBILITY ! workaround for old viewers. + && (i != BAKED_HAIR || is_layer_baked[i] || isSelf())) // ! BACKWARDS COMPATIBILITY ! workaround for old viewers. { - mBakedTextureData[i].mTexLayerSet->createComposite(); - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE ); - mBakedTextureData[i].mIsUsed = FALSE; - for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) + mBakedTextureDatas[i].mTexLayerSet->createComposite(); + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); + mBakedTextureDatas[i].mIsUsed = FALSE; + for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet ); + mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); } } } // ! BACKWARDS COMPATIBILITY ! // Workaround for viewing avatars from old viewers that haven't baked hair textures. - // if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) if (!is_layer_baked[BAKED_HAIR] || self_customizing) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); - LLViewerImage* hair_img = getTEImage( TEX_HAIR ); - for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) + LLViewerImage* hair_img = getImage( TEX_HAIR ); + for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); } - mHasBakedHair = FALSE; } - else - { - mHasBakedHair = TRUE; - } - /* // Head - BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureData[BAKED_HEAD].mIsLoaded) || other_culled; - setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */ - for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + // Turn on alpha masking correctly for yourself and other avatars on 1.23+ + mSupportsAlphaLayers = isSelf() || is_layer_baked[BAKED_HAIR]; + + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); baked_iter++) { const EBakedTextureIndex baked_index = baked_iter->first; - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); local_tex_iter++) { const ETextureIndex texture_index = *local_tex_iter; - const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureData[baked_index].mIsLoaded) || other_culled; - setLocalTexture(texture_index, getTEImage(texture_index), is_baked_ready ); + const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureDatas[baked_index].mIsLoaded) || other_culled; + setLocalTexture(texture_index, getImage(texture_index), is_baked_ready ); } } removeMissingBakedTextures(); } +// virtual //----------------------------------------------------------------------------- // setLocalTexture() //----------------------------------------------------------------------------- -void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerImage* tex, BOOL baked_version_ready ) -{ - if (!isIndexLocalTexture(index)) return; - - S32 desired_discard = mIsSelf ? 0 : 2; - LocalTextureData &local_tex_data = mLocalTextureData[index]; - if (!baked_version_ready) - { - if (tex != local_tex_data.mImage || local_tex_data.mIsBakedReady) - { - local_tex_data.mDiscard = MAX_DISCARD_LEVEL+1; - } - if (tex->getID() != IMG_DEFAULT_AVATAR) - { - if (local_tex_data.mDiscard > desired_discard) - { - S32 tex_discard = tex->getDiscardLevel(); - if (tex_discard >= 0 && tex_discard <= desired_discard) - { - local_tex_data.mDiscard = tex_discard; - if( mIsSelf && !gAgent.cameraCustomizeAvatar() ) - { - requestLayerSetUpdate( index ); - } - else if( mIsSelf && gAgent.cameraCustomizeAvatar() ) - { - LLVisualParamHint::requestHintUpdates(); - } - } - else - { - tex->setLoadedCallback( onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), index) ); - } - } - tex->setMinDiscardLevel(desired_discard); - } - } - local_tex_data.mIsBakedReady = baked_version_ready; - local_tex_data.mImage = tex; -} - -//----------------------------------------------------------------------------- -// requestLayerSetUploads() -//----------------------------------------------------------------------------- -void LLVOAvatar::requestLayerSetUploads() +void LLVOAvatar::setLocalTexture(ETextureIndex type, LLViewerImage* tex, BOOL baked_version_exists, U32 index) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); - if ( !layer_baked && mBakedTextureData[i].mTexLayerSet ) - { - mBakedTextureData[i].mTexLayerSet->requestUpload(); - } - } -} - - -//----------------------------------------------------------------------------- -// setCompositeUpdatesEnabled() -//----------------------------------------------------------------------------- -void LLVOAvatar::setCompositeUpdatesEnabled( BOOL b ) -{ - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - if (mBakedTextureData[i].mTexLayerSet ) - { - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( b ); - } - } + // invalid for anyone but self + llassert(0); } void LLVOAvatar::addChat(const LLChat& chat) @@ -7095,184 +5937,85 @@ void LLVOAvatar::clearChat() mChats.clear(); } -S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) +// adds a morph mask to the appropriate baked texture structure +void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer) { - if (!isIndexLocalTexture(index)) return FALSE; - - LocalTextureData &local_tex_data = mLocalTextureData[index]; - if (index >= 0 - && getLocalTextureID(index) != IMG_DEFAULT_AVATAR - && !local_tex_data.mImage->isMissingAsset()) + if (index < BAKED_NUM_INDICES) { - return local_tex_data.mImage->getDiscardLevel(); - } - else - { - // We don't care about this (no image associated with the layer) treat as fully loaded. - return 0; + LLMaskedMorph *morph = new LLMaskedMorph(morph_target, invert, layer); + mBakedTextureDatas[index].mMaskedMorphs.push_front(morph); } } -//----------------------------------------------------------------------------- -// isLocalTextureDataFinal() -// Returns true if the highest quality discard level exists for every texture -// in the layerset. -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::isLocalTextureDataFinal( LLTexLayerSet* layerset ) +// invalidates morph masks for a given layer. Don't pass a parameter to invalidate all morph masks. +void LLVOAvatar::invalidateMorphMasks(LLVOAvatarDefines::EBakedTextureIndex index) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - if (layerset == mBakedTextureData[i].mTexLayerSet) - { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); - for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); - local_tex_iter != baked_dict->mLocalTextures.end(); - local_tex_iter++) - { - if (getLocalDiscardLevel(*local_tex_iter) != 0) - { - return FALSE; - } - } - return TRUE; - } - } - - llassert(0); - return FALSE; + setMorphMasksValid(FALSE, index); } -//----------------------------------------------------------------------------- -// isLocalTextureDataAvailable() -// Returns true if at least the lowest quality discard level exists for every texture -// in the layerset. -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::isLocalTextureDataAvailable( LLTexLayerSet* layerset ) +// updates morph masks to be a value for a given layer. Don't pass an argument to set value for all morph masks +void LLVOAvatar::setMorphMasksValid(BOOL new_status, LLVOAvatarDefines::EBakedTextureIndex index) { - /* if( layerset == mBakedTextureData[BAKED_HEAD].mTexLayerSet ) - return getLocalDiscardLevel( TEX_HEAD_BODYPAINT ) >= 0; */ - for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); - baked_iter++) + if (index == BAKED_NUM_INDICES) { - const EBakedTextureIndex baked_index = baked_iter->first; - if (layerset == mBakedTextureData[baked_index].mTexLayerSet) + for (U8 tex = 0; tex < (U8)BAKED_NUM_INDICES; tex++) { - bool ret = true; - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; - for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); - local_tex_iter != baked_dict->mLocalTextures.end(); - local_tex_iter++) - { - ret &= (getLocalDiscardLevel(*local_tex_iter) >= 0); - } - return ret; + mBakedTextureDatas[tex].mMorphMasksValid = new_status; } - } - llassert(0); - return FALSE; -} - - -//----------------------------------------------------------------------------- -// getBakedTE() -// Used by the LayerSet. (Layer sets don't in general know what textures depend on them.) -//----------------------------------------------------------------------------- -ETextureIndex LLVOAvatar::getBakedTE( LLTexLayerSet* layerset ) -{ - for (U32 i = 0; i < mBakedTextureData.size(); i++) + } + else if (index < BAKED_NUM_INDICES) { - if (layerset == mBakedTextureData[i].mTexLayerSet ) - { - return mBakedTextureData[i].mTextureIndex; - } + mBakedTextureDatas[index].mMorphMasksValid = new_status; } - - llassert(0); - return TEX_HEAD_BAKED; } -//----------------------------------------------------------------------------- -// setNewBakedTexture() -// A new baked texture has been successfully uploaded and we can start using it now. -//----------------------------------------------------------------------------- -void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) +// returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise +BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index) { - // Baked textures live on other sims. - LLHost target_host = getObjectHost(); - setTEImage( te, gImageList.getImageFromHost( uuid, target_host ) ); - updateMeshTextures(); - dirtyMesh(); - - - LLVOAvatar::cullAvatarsByPixelArea(); - - /* switch(te) - case TEX_HEAD_BAKED: - llinfos << "New baked texture: HEAD" << llendl; */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(te); - if (text_dict->mIsBakedTexture) - { - llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <mBakedTextureIndex].mTexLayerSet->requestUpdate(); - } - else + if (index >= BAKED_NUM_INDICES) { - llwarns << "New baked texture: unknown te " << te << llendl; + return FALSE; } - - // dumpAvatarTEs( "setNewBakedTexture() send" ); - // RN: throttle uploads - if (!hasPendingBakedUploads()) + + if (!mBakedTextureDatas[index].mMaskedMorphs.empty() && !mBakedTextureDatas[index].mMorphMasksValid) { - gAgent.sendAgentSetAppearance(); + return TRUE; } + + return FALSE; } -bool LLVOAvatar::hasPendingBakedUploads() +void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + if (index >= BAKED_NUM_INDICES) { - bool upload_pending = (mBakedTextureData[i].mTexLayerSet && mBakedTextureData[i].mTexLayerSet->getComposite()->uploadPending()); - if (upload_pending) - { - return true; - } + llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; + return; } - return false; -} -//----------------------------------------------------------------------------- -// setCachedBakedTexture() -// A baked texture id was received from a cache query, make it active -//----------------------------------------------------------------------------- -void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid ) -{ - setTETexture( te, uuid ); - - /* switch(te) - case TEX_HEAD_BAKED: - if( mHeadLayerSet ) - mHeadLayerSet->cancelUpload(); */ - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - if ( mBakedTextureData[i].mTextureIndex == te && mBakedTextureData[i].mTexLayerSet) - { - mBakedTextureData[i].mTexLayerSet->cancelUpload(); - } + for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); + iter != mBakedTextureDatas[index].mMaskedMorphs.end(); iter++) + { + const LLMaskedMorph* maskedMorph = (*iter); + maskedMorph->mMorphTarget->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); } } + //----------------------------------------------------------------------------- -// releaseUnneccesaryTextures() +// releaseComponentTextures() // release any component texture UUIDs for which we have a baked texture +// ! BACKWARDS COMPATIBILITY ! +// This is only called for non-self avatars, it can be taken out once component +// textures aren't communicated by non-self avatars. //----------------------------------------------------------------------------- -void LLVOAvatar::releaseUnnecessaryTextures() +void LLVOAvatar::releaseComponentTextures() { - // Backwards Compat: detect if the baked hair texture actually wasn't sent, and if so set to default - if (isTextureDefined(TEX_HAIR_BAKED) && getTEImage(TEX_HAIR_BAKED)->getID() == getTEImage(TEX_SKIRT_BAKED)->getID()) + // ! BACKWARDS COMPATIBILITY ! + // Detect if the baked hair texture actually wasn't sent, and if so set to default + if (isTextureDefined(TEX_HAIR_BAKED) && getImage(TEX_HAIR_BAKED)->getID() == getImage(TEX_SKIRT_BAKED)->getID()) { - if (getTEImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE) + if (getImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE) { // Regression case of messaging system. Expected 21 textures, received 20. last texture is not valid so set to default setTETexture(TEX_HAIR_BAKED, IMG_DEFAULT_AVATAR); @@ -7281,7 +6024,7 @@ void LLVOAvatar::releaseUnnecessaryTextures() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID if (!isTextureDefined(bakedDicEntry->mTextureIndex) && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) )) @@ -7297,111 +6040,68 @@ void LLVOAvatar::releaseUnnecessaryTextures() } } -//----------------------------------------------------------------------------- -// static -// onCustomizeStart() -//----------------------------------------------------------------------------- -void LLVOAvatar::onCustomizeStart() -{ - // We're no longer doing any baking or invalidating on entering - // appearance editing mode. Leaving function in place in case - // further changes require us to do something at this point - Nyx -} - -//----------------------------------------------------------------------------- -// static -// onCustomizeEnd() -//----------------------------------------------------------------------------- -void LLVOAvatar::onCustomizeEnd() -{ - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - if (avatarp) - { - avatarp->invalidateAll(); - avatarp->requestLayerSetUploads(); - } -} - -void LLVOAvatar::onChangeSelfInvisible(BOOL newvalue) -{ - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - if (avatarp) - { - if (newvalue) - { - // we have just requested to set the avatar's baked textures to invisible - avatarp->setInvisible(TRUE); - } - else - { - avatarp->setInvisible(FALSE); - } - } -} - - BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] ) { switch( te ) { - case TEX_UPPER_SHIRT: - param_name[0] = "shirt_red"; - param_name[1] = "shirt_green"; - param_name[2] = "shirt_blue"; - break; - - case TEX_LOWER_PANTS: - param_name[0] = "pants_red"; - param_name[1] = "pants_green"; - param_name[2] = "pants_blue"; - break; - - case TEX_LOWER_SHOES: - param_name[0] = "shoes_red"; - param_name[1] = "shoes_green"; - param_name[2] = "shoes_blue"; - break; - - case TEX_LOWER_SOCKS: - param_name[0] = "socks_red"; - param_name[1] = "socks_green"; - param_name[2] = "socks_blue"; - break; - - case TEX_UPPER_JACKET: - case TEX_LOWER_JACKET: - param_name[0] = "jacket_red"; - param_name[1] = "jacket_green"; - param_name[2] = "jacket_blue"; - break; - - case TEX_UPPER_GLOVES: - param_name[0] = "gloves_red"; - param_name[1] = "gloves_green"; - param_name[2] = "gloves_blue"; - break; - - case TEX_UPPER_UNDERSHIRT: - param_name[0] = "undershirt_red"; - param_name[1] = "undershirt_green"; - param_name[2] = "undershirt_blue"; - break; + case TEX_UPPER_SHIRT: + param_name[0] = "shirt_red"; + param_name[1] = "shirt_green"; + param_name[2] = "shirt_blue"; + break; + + case TEX_LOWER_PANTS: + param_name[0] = "pants_red"; + param_name[1] = "pants_green"; + param_name[2] = "pants_blue"; + break; + + case TEX_LOWER_SHOES: + param_name[0] = "shoes_red"; + param_name[1] = "shoes_green"; + param_name[2] = "shoes_blue"; + break; + + case TEX_LOWER_SOCKS: + param_name[0] = "socks_red"; + param_name[1] = "socks_green"; + param_name[2] = "socks_blue"; + break; + + case TEX_UPPER_JACKET: + case TEX_LOWER_JACKET: + param_name[0] = "jacket_red"; + param_name[1] = "jacket_green"; + param_name[2] = "jacket_blue"; + break; + + case TEX_UPPER_GLOVES: + param_name[0] = "gloves_red"; + param_name[1] = "gloves_green"; + param_name[2] = "gloves_blue"; + break; + + case TEX_UPPER_UNDERSHIRT: + param_name[0] = "undershirt_red"; + param_name[1] = "undershirt_green"; + param_name[2] = "undershirt_blue"; + break; - case TEX_LOWER_UNDERPANTS: - param_name[0] = "underpants_red"; - param_name[1] = "underpants_green"; - param_name[2] = "underpants_blue"; - break; - - case TEX_SKIRT: - param_name[0] = "skirt_red"; - param_name[1] = "skirt_green"; - param_name[2] = "skirt_blue"; - break; - - default: - llassert(0); - return FALSE; + case TEX_LOWER_UNDERPANTS: + param_name[0] = "underpants_red"; + param_name[1] = "underpants_green"; + param_name[2] = "underpants_blue"; + break; + + case TEX_SKIRT: + param_name[0] = "skirt_red"; + param_name[1] = "skirt_green"; + param_name[2] = "skirt_blue"; + break; + + default: + llassert(0); + return FALSE; } return TRUE; @@ -7431,140 +6131,53 @@ LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) return color; } - - +// static +LLColor4 LLVOAvatar::getDummyColor() +{ + return DUMMY_COLOR; +} void LLVOAvatar::dumpAvatarTEs( const std::string& context ) { /* const char* te_name[] = { "TEX_HEAD_BODYPAINT ", "TEX_UPPER_SHIRT ", */ - llinfos << (mIsSelf ? "Self: " : "Other: ") << context << llendl; - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + llinfos << (isSelf() ? "Self: " : "Other: ") << context << llendl; + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); iter++) { - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; - const LLViewerImage* te_image = getTEImage(iter->first); + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLViewerImage* te_image = getImage(iter->first); if( !te_image ) { - llinfos << " " << text_dict->mName << ": null ptr" << llendl; + llinfos << " " << texture_dict->mName << ": null ptr" << llendl; } else if( te_image->getID().isNull() ) { - llinfos << " " << text_dict->mName << ": null UUID" << llendl; + llinfos << " " << texture_dict->mName << ": null UUID" << llendl; } else if( te_image->getID() == IMG_DEFAULT ) { - llinfos << " " << text_dict->mName << ": IMG_DEFAULT" << llendl; + llinfos << " " << texture_dict->mName << ": IMG_DEFAULT" << llendl; } else if( te_image->getID() == IMG_DEFAULT_AVATAR ) { - llinfos << " " << text_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl; - } - else - { - llinfos << " " << text_dict->mName << ": " << te_image->getID() << llendl; - } - } -} - -//----------------------------------------------------------------------------- -// updateAttachmentVisibility() -//----------------------------------------------------------------------------- -void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode) -{ - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) - { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - if (attachment->getIsHUDAttachment()) - { - attachment->setAttachmentVisibility(TRUE); + llinfos << " " << texture_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl; } else { - switch (camera_mode) - { - case CAMERA_MODE_MOUSELOOK: - if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson()) - { - attachment->setAttachmentVisibility(TRUE); - } - else - { - attachment->setAttachmentVisibility(FALSE); - } - break; - default: - attachment->setAttachmentVisibility(TRUE); - break; - } - } - } -} - -// Given a texture entry, determine which wearable type owns it. -// static -LLUUID LLVOAvatar::getDefaultTEImageID(ETextureIndex index ) -{ - /* switch( index ) - case TEX_UPPER_SHIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultShirtUUID") ); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); - const std::string &default_image_name = text_dict->mDefaultImageName; - if (default_image_name == "") - { - return IMG_DEFAULT_AVATAR; - } - else - { - return LLUUID(gSavedSettings.getString(default_image_name)); - } -} - - -void LLVOAvatar::setInvisible(BOOL newvalue) -{ - if (newvalue) - { - setCompositeUpdatesEnabled(FALSE); - for (U32 i = 0; i < mBakedTextureData.size(); i++ ) - { - setNewBakedTexture(mBakedTextureData[i].mTextureIndex, IMG_INVISIBLE); + llinfos << " " << texture_dict->mName << ": " << te_image->getID() << llendl; } - gAgent.sendAgentSetAppearance(); } - else - { - setCompositeUpdatesEnabled(TRUE); - invalidateAll(); - requestLayerSetUploads(); - gAgent.sendAgentSetAppearance(); - } -} - -LLColor4 LLVOAvatar::getDummyColor() -{ - return DUMMY_COLOR; -} - -// Given a texture entry, determine which wearable type owns it. -// static -EWearableType LLVOAvatar::getTEWearableType(ETextureIndex index ) -{ - /* switch(index) - case TEX_UPPER_SHIRT: - return WT_SHIRT; */ - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mWearableType; } // Unlike most wearable functions, this works for both self and other. -BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) +BOOL LLVOAvatar::isWearingWearableType(EWearableType type) const { if (mIsDummy) return TRUE; - switch( type ) + switch(type) { case WT_SHAPE: case WT_SKIN: @@ -7578,16 +6191,16 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) /* switch(type) case WT_SHIRT: indicator_te = TEX_UPPER_SHIRT; */ - for (LLVOAvatarDictionary::texture_map_t::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); tex_iter++) { const LLVOAvatarDefines::ETextureIndex index = tex_iter->first; - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = tex_iter->second; - if (text_dict->mWearableType == type) + const LLVOAvatarDictionary::TextureEntry *texture_dict = tex_iter->second; + if (texture_dict->mWearableType == type) { // If you're checking your own clothing, check the component texture - if (mIsSelf) + if (isSelf()) { if (isTextureDefined(index)) { @@ -7604,23 +6217,10 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that // gets baked into a texture that always exists (upper or lower). - const std::string name = text_dict->mName; - for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); - iter++) + if (texture_dict->mIsUsedByBakedTexture) { - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; - if (baked_dict->mName == name) - { - if (isTextureDefined(baked_dict->mTextureIndex)) - { - return TRUE; - } - else - { - return FALSE; - } - } + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + return isTextureDefined(LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); } return FALSE; } @@ -7628,41 +6228,6 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) return FALSE; } -//----------------------------------------------------------------------------- -// updatedWearable( EWearableType type ) -// forces an update to any baked textures relevant to type. -// Should be called only on saving the wearable -//----------------------------------------------------------------------------- -void LLVOAvatar::wearableUpdated( EWearableType type ) -{ - for (LLVOAvatarDictionary::wearable_map_t::const_iterator wearable_iter = LLVOAvatarDictionary::getInstance()->getWearables().begin(); - wearable_iter != LLVOAvatarDictionary::getInstance()->getWearables().end(); - wearable_iter++) - { - const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = wearable_iter->second; - const LLVOAvatarDefines::EBakedTextureIndex index = wearable_iter->first; - if (wearable_dict) - { - for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = wearable_dict->mWearablesVec.begin(); - type_iter != wearable_dict->mWearablesVec.end(); - type_iter++) - { - const EWearableType comp_type = *type_iter; - if (comp_type == type) - { - if (mBakedTextureData[index].mTexLayerSet) - { - mBakedTextureData[index].mTexLayerSet->requestUpdate(); - mBakedTextureData[index].mTexLayerSet->requestUpload(); - } - break; - } - } - } - } -} - - //----------------------------------------------------------------------------- // clampAttachmentPositions() //----------------------------------------------------------------------------- @@ -7741,16 +6306,16 @@ void LLVOAvatar::onFirstTEMessageReceived() { mFirstTEMessageReceived = TRUE; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); + const BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); // Use any baked textures that we have even if they haven't downloaded yet. // (That is, don't do a transition from unbaked to baked.) if (layer_baked) { - LLViewerImage* image = getTEImage( mBakedTextureData[i].mTextureIndex ); - mBakedTextureData[i].mLastTextureIndex = image->getID(); + LLViewerImage* image = getImage( mBakedTextureDatas[i].mTextureIndex ); + mBakedTextureDatas[i].mLastTextureIndex = image->getID(); // If we have more than one texture for the other baked layers, we'll want to call this for them too. if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) { @@ -7782,7 +6347,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mFirstAppearanceMessageReceived = TRUE; - if( mIsSelf ) + if( isSelf() ) { llwarns << "Received AvatarAppearance for self" << llendl; if( mFirstTEMessageReceived ) @@ -7799,31 +6364,23 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) ESex old_sex = getSex(); -// llinfos << "ady LLVOAvatar::processAvatarAppearance()" << llendl; +// llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); unpackTEMessage(mesgsys, _PREHASH_ObjectData); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // prevent the overwriting of valid baked textures with invalid baked textures - for (U8 baked_index = 0; baked_index < mBakedTextureData.size(); baked_index++) + for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { - if (!isTextureDefined(mBakedTextureData[baked_index].mTextureIndex) - && mBakedTextureData[baked_index].mLastTextureIndex != IMG_DEFAULT + if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex) + && mBakedTextureDatas[baked_index].mLastTextureIndex != IMG_DEFAULT && baked_index != BAKED_SKIRT) { - setTEImage(mBakedTextureData[baked_index].mTextureIndex, gImageList.getImage(mBakedTextureData[baked_index].mLastTextureIndex)); + setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, gImageList.getImage(mBakedTextureDatas[baked_index].mLastTextureIndex)); } } - //llinfos << "Received AvatarAppearance: " << (mIsSelf ? "(self): " : "(other): ") << std::endl << - // (isTextureDefined(TEX_HEAD_BAKED) ? "HEAD " : "head " ) << (getTEImage(TEX_HEAD_BAKED)->getID()) << std::endl << - // (isTextureDefined(TEX_UPPER_BAKED) ? "UPPER " : "upper " ) << (getTEImage(TEX_UPPER_BAKED)->getID()) << std::endl << - // (isTextureDefined(TEX_LOWER_BAKED) ? "LOWER " : "lower " ) << (getTEImage(TEX_LOWER_BAKED)->getID()) << std::endl << - // (isTextureDefined(TEX_SKIRT_BAKED) ? "SKIRT " : "skirt " ) << (getTEImage(TEX_SKIRT_BAKED)->getID()) << std::endl << - // (isTextureDefined(TEX_HAIR_BAKED) ? "HAIR" : "hair " ) << (getTEImage(TEX_HAIR_BAKED)->getID()) << std::endl << - // (isTextureDefined(TEX_EYES_BAKED) ? "EYES" : "eyes" ) << (getTEImage(TEX_EYES_BAKED)->getID()) << llendl ; - if( !mFirstTEMessageReceived ) { onFirstTEMessageReceived(); @@ -7831,9 +6388,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setCompositeUpdatesEnabled( FALSE ); - if (!mIsSelf) + // ! BACKWARDS COMPATIBILITY ! + // Non-self avatars will no longer have component textures + if (!isSelf()) { - releaseUnnecessaryTextures(); + releaseComponentTextures(); } updateMeshTextures(); // enables updates for laysets without baked textures. @@ -7993,39 +6552,32 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); /* if( id == head_baked->getID() ) - if (self->mBakedTextureData[BAKED_HEAD].mTexLayerSet) + if (self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) //llinfos << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << llendl; - self->mBakedTextureData[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); + self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ - bool found_texture_id = false; - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + BOOL found_texture_id = false; + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); iter++) { - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; - if (text_dict->mIsUsedByBakedTexture) + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsUsedByBakedTexture) { const ETextureIndex texture_index = iter->first; - const LLViewerImage *baked_img = self->getTEImage(texture_index); + const LLViewerImage *baked_img = self->getImage(texture_index); if (id == baked_img->getID()) { - const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - if (self->mBakedTextureData[baked_index].mTexLayerSet) + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + self->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1, baked_index); + maskData->mLastDiscardLevel = discard_level; + if (self->mBakedTextureDatas[baked_index].mMaskTexName) { - //llinfos << "onBakedTextureMasksLoaded for " << text_dict->mName << " " << id << " discard = " << discard_level << llendl; - self->mBakedTextureData[baked_index].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); - maskData->mLastDiscardLevel = discard_level; - if (self->mBakedTextureData[baked_index].mMaskTexName) - { - LLImageGL::deleteTextures(1, &(self->mBakedTextureData[baked_index].mMaskTexName)); - } - self->mBakedTextureData[baked_index].mMaskTexName = gl_name; - } - else - { - llwarns << "onBakedTextureMasksLoaded: no LayerSet for " << text_dict->mName << "." << llendl; + LLImageGL::deleteTextures(1, &(self->mBakedTextureDatas[baked_index].mMaskTexName)); } + + self->mBakedTextureDatas[baked_index].mMaskTexName = gl_name; found_texture_id = true; break; } @@ -8100,28 +6652,28 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mLastHeadBakedID = id; mHeadMesh0.setTexture( head_baked ); mHeadMesh1.setTexture( head_baked ); */ - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - LLViewerImage* image_baked = getTEImage( mBakedTextureData[i].mTextureIndex ); + LLViewerImage* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex ); if (id == image_baked->getID()) { - mBakedTextureData[i].mIsLoaded = true; - mBakedTextureData[i].mIsUsed = true; - mBakedTextureData[i].mLastTextureIndex = id; - for (U32 k = 0; k < mBakedTextureData[i].mMeshes.size(); k++) + mBakedTextureDatas[i].mIsLoaded = true; + mBakedTextureDatas[i].mLastTextureIndex = id; + mBakedTextureDatas[i].mIsUsed = true; + for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureData[i].mMeshes[k]->setTexture( image_baked ); + mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); } - if (mBakedTextureData[i].mTexLayerSet) + if (mBakedTextureDatas[i].mTexLayerSet) { - mBakedTextureData[i].mTexLayerSet->destroyComposite(); + mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); local_tex_iter++) { - setLocalTexture(*local_tex_iter, getTEImage(*local_tex_iter), TRUE); + setLocalTexture(*local_tex_iter, getImage(*local_tex_iter), TRUE); } // ! BACKWARDS COMPATIBILITY ! @@ -8129,9 +6681,9 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // This is paired with similar code in updateMeshTextures that sets hair mesh color. if (i == BAKED_HAIR) { - for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); } } } @@ -8147,7 +6699,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) LLAPRFile outfile ; outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB ); apr_file_t* file = outfile.getFileHandle() ; - if( !file ) + if (!file) { return; } @@ -8157,27 +6709,27 @@ void LLVOAvatar::dumpArchetypeXML( void* ) apr_file_printf( file, "\n\t\n" ); // only body parts, not clothing. - for( S32 type = WT_SHAPE; type <= WT_EYES; type++ ) + for (S32 type = WT_SHAPE; type <= WT_EYES; type++) { - const std::string& wearable_name = LLWearable::typeToTypeName( (EWearableType) type ); + const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type); apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + for (LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && (viewer_param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) ) { - apr_file_printf( file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight() ); + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); } } - for(U8 te = 0; te < TEX_NUM_INDICES; te++) + for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if( LLVOAvatar::getTEWearableType((ETextureIndex)te) == type ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { - LLViewerImage* te_image = avatar->getTEImage((ETextureIndex)te); + LLViewerImage* te_image = avatar->getImage((ETextureIndex)te); if( te_image ) { std::string uuid_str; @@ -8192,18 +6744,13 @@ void LLVOAvatar::dumpArchetypeXML( void* ) } -U32 LLVOAvatar::getVisibilityRank() -{ - return mVisibilityRank; -} - void LLVOAvatar::setVisibilityRank(U32 rank) { if (mDrawable.isNull() || mDrawable->isDead()) - { //do nothing + { + // do nothing return; } - mVisibilityRank = rank; } @@ -8212,15 +6759,14 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() { S32 rank = 1; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; - if( inst == this ) + if (inst == this) { return rank; } - else - if( !inst->isDead() && !inst->isFullyBaked() ) + else if (!inst->isDead() && !inst->isFullyBaked()) { rank++; } @@ -8232,7 +6778,7 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() struct CompareScreenAreaGreater { - bool operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) + BOOL operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) { return lhs->getPixelArea() > rhs->getPixelArea(); } @@ -8246,7 +6792,7 @@ void LLVOAvatar::cullAvatarsByPixelArea() // Update the avatars that have changed status U32 rank = 0; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; BOOL culled; @@ -8277,7 +6823,7 @@ void LLVOAvatar::cullAvatarsByPixelArea() } S32 grey_avatars = 0; - if ( LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars) ) + if (LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) { LLVOAvatar::deleteCachedImages(false); } @@ -8299,144 +6845,6 @@ void LLVOAvatar::cullAvatarsByPixelArea() } } -const LLUUID& LLVOAvatar::grabLocalTexture(ETextureIndex index) -{ - if (canGrabLocalTexture(index)) - { - return getTEImage( index )->getID(); - } - return LLUUID::null; -} - -BOOL LLVOAvatar::canGrabLocalTexture(ETextureIndex index) -{ - // Check if the texture hasn't been baked yet. - if (!isTextureDefined(index)) - { - lldebugs << "getTEImage( " << (U32) index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl; - return FALSE; - } - - if (gAgent.isGodlike()) - return TRUE; - - // Check permissions of textures that show up in the - // baked texture. We don't want people copying people's - // work via baked textures. - /* switch(index) - case TEX_EYES_BAKED: - textures.push_back(TEX_EYES_IRIS); */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); - if (!text_dict->mIsUsedByBakedTexture) return FALSE; - - const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); - for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin(); - iter != baked_dict->mLocalTextures.end(); - iter++) - { - const ETextureIndex t_index = (*iter); - lldebugs << "Checking index " << (U32) t_index << llendl; - const LLUUID& texture_id = getTEImage( t_index )->getID(); - if (texture_id != IMG_DEFAULT_AVATAR) - { - // Search inventory for this texture. - LLViewerInventoryCategory::cat_array_t cats; - LLViewerInventoryItem::item_array_t items; - LLAssetIDMatches asset_id_matches(texture_id); - gInventory.collectDescendentsIf(LLUUID::null, - cats, - items, - LLInventoryModel::INCLUDE_TRASH, - asset_id_matches); - - BOOL can_grab = FALSE; - lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl; - if (items.count()) - { - // search for full permissions version - for (S32 i = 0; i < items.count(); i++) - { - LLInventoryItem* itemp = items[i]; - LLPermissions item_permissions = itemp->getPermissions(); - if ( item_permissions.allowOperationBy( - PERM_MODIFY, gAgent.getID(), gAgent.getGroupID()) && - item_permissions.allowOperationBy( - PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && - item_permissions.allowOperationBy( - PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID()) ) - { - can_grab = TRUE; - break; - } - } - } - if (!can_grab) return FALSE; - } - } - - return TRUE; -} - -void LLVOAvatar::dumpLocalTextures() -{ - llinfos << "Local Textures:" << llendl; - - /* ETextureIndex baked_equiv[] = { - TEX_UPPER_BAKED, - if (isTextureDefined(baked_equiv[i])) */ - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - iter++) - { - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; - if (!text_dict->mIsLocalTexture || !text_dict->mIsUsedByBakedTexture) - continue; - - const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - const ETextureIndex baked_equiv = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex; - - const std::string &name = text_dict->mName; - const LocalTextureData &local_tex_data = mLocalTextureData[iter->first]; - if (isTextureDefined(baked_equiv)) - { -#if LL_RELEASE_FOR_DOWNLOAD - // End users don't get to trivially see avatar texture IDs, makes textures - // easier to steal. JC - llinfos << "LocTex " << name << ": Baked " << llendl; -#else - llinfos << "LocTex " << name << ": Baked " << getTEImage( baked_equiv )->getID() << llendl; -#endif - } - else if (local_tex_data.mImage.notNull()) - { - if( local_tex_data.mImage->getID() == IMG_DEFAULT_AVATAR ) - { - llinfos << "LocTex " << name << ": None" << llendl; - } - else - { - const LLViewerImage* image = local_tex_data.mImage; - - llinfos << "LocTex " << name << ": " - << "Discard " << image->getDiscardLevel() << ", " - << "(" << image->getWidth() << ", " << image->getHeight() << ") " -#if !LL_RELEASE_FOR_DOWNLOAD - // End users don't get to trivially see avatar texture IDs, - // makes textures easier to steal - << image->getID() << " " -#endif - << "Priority: " << image->getDecodePriority() - << llendl; - } - } - else - { - llinfos << "LocTex " << name << ": No LLViewerImage" << llendl; - } - } -} - void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound) { if(!mAppearanceAnimating) @@ -8448,53 +6856,31 @@ void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound) } } - +// virtual void LLVOAvatar::removeMissingBakedTextures() { - if (!mIsSelf) return; - - BOOL removed = FALSE; - for (U32 i = 0; i < mBakedTextureData.size(); i++) - { - const S32 te = mBakedTextureData[i].mTextureIndex; - if (getTEImage(te)->isMissingAsset()) - { - setTEImage(te, gImageList.getImage(IMG_DEFAULT_AVATAR)); - removed = TRUE; - } - } - - if (removed) - { - for(U32 i = 0; i < mBakedTextureData.size(); i++) - { - invalidateComposite(mBakedTextureData[i].mTexLayerSet, FALSE); - } - updateMeshTextures(); - requestLayerSetUploads(); - } } - //----------------------------------------------------------------------------- // LLVOAvatarXmlInfo //----------------------------------------------------------------------------- -LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() +LLVOAvatar::LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) { } -LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() +LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() { std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); - delete mTexSkinColorInfo; - delete mTexHairColorInfo; - delete mTexEyeColorInfo; + deleteAndClear(mTexSkinColorInfo); + deleteAndClear(mTexHairColorInfo); + deleteAndClear(mTexEyeColorInfo); std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); - std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); + std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); + std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer()); } //----------------------------------------------------------------------------- @@ -8606,7 +6992,7 @@ BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) //----------------------------------------------------------------------------- // parseXmlSkeletonNode(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) { LLXmlTreeNode* node = root->getChildByName( "skeleton" ); if( !node ) @@ -8712,7 +7098,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlMeshNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); node; @@ -8802,7 +7188,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlColorNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); color_node; @@ -8822,7 +7208,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) mTexSkinColorInfo = new LLTexGlobalColorInfo; if( !mTexSkinColorInfo->parseXml( color_node ) ) { - delete mTexSkinColorInfo; mTexSkinColorInfo = 0; + deleteAndClear(mTexSkinColorInfo); llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl; return FALSE; } @@ -8837,7 +7223,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) mTexHairColorInfo = new LLTexGlobalColorInfo; if( !mTexHairColorInfo->parseXml( color_node ) ) { - delete mTexHairColorInfo; mTexHairColorInfo = 0; + deleteAndClear(mTexHairColorInfo); llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl; return FALSE; } @@ -8864,7 +7250,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlLayerNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); layer_node; @@ -8888,7 +7274,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlDriverNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) { LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); if( driver ) @@ -8916,36 +7302,60 @@ BOOL LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) return TRUE; } -// warning: order(N) not order(1) -S32 LLVOAvatar::getAttachmentCount() +//----------------------------------------------------------------------------- +// parseXmlDriverNodes(): parses nodes from XML tree +//----------------------------------------------------------------------------- +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) { - S32 count = mAttachmentPoints.size(); - return count; -} + LLXmlTreeNode* masks = root->getChildByName( "morph_masks" ); + if( !masks ) + { + return FALSE; + } -//virtual -void LLVOAvatar::updateRegion(LLViewerRegion *regionp) -{ - if (mIsSelf) + for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" ); + grand_child; + grand_child = masks->getNextNamedChild()) { - if (regionp->getHandle() != mLastRegionHandle) + LLVOAvatarMorphInfo* info = new LLVOAvatarMorphInfo(); + + static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name"); + if (!grand_child->getFastAttributeString(name_string, info->mName)) { - if (mLastRegionHandle != 0) - { - ++mRegionCrossingCount; - F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); - F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); - F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); + llwarns << "No name supplied for morph mask." << llendl; + delete info; + continue; + } - F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); - max = llmax(delta, max); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); - } - mLastRegionHandle = regionp->getHandle(); + static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region"); + if (!grand_child->getFastAttributeString(region_string, info->mRegion)) + { + llwarns << "No region supplied for morph mask." << llendl; + delete info; + continue; + } + + static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer"); + if (!grand_child->getFastAttributeString(layer_string, info->mLayer)) + { + llwarns << "No layer supplied for morph mask." << llendl; + delete info; + continue; } - mRegionCrossingTimer.reset(); + + // optional parameter. don't throw a warning if not present. + static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); + grand_child->getFastAttributeBOOL(invert_string, info->mInvert); + + mMorphMaskInfoList.push_back(info); } + + return TRUE; +} + +//virtual +void LLVOAvatar::updateRegion(LLViewerRegion *regionp) +{ } std::string LLVOAvatar::getFullname() const @@ -8964,21 +7374,6 @@ std::string LLVOAvatar::getFullname() const return name; } -LLTexLayerSet* LLVOAvatar::getLayerSet(ETextureIndex index) const -{ - /* switch(index) - case TEX_HEAD_BAKED: - case TEX_HEAD_BODYPAINT: - return mHeadLayerSet; */ - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); - if (text_dict->mIsUsedByBakedTexture) - { - const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - return mBakedTextureData[baked_index].mTexLayerSet; - } - return NULL; -} - LLHost LLVOAvatar::getObjectHost() const { LLViewerRegion* region = getRegion(); @@ -9017,7 +7412,7 @@ BOOL LLVOAvatar::updateLOD() if (facep->mVertexBuffer.isNull() || LLVertexBuffer::sEnableVBOs && ((facep->mVertexBuffer->getUsage() == GL_STATIC_DRAW ? TRUE : FALSE) != - (facep->getPool()->getVertexShaderLevel() > 0 ? TRUE : FALSE))) + (facep->getPool()->getVertexShaderLevel() > 0 ? TRUE : FALSE))) { mDirtyMesh = TRUE; } @@ -9036,7 +7431,8 @@ BOOL LLVOAvatar::updateLOD() } U32 LLVOAvatar::getPartitionType() const -{ //avatars merely exist as drawables in the bridge partition +{ + // Avatars merely exist as drawables in the bridge partition return LLViewerRegion::PARTITION_BRIDGE; } @@ -9044,10 +7440,9 @@ U32 LLVOAvatar::getPartitionType() const void LLVOAvatar::updateImpostors() { for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* avatar = (LLVOAvatar*) *iter; - if (!avatar->isDead() && avatar->needsImpostorUpdate() && avatar->isVisible() && avatar->isImpostor()) { gPipeline.generateImpostor(avatar); @@ -9111,10 +7506,9 @@ void LLVOAvatar::idleUpdateRenderCost() std::set textures; - attachment_map_t::const_iterator iter; - for (iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { LLViewerJointAttachment* attachment = iter->second; LLViewerObject* object = attachment->getObject(); @@ -9159,15 +7553,15 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const { std::string line; - for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); iter++) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; - if (text_dict->mIsBakedTexture) + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsBakedTexture) { - line += text_dict->mName; + line += texture_dict->mName; if (isTextureDefined(index)) { line += "_baked"; @@ -9283,6 +7677,12 @@ U32 calc_shame(LLVOVolume* volume, std::set &textures) return shame; } +//virtual +S32 LLVOAvatar::getTexImageSize() const +{ + return TEX_IMAGE_SIZE_OTHER; +} + //----------------------------------------------------------------------------- // Utility functions //----------------------------------------------------------------------------- @@ -9291,3 +7691,16 @@ F32 calc_bouncy_animation(F32 x) { return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f; } + +//virtual +BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index ) const +{ + if (isIndexLocalTexture(te)) + { + return FALSE; + } + + return (getImage(te)->getID() != IMG_DEFAULT_AVATAR && + getImage(te)->getID() != IMG_DEFAULT); +} + diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index f8b2c068ff..301c032b25 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -46,8 +46,9 @@ #include "llviewerjointmesh.h" #include "llviewerjointattachment.h" #include "llrendertarget.h" -#include "llwearable.h" #include "llvoavatardefines.h" +#include "lltexglobalcolor.h" +#include "lldriverparam.h" extern const LLUUID ANIM_AGENT_BODY_NOISE; extern const LLUUID ANIM_AGENT_BREATHE_ROT; @@ -65,10 +66,8 @@ class LLVoiceVisualizer; class LLHUDText; class LLHUDEffectSpiral; class LLTexGlobalColor; - class LLVOAvatarBoneInfo; class LLVOAvatarSkeletonInfo; -class LLVOAvatarXmlInfo; //------------------------------------------------------------------------ // LLVOAvatar @@ -77,686 +76,938 @@ class LLVOAvatar : public LLViewerObject, public LLCharacter { +public: + friend class LLVOAvatarSelf; protected: - virtual ~LLVOAvatar(); + struct LLVOAvatarXmlInfo; + struct LLMaskedMorph; + +/******************************************************************************** + ** ** + ** INITIALIZATION + **/ public: LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - /*virtual*/ void markDead(); - void startDefaultMotions(); + virtual void markDead(); + static void initClass(); // Initialize data that's only init'd once per class. + static void cleanupClass(); // Cleanup data that's only init'd once per class. + void initInstance(); // Called after construction to initialize the class. +protected: + virtual ~LLVOAvatar(); + BOOL loadSkeletonNode(); + BOOL loadMeshNodes(); + virtual BOOL loadLayersets(); + +/** Initialization + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** INHERITED + **/ + + //-------------------------------------------------------------------- + // LLViewerObject interface and related + //-------------------------------------------------------------------- +public: + virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, + void **user_data, + U32 block_num, + const EObjectUpdateType update_type, + LLDataPacker *dp); + virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + virtual BOOL updateLOD(); + BOOL updateJointLODs(); + virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate. + virtual void updateTextures(LLAgent &agent); + virtual S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. + virtual void onShift(const LLVector3& shift_vector); + virtual U32 getPartitionType() const; + virtual const LLVector3 getRenderPosition() const; + virtual void updateDrawable(BOOL force_damped); + virtual LLDrawable* createDrawable(LLPipeline *pipeline); + virtual BOOL updateGeometry(LLDrawable *drawable); + virtual void setPixelAreaAndAngle(LLAgent &agent); + virtual void updateRegion(LLViewerRegion *regionp); + virtual void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax); + virtual void getSpatialExtents(LLVector3& newMin, LLVector3& newMax); + virtual BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point + + //-------------------------------------------------------------------- + // LLCharacter interface and related + //-------------------------------------------------------------------- +public: + virtual LLVector3 getCharacterPosition(); + virtual LLQuaternion getCharacterRotation(); + virtual LLVector3 getCharacterVelocity(); + virtual LLVector3 getCharacterAngularVelocity(); + virtual LLJoint* getCharacterJoint(U32 num); + virtual BOOL allocateCharacterJoints(U32 num); + + virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); + virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); + virtual void stopMotionFromSource(const LLUUID& source_id); + virtual void requestStopMotion(LLMotion* motion); + LLMotion* findMotion(const LLUUID& id) const; + void startDefaultMotions(); + + virtual LLJoint* getJoint(const std::string &name); + virtual LLJoint* getRootJoint() { return &mRoot; } + + virtual const char* getAnimationPrefix() { return "avatar"; } + virtual const LLUUID& getID(); + virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset); + virtual LLJoint* findCollisionVolume(U32 volume_id); + virtual S32 getCollisionVolumeID(std::string &name); + virtual void addDebugText(const std::string& text); + virtual F32 getTimeDilation(); + virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); + virtual F32 getPixelArea() const; + virtual LLPolyMesh* getHeadMesh(); + virtual LLPolyMesh* getUpperBodyMesh(); + virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position); + virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position); + virtual void updateVisualParams(); + + +/** Inherited + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** STATE + **/ + +public: + virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent +private: + BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients - static void updateImpostors(); + //-------------------------------------------------------------------- + // Updates + //-------------------------------------------------------------------- +public: + virtual BOOL updateCharacter(LLAgent &agent); + void idleUpdateVoiceVisualizer(bool voice_enabled); + void idleUpdateMisc(bool detailed_update); + void idleUpdateAppearanceAnimation(); + void idleUpdateLipSync(bool voice_enabled); + void idleUpdateLoadingEffect(); + void idleUpdateWindEffect(); + void idleUpdateNameTag(const LLVector3& root_pos_last); + void idleUpdateRenderCost(); + void idleUpdateTractorBeam(); + void idleUpdateBelowWater(); //-------------------------------------------------------------------- - // LLViewerObject interface - //-------------------------------------------------------------------- -public: - static void initClass(); // Initialize data that's only init'd once per class. - static void cleanupClass(); // Cleanup data that's only init'd once per class. - static BOOL parseSkeletonFile(const std::string& filename); - virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, - void **user_data, - U32 block_num, - const EObjectUpdateType update_type, - LLDataPacker *dp); - /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); - void idleUpdateVoiceVisualizer(bool voice_enabled); - void idleUpdateMisc(bool detailed_update); - void idleUpdateAppearanceAnimation(); - void idleUpdateLipSync(bool voice_enabled); - void idleUpdateLoadingEffect(); - void idleUpdateWindEffect(); - void idleUpdateNameTag(const LLVector3& root_pos_last); - void idleUpdateRenderCost(); - void idleUpdateTractorBeam(); - void idleUpdateBelowWater(); - -public: - virtual BOOL updateLOD(); - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - - // Graphical stuff for objects - maybe broken out into render class later? - U32 renderFootShadows(); - U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255)); - U32 renderRigid(); - U32 renderSkinned(EAvatarRenderPass pass); - U32 renderTransparent(BOOL first_pass); - void renderCollisionVolumes(); - - /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, - S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - S32* face_hit = NULL, // which face was hit - LLVector3* intersection = NULL, // return the intersection point - LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point - LLVector3* normal = NULL, // return the surface normal at the intersection point - LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point - ); - - /*virtual*/ void updateTextures(LLAgent &agent); - // If setting a baked texture, need to request it from a non-local sim. - /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); - /*virtual*/ void onShift(const LLVector3& shift_vector); - virtual U32 getPartitionType() const; + // Static preferences (controlled by user settings/menus) + //-------------------------------------------------------------------- +public: + static S32 sRenderName; + static BOOL sRenderGroupTitles; + static S32 sMaxVisible; + static F32 sRenderDistance; //distance at which avatars will render (affected by control "RenderAvatarMaxVisible") + static BOOL sShowAnimationDebug; // show animation debug info + static BOOL sUseImpostors; //use impostors for far away avatars + static BOOL sShowFootPlane; // show foot collision plane reported by server + static BOOL sShowCollisionVolumes; // show skeletal collision volumes + static BOOL sVisibleInFirstPerson; + static S32 sNumLODChangesThisFrame; + static S32 sNumVisibleChatBubbles; + static BOOL sDebugInvisible; + static BOOL sShowAttachmentPoints; + static F32 sLODFactor; // user-settable LOD factor + static BOOL sJointDebug; // output total number of joints being touched for each avatar + static BOOL sDebugAvatarRotation; + + //-------------------------------------------------------------------- + // Region state + //-------------------------------------------------------------------- +public: + LLHost getObjectHost() const; + + //-------------------------------------------------------------------- + // Loading state + //-------------------------------------------------------------------- +public: + BOOL isFullyLoaded() const; + virtual BOOL updateIsFullyLoaded(); + BOOL processFullyLoadedChange(bool loading); +private: + BOOL mFullyLoaded; + BOOL mPreviousFullyLoaded; + BOOL mFullyLoadedInitialized; + S32 mFullyLoadedFrameCounter; + LLFrameTimer mFullyLoadedTimer; + +/** State + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** SKELETON + **/ + +public: + void updateHeadOffset(); + F32 getPelvisToFoot() const { return mPelvisToFoot; } + LLVector3 mHeadOffset; // current head position + LLViewerJoint mRoot; +protected: + static BOOL parseSkeletonFile(const std::string& filename); + void buildCharacter(); + BOOL loadAvatar(); + BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); + BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); +private: + BOOL mIsBuilt; // state of deferred character building + S32 mNumJoints; + LLViewerJoint* mSkeleton; - void updateVisibility(); - void updateAttachmentVisibility(U32 camera_mode); - void clampAttachmentPositions(); - S32 getAttachmentCount(); // Warning: order(N) not order(1) + //-------------------------------------------------------------------- + // Pelvis height adjustment members. + //-------------------------------------------------------------------- +public: + LLVector3 mBodySize; + S32 mLastSkeletonSerialNum; +private: + F32 mPelvisToFoot; - // HUD functions - BOOL hasHUDAttachment() const; - LLBBox getHUDBBox() const; - void rebuildHUD(); + //-------------------------------------------------------------------- + // Cached pointers to well known joints + //-------------------------------------------------------------------- +public: + LLViewerJoint* mPelvisp; + LLViewerJoint* mTorsop; + LLViewerJoint* mChestp; + LLViewerJoint* mNeckp; + LLViewerJoint* mHeadp; + LLViewerJoint* mSkullp; + LLViewerJoint* mEyeLeftp; + LLViewerJoint* mEyeRightp; + LLViewerJoint* mHipLeftp; + LLViewerJoint* mHipRightp; + LLViewerJoint* mKneeLeftp; + LLViewerJoint* mKneeRightp; + LLViewerJoint* mAnkleLeftp; + LLViewerJoint* mAnkleRightp; + LLViewerJoint* mFootLeftp; + LLViewerJoint* mFootRightp; + LLViewerJoint* mWristLeftp; + LLViewerJoint* mWristRightp; - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + //-------------------------------------------------------------------- + // XML parse tree + //-------------------------------------------------------------------- +private: + static LLXmlTree sXMLTree; // avatar config file + static LLXmlTree sSkeletonXMLTree; // avatar skeleton file + +/** Skeleton + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** RENDERING + **/ + +public: + U32 renderFootShadows(); + U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255)); + U32 renderRigid(); + U32 renderSkinned(EAvatarRenderPass pass); + U32 renderTransparent(BOOL first_pass); + void renderCollisionVolumes(); + static void deleteCachedImages(bool clearAll=true); + static void destroyGL(); + static void restoreGL(); + BOOL mIsDummy; // for special views + S32 mSpecialRenderMode; // special lighting +private: + BOOL mNeedsSkin; // avatar has been animated and verts have not been updated + S32 mUpdatePeriod; + S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer. - /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); - BOOL updateJointLODs(); + //-------------------------------------------------------------------- + // Morph masks + //-------------------------------------------------------------------- +public: + void invalidateMorphMasks(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); + BOOL morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); + void addMaskedMorph(LLVOAvatarDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer); + void setMorphMasksValid(BOOL new_status, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); + void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES); - virtual void updateRegion(LLViewerRegion *regionp); + //-------------------------------------------------------------------- + // Visibility + //-------------------------------------------------------------------- +protected: + void updateVisibility(); +private: + U32 mVisibilityRank; + BOOL mVisible; - virtual const LLVector3 getRenderPosition() const; - virtual void updateDrawable(BOOL force_damped); - void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax); - void getSpatialExtents(LLVector3& newMin, LLVector3& newMax); - BOOL isImpostor() const; - BOOL needsImpostorUpdate() const; + //-------------------------------------------------------------------- + // Shadowing + //-------------------------------------------------------------------- +public: + void updateShadowFaces(); + LLDrawable* mShadow; +private: + LLFace* mShadow0Facep; + LLFace* mShadow1Facep; + LLPointer mShadowImagep; + + //-------------------------------------------------------------------- + // Impostors + //-------------------------------------------------------------------- +public: + BOOL isImpostor() const; + BOOL needsImpostorUpdate() const; const LLVector3& getImpostorOffset() const; const LLVector2& getImpostorDim() const; - void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const; - void cacheImpostorValues(); - void setImpostorDim(const LLVector2& dim); - - //-------------------------------------------------------------------- - // LLCharacter interface - //-------------------------------------------------------------------- -public: - virtual const char *getAnimationPrefix() { return "avatar"; } - virtual LLJoint *getRootJoint() { return &mRoot; } - virtual LLVector3 getCharacterPosition(); - virtual LLQuaternion getCharacterRotation(); - virtual LLVector3 getCharacterVelocity(); - virtual LLVector3 getCharacterAngularVelocity(); - virtual F32 getTimeDilation(); - virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); - virtual BOOL allocateCharacterJoints( U32 num ); - virtual LLJoint *getCharacterJoint( U32 num ); - virtual void requestStopMotion( LLMotion* motion ); - virtual F32 getPixelArea() const; - virtual LLPolyMesh* getHeadMesh(); - virtual LLPolyMesh* getUpperBodyMesh(); - virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position); - virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position); - virtual void updateVisualParams(); - virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); - virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); - virtual void stopMotionFromSource(const LLUUID& source_id); - virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset); - virtual LLJoint* findCollisionVolume(U32 volume_id); - virtual S32 getCollisionVolumeID(std::string &name); - virtual void addDebugText(const std::string& text); - virtual const LLUUID& getID(); - virtual LLJoint *getJoint( const std::string &name ); - - //-------------------------------------------------------------------- - // Other public functions - //-------------------------------------------------------------------- -public: - static void onCustomizeStart(); - static void onCustomizeEnd(); - -public: - static void dumpTotalLocalTextureByteCount(); -protected: - void getLocalTextureByteCount( S32* gl_byte_count ); + void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const; + void cacheImpostorValues(); + void setImpostorDim(const LLVector2& dim); + static void resetImpostors(); + static void updateImpostors(); + LLRenderTarget mImpostor; + BOOL mNeedsImpostorUpdate; +private: + LLVector3 mImpostorOffset; + LLVector2 mImpostorDim; + BOOL mNeedsAnimUpdate; + LLVector3 mImpostorExtents[2]; + LLVector3 mImpostorAngle; + F32 mImpostorDistance; + F32 mImpostorPixelArea; + LLVector3 mLastAnimExtents[2]; + //-------------------------------------------------------------------- + // Wind rippling in clothes + //-------------------------------------------------------------------- public: - LLMotion* findMotion(const LLUUID& id); - - BOOL isVisible(); - BOOL isSelf() const { return mIsSelf; } - BOOL isCulled() const { return mCulled; } + LLVector4 mWindVec; + F32 mRipplePhase; + BOOL mBelowWater; +private: + F32 mWindFreq; + LLFrameTimer mRippleTimer; + F32 mRippleTimeLast; + LLVector3 mRippleAccel; + LLVector3 mLastVel; + //-------------------------------------------------------------------- + // Culling + //-------------------------------------------------------------------- public: - static void cullAvatarsByPixelArea(); - void setVisibilityRank(U32 rank); - U32 getVisibilityRank(); // unused -protected: - S32 getUnbakedPixelAreaRank(); + static void cullAvatarsByPixelArea(); + BOOL isCulled() const { return mCulled; } +private: + BOOL mCulled; + //-------------------------------------------------------------------- + // Freeze counter + //-------------------------------------------------------------------- public: - void dumpLocalTextures(); - const LLUUID& grabLocalTexture(LLVOAvatarDefines::ETextureIndex index); - BOOL canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex index); - BOOL isTextureDefined(U8 te) const; - BOOL isTextureVisible(U8 te) const; - void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound); - - void setCompositeUpdatesEnabled(BOOL b); - - void addChat(const LLChat& chat); - void clearChat(); - void startTyping() { mTyping = TRUE; mTypingTimer.reset(); } - void stopTyping() { mTyping = FALSE; } + static void updateFreezeCounter(S32 counter = 0); +private: + static S32 sFreezeCounter; - // Returns "FirstName LastName" - std::string getFullname() const; + //-------------------------------------------------------------------- + // Constants + //-------------------------------------------------------------------- +public: + virtual LLViewerImage::EBoostLevel getAvatarBoostLevel() const { return LLViewerImage::BOOST_AVATAR; } + virtual LLViewerImage::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerImage::BOOST_AVATAR_BAKED; } + virtual S32 getTexImageSize() const; + virtual S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); } - BOOL updateCharacter(LLAgent &agent); - void updateHeadOffset(); +/** Rendering + ** ** + *******************************************************************************/ - F32 getPelvisToFoot() const { return mPelvisToFoot; } +/******************************************************************************** + ** ** + ** TEXTURES + **/ + //-------------------------------------------------------------------- + // Loading status + //-------------------------------------------------------------------- public: - BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims); - void processAnimationStateChanges(); + virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex index) const; protected: - BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start); - void resetAnimations(); + BOOL isFullyBaked(); + static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); + //-------------------------------------------------------------------- + // Baked textures + //-------------------------------------------------------------------- public: - void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm); - void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); - void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm); - - void slamPosition(); // Slam position to transmitted position (for teleport); + void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY ! +protected: + static void onBakedTextureMasksLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + static void onInitialBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + static void onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + virtual void removeMissingBakedTextures(); + void useBakedTexture(const LLUUID& id); - // morph targets and such - void processAvatarAppearance( LLMessageSystem* mesgsys ); - void onFirstTEMessageReceived(); - void updateSexDependentLayerSets( BOOL set_by_user ); - void dirtyMesh(); // Dirty the avatar mesh - void hideSkirt(); + typedef std::deque morph_list_t; + struct BakedTextureData + { + LLUUID mLastTextureIndex; + LLTexLayerSet* mTexLayerSet; // Only exists for self + bool mIsLoaded; + bool mIsUsed; + LLVOAvatarDefines::ETextureIndex mTextureIndex; + U32 mMaskTexName; + // Stores pointers to the joint meshes that this baked texture deals with + std::vector< LLViewerJointMesh * > mMeshes; // std::vector mJoints[i]->mMeshParts + morph_list_t mMaskedMorphs; + BOOL mMorphMasksValid; + }; + typedef std::vector bakedtexturedata_vec_t; + bakedtexturedata_vec_t mBakedTextureDatas; - virtual void setParent(LLViewerObject* parent); - virtual void addChild(LLViewerObject *childp); - virtual void removeChild(LLViewerObject *childp); + //-------------------------------------------------------------------- + // Local Textures + //-------------------------------------------------------------------- +protected: + virtual void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerImage* tex, BOOL baked_version_exits, U32 index = 0); + virtual void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex type, LLViewerImage* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0); - LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object); - BOOL attachObject(LLViewerObject *viewer_object); - BOOL detachObject(LLViewerObject *viewer_object); - void lazyAttach(); - - void sitOnObject(LLViewerObject *sit_object); - void getOffObject(); - - BOOL isWearingAttachment( const LLUUID& inv_item_id ); - LLViewerObject* getWornAttachment( const LLUUID& inv_item_id ); - const std::string getAttachedPointName(const LLUUID& inv_item_id); - - static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj ); - - void updateMeshTextures(); - - //-------------------------------------------------------------------- - // texture compositing (used only by the LLTexLayer series of classes) - //-------------------------------------------------------------------- -public: - LLColor4 getGlobalColor( const std::string& color_name ); - BOOL isLocalTextureDataAvailable( LLTexLayerSet* layerset ); - BOOL isLocalTextureDataFinal( LLTexLayerSet* layerset ); - LLVOAvatarDefines::ETextureIndex getBakedTE( LLTexLayerSet* layerset ); - void updateComposites(); - void onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user ); - BOOL getLocalTextureRaw( LLVOAvatarDefines::ETextureIndex index, LLImageRaw* image_raw_pp ); - BOOL getLocalTextureGL( LLVOAvatarDefines::ETextureIndex index, LLImageGL** image_gl_pp ); - const LLUUID& getLocalTextureID( LLVOAvatarDefines::ETextureIndex index ); - LLGLuint getScratchTexName( LLGLenum format, U32* texture_bytes ); - BOOL bindScratchTexture( LLGLenum format ); - void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ); - void invalidateAll(); - void forceBakeAllTextures(bool slam_for_debug = false); - static void processRebakeAvatarTextures(LLMessageSystem* msg, void**); - void setNewBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid ); - void setCachedBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid ); - void releaseUnnecessaryTextures(); - void requestLayerSetUploads(); - bool hasPendingBakedUploads(); - static void onLocalTextureLoaded( BOOL succcess, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static void dumpArchetypeXML( void* ); - static void dumpScratchTextureByteCount(); - static void dumpBakedStatus(); - static void deleteCachedImages(bool clearAll=true); - static void destroyGL(); - static void restoreGL(); - static void resetImpostors(); - static enum EWearableType getTEWearableType(LLVOAvatarDefines::ETextureIndex te ); - static LLUUID getDefaultTEImageID(LLVOAvatarDefines::ETextureIndex te ); - static void onChangeSelfInvisible(BOOL newvalue); - void setInvisible(BOOL newvalue); - static LLColor4 getDummyColor(); + //-------------------------------------------------------------------- + // Texture accessors + //-------------------------------------------------------------------- +private: + virtual void setImage(const U8 te, LLViewerImage *imagep); + virtual LLViewerImage* getImage(const U8 te) const; + virtual const LLTextureEntry* getTexEntry(const U8 te_num) const; + virtual void setTexEntry(const U8 index, const LLTextureEntry &te); //-------------------------------------------------------------------- - // Clothing colors (conventience functions to access visual parameters + // Layers //-------------------------------------------------------------------- -public: - void setClothesColor( LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user ); - LLColor4 getClothesColor( LLVOAvatarDefines::ETextureIndex te ); - BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] ); - - BOOL isWearingWearableType( EWearableType type ); - void wearableUpdated( EWearableType type ); +protected: + void deleteLayerSetCaches(bool clearAll = true); + void addBakedTextureStats(LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level); //-------------------------------------------------------------------- - // texture compositing + // Composites //-------------------------------------------------------------------- public: - void setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user ); - void setupComposites(); + virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL set_by_user); + virtual void invalidateAll(); + virtual void setCompositeUpdatesEnabled(BOOL b); //-------------------------------------------------------------------- - // Handling partially loaded avatars (Ruth) + // Static texture/mesh/baked dictionary //-------------------------------------------------------------------- public: - BOOL isFullyLoaded(); - BOOL updateIsFullyLoaded(); + static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i); + static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i); private: - BOOL mFullyLoaded; - BOOL mPreviousFullyLoaded; - BOOL mFullyLoadedInitialized; - S32 mFullyLoadedFrameCounter; - LLFrameTimer mFullyLoadedTimer; + static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; } + static LLVOAvatarDefines::LLVOAvatarDictionary* sAvatarDictionary; + static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo; + static LLVOAvatarXmlInfo* sAvatarXmlInfo; //-------------------------------------------------------------------- - // Collision Volumes + // Messaging //-------------------------------------------------------------------- public: - S32 mNumCollisionVolumes; - LLViewerJointCollisionVolume* mCollisionVolumes; + void onFirstTEMessageReceived(); +private: + BOOL mFirstTEMessageReceived; + BOOL mFirstAppearanceMessageReceived; + +/** Textures + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** MESHES + **/ + +public: + void updateMeshTextures(); + void updateSexDependentLayerSets(BOOL set_by_user); + void dirtyMesh(); // Dirty the avatar mesh + void updateMeshData(); +protected: + void releaseMeshData(); + /*virtual*/ void restoreMeshData(); +private: + BOOL mDirtyMesh; + + typedef std::multimap polymesh_map_t; + polymesh_map_t mMeshes; + std::vector mMeshLOD; //-------------------------------------------------------------------- - // cached pointers to well known joints + // Destroy invisible mesh //-------------------------------------------------------------------- -public: - LLViewerJoint* mPelvisp; - LLViewerJoint* mTorsop; - LLViewerJoint* mChestp; - LLViewerJoint* mNeckp; - LLViewerJoint* mHeadp; - LLViewerJoint* mSkullp; - LLViewerJoint* mEyeLeftp; - LLViewerJoint* mEyeRightp; - LLViewerJoint* mHipLeftp; - LLViewerJoint* mHipRightp; - LLViewerJoint* mKneeLeftp; - LLViewerJoint* mKneeRightp; - LLViewerJoint* mAnkleLeftp; - LLViewerJoint* mAnkleRightp; - LLViewerJoint* mFootLeftp; - LLViewerJoint* mFootRightp; - LLViewerJoint* mWristLeftp; - LLViewerJoint* mWristRightp; +protected: + BOOL mMeshValid; + LLFrameTimer mMeshInvisibleTime; + +/** Meshes + ** ** + *******************************************************************************/ +/******************************************************************************** + ** ** + ** APPEARANCE + **/ + +public: + void processAvatarAppearance(LLMessageSystem* mesgsys); + void hideSkirt(); + void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound); + //-------------------------------------------------------------------- - // impostor state + // Appearance morphing //-------------------------------------------------------------------- public: - LLRenderTarget mImpostor; - BOOL mNeedsImpostorUpdate; + BOOL mAppearanceAnimating; private: - LLVector3 mImpostorOffset; - LLVector2 mImpostorDim; - BOOL mNeedsAnimUpdate; - LLVector3 mImpostorExtents[2]; - LLVector3 mImpostorAngle; - F32 mImpostorDistance; - F32 mImpostorPixelArea; - LLVector3 mLastAnimExtents[2]; + LLFrameTimer mAppearanceMorphTimer; + BOOL mAppearanceAnimSetByUser; + F32 mLastAppearanceBlendTime; //-------------------------------------------------------------------- - // Misc Render State + // Clothing colors (convenience functions to access visual parameters) //-------------------------------------------------------------------- public: - BOOL mIsDummy; // For special views - S32 mSpecialRenderMode; // Special lighting + void setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user); + LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te); + BOOL teToColorParams(LLVOAvatarDefines::ETextureIndex te, const char* param_name[3]); //-------------------------------------------------------------------- - // animation state data + // Global colors //-------------------------------------------------------------------- public: - typedef std::map::iterator AnimIterator; + LLColor4 getGlobalColor(const std::string& color_name ) const; + void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user); +private: + LLTexGlobalColor* mTexSkinColor; + LLTexGlobalColor* mTexHairColor; + LLTexGlobalColor* mTexEyeColor; - std::map mSignaledAnimations; // requested state of Animation name/value - std::map mPlayingAnimations; // current state of Animation name/value + //-------------------------------------------------------------------- + // Visibility + //-------------------------------------------------------------------- +public: + BOOL isVisible() const; + void setVisibilityRank(U32 rank); + U32 getVisibilityRank() const { return mVisibilityRank; } // unused + static S32 sNumVisibleAvatars; // Number of instances of this class + static LLColor4 getDummyColor(); +/** Appearance + ** ** + *******************************************************************************/ - typedef std::multimap AnimationSourceMap; - typedef AnimationSourceMap::iterator AnimSourceIterator; - AnimationSourceMap mAnimationSources; // object ids that triggered anim ids +/******************************************************************************** + ** ** + ** WEARABLES + **/ +public: + BOOL isWearingWearableType(EWearableType type ) const; + //-------------------------------------------------------------------- - // Shadowing + // Attachments //-------------------------------------------------------------------- public: - void updateShadowFaces(); - LLDrawable* mShadow; -private: - LLFace* mShadow0Facep; - LLFace* mShadow1Facep; - LLPointer mShadowImagep; + void clampAttachmentPositions(); + virtual LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object); + BOOL detachObject(LLViewerObject *viewer_object); + static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj); +protected: + LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object); + void lazyAttach(); //-------------------------------------------------------------------- - // Keeps track of foot step state for generating sounds + // Map of attachment points, by ID //-------------------------------------------------------------------- public: - void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; } - LLVector4 mFootPlane; -private: - BOOL mWasOnGroundLeft; - BOOL mWasOnGroundRight; + S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self + typedef std::map attachment_map_t; + attachment_map_t mAttachmentPoints; + std::vector > mPendingAttachment; //-------------------------------------------------------------------- - // Pelvis height adjustment members. + // HUD functions //-------------------------------------------------------------------- public: - LLVector3 mBodySize; - S32 mLastSkeletonSerialNum; -private: - F32 mPelvisToFoot; + BOOL hasHUDAttachment() const; + LLBBox getHUDBBox() const; + void rebuildHUD(); + void resetHUDAttachments(); + +/** Wearables + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** ACTIONS + **/ //-------------------------------------------------------------------- - // Display the name, then optionally fade it out + // Animations //-------------------------------------------------------------------- public: - LLFrameTimer mChatTimer; - LLPointer mNameText; + BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const; + void processAnimationStateChanges(); +protected: + BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start); + void resetAnimations(); private: - LLFrameTimer mTimeVisible; - std::deque mChats; - BOOL mTyping; - LLFrameTimer mTypingTimer; + LLTimer mAnimTimer; + F32 mTimeLast; //-------------------------------------------------------------------- - // wind rippling in clothes + // Animation state data //-------------------------------------------------------------------- public: - LLVector4 mWindVec; - F32 mRipplePhase; - BOOL mBelowWater; -private: - F32 mWindFreq; - LLFrameTimer mRippleTimer; - F32 mRippleTimeLast; - LLVector3 mRippleAccel; - LLVector3 mLastVel; + typedef std::map::iterator AnimIterator; + std::map mSignaledAnimations; // requested state of Animation name/value + std::map mPlayingAnimations; // current state of Animation name/value + + typedef std::multimap AnimationSourceMap; + typedef AnimationSourceMap::iterator AnimSourceIterator; + AnimationSourceMap mAnimationSources; // object ids that triggered anim ids //-------------------------------------------------------------------- - // appearance morphing + // Chat //-------------------------------------------------------------------- public: - BOOL mAppearanceAnimating; + void addChat(const LLChat& chat); + void clearChat(); + void startTyping() { mTyping = TRUE; mTypingTimer.reset(); } + void stopTyping() { mTyping = FALSE; } private: - LLFrameTimer mAppearanceMorphTimer; - BOOL mAppearanceAnimSetByUser; - F32 mLastAppearanceBlendTime; + BOOL mVisibleChat; //-------------------------------------------------------------------- - // Attachments + // Lip synch morphs + //-------------------------------------------------------------------- +private: + bool mLipSyncActive; // we're morphing for lip sync + LLVisualParam* mOohMorph; // cached pointers morphs for lip sync + LLVisualParam* mAahMorph; // cached pointers morphs for lip sync + + //-------------------------------------------------------------------- + // Flight //-------------------------------------------------------------------- public: - // map of attachment points, by ID - typedef std::map attachment_map_t; - attachment_map_t mAttachmentPoints; - std::vector > mPendingAttachment; + BOOL mInAir; + LLFrameTimer mTimeInAir; + +/** Actions + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** PHYSICS + **/ + +private: + F32 mSpeedAccum; // measures speed (for diagnostics mostly). + BOOL mTurning; // controls hysteresis on avatar rotation + F32 mSpeed; // misc. animation repeated state //-------------------------------------------------------------------- - // static preferences that are controlled by user settings/menus + // Collision volumes //-------------------------------------------------------------------- public: - static S32 sRenderName; - static BOOL sRenderGroupTitles; - static S32 sMaxVisible; - static F32 sRenderDistance; //distance at which avatars will render (affected by control "RenderAvatarMaxVisible") - static BOOL sShowAnimationDebug; // show animation debug info - static BOOL sUseImpostors; //use impostors for far away avatars - static BOOL sShowFootPlane; // show foot collision plane reported by server - static BOOL sVisibleInFirstPerson; - static S32 sNumLODChangesThisFrame; - static S32 sNumVisibleChatBubbles; - static BOOL sDebugInvisible; - static BOOL sShowAttachmentPoints; - static F32 sLODFactor; // user-settable LOD factor - static BOOL sJointDebug; // output total number of joints being touched for each avatar - static BOOL sDebugAvatarRotation; + S32 mNumCollisionVolumes; + LLViewerJointCollisionVolume* mCollisionVolumes; +protected: + BOOL allocateCollisionVolumes(U32 num); - static S32 sNumVisibleAvatars; // Number of instances of this class - //-------------------------------------------------------------------- - // Miscellaneous public variables. + // Dimensions //-------------------------------------------------------------------- public: - BOOL mInAir; - LLFrameTimer mTimeInAir; - LLVector3 mHeadOffset; // current head position - LLViewerJoint mRoot; // avatar skeleton - BOOL mIsSitting; // sitting state + void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm); + void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); + void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm); + void slamPosition(); // Slam position to transmitted position (for teleport); +protected: + void computeBodySize(); //-------------------------------------------------------------------- - // Private member variables. + // Material being stepped on //-------------------------------------------------------------------- private: - BOOL mIsSelf; // True if this avatar is for this viewer's agent + BOOL mStepOnLand; + U8 mStepMaterial; + LLVector3 mStepObjectVelocity; - LLViewerJoint *mScreenp; // special purpose joint for HUD attachments - BOOL mIsBuilt; // state of deferred character building - F32 mSpeedAccum; // measures speed (for diagnostics mostly). - - - // LLFrameTimer mUpdateLODTimer; // controls frequency of LOD change calculations - BOOL mDirtyMesh; - BOOL mTurning; // controls hysteresis on avatar rotation - F32 mSpeed; // misc. animation repeated state +/** Physics + ** ** + *******************************************************************************/ - // Keep track of the material being stepped on - BOOL mStepOnLand; - U8 mStepMaterial; - LLVector3 mStepObjectVelocity; +/******************************************************************************** + ** ** + ** HIERARCHY + **/ - // Destroy mesh data after being invisible for a while - BOOL mMeshValid; - BOOL mVisible; - LLFrameTimer mMeshInvisibleTime; +public: + virtual void setParent(LLViewerObject* parent); + virtual void addChild(LLViewerObject *childp); + virtual void removeChild(LLViewerObject *childp); - // Lip synch morph stuff - bool mLipSyncActive; // we're morphing for lip sync - LLVisualParam* mOohMorph; // cached pointers morphs for lip sync - LLVisualParam* mAahMorph; // cached pointers morphs for lip sync + //-------------------------------------------------------------------- + // Sitting + //-------------------------------------------------------------------- +public: + void sitOnObject(LLViewerObject *sit_object); + void getOffObject(); + BOOL mIsSitting; - // Skeleton for skinned avatar - S32 mNumJoints; - LLViewerJoint* mSkeleton; +/** Hierarchy + ** ** + *******************************************************************************/ - // Scratch textures used for compositing - static LLMap< LLGLenum, LLGLuint*> sScratchTexNames; - static LLMap< LLGLenum, F32*> sScratchTexLastBindTime; - static S32 sScratchTexBytes; +/******************************************************************************** + ** ** + ** NAME + **/ - // Global table of sound ids per material, and the ground - const static LLUUID sStepSounds[LL_MCODE_END]; - const static LLUUID sStepSoundOnLand; - - // Xml parse tree of avatar config file - static LLXmlTree sXMLTree; - // Xml parse tree of avatar skeleton file - static LLXmlTree sSkeletonXMLTree; +public: + std::string getFullname() const; // Returns "FirstName LastName" +protected: + static void getAnimLabels(LLDynamicArray* labels); + static void getAnimNames(LLDynamicArray* names); +private: + LLWString mNameString; + std::string mTitle; + BOOL mNameAway; + BOOL mNameBusy; + BOOL mNameMute; + BOOL mNameAppearance; + BOOL mRenderGroupTitles; - // Voice Visualizer is responsible for detecting the user's voice signal, and when the - // user speaks, it puts a voice symbol over the avatar's head, and triggering gesticulations - LLVoiceVisualizer* mVoiceVisualizer; - int mCurrentGesticulationLevel; - - // Animation timer - LLTimer mAnimTimer; - F32 mTimeLast; - - LLPointer mBeam; - LLFrameTimer mBeamTimer; - - F32 mAdjustedPixelArea; - - LLWString mNameString; - std::string mTitle; - BOOL mNameAway; - BOOL mNameBusy; - BOOL mNameMute; - BOOL mNameAppearance; - BOOL mVisibleChat; - BOOL mRenderGroupTitles; - - std::string mDebugText; - U64 mLastRegionHandle; - LLFrameTimer mRegionCrossingTimer; - S32 mRegionCrossingCount; - //-------------------------------------------------------------------- - // local textures for compositing. + // Display the name (then optionally fade it out) //-------------------------------------------------------------------- +public: + LLFrameTimer mChatTimer; + LLPointer mNameText; private: - LLUUID mSavedTE[ LLVOAvatarDefines::TEX_NUM_INDICES ]; - BOOL mFirstTEMessageReceived; - BOOL mFirstAppearanceMessageReceived; - BOOL mHasBakedHair; - - BOOL mCulled; - U32 mVisibilityRank; - F32 mMinPixelArea; // debug - F32 mMaxPixelArea; // debug - BOOL mHasGrey; // debug - + LLFrameTimer mTimeVisible; + std::deque mChats; + BOOL mTyping; + LLFrameTimer mTypingTimer; + +/** Name + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** SOUNDS + **/ + //-------------------------------------------------------------------- - // Global Colors + // Voice visualizer //-------------------------------------------------------------------- -private: - LLTexGlobalColor* mTexSkinColor; - LLTexGlobalColor* mTexHairColor; - LLTexGlobalColor* mTexEyeColor; - - BOOL mNeedsSkin; //if TRUE, avatar has been animated and verts have not been updated - S32 mUpdatePeriod; +public: + // Responsible for detecting the user's voice signal (and when the + // user speaks, it puts a voice symbol over the avatar's head) and gesticulations + LLVoiceVisualizer* mVoiceVisualizer; + int mCurrentGesticulationLevel; //-------------------------------------------------------------------- - // Internal functions + // Step sound //-------------------------------------------------------------------- protected: - void buildCharacter(); - void releaseMeshData(); - void restoreMeshData(); - void updateMeshData(); - void computeBodySize(); - const LLUUID& getStepSound() const; - BOOL needsRenderBeam(); - - BOOL allocateCollisionVolumes( U32 num ); - void resetHUDAttachments(); - static void getAnimLabels( LLDynamicArray* labels ); - static void getAnimNames( LLDynamicArray* names ); + const LLUUID& getStepSound() const; +private: + // Global table of sound ids per material, and the ground + const static LLUUID sStepSounds[LL_MCODE_END]; + const static LLUUID sStepSoundOnLand; //-------------------------------------------------------------------- - // Textures and Layers + // Foot step state (for generating sounds) //-------------------------------------------------------------------- -protected: - BOOL loadSkeletonNode(); - BOOL loadMeshNodes(); - BOOL isFullyBaked(); - void deleteLayerSetCaches(bool clearAll = true); - static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); - static void onBakedTextureMasksLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - void setLocalTexture(LLVOAvatarDefines::ETextureIndex i, LLViewerImage* tex, BOOL baked_version_exits); - void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i); - void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerImage* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); - void addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level); - static void onInitialBakedTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static void onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - void useBakedTexture(const LLUUID& id); - void dumpAvatarTEs(const std::string& context); - void removeMissingBakedTextures(); - LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; - LLHost getObjectHost() const; - S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex index); public: - static void updateFreezeCounter(S32 counter = 0 ); + void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; } + LLVector4 mFootPlane; private: - static S32 sFreezeCounter; + BOOL mWasOnGroundLeft; + BOOL mWasOnGroundRight; + +/** Sounds + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** DIAGNOSTICS + **/ - //----------------------------------------------------------------------------------------------- - // Avatar skeleton setup. - //----------------------------------------------------------------------------------------------- -private: - BOOL loadAvatar(); - BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); - BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); - - //----------------------------------------------------------------------------------------------- - // Per-avatar information about texture data. - // To-do: Move this to private implementation class - //----------------------------------------------------------------------------------------------- +public: + static void dumpArchetypeXML(void*); + static void dumpBakedStatus(); + const std::string getBakedStatusForPrintout() const; + void dumpAvatarTEs(const std::string& context); + + static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars + static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) + static F32 sGreyTime; // Total seconds with >=1 grey avatars + static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) +protected: + S32 getUnbakedPixelAreaRank(); + BOOL mHasGrey; private: - struct BakedTextureData + F32 mMinPixelArea; + F32 mMaxPixelArea; + F32 mAdjustedPixelArea; + std::string mDebugText; + +/** Diagnostics + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** SUPPORT CLASSES + **/ + +protected: // Shared with LLVOAvatarSelf + + struct LLVOAvatarXmlInfo { - LLUUID mLastTextureIndex; - LLTexLayerSet* mTexLayerSet; - bool mIsLoaded; - bool mIsUsed; - LLVOAvatarDefines::ETextureIndex mTextureIndex; - U32 mMaskTexName; - // Stores pointers to the joint meshes that this baked texture deals with - std::vector< LLViewerJointMesh * > mMeshes; // std::vector mJoints[i]->mMeshParts + LLVOAvatarXmlInfo(); + ~LLVOAvatarXmlInfo(); + + BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); + BOOL parseXmlMeshNodes(LLXmlTreeNode* root); + BOOL parseXmlColorNodes(LLXmlTreeNode* root); + BOOL parseXmlLayerNodes(LLXmlTreeNode* root); + BOOL parseXmlDriverNodes(LLXmlTreeNode* root); + BOOL parseXmlMorphNodes(LLXmlTreeNode* root); + + struct LLVOAvatarMeshInfo + { + typedef std::pair morph_info_pair_t; + typedef std::vector morph_info_list_t; + + LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} + ~LLVOAvatarMeshInfo() + { + morph_info_list_t::iterator iter; + for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) + { + delete iter->first; + } + mPolyMorphTargetInfoList.clear(); + } + + std::string mType; + S32 mLOD; + std::string mMeshFileName; + std::string mReferenceMeshName; + F32 mMinPixelArea; + morph_info_list_t mPolyMorphTargetInfoList; + }; + typedef std::vector mesh_info_list_t; + mesh_info_list_t mMeshInfoList; + + typedef std::vector skeletal_distortion_info_list_t; + skeletal_distortion_info_list_t mSkeletalDistortionInfoList; + + struct LLVOAvatarAttachmentInfo + { + LLVOAvatarAttachmentInfo() + : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), + mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} + std::string mName; + std::string mJointName; + LLVector3 mPosition; + LLVector3 mRotationEuler; + S32 mGroup; + S32 mAttachmentID; + S32 mPieMenuSlice; + BOOL mVisibleFirstPerson; + BOOL mIsHUDAttachment; + BOOL mHasPosition; + BOOL mHasRotation; + }; + typedef std::vector attachment_info_list_t; + attachment_info_list_t mAttachmentInfoList; + + LLTexGlobalColorInfo *mTexSkinColorInfo; + LLTexGlobalColorInfo *mTexHairColorInfo; + LLTexGlobalColorInfo *mTexEyeColorInfo; + + typedef std::vector layer_info_list_t; + layer_info_list_t mLayerInfoList; + + typedef std::vector driver_info_list_t; + driver_info_list_t mDriverInfoList; + + struct LLVOAvatarMorphInfo + { + LLVOAvatarMorphInfo() + : mInvert(FALSE) {} + std::string mName; + std::string mRegion; + std::string mLayer; + BOOL mInvert; + }; + + typedef std::vector morph_info_list_t; + morph_info_list_t mMorphMaskInfoList; }; - typedef std::vector bakedtexturedata_vec_t; - bakedtexturedata_vec_t mBakedTextureData; - struct LocalTextureData + struct LLMaskedMorph { - LocalTextureData() : mIsBakedReady(FALSE), mDiscard(MAX_DISCARD_LEVEL+1), mImage(NULL) - {} - LLPointer mImage; - BOOL mIsBakedReady; - S32 mDiscard; + LLMaskedMorph(LLPolyMorphTarget *morph_target, BOOL invert, std::string layer) : + mMorphTarget(morph_target), + mInvert(invert), + mLayer(layer) + { + morph_target->addPendingMorphMask(); + } + + LLPolyMorphTarget *mMorphTarget; + BOOL mInvert; + std::string mLayer; }; - typedef std::map localtexture_map_t; - localtexture_map_t mLocalTextureData; - - typedef std::multimap polymesh_map_t; - polymesh_map_t mMeshes; - std::vector mMeshLOD; - S32 mNumInitFaces ; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer. - - //----------------------------------------------------------------------------------------------- - // Static texture/mesh/baked dictionary for avatars - //----------------------------------------------------------------------------------------------- -public: - static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i); - static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i); -private: - static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; } - static LLVOAvatarDefines::LLVOAvatarDictionary *sAvatarDictionary; - static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo; - static LLVOAvatarXmlInfo* sAvatarXmlInfo; - //----------------------------------------------------------------------------------------------- - // Diagnostics - //----------------------------------------------------------------------------------------------- -public: - static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars - static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) - static F32 sGreyTime; // Total seconds with >=1 grey avatars - static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) +/** Support classes + ** ** + *******************************************************************************/ - const std::string getBakedStatusForPrintout() const; -}; +}; // LLVOAvatar -//----------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------ // Inlines -//----------------------------------------------------------------------------------------------- -inline BOOL LLVOAvatar::isTextureDefined(U8 te) const -{ - return (getTEImage(te)->getID() != IMG_DEFAULT_AVATAR && getTEImage(te)->getID() != IMG_DEFAULT); -} - -inline BOOL LLVOAvatar::isTextureVisible(U8 te) const +//------------------------------------------------------------------------ +inline BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex te) const { return ((isTextureDefined(te) || isSelf()) && (getTEImage(te)->getID() != IMG_INVISIBLE diff --git a/indra/newview/llvoavatardefines.cpp b/indra/newview/llvoavatardefines.cpp index 19ad90a8e2..978a61972f 100644 --- a/indra/newview/llvoavatardefines.cpp +++ b/indra/newview/llvoavatardefines.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2001&license=viewergpl$ * - * Copyright (c) 2001-2007, Linden Research, Inc. + * Copyright (c) 2001-2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -12,12 +12,13 @@ * ("GPL"), unless you have obtained a separate licensing agreement * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -31,6 +32,7 @@ #include "llviewerprecompiledheaders.h" #include "llvoavatardefines.h" +#include "llviewercontrol.h" // gSavedSettings const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512; const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512; @@ -41,56 +43,87 @@ using namespace LLVOAvatarDefines; /********************************************************************************* * Edit this function to add/remove/change textures and mesh definitions for avatars. */ -void LLVOAvatarDictionary::initData() + +LLVOAvatarDictionary::Textures::Textures() { - // Textures - mTextureMap[TEX_HEAD_BODYPAINT] = new TextureDictionaryEntry("head bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN); - mTextureMap[TEX_UPPER_SHIRT] = new TextureDictionaryEntry("shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", WT_SHIRT); - mTextureMap[TEX_LOWER_PANTS] = new TextureDictionaryEntry("pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", WT_PANTS); - mTextureMap[TEX_EYES_IRIS] = new TextureDictionaryEntry("iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", WT_EYES); - mTextureMap[TEX_HAIR] = new TextureDictionaryEntry("hair", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", WT_HAIR); - mTextureMap[TEX_UPPER_BODYPAINT] = new TextureDictionaryEntry("upper bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN); - mTextureMap[TEX_LOWER_BODYPAINT] = new TextureDictionaryEntry("lower bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN); - mTextureMap[TEX_LOWER_SHOES] = new TextureDictionaryEntry("shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", WT_SHOES); - mTextureMap[TEX_LOWER_SOCKS] = new TextureDictionaryEntry("socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", WT_SOCKS); - mTextureMap[TEX_UPPER_JACKET] = new TextureDictionaryEntry("upper jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET); - mTextureMap[TEX_LOWER_JACKET] = new TextureDictionaryEntry("lower jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET); - mTextureMap[TEX_UPPER_GLOVES] = new TextureDictionaryEntry("gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", WT_GLOVES); - mTextureMap[TEX_UPPER_UNDERSHIRT] = new TextureDictionaryEntry("undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERSHIRT); - mTextureMap[TEX_LOWER_UNDERPANTS] = new TextureDictionaryEntry("underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERPANTS); - mTextureMap[TEX_SKIRT] = new TextureDictionaryEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", WT_SKIRT); - mTextureMap[TEX_HEAD_BAKED] = new TextureDictionaryEntry("head-baked", FALSE, BAKED_HEAD); - mTextureMap[TEX_UPPER_BAKED] = new TextureDictionaryEntry("upper-baked", FALSE, BAKED_UPPER); - mTextureMap[TEX_LOWER_BAKED] = new TextureDictionaryEntry("lower-baked", FALSE, BAKED_LOWER); - mTextureMap[TEX_EYES_BAKED] = new TextureDictionaryEntry("eyes-baked", FALSE, BAKED_EYES); - mTextureMap[TEX_HAIR_BAKED] = new TextureDictionaryEntry("hair-baked", FALSE, BAKED_HAIR); - mTextureMap[TEX_SKIRT_BAKED] = new TextureDictionaryEntry("skirt-baked", FALSE, BAKED_SKIRT); + addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN)); + addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", WT_SHIRT)); + addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", WT_PANTS)); + addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", WT_EYES)); + addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", WT_HAIR)); + addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN)); + addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN)); + addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", WT_SHOES)); + addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", WT_SOCKS)); + addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET)); + addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET)); + addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", WT_GLOVES)); + addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERSHIRT)); + addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERPANTS)); + addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", WT_SKIRT)); + addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA)); + addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA)); + addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA)); + addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA)); + addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA)); + addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "UIImgDefaultTattooUUID", WT_TATTOO)); + addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "UIImgDefaultTattooUUID", WT_TATTOO)); + addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "UIImgDefaultTattooUUID", WT_TATTOO)); + addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD)); + addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER)); + addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER)); + addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES)); + addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR)); + addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT)); +} +LLVOAvatarDictionary::BakedTextures::BakedTextures() +{ // Baked textures - mBakedTextureMap[BAKED_HEAD] = new BakedDictionaryEntry(TEX_HEAD_BAKED, "head", 1, TEX_HEAD_BODYPAINT); - mBakedTextureMap[BAKED_UPPER] = new BakedDictionaryEntry(TEX_UPPER_BAKED, "upper_body", 5, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT,TEX_UPPER_JACKET,TEX_UPPER_GLOVES,TEX_UPPER_UNDERSHIRT); - mBakedTextureMap[BAKED_LOWER] = new BakedDictionaryEntry(TEX_LOWER_BAKED, "lower_body", 6, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES,TEX_LOWER_SOCKS,TEX_LOWER_JACKET,TEX_LOWER_UNDERPANTS); - mBakedTextureMap[BAKED_EYES] = new BakedDictionaryEntry(TEX_EYES_BAKED, "eyes", 1, TEX_EYES_IRIS); - mBakedTextureMap[BAKED_SKIRT] = new BakedDictionaryEntry(TEX_SKIRT_BAKED, "skirt", 1, TEX_SKIRT); - mBakedTextureMap[BAKED_HAIR] = new BakedDictionaryEntry(TEX_HAIR_BAKED, "hair", 1, TEX_HAIR); - + addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED, + "head", "18ded8d6-bcfc-e415-8539-944c0f5ea7a6", + 3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA, + 5, WT_SHAPE, WT_SKIN, WT_HAIR, WT_TATTOO, WT_ALPHA)); + + addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED, + "upper_body", "338c29e3-3024-4dbb-998d-7c04cf4fa88f", + 7, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET, + TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA, + 8, WT_SHAPE, WT_SKIN, WT_SHIRT, WT_JACKET, WT_GLOVES, WT_UNDERSHIRT, WT_TATTOO, WT_ALPHA)); + + addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED, + "lower_body", "91b4a2c7-1b1a-ba16-9a16-1f8f8dcc1c3f", + 8, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS, + TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA, + 9, WT_SHAPE, WT_SKIN, WT_PANTS, WT_SHOES, WT_SOCKS, WT_JACKET, WT_UNDERPANTS, WT_TATTOO, WT_ALPHA)); + + addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED, + "eyes", "b2cf28af-b840-1071-3c6a-78085d8128b5", + 2, TEX_EYES_IRIS, TEX_EYES_ALPHA, + 2, WT_EYES, WT_ALPHA)); + + addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED, + "skirt", "ea800387-ea1a-14e0-56cb-24f2022f969a", + 1, TEX_SKIRT, + 1, WT_SKIRT)); + + addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED, + "hair", "0af1ef7c-ad24-11dd-8790-001f5bf833e8", + 2, TEX_HAIR, TEX_HAIR_ALPHA, + 2, WT_HAIR, WT_ALPHA)); +} + +LLVOAvatarDictionary::Meshes::Meshes() +{ // Meshes - mMeshMap[MESH_ID_HAIR] = new MeshDictionaryEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4); - mMeshMap[MESH_ID_HEAD] = new MeshDictionaryEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5); - mMeshMap[MESH_ID_EYELASH] = new MeshDictionaryEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0); // no baked mesh associated currently - mMeshMap[MESH_ID_UPPER_BODY] = new MeshDictionaryEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1); - mMeshMap[MESH_ID_LOWER_BODY] = new MeshDictionaryEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2); - mMeshMap[MESH_ID_EYEBALL_LEFT] = new MeshDictionaryEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3); - mMeshMap[MESH_ID_EYEBALL_RIGHT] = new MeshDictionaryEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3); - mMeshMap[MESH_ID_SKIRT] = new MeshDictionaryEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5); - - // Wearables - mWearableMap[BAKED_HEAD] = new WearableDictionaryEntry("18ded8d6-bcfc-e415-8539-944c0f5ea7a6", 3, WT_SHAPE, WT_SKIN, WT_HAIR); - mWearableMap[BAKED_UPPER] = new WearableDictionaryEntry("338c29e3-3024-4dbb-998d-7c04cf4fa88f", 6, WT_SHAPE, WT_SKIN, WT_SHIRT, WT_JACKET, WT_GLOVES, WT_UNDERSHIRT); - mWearableMap[BAKED_LOWER] = new WearableDictionaryEntry("91b4a2c7-1b1a-ba16-9a16-1f8f8dcc1c3f", 7, WT_SHAPE, WT_SKIN, WT_PANTS, WT_SHOES, WT_SOCKS, WT_JACKET, WT_UNDERPANTS); - mWearableMap[BAKED_EYES] = new WearableDictionaryEntry("b2cf28af-b840-1071-3c6a-78085d8128b5", 1, WT_EYES); - mWearableMap[BAKED_SKIRT] = new WearableDictionaryEntry("ea800387-ea1a-14e0-56cb-24f2022f969a", 1, WT_SKIRT); - mWearableMap[BAKED_HAIR] = new WearableDictionaryEntry("0af1ef7c-ad24-11dd-8790-001f5bf833e8", 1, WT_HAIR); + addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4)); + addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5)); + addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently + addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1)); + addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2)); + addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3)); + addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3)); + addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5)); } /* @@ -99,18 +132,22 @@ void LLVOAvatarDictionary::initData() LLVOAvatarDictionary::LLVOAvatarDictionary() { - initData(); createAssociations(); } +//virtual +LLVOAvatarDictionary::~LLVOAvatarDictionary() +{ +} + // Baked textures are composites of textures; for each such composited texture, // map it to the baked texture. void LLVOAvatarDictionary::createAssociations() { - for (baked_map_t::const_iterator iter = mBakedTextureMap.begin(); iter != mBakedTextureMap.end(); iter++) + for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++) { const EBakedTextureIndex baked_index = (iter->first); - const BakedDictionaryEntry *dict = (iter->second); + const BakedEntry *dict = (iter->second); // For each texture that this baked texture index affects, associate those textures // with this baked texture index. @@ -119,19 +156,19 @@ void LLVOAvatarDictionary::createAssociations() local_texture_iter++) { const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter; - mTextureMap[local_texture_index]->mIsUsedByBakedTexture = true; - mTextureMap[local_texture_index]->mBakedTextureIndex = baked_index; + mTextures[local_texture_index]->mIsUsedByBakedTexture = true; + mTextures[local_texture_index]->mBakedTextureIndex = baked_index; } } } -LLVOAvatarDictionary::TextureDictionaryEntry::TextureDictionaryEntry(const std::string &name, - bool is_local_texture, - EBakedTextureIndex baked_texture_index, - const std::string &default_image_name, - EWearableType wearable_type) : - mName(name), +LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name, + bool is_local_texture, + EBakedTextureIndex baked_texture_index, + const std::string &default_image_name, + EWearableType wearable_type) : + LLDictionaryEntry(name), mIsLocalTexture(is_local_texture), mIsBakedTexture(!is_local_texture), mIsUsedByBakedTexture(baked_texture_index != BAKED_NUM_INDICES), @@ -141,87 +178,93 @@ LLVOAvatarDictionary::TextureDictionaryEntry::TextureDictionaryEntry(const std:: { } -LLVOAvatarDictionary::MeshDictionaryEntry::MeshDictionaryEntry(EBakedTextureIndex baked_index, - const std::string &name, - U8 level, - LLViewerJoint::PickName pick) : +LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index, + const std::string &name, + U8 level, + LLViewerJoint::PickName pick) : + LLDictionaryEntry(name), mBakedID(baked_index), - mName(name), mLOD(level), mPickName(pick) { } -LLVOAvatarDictionary::BakedDictionaryEntry::BakedDictionaryEntry(ETextureIndex tex_index, - const std::string &name, - U32 num_local_textures, ... ) : - mName(name), +LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index, + const std::string &name, + const std::string &hash_name, + U32 num_local_textures, + ... ) : + LLDictionaryEntry(name), + mWearablesHashID(LLUUID(hash_name)), mTextureIndex(tex_index) - { va_list argp; + va_start(argp, num_local_textures); + + // Read in local textures for (U8 i=0; i < num_local_textures; i++) { ETextureIndex t = (ETextureIndex)va_arg(argp,int); mLocalTextures.push_back(t); } -} -LLVOAvatarDictionary::WearableDictionaryEntry::WearableDictionaryEntry(const std::string &hash_name, - U32 num_wearables, ... ) : - mHashID(LLUUID(hash_name)) -{ - va_list argp; - va_start(argp, num_wearables); + // Read in number of wearables + const U32 num_wearables = (U32)va_arg(argp,int); + // Read in wearables for (U8 i=0; i < num_wearables; i++) { EWearableType t = (EWearableType)va_arg(argp,int); - mWearablesVec.push_back(t); + mWearables.push_back(t); } } -//virtual -LLVOAvatarDictionary::~LLVOAvatarDictionary() +// static +ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index) { - for (mesh_map_t::iterator iter = mMeshMap.begin(); iter != mMeshMap.end(); iter++) - delete (iter->second); - for (baked_map_t::iterator iter = mBakedTextureMap.begin(); iter != mBakedTextureMap.end(); iter++) - delete (iter->second); - for (texture_map_t::iterator iter = mTextureMap.begin(); iter != mTextureMap.end(); iter++) - delete (iter->second); -} - -const LLVOAvatarDictionary::MeshDictionaryEntry *LLVOAvatarDictionary::getMesh(EMeshIndex index) const -{ - mesh_map_t::const_iterator mesh_iter = mMeshMap.find(index); - if (mesh_iter == mMeshMap.end()) return NULL; - return mesh_iter->second; + return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex; } -const LLVOAvatarDictionary::BakedDictionaryEntry *LLVOAvatarDictionary::getBakedTexture(EBakedTextureIndex index) const +//static +EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name) { - baked_map_t::const_iterator baked_iter = mBakedTextureMap.find(index); - if (baked_iter == mBakedTextureMap.end()) return NULL; - return baked_iter->second; + U8 index = 0; + while (index < BAKED_NUM_INDICES) + { + const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index); + if (be && be->mName.compare(name) == 0) + { + // baked texture found + return (EBakedTextureIndex) index; + } + index++; + } + // baked texture could not be found + return BAKED_NUM_INDICES; } -const LLVOAvatarDictionary::TextureDictionaryEntry *LLVOAvatarDictionary::getTexture(ETextureIndex index) const +//static +const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index) { - texture_map_t::const_iterator texture_iter = mTextureMap.find(index); - if (texture_iter == mTextureMap.end()) return NULL; - return texture_iter->second; + /* switch( index ) + case TEX_UPPER_SHIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultShirtUUID") ); */ + const TextureEntry *texture_dict = getInstance()->getTexture(index); + const std::string &default_image_name = texture_dict->mDefaultImageName; + if (default_image_name == "") + { + return IMG_DEFAULT_AVATAR; + } + else + { + return LLUUID(gSavedSettings.getString(default_image_name)); + } } -const LLVOAvatarDictionary::WearableDictionaryEntry *LLVOAvatarDictionary::getWearable(EBakedTextureIndex index) const +// static +EWearableType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index ) { - wearable_map_t::const_iterator wearable_iter = mWearableMap.find(index); - if (wearable_iter == mWearableMap.end()) return NULL; - return wearable_iter->second; + /* switch(index) + case TEX_UPPER_SHIRT: + return WT_SHIRT; */ + return getInstance()->getTexture(index)->mWearableType; } - - -ETextureIndex LLVOAvatarDefines::getTextureIndex(EBakedTextureIndex index) -{ - return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex; -} diff --git a/indra/newview/llvoavatardefines.h b/indra/newview/llvoavatardefines.h index bc1a1f1c1f..cf3d318159 100644 --- a/indra/newview/llvoavatardefines.h +++ b/indra/newview/llvoavatardefines.h @@ -5,7 +5,7 @@ * * $LicenseInfo:firstyear=2001&license=viewergpl$ * - * Copyright (c) 2001-2007, Linden Research, Inc. + * Copyright (c) 2001-2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab @@ -13,12 +13,13 @@ * ("GPL"), unless you have obtained a separate licensing agreement * ("Other License"), formally executed by you and Linden Lab. Terms of * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -36,6 +37,7 @@ #include #include "llwearable.h" #include "llviewerjoint.h" +#include "lldictionary.h" namespace LLVOAvatarDefines { @@ -45,7 +47,7 @@ extern const S32 SCRATCH_TEX_HEIGHT; extern const S32 IMPOSTOR_PERIOD; //-------------------------------------------------------------------- -// texture entry assignment +// Enums //-------------------------------------------------------------------- enum ETextureIndex { @@ -57,9 +59,9 @@ enum ETextureIndex TEX_UPPER_BODYPAINT, TEX_LOWER_BODYPAINT, TEX_LOWER_SHOES, - TEX_HEAD_BAKED, // Pre-composited - TEX_UPPER_BAKED, // Pre-composited - TEX_LOWER_BAKED, // Pre-composited + TEX_HEAD_BAKED, // Pre-composited + TEX_UPPER_BAKED, // Pre-composited + TEX_LOWER_BAKED, // Pre-composited TEX_EYES_BAKED, // Pre-composited TEX_LOWER_SOCKS, TEX_UPPER_JACKET, @@ -68,14 +70,19 @@ enum ETextureIndex TEX_UPPER_UNDERSHIRT, TEX_LOWER_UNDERPANTS, TEX_SKIRT, - TEX_SKIRT_BAKED, // Pre-composited + TEX_SKIRT_BAKED, // Pre-composited TEX_HAIR_BAKED, // Pre-composited + TEX_LOWER_ALPHA, + TEX_UPPER_ALPHA, + TEX_HEAD_ALPHA, + TEX_EYES_ALPHA, + TEX_HAIR_ALPHA, + TEX_HEAD_TATTOO, + TEX_UPPER_TATTOO, + TEX_LOWER_TATTOO, TEX_NUM_INDICES -}; // "Note: if TEX_NUM_ENTRIES changes, update AGENT_TEXTURES in llagentinfo.h, mTextureIndexBaked, and BAKED_TEXTURE_COUNT" -// Seraph - Above comment about order is probably obsolete. +}; -typedef std::vector texture_vec_t; - enum EBakedTextureIndex { BAKED_HEAD = 0, @@ -86,7 +93,6 @@ enum EBakedTextureIndex BAKED_HAIR, BAKED_NUM_INDICES }; -typedef std::vector bakedtexture_vec_t; // Reference IDs for each mesh. Used as indices for vector of joints enum EMeshIndex @@ -101,19 +107,15 @@ enum EMeshIndex MESH_ID_SKIRT, MESH_ID_NUM_INDICES }; -typedef std::vector mesh_vec_t; +//-------------------------------------------------------------------- +// Vector Types +//-------------------------------------------------------------------- +typedef std::vector texture_vec_t; +typedef std::vector bakedtexture_vec_t; +typedef std::vector mesh_vec_t; typedef std::vector wearables_vec_t; -//-------------------------------------------------------------------------------- -// Convenience Functions -//-------------------------------------------------------------------------------- - -// Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED -ETextureIndex getTextureIndex(EBakedTextureIndex t); - - - //------------------------------------------------------------------------ // LLVOAvatarDictionary // @@ -124,86 +126,109 @@ ETextureIndex getTextureIndex(EBakedTextureIndex t); //------------------------------------------------------------------------ class LLVOAvatarDictionary : public LLSingleton { + //-------------------------------------------------------------------- + // Constructors and Destructors + //-------------------------------------------------------------------- public: LLVOAvatarDictionary(); virtual ~LLVOAvatarDictionary(); +private: + void createAssociations(); - struct TextureDictionaryEntry + //-------------------------------------------------------------------- + // Local and baked textures + //-------------------------------------------------------------------- +public: + struct TextureEntry : public LLDictionaryEntry { - TextureDictionaryEntry(const std::string &name, - bool is_local_texture, - EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES, - const std::string &default_image_name = "", - EWearableType wearable_type = WT_INVALID); - const std::string mName; - const std::string mDefaultImageName; + TextureEntry(const std::string &name, // this must match the xml name used by LLTexLayerInfo::parseXml + bool is_local_texture, + EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES, + const std::string& default_image_name = "", + EWearableType wearable_type = WT_INVALID); + const std::string mDefaultImageName; const EWearableType mWearableType; // It's either a local texture xor baked - BOOL mIsLocalTexture; - BOOL mIsBakedTexture; + BOOL mIsLocalTexture; + BOOL mIsBakedTexture; // If it's a local texture, it may be used by a baked texture - BOOL mIsUsedByBakedTexture; - EBakedTextureIndex mBakedTextureIndex; + BOOL mIsUsedByBakedTexture; + EBakedTextureIndex mBakedTextureIndex; }; + + struct Textures : public LLDictionary + { + Textures(); + } mTextures; + const TextureEntry* getTexture(ETextureIndex index) const { return mTextures.lookup(index); } + const Textures& getTextures() const { return mTextures; } - struct MeshDictionaryEntry + //-------------------------------------------------------------------- + // Meshes + //-------------------------------------------------------------------- +public: + struct MeshEntry : public LLDictionaryEntry { - MeshDictionaryEntry(EBakedTextureIndex baked_index, - const std::string &name, - U8 level, - LLViewerJoint::PickName pick); - const std::string mName; // names of mesh types as they are used in avatar_lad.xml + MeshEntry(EBakedTextureIndex baked_index, + const std::string &name, // names of mesh types as they are used in avatar_lad.xml + U8 level, + LLViewerJoint::PickName pick); // Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml // Otherwise meshes will be unable to be found, or levels of detail will be ignored - const U8 mLOD; - const EBakedTextureIndex mBakedID; - const LLViewerJoint::PickName mPickName; + const U8 mLOD; + const EBakedTextureIndex mBakedID; + const LLViewerJoint::PickName mPickName; }; - struct BakedDictionaryEntry + struct Meshes : public LLDictionary { - BakedDictionaryEntry(ETextureIndex tex_index, - const std::string &name, - U32 num_local_textures, ... ); - const ETextureIndex mTextureIndex; - const std::string mName; - texture_vec_t mLocalTextures; - }; - - struct WearableDictionaryEntry + Meshes(); + } mMeshes; + const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); } + const Meshes& getMeshes() const { return mMeshes; } + + //-------------------------------------------------------------------- + // Baked Textures + //-------------------------------------------------------------------- +public: + struct BakedEntry : public LLDictionaryEntry { - WearableDictionaryEntry(const std::string &hash_name, - U32 num_wearables, ... ); - const LLUUID mHashID; - wearables_vec_t mWearablesVec; + BakedEntry(ETextureIndex tex_index, + const std::string &name, // unused, but necessary for templating. + const std::string &hash_name, + U32 num_local_textures, ... ); // # local textures, local texture list, # wearables, wearable list + // Local Textures + const ETextureIndex mTextureIndex; + texture_vec_t mLocalTextures; + // Wearables + const LLUUID mWearablesHashID; + wearables_vec_t mWearables; }; - typedef std::map baked_map_t; - typedef std::map texture_map_t; - typedef std::map mesh_map_t; - typedef std::map wearable_map_t; + struct BakedTextures: public LLDictionary + { + BakedTextures(); + } mBakedTextures; + const BakedEntry* getBakedTexture(EBakedTextureIndex index) const { return mBakedTextures.lookup(index); } + const BakedTextures& getBakedTextures() const { return mBakedTextures; } + + //-------------------------------------------------------------------- + // Convenience Functions + //-------------------------------------------------------------------- +public: + // Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED + static ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t); - const MeshDictionaryEntry *getMesh(EMeshIndex index) const; - const BakedDictionaryEntry *getBakedTexture(EBakedTextureIndex index) const; - const TextureDictionaryEntry *getTexture(ETextureIndex index) const; - const WearableDictionaryEntry *getWearable(EBakedTextureIndex index) const; + // find a baked texture index based on its name + static EBakedTextureIndex findBakedByRegionName(std::string name); - const texture_map_t &getTextures() const { return mTextureMap; } - const baked_map_t &getBakedTextures() const { return mBakedTextureMap; } - const mesh_map_t &getMeshes() const { return mMeshMap; } - const wearable_map_t &getWearables() const { return mWearableMap; } - -private: - void initData(); - void createAssociations(); + static const LLUUID getDefaultTextureImageID(ETextureIndex index); - texture_map_t mTextureMap; - baked_map_t mBakedTextureMap; - mesh_map_t mMeshMap; - wearable_map_t mWearableMap; + // Given a texture entry, determine which wearable type owns it. + static EWearableType getTEWearableType(ETextureIndex index); }; // End LLVOAvatarDictionary } // End namespace LLVOAvatarDefines -#endif +#endif //LL_VO_AVATARDEFINES_H diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp new file mode 100644 index 0000000000..d629767bbe --- /dev/null +++ b/indra/newview/llvoavatarself.cpp @@ -0,0 +1,2016 @@ +/** + * @file llvoavatar.cpp + * @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llvoavatarself.h" +#include "llvoavatar.h" + +#include +#include + +#include "audioengine.h" +#include "noise.h" + +// TODO: Seraph - Remove unnecessary headers. These are copied from llvoavatar.h. +#include "llagent.h" // Get state values from here +#include "llagentwearables.h" +#include "llviewercontrol.h" +#include "lldrawpoolavatar.h" +#include "lldriverparam.h" +#include "lleditingmotion.h" +#include "llemote.h" +#include "llface.h" +#include "llfirstuse.h" +#include "llheadrotmotion.h" +#include "llhudeffecttrail.h" +#include "llhudmanager.h" +#include "llinventoryview.h" +#include "llkeyframefallmotion.h" +#include "llkeyframestandmotion.h" +#include "llkeyframewalkmotion.h" +#include "llmutelist.h" +#include "llselectmgr.h" +#include "llsprite.h" +#include "lltargetingmotion.h" +#include "lltexlayer.h" +#include "lltexglobalcolor.h" +#include "lltoolgrab.h" // for needsRenderBeam +#include "lltoolmgr.h" // for needsRenderBeam +#include "lltoolmorph.h" +#include "lltrans.h" +#include "llviewercamera.h" +#include "llviewerimagelist.h" +#include "llviewermenu.h" +#include "llviewerobjectlist.h" +#include "llviewerparcelmgr.h" +#include "llviewerstats.h" +#include "llvovolume.h" +#include "llworld.h" +#include "pipeline.h" +#include "llviewershadermgr.h" +#include "llsky.h" +#include "llanimstatelabels.h" +#include "llgesturemgr.h" //needed to trigger the voice gesticulations +#include "llvoiceclient.h" +#include "llvoicevisualizer.h" // Ventrella + +#include "boost/lexical_cast.hpp" + +using namespace LLVOAvatarDefines; + +/********************************************************************************* + ** ** + ** Begin private LLVOAvatarSelf Support classes + ** + **/ + +struct LocalTextureData +{ + LocalTextureData() : + mIsBakedReady(FALSE), + mDiscard(MAX_DISCARD_LEVEL+1), + mImage(NULL), + mWearableID(IMG_DEFAULT_AVATAR), + mTexEntry(NULL) + {} + LLPointer mImage; + BOOL mIsBakedReady; + S32 mDiscard; + LLUUID mWearableID; // UUID of the wearable that this texture belongs to, not of the image itself + LLTextureEntry *mTexEntry; +}; + +//----------------------------------------------------------------------------- +// Callback data +//----------------------------------------------------------------------------- +struct LLAvatarTexData +{ + LLAvatarTexData(const LLUUID& id, ETextureIndex index) : + mAvatarID(id), + mIndex(index) + {} + LLUUID mAvatarID; + ETextureIndex mIndex; +}; + +/** + ** + ** End LLVOAvatarSelf Support classes + ** ** + *********************************************************************************/ + + +//----------------------------------------------------------------------------- +// Static Data +//----------------------------------------------------------------------------- +S32 LLVOAvatarSelf::sScratchTexBytes = 0; +LLMap< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames; +LLMap< LLGLenum, F32*> LLVOAvatarSelf::sScratchTexLastBindTime; + + +/********************************************************************************* + ** ** + ** Begin LLVOAvatarSelf Constructor routines + ** + **/ + +LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, + const LLPCode pcode, + LLViewerRegion* regionp) : + LLVOAvatar(id, pcode, regionp), + mScreenp(NULL), + mLastRegionHandle(0), + mRegionCrossingCount(0) +{ + gAgent.setAvatarObject(this); + gAgentWearables.setAvatarObject(this); + + lldebugs << "Marking avatar as self " << id << llendl; + + for (U32 i = 0; i < TEX_NUM_INDICES; i++) + { + mLocalTextureDatas[(ETextureIndex)i].push_back(new LocalTextureData); + } + + BOOL status = TRUE; + status &= loadAvatarSelf(); + status &= buildMenus(); + if (!status) + { + llerrs << "Unable to load user's avatar" << llendl; + return; + } +} + +// virtual +void LLVOAvatarSelf::markDead() +{ + mBeam = NULL; + LLVOAvatar::markDead(); +} + +BOOL LLVOAvatarSelf::loadAvatarSelf() +{ + BOOL success = TRUE; + // avatar_skeleton.xml + if (!buildSkeletonSelf(sAvatarSkeletonInfo)) + { + llwarns << "avatar file: buildSkeleton() failed" << llendl; + return FALSE; + } + // TODO: make loadLayersets() called only by self. + //success &= loadLayersets(); + + return success; +} + +BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info) +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + // add special-purpose "screen" joint + mScreenp = new LLViewerJoint("mScreen", NULL); + // for now, put screen at origin, as it is only used during special + // HUD rendering mode + F32 aspect = LLViewerCamera::getInstance()->getAspect(); + LLVector3 scale(1.f, aspect, 1.f); + mScreenp->setScale(scale); + mScreenp->setWorldPosition(LLVector3::zero); + return TRUE; +} + +BOOL LLVOAvatarSelf::buildMenus() +{ + //------------------------------------------------------------------------- + // build the attach and detach menus + //------------------------------------------------------------------------- + gAttachBodyPartPieMenus[0] = NULL; + + LLContextMenu::Params params; + params.label(LLTrans::getString("BodyPartsRightArm") + " >"); + params.name(params.label); + params.visible(false); + gAttachBodyPartPieMenus[1] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsHead") + " >"); + params.name(params.label); + gAttachBodyPartPieMenus[2] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsLeftArm") + " >"); + params.name(params.label); + gAttachBodyPartPieMenus[3] = LLUICtrlFactory::create (params); + + gAttachBodyPartPieMenus[4] = NULL; + + params.label(LLTrans::getString("BodyPartsLeftLeg") + " >"); + params.name(params.label); + gAttachBodyPartPieMenus[5] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsTorso") + " >"); + params.name(params.label); + gAttachBodyPartPieMenus[6] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsRightLeg") + " >"); + params.name(params.label); + gAttachBodyPartPieMenus[7] = LLUICtrlFactory::create (params); + + gDetachBodyPartPieMenus[0] = NULL; + + params.label(LLTrans::getString("BodyPartsRightArm") + " >"); + params.name(params.label); + gDetachBodyPartPieMenus[1] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsHead") + " >"); + params.name(params.label); + gDetachBodyPartPieMenus[2] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsLeftArm") + " >"); + params.name(params.label); + gDetachBodyPartPieMenus[3] = LLUICtrlFactory::create (params); + + gDetachBodyPartPieMenus[4] = NULL; + + params.label(LLTrans::getString("BodyPartsLeftLeg") + " >"); + params.name(params.label); + gDetachBodyPartPieMenus[5] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsTorso") + " >"); + params.name(params.label); + gDetachBodyPartPieMenus[6] = LLUICtrlFactory::create (params); + + params.label(LLTrans::getString("BodyPartsRightLeg") + " >"); + params.name(params.label); + gDetachBodyPartPieMenus[7] = LLUICtrlFactory::create (params); + + for (S32 i = 0; i < 8; i++) + { + if (gAttachBodyPartPieMenus[i]) + { + gAttachPieMenu->appendContextSubMenu( gAttachBodyPartPieMenus[i] ); + } + else + { + BOOL attachment_found = FALSE; + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getGroup() == i) + { + LLMenuItemCallGL::Params item_params; + + std::string sub_piemenu_name = attachment->getName(); + if (LLTrans::getString(sub_piemenu_name) != "") + { + item_params.label = LLTrans::getString(sub_piemenu_name); + } + else + { + item_params.label = sub_piemenu_name; + } + item_params.name =(item_params.label ); + item_params.on_click.function_name = "Object.AttachToAvatar"; + item_params.on_click.parameter = curiter->first; + item_params.on_enable.function_name = "Object.EnableWear"; + item_params.on_enable.parameter = curiter->first; + LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); + + gAttachPieMenu->addChild(item); + + attachment_found = TRUE; + break; + + } + } + + if (!attachment_found) + { + gAttachPieMenu->addSeparator(); + } + } + + if (gDetachBodyPartPieMenus[i]) + { + gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] ); + } + else + { + BOOL attachment_found = FALSE; + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getGroup() == i) + { + LLMenuItemCallGL::Params item_params; + std::string sub_piemenu_name = attachment->getName(); + if (LLTrans::getString(sub_piemenu_name) != "") + { + item_params.label = LLTrans::getString(sub_piemenu_name); + } + else + { + item_params.label = sub_piemenu_name; + } + item_params.name =(item_params.label ); + item_params.on_click.function_name = "Attachment.Detach"; + item_params.on_click.parameter = curiter->first; + item_params.on_enable.function_name = "Attachment.EnableDetach"; + item_params.on_enable.parameter = curiter->first; + LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); + + gDetachPieMenu->addChild(item); + + attachment_found = TRUE; + break; + } + } + + if (!attachment_found) + { + gDetachPieMenu->addSeparator(); + } + } + } + + // add screen attachments + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getGroup() == 8) + { + LLMenuItemCallGL::Params item_params; + std::string sub_piemenu_name = attachment->getName(); + if (LLTrans::getString(sub_piemenu_name) != "") + { + item_params.label = LLTrans::getString(sub_piemenu_name); + } + else + { + item_params.label = sub_piemenu_name; + } + item_params.name =(item_params.label ); + item_params.on_click.function_name = "Object.AttachToAvatar"; + item_params.on_click.parameter = curiter->first; + item_params.on_enable.function_name = "Object.EnableWear"; + item_params.on_enable.parameter = curiter->first; + LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); + gAttachScreenPieMenu->addChild(item); + + item_params.on_click.function_name = "Attachment.DetachFromPoint"; + item_params.on_click.parameter = curiter->first; + item_params.on_enable.function_name = "Attachment.PointFilled"; + item_params.on_enable.parameter = curiter->first; + item = LLUICtrlFactory::create(item_params); + gDetachScreenPieMenu->addChild(item); + } + } + + for (S32 pass = 0; pass < 2; pass++) + { + // *TODO: Skinning - gAttachSubMenu is an awful, awful hack + if (!gAttachSubMenu) + { + break; + } + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getIsHUDAttachment() != (pass == 1)) + { + continue; + } + LLMenuItemCallGL::Params item_params; + std::string sub_piemenu_name = attachment->getName(); + if (LLTrans::getString(sub_piemenu_name) != "") + { + item_params.label = LLTrans::getString(sub_piemenu_name); + } + else + { + item_params.label = sub_piemenu_name; + } + item_params.name =(item_params.label ); + item_params.on_click.function_name = "Object.AttachToAvatar"; + item_params.on_click.parameter = curiter->first; + item_params.on_enable.function_name = "Object.EnableWear"; + item_params.on_enable.parameter = curiter->first; + //* TODO: Skinning: + //LLSD params; + //params["index"] = curiter->first; + //params["label"] = attachment->getName(); + //item->addEventHandler("on_enable", LLMenuItemCallGL::MenuCallback().function_name("Attachment.Label").parameter(params)); + + LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); + gAttachSubMenu->addChild(item); + + item_params.on_click.function_name = "Attachment.DetachFromPoint"; + item_params.on_click.parameter = curiter->first; + item_params.on_enable.function_name = "Attachment.PointFilled"; + item_params.on_enable.parameter = curiter->first; + //* TODO: Skinning: item->addEventHandler("on_enable", LLMenuItemCallGL::MenuCallback().function_name("Attachment.Label").parameter(params)); + + item = LLUICtrlFactory::create(item_params); + gDetachSubMenu->addChild(item); + } + if (pass == 0) + { + // put separator between non-hud and hud attachments + gAttachSubMenu->addSeparator(); + gDetachSubMenu->addSeparator(); + } + } + + for (S32 group = 0; group < 8; group++) + { + // skip over groups that don't have sub menus + if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group]) + { + continue; + } + + std::multimap attachment_pie_menu_map; + + // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if(attachment->getGroup() == group) + { + // use multimap to provide a partial order off of the pie slice key + S32 pie_index = attachment->getPieSlice(); + attachment_pie_menu_map.insert(std::make_pair(pie_index, curiter->first)); + } + } + + // add in requested order to pie menu, inserting separators as necessary + S32 cur_pie_slice = 0; + for (std::multimap::iterator attach_it = attachment_pie_menu_map.begin(); + attach_it != attachment_pie_menu_map.end(); ++attach_it) + { + S32 requested_pie_slice = attach_it->first; + S32 attach_index = attach_it->second; + while (cur_pie_slice < requested_pie_slice) + { + gAttachBodyPartPieMenus[group]->addSeparator(); + gDetachBodyPartPieMenus[group]->addSeparator(); + cur_pie_slice++; + } + + LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); + if (attachment) + { + LLMenuItemCallGL::Params item_params; + item_params.name = attachment->getName(); + item_params.label = attachment->getName(); + item_params.on_click.function_name = "Object.AttachToAvatar"; + item_params.on_click.parameter = attach_index; + item_params.on_enable.function_name = "Object.EnableWear"; + item_params.on_enable.parameter = attach_index; + + LLMenuItemCallGL* item = LLUICtrlFactory::create(item_params); + gAttachBodyPartPieMenus[group]->addChild(item); + + item_params.on_click.function_name = "Attachment.DetachFromPoint"; + item_params.on_click.parameter = attach_index; + item_params.on_enable.function_name = "Attachment.PointFilled"; + item_params.on_enable.parameter = attach_index; + item = LLUICtrlFactory::create(item_params); + gDetachBodyPartPieMenus[group]->addChild(item); + cur_pie_slice++; + } + } + } + return TRUE; +} + +LLVOAvatarSelf::~LLVOAvatarSelf() +{ + gAgent.setAvatarObject(NULL); + gAgentWearables.setAvatarObject(NULL); + delete mScreenp; + mScreenp = NULL; + + for (localtexture_map_t::iterator iter = mLocalTextureDatas.begin(); + iter != mLocalTextureDatas.end(); + iter++) + { + localtexture_vec_t &local_textures = iter->second; + for (U32 i = 0; i < local_textures.size(); i++) + { + LocalTextureData* loc_tex_data = local_textures[i]; + delete loc_tex_data; + local_textures[i] = NULL; + } + } +} + +/** + ** + ** End LLVOAvatarSelf Constructor routines + ** ** + *********************************************************************************/ + +//virtual +BOOL LLVOAvatarSelf::loadLayersets() +{ + BOOL success = TRUE; + for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator iter = sAvatarXmlInfo->mLayerInfoList.begin(); + iter != sAvatarXmlInfo->mLayerInfoList.end(); + iter++) + { + // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. + const LLTexLayerSetInfo *info = *iter; + LLTexLayerSet* layer_set = new LLTexLayerSet( this ); + + if (!layer_set->setInfo(info)) + { + stop_glerror(); + delete layer_set; + llwarns << "avatar file: layer_set->parseData() failed" << llendl; + return FALSE; + } + + // scan baked textures and associate the layerset with the appropriate one + EBakedTextureIndex baked_index = BAKED_NUM_INDICES; + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + baked_iter++) + { + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + if (layer_set->isBodyRegion(baked_dict->mName)) + { + baked_index = baked_iter->first; + // ensure both structures are aware of each other + mBakedTextureDatas[baked_index].mTexLayerSet = layer_set; + layer_set->setBakedTexIndex(baked_index); + break; + } + } + // if no baked texture was found, warn and cleanup + if (baked_index == BAKED_NUM_INDICES) + { + llwarns << " has invalid body_region attribute" << llendl; + delete layer_set; + return FALSE; + } + + // scan morph masks and let any affected layers know they have an associated morph + for (LLVOAvatar::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin(); + morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end(); + morph_iter++) + { + LLMaskedMorph *morph = *morph_iter; + LLTexLayer * layer = layer_set->findLayerByName(morph->mLayer); + if (layer) + { + layer->setHasMorph(TRUE); + } + else + { + llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl; + success = FALSE; + } + } + } + return success; +} +// virtual +BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent) +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + // update screen joint size + if (mScreenp) + { + F32 aspect = LLViewerCamera::getInstance()->getAspect(); + LLVector3 scale(1.f, aspect, 1.f); + mScreenp->setScale(scale); + mScreenp->updateWorldMatrixChildren(); + resetHUDAttachments(); + } + return LLVOAvatar::updateCharacter(agent); +} + +// virtual +LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) +{ + if (mScreenp) + { + LLJoint* jointp = mScreenp->findJoint(name); + if (jointp) return jointp; + } + return LLVOAvatar::getJoint(name); +} + +// virtual +void LLVOAvatarSelf::requestStopMotion(LLMotion* motion) +{ + // Only agent avatars should handle the stop motion notifications. + + // Notify agent that motion has stopped + gAgent.requestStopMotion(motion); +} + +// virtual +void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) +{ + for (AnimSourceIterator motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end(); ) + { + gAgent.sendAnimationRequest(motion_it->second, ANIM_REQUEST_STOP); + mAnimationSources.erase(motion_it++); + } + + LLViewerObject* object = gObjectList.findObject(source_id); + if (object) + { + object->mFlags &= ~FLAGS_ANIM_SOURCE; + } +} + +// virtual +void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerImage* image, BOOL set_by_user, U32 index) +{ + if (te >= TEX_NUM_INDICES) + { + llassert(0); + return; + } + + if (getTEImage(te)->getID() == image->getID()) + { + return; + } + + if (isIndexBakedTexture((ETextureIndex)te)) + { + llassert(0); + return; + } + + LLTexLayerSet* layer_set = getLayerSet((ETextureIndex)te); + if (layer_set) + { + invalidateComposite(layer_set, set_by_user); + } + + setTEImage(te, image); + updateMeshTextures(); + + if (gAgent.cameraCustomizeAvatar()) + { + LLVisualParamHint::requestHintUpdates(); + } +} + +//virtual +void LLVOAvatarSelf::removeMissingBakedTextures() +{ + BOOL removed = FALSE; + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + const S32 te = mBakedTextureDatas[i].mTextureIndex; + if (getTEImage(te)->isMissingAsset()) + { + setTEImage(te, gImageList.getImage(IMG_DEFAULT_AVATAR)); + removed = TRUE; + } + } + + if (removed) + { + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); + } + updateMeshTextures(); + requestLayerSetUploads(); + } +} + +//virtual +void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) +{ + if (regionp->getHandle() != mLastRegionHandle) + { + if (mLastRegionHandle != 0) + { + ++mRegionCrossingCount; + F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); + F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); + F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); + + F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); + max = llmax(delta, max); + LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); + } + mLastRegionHandle = regionp->getHandle(); + } + mRegionCrossingTimer.reset(); +} + +//-------------------------------------------------------------------- +// draw tractor beam when editing objects +//-------------------------------------------------------------------- +//virtual +void LLVOAvatarSelf::idleUpdateTractorBeam() +{ + // This is only done for yourself (maybe it should be in the agent?) + if (!needsRenderBeam() || !mIsBuilt) + { + mBeam = NULL; + } + else if (!mBeam || mBeam->isDead()) + { + // VEFFECT: Tractor Beam + mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); + mBeam->setColor(LLColor4U(gAgent.getEffectColor())); + mBeam->setSourceObject(this); + mBeamTimer.reset(); + } + + if (!mBeam.isNull()) + { + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + + if (gAgent.mPointAt.notNull()) + { + // get point from pointat effect + mBeam->setPositionGlobal(gAgent.mPointAt->getPointAtPosGlobal()); + mBeam->triggerLocal(); + } + else if (selection->getFirstRootObject() && + selection->getSelectType() != SELECT_TYPE_HUD) + { + LLViewerObject* objectp = selection->getFirstRootObject(); + mBeam->setTargetObject(objectp); + } + else + { + mBeam->setTargetObject(NULL); + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if (tool->isEditing()) + { + if (tool->getEditingObject()) + { + mBeam->setTargetObject(tool->getEditingObject()); + } + else + { + mBeam->setPositionGlobal(tool->getEditingPointGlobal()); + } + } + else + { + const LLPickInfo& pick = gViewerWindow->getLastPick(); + mBeam->setPositionGlobal(pick.mPosGlobal); + } + + } + if (mBeamTimer.getElapsedTimeF32() > 0.25f) + { + mBeam->setColor(LLColor4U(gAgent.getEffectColor())); + mBeam->setNeedsSendToSim(TRUE); + mBeamTimer.reset(); + } + } +} + +//----------------------------------------------------------------------------- +// restoreMeshData() +//----------------------------------------------------------------------------- +// virtual +void LLVOAvatarSelf::restoreMeshData() +{ + LLMemType mt(LLMemType::MTYPE_AVATAR); + + //llinfos << "Restoring" << llendl; + mMeshValid = TRUE; + updateJointLODs(); + updateAttachmentVisibility(gAgent.getCameraMode()); + + // force mesh update as LOD might not have changed to trigger this + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY, TRUE); +} + + + +//----------------------------------------------------------------------------- +// updateAttachmentVisibility() +//----------------------------------------------------------------------------- +void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode) +{ + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getIsHUDAttachment()) + { + attachment->setAttachmentVisibility(TRUE); + } + else + { + switch (camera_mode) + { + case CAMERA_MODE_MOUSELOOK: + if (LLVOAvatar::sVisibleInFirstPerson && attachment->getVisibleInFirstPerson()) + { + attachment->setAttachmentVisibility(TRUE); + } + else + { + attachment->setAttachmentVisibility(FALSE); + } + break; + default: + attachment->setAttachmentVisibility(TRUE); + break; + } + } + } +} + +//----------------------------------------------------------------------------- +// updatedWearable( EWearableType type ) +// forces an update to any baked textures relevant to type. +// Should be called only on saving the wearable +//----------------------------------------------------------------------------- +void LLVOAvatarSelf::wearableUpdated( EWearableType type ) +{ + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + baked_iter++) + { + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first; + if (baked_dict) + { + for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin(); + type_iter != baked_dict->mWearables.end(); + type_iter++) + { + const EWearableType comp_type = *type_iter; + if (comp_type == type) + { + if (mBakedTextureDatas[index].mTexLayerSet) + { + mBakedTextureDatas[index].mTexLayerSet->requestUpdate(); + mBakedTextureDatas[index].mTexLayerSet->requestUpload(); + } + break; + } + } + } + } +} + +//----------------------------------------------------------------------------- +// isWearingAttachment() +//----------------------------------------------------------------------------- +BOOL LLVOAvatarSelf::isWearingAttachment( const LLUUID& inv_item_id ) +{ + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + if( attachment->getItemID() == inv_item_id ) + { + return TRUE; + } + } + return FALSE; +} + +//----------------------------------------------------------------------------- +// getWornAttachment() +//----------------------------------------------------------------------------- +LLViewerObject* LLVOAvatarSelf::getWornAttachment( const LLUUID& inv_item_id ) const +{ + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::const_iterator curiter = iter++; + const LLViewerJointAttachment* attachment = curiter->second; + if( attachment->getItemID() == inv_item_id ) + { + return attachment->getObject(); + } + } + return NULL; +} + +const std::string LLVOAvatarSelf::getAttachedPointName(const LLUUID& inv_item_id) const +{ + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); ) + { + attachment_map_t::const_iterator curiter = iter++; + const LLViewerJointAttachment* attachment = curiter->second; + if( attachment->getItemID() == inv_item_id ) + { + return attachment->getName(); + } + } + + return LLStringUtil::null; +} + +//virtual +LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *viewer_object) +{ + LLViewerJointAttachment *attachment = LLVOAvatar::attachObject(viewer_object); + if (!attachment) + { + return 0; + } + + updateAttachmentVisibility(gAgent.getCameraMode()); + + // Then make sure the inventory is in sync with the avatar. + gInventory.addChangedMask(LLInventoryObserver::LABEL, attachment->getItemID()); + gInventory.notifyObservers(); + + return attachment; +} + +// virtual +void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +{ + //llinfos << "onLocalTextureLoaded: " << src_vi->getID() << llendl; + + const LLUUID& src_id = src_vi->getID(); + LLAvatarTexData *data = (LLAvatarTexData *)userdata; + if (success) + { + ETextureIndex index = data->mIndex; + if (!isIndexLocalTexture(index)) return; + LocalTextureData *local_tex_data = getLocalTextureData(index,0); + if (!local_tex_data->mIsBakedReady && + local_tex_data->mImage.notNull() && + (local_tex_data->mImage->getID() == src_id) && + discard_level < local_tex_data->mDiscard) + { + local_tex_data->mDiscard = discard_level; + if (!gAgent.cameraCustomizeAvatar()) + { + requestLayerSetUpdate(index); + } + else if (gAgent.cameraCustomizeAvatar()) + { + LLVisualParamHint::requestHintUpdates(); + } + updateMeshTextures(); + } + } + else if (final) + { + ETextureIndex index = data->mIndex; + if (!isIndexLocalTexture(index)) return; + LocalTextureData *local_tex_data = getLocalTextureData(index,0); + // Failed: asset is missing + if (!local_tex_data->mIsBakedReady && + local_tex_data->mImage.notNull() && + local_tex_data->mImage->getID() == src_id) + { + local_tex_data->mDiscard = 0; + requestLayerSetUpdate(index); + updateMeshTextures(); + } + } +} + +// virtual +/* //unused +BOOL LLVOAvatarSelf::getLocalTextureRaw(ETextureIndex index, LLImageRaw* image_raw) const +{ + if (!isIndexLocalTexture(index)) return FALSE; + if (getLocalTextureID(index) == IMG_DEFAULT_AVATAR) return TRUE; + + const LocalTextureData *local_tex_data = getLocalTextureData(index)[0]; + if (local_tex_data->mImage->readBackRaw(-1, image_raw, false)) + { + + return TRUE; + } + + // No data loaded yet + setLocalTexture((ETextureIndex)index, getTEImage(index), FALSE); // <-- non-const, move this elsewhere + return FALSE; +} +*/ + +// virtual +BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLImageGL** image_gl_pp, U32 index) const +{ + *image_gl_pp = NULL; + + if (!isIndexLocalTexture(type)) return FALSE; + if (getLocalTextureID(type, index) == IMG_DEFAULT_AVATAR) return TRUE; + + const LocalTextureData *local_tex_data = getLocalTextureData(type, index); + if (!local_tex_data) + { + return FALSE; + } + *image_gl_pp = local_tex_data->mImage; + return TRUE; +} + +const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) const +{ + if (!isIndexLocalTexture(type)) return IMG_DEFAULT_AVATAR; + + const LocalTextureData *local_tex_data = getLocalTextureData(type,index); + if (local_tex_data && local_tex_data->mImage.notNull()) + { + return local_tex_data->mImage->getID(); + } + return IMG_DEFAULT_AVATAR; +} + +//----------------------------------------------------------------------------- +// isLocalTextureDataAvailable() +// Returns true if at least the lowest quality discard level exists for every texture +// in the layerset. +//----------------------------------------------------------------------------- +BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const +{ + /* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) + return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */ + for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + baked_iter++) + { + const EBakedTextureIndex baked_index = baked_iter->first; + if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) + { + BOOL ret = true; + const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); + local_tex_iter != baked_dict->mLocalTextures.end(); + local_tex_iter++) + { + const ETextureIndex tex_index = *local_tex_iter; + ret &= (getLocalDiscardLevel(tex_index) >= 0); + } + return ret; + } + } + llassert(0); + return FALSE; +} + +//----------------------------------------------------------------------------- +// virtual +// isLocalTextureDataFinal() +// Returns true if the highest quality discard level exists for every texture +// in the layerset. +//----------------------------------------------------------------------------- +BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) const +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + if (layerset == mBakedTextureDatas[i].mTexLayerSet) + { + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); + local_tex_iter != baked_dict->mLocalTextures.end(); + local_tex_iter++) + { + if (getLocalDiscardLevel(*local_tex_iter) != 0) + { + return FALSE; + } + } + return TRUE; + } + } + llassert(0); + return FALSE; +} + +BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const +{ + LLUUID id; + if (isIndexLocalTexture(type)) + { + id = getLocalTextureID(type, index); + } + else + { + id = getTEImage(type)->getID(); + } + + return (id != IMG_DEFAULT_AVATAR && + id != IMG_DEFAULT); +} + +//----------------------------------------------------------------------------- +// virtual +// requestLayerSetUploads() +//----------------------------------------------------------------------------- +void LLVOAvatarSelf::requestLayerSetUploads() +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); + if (!layer_baked && mBakedTextureDatas[i].mTexLayerSet) + { + mBakedTextureDatas[i].mTexLayerSet->requestUpload(); + } + } +} + +bool LLVOAvatarSelf::areTexturesCurrent() const +{ + return !hasPendingBakedUploads() && gAgentWearables.areWearablesLoaded(); +} + +// virtual +bool LLVOAvatarSelf::hasPendingBakedUploads() const +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + BOOL upload_pending = (mBakedTextureDatas[i].mTexLayerSet && mBakedTextureDatas[i].mTexLayerSet->getComposite()->uploadPending()); + if (upload_pending) + { + return true; + } + } + return false; +} + +void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ) +{ + if( !layerset || !layerset->getUpdatesEnabled() ) + { + return; + } + // llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegion() << llendl; + + invalidateMorphMasks(layerset->getBakedTexIndex()); + layerset->requestUpdate(); + + if( set_by_user ) + { + llassert(isSelf()); + + ETextureIndex baked_te = getBakedTE( layerset ); + setTEImage( baked_te, gImageList.getImage(IMG_DEFAULT_AVATAR) ); + layerset->requestUpload(); + } +} + +void LLVOAvatarSelf::invalidateAll() +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE); + } + updateMeshTextures(); +} + +//----------------------------------------------------------------------------- +// setCompositeUpdatesEnabled() +//----------------------------------------------------------------------------- +void LLVOAvatarSelf::setCompositeUpdatesEnabled( BOOL b ) +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + if (mBakedTextureDatas[i].mTexLayerSet ) + { + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( b ); + } + } +} + +void LLVOAvatarSelf::setupComposites() +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); + if (mBakedTextureDatas[i].mTexLayerSet) + { + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(!layer_baked); + } + } +} + +void LLVOAvatarSelf::updateComposites() +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + if (mBakedTextureDatas[i].mTexLayerSet + && ((i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT))) + { + mBakedTextureDatas[i].mTexLayerSet->updateComposite(); + } + } +} + +// virtual +S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 index) const +{ + if (!isIndexLocalTexture(type)) return FALSE; + + const LocalTextureData *local_tex_data = getLocalTextureData(type,index); + if (local_tex_data) + { + if (type >= 0 + && getLocalTextureID(type,index) != IMG_DEFAULT_AVATAR + && !local_tex_data->mImage->isMissingAsset()) + { + return local_tex_data->mImage->getDiscardLevel(); + } + else + { + // We don't care about this (no image associated with the layer) treat as fully loaded. + return 0; + } + } + return 0; +} + +// virtual +// Counts the memory footprint of local textures. +void LLVOAvatarSelf::getLocalTextureByteCount(S32* gl_bytes) const +{ + *gl_bytes = 0; + for (S32 type = 0; type < TEX_NUM_INDICES; type++) + { + if (!isIndexLocalTexture((ETextureIndex)type)) continue; + const localtexture_vec_t & local_tex_vec = getLocalTextureData((ETextureIndex)type); + for (U32 num = 0; num < local_tex_vec.size(); num++) + { + const LocalTextureData *local_tex_data = local_tex_vec[num]; + if (local_tex_data) + { + const LLViewerImage* image_gl = local_tex_data->mImage; + if (image_gl) + { + S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents(); + + if (image_gl->getHasGLTexture()) + { + *gl_bytes += bytes; + } + } + } + } + } +} + +// virtual +void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerImage* tex, BOOL baked_version_ready, U32 index) +{ + if (!isIndexLocalTexture(type)) return; + + S32 desired_discard = isSelf() ? 0 : 2; + LocalTextureData *local_tex_data = getLocalTextureData(type,index); + if (!baked_version_ready) + { + if (tex != local_tex_data->mImage || local_tex_data->mIsBakedReady) + { + local_tex_data->mDiscard = MAX_DISCARD_LEVEL+1; + } + if (tex->getID() != IMG_DEFAULT_AVATAR) + { + if (local_tex_data->mDiscard > desired_discard) + { + S32 tex_discard = tex->getDiscardLevel(); + if (tex_discard >= 0 && tex_discard <= desired_discard) + { + local_tex_data->mDiscard = tex_discard; + if (isSelf() && !gAgent.cameraCustomizeAvatar()) + { + requestLayerSetUpdate(type); + } + else if (isSelf() && gAgent.cameraCustomizeAvatar()) + { + LLVisualParamHint::requestHintUpdates(); + } + } + else + { + tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type)); + } + } + tex->setMinDiscardLevel(desired_discard); + } + } + local_tex_data->mIsBakedReady = baked_version_ready; + local_tex_data->mImage = tex; +} + +// virtual +void LLVOAvatarSelf::dumpLocalTextures() const +{ + llinfos << "Local Textures:" << llendl; + + /* ETextureIndex baked_equiv[] = { + TEX_UPPER_BAKED, + if (isTextureDefined(baked_equiv[i])) */ + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + iter++) + { + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) + continue; + + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + const ETextureIndex baked_equiv = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex; + + const std::string &name = texture_dict->mName; + const LocalTextureData *local_tex_data = getLocalTextureData(iter->first,0); + if (isTextureDefined(baked_equiv)) + { +#if LL_RELEASE_FOR_DOWNLOAD + // End users don't get to trivially see avatar texture IDs, makes textures + // easier to steal. JC + llinfos << "LocTex " << name << ": Baked " << llendl; +#else + llinfos << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << llendl; +#endif + } + else if (local_tex_data->mImage.notNull()) + { + if (local_tex_data->mImage->getID() == IMG_DEFAULT_AVATAR) + { + llinfos << "LocTex " << name << ": None" << llendl; + } + else + { + const LLViewerImage* image = local_tex_data->mImage; + + llinfos << "LocTex " << name << ": " + << "Discard " << image->getDiscardLevel() << ", " + << "(" << image->getWidth() << ", " << image->getHeight() << ") " +#if !LL_RELEASE_FOR_DOWNLOAD + // End users don't get to trivially see avatar texture IDs, + // makes textures easier to steal + << image->getID() << " " +#endif + << "Priority: " << image->getDecodePriority() + << llendl; + } + } + else + { + llinfos << "LocTex " << name << ": No LLViewerImage" << llendl; + } + } +} + +//----------------------------------------------------------------------------- +// static +// onLocalTextureLoaded() +//----------------------------------------------------------------------------- + +void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src_raw, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) +{ + LLAvatarTexData *data = (LLAvatarTexData *)userdata; + LLVOAvatarSelf *self = (LLVOAvatarSelf *)gObjectList.findObject(data->mAvatarID); + if (self) + { + // We should only be handling local textures for ourself + self->localTextureLoaded(success, src_vi, src_raw, aux_src, discard_level, final, userdata); + } + // ensure data is cleaned up + if (final || !success) + { + delete data; + } +} + + +const LLVOAvatarSelf::localtexture_vec_t &LLVOAvatarSelf::getLocalTextureData(LLVOAvatarDefines::ETextureIndex type) const +{ + localtexture_map_t::const_iterator found_localtexture = mLocalTextureDatas.find(type); + if (found_localtexture != mLocalTextureDatas.end()) + { + const localtexture_vec_t &local_tex_data = found_localtexture->second; + return local_tex_data; + } + llassert(0); + static localtexture_vec_t ret; + return ret; +} + +const LocalTextureData* LLVOAvatarSelf::getLocalTextureData(LLVOAvatarDefines::ETextureIndex type, U32 index ) const +{ + const localtexture_vec_t &local_tex_array = getLocalTextureData(type); + + if (index >= local_tex_array.size()) + { + return NULL; + } + + return local_tex_array[index]; +} + +LLVOAvatarSelf::localtexture_vec_t &LLVOAvatarSelf::getLocalTextureData(LLVOAvatarDefines::ETextureIndex type) +{ + localtexture_map_t::iterator found_localtexture = mLocalTextureDatas.find(type); + if (found_localtexture != mLocalTextureDatas.end()) + { + localtexture_vec_t &local_tex_data = found_localtexture->second; + return local_tex_data; + } + llassert(0); + static localtexture_vec_t ret; + return ret; +} + +LocalTextureData* LLVOAvatarSelf::getLocalTextureData(LLVOAvatarDefines::ETextureIndex type, U32 index ) +{ + localtexture_vec_t &local_tex_array = getLocalTextureData(type); + + if (index >= local_tex_array.size()) + { + return NULL; + } + + return local_tex_array[index]; +} + +// static +void LLVOAvatarSelf::dumpTotalLocalTextureByteCount() +{ + S32 gl_bytes = 0; + gAgent.getAvatarObject()->getLocalTextureByteCount(&gl_bytes); + llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl; +} + +BOOL LLVOAvatarSelf::updateIsFullyLoaded() +{ + BOOL loading = FALSE; + + // do we have a shape? + if (visualParamWeightsAreDefault()) + { + loading = TRUE; + } + + if (!isTextureDefined(TEX_HAIR)) + { + loading = TRUE; + } + + if (!mPreviousFullyLoaded) + { + if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) && + (!isTextureDefined(TEX_LOWER_BAKED))) + { + loading = TRUE; + } + + if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) && + (!isTextureDefined(TEX_UPPER_BAKED))) + { + loading = TRUE; + } + + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + if (i == BAKED_SKIRT && !isWearingWearableType(WT_SKIRT)) + continue; + + BakedTextureData& texture_data = mBakedTextureDatas[i]; + if (!isTextureDefined(texture_data.mTextureIndex)) + continue; + + // Check for the case that texture is defined but not sufficiently loaded to display anything. + LLViewerImage* baked_img = getImage( texture_data.mTextureIndex ); + if (!baked_img || !baked_img->getHasGLTexture()) + { + loading = TRUE; + } + + } + + } + return processFullyLoadedChange(loading); +} + +const LLUUID& LLVOAvatarSelf::grabLocalTexture(ETextureIndex type, U32 index) const +{ + if (canGrabLocalTexture(type, index)) + { + return getTEImage( type )->getID(); + } + return LLUUID::null; +} + +BOOL LLVOAvatarSelf::canGrabLocalTexture(ETextureIndex type, U32 index) const +{ + // Check if the texture hasn't been baked yet. + if (!isTextureDefined(type)) + { + lldebugs << "getTEImage( " << (U32) type << " )->getID() == IMG_DEFAULT_AVATAR" << llendl; + return FALSE; + } + + if (gAgent.isGodlike()) + return TRUE; + + // Check permissions of textures that show up in the + // baked texture. We don't want people copying people's + // work via baked textures. + /* switch(type) + case TEX_EYES_BAKED: + textures.push_back(TEX_EYES_IRIS); */ + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(type); + if (!texture_dict->mIsUsedByBakedTexture) return FALSE; + + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index); + for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin(); + iter != baked_dict->mLocalTextures.end(); + iter++) + { + const ETextureIndex t_index = (*iter); + lldebugs << "Checking index " << (U32) t_index << llendl; + const LLUUID& texture_id = getTEImage( t_index )->getID(); + if (texture_id != IMG_DEFAULT_AVATAR) + { + // Search inventory for this texture. + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + LLAssetIDMatches asset_id_matches(texture_id); + gInventory.collectDescendentsIf(LLUUID::null, + cats, + items, + LLInventoryModel::INCLUDE_TRASH, + asset_id_matches); + + BOOL can_grab = FALSE; + lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl; + if (items.count()) + { + // search for full permissions version + for (S32 i = 0; i < items.count(); i++) + { + LLInventoryItem* itemp = items[i]; + LLPermissions item_permissions = itemp->getPermissions(); + if ( item_permissions.allowOperationBy( + PERM_MODIFY, gAgent.getID(), gAgent.getGroupID()) && + item_permissions.allowOperationBy( + PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && + item_permissions.allowOperationBy( + PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID()) ) + { + can_grab = TRUE; + break; + } + } + } + if (!can_grab) return FALSE; + } + } + + return TRUE; +} + +void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerImage* imagep, + F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked, U32 index ) +{ + if (!isIndexLocalTexture(type)) return; + + if (!covered_by_baked) + { + if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) + { + F32 desired_pixels; + desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + imagep->setBoostLevel(getAvatarBoostLevel()); + imagep->addTextureStats( desired_pixels / texel_area_ratio ); + if (imagep->getDiscardLevel() < 0) + { + mHasGrey = TRUE; // for statistics gathering + } + } + else + { + // texture asset is missing + mHasGrey = TRUE; // for statistics gathering + } + } +} + +//----------------------------------------------------------------------------- +// getBakedTE() +// Used by the LayerSet. (Layer sets don't in general know what textures depend on them.) +//----------------------------------------------------------------------------- +ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const +{ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + if (layerset == mBakedTextureDatas[i].mTexLayerSet ) + { + return mBakedTextureDatas[i].mTextureIndex; + } + } + llassert(0); + return TEX_HEAD_BAKED; +} + + +//----------------------------------------------------------------------------- +// setNewBakedTexture() +// A new baked texture has been successfully uploaded and we can start using it now. +//----------------------------------------------------------------------------- +void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) +{ + // Baked textures live on other sims. + LLHost target_host = getObjectHost(); + setTEImage( te, gImageList.getImageFromHost( uuid, target_host ) ); + updateMeshTextures(); + dirtyMesh(); + + LLVOAvatar::cullAvatarsByPixelArea(); + + /* switch(te) + case TEX_HEAD_BAKED: + llinfos << "New baked texture: HEAD" << llendl; */ + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(te); + if (texture_dict->mIsBakedTexture) + { + llinfos << "New baked texture: " << texture_dict->mName << " UUID: " << uuid <cancelUpload(); */ + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + if ( mBakedTextureDatas[i].mTextureIndex == te && mBakedTextureDatas[i].mTexLayerSet) + { + mBakedTextureDatas[i].mTexLayerSet->cancelUpload(); + } + } +} + +// static +void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) +{ + LLUUID texture_id; + msg->getUUID("TextureData", "TextureID", texture_id); + + LLVOAvatarSelf* self = gAgent.getAvatarObject(); + if (!self) return; + + // If this is a texture corresponding to one of our baked entries, + // just rebake that layer set. + BOOL found = FALSE; + + /* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] = + TEX_HEAD_BAKED, + TEX_UPPER_BAKED, */ + for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); + iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + iter++) + { + const ETextureIndex index = iter->first; + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsBakedTexture) + { + if (texture_id == self->getTEImage(index)->getID()) + { + LLTexLayerSet* layer_set = self->getLayerSet(index); + if (layer_set) + { + llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; + // Apparently set_by_user == force upload + BOOL set_by_user = TRUE; + self->invalidateComposite(layer_set, set_by_user); + found = TRUE; + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); + } + } + } + } + + // If texture not found, rebake all entries. + if (!found) + { + self->forceBakeAllTextures(); + } + else + { + // Not sure if this is necessary, but forceBakeAllTextures() does it. + self->updateMeshTextures(); + } +} + +void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug) +{ + llinfos << "TAT: forced full rebake. " << llendl; + + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex; + LLTexLayerSet* layer_set = getLayerSet(baked_index); + if (layer_set) + { + if (slam_for_debug) + { + layer_set->setUpdatesEnabled(TRUE); + layer_set->cancelUpload(); + } + + BOOL set_by_user = TRUE; + invalidateComposite(layer_set, set_by_user); + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); + } + else + { + llwarns << "TAT: NO LAYER SET FOR " << (S32)baked_index << llendl; + } + } + + // Don't know if this is needed + updateMeshTextures(); +} + +//----------------------------------------------------------------------------- +// requestLayerSetUpdate() +//----------------------------------------------------------------------------- +void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index ) +{ + /* switch(index) + case LOCTEX_UPPER_BODYPAINT: + case LOCTEX_UPPER_SHIRT: + if( mUpperBodyLayerSet ) + mUpperBodyLayerSet->requestUpdate(); */ + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) + return; + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + if (mBakedTextureDatas[baked_index].mTexLayerSet) + { + mBakedTextureDatas[baked_index].mTexLayerSet->requestUpdate(); + } +} + +LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const +{ + /* switch(index) + case TEX_HEAD_BAKED: + case TEX_HEAD_BODYPAINT: + return mHeadLayerSet; */ + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + if (texture_dict->mIsUsedByBakedTexture) + { + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + return mBakedTextureDatas[baked_index].mTexLayerSet; + } + return NULL; +} + +// static +void LLVOAvatarSelf::onCustomizeStart() +{ + // We're no longer doing any baking or invalidating on entering + // appearance editing mode. Leaving function in place in case + // further changes require us to do something at this point - Nyx +} + +// static +void LLVOAvatarSelf::onCustomizeEnd() +{ + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); + if (avatarp) + { + avatarp->invalidateAll(); + avatarp->requestLayerSetUploads(); + } +} + +// static +void LLVOAvatarSelf::onChangeSelfInvisible(BOOL newvalue) +{ + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); + if (avatarp) + { + if (newvalue) + { + // we have just requested to set the avatar's baked textures to invisible + avatarp->setInvisible(TRUE); + } + else + { + avatarp->setInvisible(FALSE); + } + } +} + +void LLVOAvatarSelf::setInvisible(BOOL newvalue) +{ + if (newvalue) + { + setCompositeUpdatesEnabled(FALSE); + for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) + { + setNewBakedTexture(mBakedTextureDatas[i].mTextureIndex, IMG_INVISIBLE); + } + gAgent.sendAgentSetAppearance(); + } + else + { + setCompositeUpdatesEnabled(TRUE); + invalidateAll(); + requestLayerSetUploads(); + gAgent.sendAgentSetAppearance(); + } +} + +//------------------------------------------------------------------------ +// needsRenderBeam() +//------------------------------------------------------------------------ +BOOL LLVOAvatarSelf::needsRenderBeam() +{ + if (gNoRender) + { + return FALSE; + } + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + + BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); + if (LLToolGrab::getInstance()->getEditingObject() && + LLToolGrab::getInstance()->getEditingObject()->isAttachment()) + { + // don't render selection beam on hud objects + is_touching_or_grabbing = FALSE; + } + return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); +} + +// static +void LLVOAvatarSelf::deleteScratchTextures() +{ + for( LLGLuint* namep = sScratchTexNames.getFirstData(); + namep; + namep = sScratchTexNames.getNextData() ) + { + LLImageGL::deleteTextures(1, (U32 *)namep ); + stop_glerror(); + } + + if( sScratchTexBytes ) + { + lldebugs << "Clearing Scratch Textures " << (sScratchTexBytes/1024) << "KB" << llendl; + + sScratchTexNames.deleteAllData(); + sScratchTexLastBindTime.deleteAllData(); + LLImageGL::sGlobalTextureMemoryInBytes -= sScratchTexBytes; + sScratchTexBytes = 0; + } +} + +BOOL LLVOAvatarSelf::bindScratchTexture( LLGLenum format ) +{ + U32 texture_bytes = 0; + GLuint gl_name = getScratchTexName( format, &texture_bytes ); + if( gl_name ) + { + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); + stop_glerror(); + + F32* last_bind_time = sScratchTexLastBindTime.getIfThere( format ); + if( last_bind_time ) + { + if( *last_bind_time != LLImageGL::sLastFrameTime ) + { + *last_bind_time = LLImageGL::sLastFrameTime; + LLImageGL::updateBoundTexMem(texture_bytes); + } + } + else + { + LLImageGL::updateBoundTexMem(texture_bytes); + sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); + } + return TRUE; + } + return FALSE; +} + +LLGLuint LLVOAvatarSelf::getScratchTexName( LLGLenum format, U32* texture_bytes ) +{ + S32 components; + GLenum internal_format; + switch( format ) + { + case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; + case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; + case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; + case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; + case GL_RGB: components = 3; internal_format = GL_RGB8; break; + case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; + default: llassert(0); components = 4; internal_format = GL_RGBA8; break; + } + + *texture_bytes = components * SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT; + + if( sScratchTexNames.checkData( format ) ) + { + return *( sScratchTexNames.getData( format ) ); + } + + LLGLSUIDefault gls_ui; + + U32 name = 0; + LLImageGL::generateTextures(1, &name ); + stop_glerror(); + + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); + stop_glerror(); + + LLImageGL::setManualImage( + GL_TEXTURE_2D, 0, internal_format, + SCRATCH_TEX_WIDTH, SCRATCH_TEX_HEIGHT, + format, GL_UNSIGNED_BYTE, NULL ); + stop_glerror(); + + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + stop_glerror(); + + sScratchTexNames.addData( format, new LLGLuint( name ) ); + + sScratchTexBytes += *texture_bytes; + LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes; + return name; +} + +// static +void LLVOAvatarSelf::dumpScratchTextureByteCount() +{ + llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl; +} diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h new file mode 100644 index 0000000000..431c814382 --- /dev/null +++ b/indra/newview/llvoavatarself.h @@ -0,0 +1,321 @@ +/** + * @file llvoavatarself.h + * @brief Declaration of LLVOAvatar class which is a derivation fo + * LLViewerObject + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLVOAVATARSELF_H +#define LL_LLVOAVATARSELF_H + +#include "llvoavatar.h" + +struct LocalTextureData; + +//------------------------------------------------------------------------ +// LLVOAvatarSelf +//------------------------------------------------------------------------ +class LLVOAvatarSelf : + public LLVOAvatar +{ + +/******************************************************************************** + ** ** + ** INITIALIZATION + **/ + +public: + LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); + virtual ~LLVOAvatarSelf(); + virtual void markDead(); +protected: + BOOL loadAvatarSelf(); + BOOL buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info); + BOOL buildMenus(); + /*virtual*/ BOOL loadLayersets(); + +/** Initialization + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** INHERITED + **/ + + //-------------------------------------------------------------------- + // LLViewerObject interface and related + //-------------------------------------------------------------------- +public: + /*virtual*/ void updateRegion(LLViewerRegion *regionp); + + //-------------------------------------------------------------------- + // LLCharacter interface and related + //-------------------------------------------------------------------- +public: + /*virtual*/ void stopMotionFromSource(const LLUUID& source_id); + /*virtual*/ void requestStopMotion(LLMotion* motion); + /*virtual*/ LLJoint* getJoint(const std::string &name); + +/** Initialization + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** STATE + **/ + +public: + /*virtual*/ bool isSelf() const { return true; } + + //-------------------------------------------------------------------- + // Updates + //-------------------------------------------------------------------- +public: + /*virtual*/ BOOL updateCharacter(LLAgent &agent); + /*virtual*/ void idleUpdateTractorBeam(); + + //-------------------------------------------------------------------- + // Loading state + //-------------------------------------------------------------------- +public: + /*virtual*/ BOOL updateIsFullyLoaded(); +private: + BOOL mIsBaked; // are the stored baked textures up to date? + + //-------------------------------------------------------------------- + // Region state + //-------------------------------------------------------------------- +private: + U64 mLastRegionHandle; + LLFrameTimer mRegionCrossingTimer; + S32 mRegionCrossingCount; + +/** State + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** RENDERING + **/ + + //-------------------------------------------------------------------- + // Render beam + //-------------------------------------------------------------------- +protected: + BOOL needsRenderBeam(); +private: + LLPointer mBeam; + LLFrameTimer mBeamTimer; + + //-------------------------------------------------------------------- + // LLVOAvatar Constants + //-------------------------------------------------------------------- +public: + /*virtual*/ LLViewerImage::EBoostLevel getAvatarBoostLevel() const { return LLViewerImage::BOOST_AVATAR_SELF; } + /*virtual*/ LLViewerImage::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerImage::BOOST_AVATAR_BAKED_SELF; } + /*virtual*/ S32 getTexImageSize() const { return LLVOAvatar::getTexImageSize()*4; } + +/** Rendering + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** TEXTURES + **/ + + //-------------------------------------------------------------------- + // Loading status + //-------------------------------------------------------------------- +public: + /*virtual*/ bool hasPendingBakedUploads() const; + S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + bool areTexturesCurrent() const; + BOOL isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const; + BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const; + /*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + + //-------------------------------------------------------------------- + // Local Textures + //-------------------------------------------------------------------- +public: + BOOL getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, LLImageGL** image_gl_pp, U32 index = 0) const; + const LLUUID& getLocalTextureID(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + void setLocalTextureTE(U8 te, LLViewerImage* image, BOOL set_by_user, U32 index = 0); + const LLUUID& grabLocalTexture(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + BOOL canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; +protected: + /*virtual*/ void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerImage* tex, BOOL baked_version_exits, U32 index = 0); + void localTextureLoaded(BOOL succcess, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + void getLocalTextureByteCount(S32* gl_byte_count) const; + /*virtual*/ void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerImage* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0); +private: + static void onLocalTextureLoaded(BOOL succcess, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + + //-------------------------------------------------------------------- + // Baked textures + //-------------------------------------------------------------------- +public: + LLVOAvatarDefines::ETextureIndex getBakedTE(const LLTexLayerSet* layerset ) const; + void setNewBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); + void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); + void forceBakeAllTextures(bool slam_for_debug = false); + static void processRebakeAvatarTextures(LLMessageSystem* msg, void**); +protected: + /*virtual*/ void removeMissingBakedTextures(); + + //-------------------------------------------------------------------- + // Layers + //-------------------------------------------------------------------- +public: + void requestLayerSetUploads(); + void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i); +protected: + LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; + + //-------------------------------------------------------------------- + // Composites + //-------------------------------------------------------------------- +public: + /* virtual */ void invalidateComposite(LLTexLayerSet* layerset, BOOL set_by_user); + /* virtual */ void invalidateAll(); + /* virtual */ void setCompositeUpdatesEnabled(BOOL b); // only works for self + void setupComposites(); + void updateComposites(); + + //-------------------------------------------------------------------- + // Scratch textures (used for compositing) + //-------------------------------------------------------------------- +public: + BOOL bindScratchTexture(LLGLenum format); + static void deleteScratchTextures(); +protected: + LLGLuint getScratchTexName(LLGLenum format, U32* texture_bytes); +private: + static S32 sScratchTexBytes; + static LLMap< LLGLenum, LLGLuint*> sScratchTexNames; + static LLMap< LLGLenum, F32*> sScratchTexLastBindTime; + + //-------------------------------------------------------------------- + // Texture Data + //-------------------------------------------------------------------- +private: + typedef std::vector localtexture_vec_t; // all textures of a certain TE + typedef std::map localtexture_map_t; // texture TE vectors arranged by texture type + localtexture_map_t mLocalTextureDatas; + + const localtexture_vec_t& getLocalTextureData(LLVOAvatarDefines::ETextureIndex index) const; // const accessor into mLocalTextureDatas + const LocalTextureData* getLocalTextureData(LLVOAvatarDefines::ETextureIndex type, U32 index) const; // const accessor to individual LocalTextureData + + localtexture_vec_t& getLocalTextureData(LLVOAvatarDefines::ETextureIndex index); // accessor into mLocalTextureDatas + LocalTextureData* getLocalTextureData(LLVOAvatarDefines::ETextureIndex type, U32 index); // accessor to individual LocalTextureData + +/** Textures + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** MESHES + **/ +protected: + /*virtual*/ void restoreMeshData(); + +/** Meshes + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** WEARABLES + **/ + +public: + void wearableUpdated(EWearableType type); + + //-------------------------------------------------------------------- + // Attachments + //-------------------------------------------------------------------- +public: + void updateAttachmentVisibility(U32 camera_mode); + BOOL isWearingAttachment(const LLUUID& inv_item_id); + LLViewerObject* getWornAttachment(const LLUUID& inv_item_id ) const; + const std::string getAttachedPointName(const LLUUID& inv_item_id) const; + /*virtual*/ LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object); + + //-------------------------------------------------------------------- + // HUDs + //-------------------------------------------------------------------- +private: + LLViewerJoint* mScreenp; // special purpose joint for HUD attachments + +/** Attachments + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** APPEARANCE + **/ + +public: + static void onCustomizeStart(); + static void onCustomizeEnd(); + + //-------------------------------------------------------------------- + // Visibility + //-------------------------------------------------------------------- +public: + static void onChangeSelfInvisible(BOOL newvalue); + void setInvisible(BOOL newvalue); + +/** Appearance + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** DIAGNOSTICS + **/ + +public: + static void dumpTotalLocalTextureByteCount(); + void dumpLocalTextures() const; + static void dumpScratchTextureByteCount(); + +/** Diagnostics + ** ** + *******************************************************************************/ + +}; + +#endif // LL_VO_AVATARSELF_H diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index fe4a2fdc76..a956ec8ab3 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -165,16 +165,6 @@ void LLVOGrass::initClass() grass_def->getFastAttributeUUID(texture_id_string, id); newGrass->mTextureID = id; - if (newGrass->mTextureID.isNull()) - { - std::string textureName; - - static LLStdStringHandle texture_name_string = LLXmlTree::addAttributeString("texture_name"); - success &= grass_def->getFastAttributeString(texture_name_string, textureName); - LLViewerImage* grass_image = gImageList.getImageFromFile(textureName); - newGrass->mTextureID = grass_image->getID(); - } - static LLStdStringHandle blade_sizex_string = LLXmlTree::addAttributeString("blade_size_x"); success &= grass_def->getFastAttributeF32(blade_sizex_string, F32_val); newGrass->mBladeSizeX = F32_val; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 94407ed08c..082dcb50a2 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -62,6 +62,7 @@ #include "llfirstuse.h" #include "llviewerwindow.h" #include "llviewercamera.h" +#include "llvoavatarself.h" #include "llfloaterfriends.h" //VIVOX, inorder to refresh communicate panel #include "llfloaterchat.h" // for LLFloaterChat::addChat() @@ -1103,58 +1104,61 @@ static void killGateway() /////////////////////////////////////////////////////////////////////////////////////////////// -LLVoiceClient::LLVoiceClient() -{ - gVoiceClient = this; - mWriteInProgress = false; - mAreaVoiceDisabled = false; - mPTT = true; - mUserPTTState = false; - mMuteMic = false; - mSessionTerminateRequested = false; - mRelogRequested = false; - mCommandCookie = 0; - mCurrentParcelLocalID = 0; - mLoginRetryCount = 0; - - mSpeakerVolume = 0; - mMicVolume = 0; - - mAudioSession = NULL; - mAudioSessionChanged = false; - - // Initial dirty state - mSpatialCoordsDirty = false; - mPTTDirty = true; - mFriendsListDirty = true; - mSpeakerVolumeDirty = true; - mMicVolumeDirty = true; - mBuddyListMapPopulated = false; - mBlockRulesListReceived = false; - mAutoAcceptRulesListReceived = false; - mCaptureDeviceDirty = false; - mRenderDeviceDirty = false; - - // Use default values for everything then call updateSettings() after preferences are loaded - mVoiceEnabled = false; - mUsePTT = true; - mPTTIsToggle = false; - mEarLocation = 0; - mLipSyncEnabled = false; +LLVoiceClient::LLVoiceClient() : + mState(stateDisabled), + mSessionTerminateRequested(false), + mRelogRequested(false), + mConnected(false), + mPump(NULL), + + mTuningMode(false), + mTuningEnergy(0.0f), + mTuningMicVolume(0), + mTuningMicVolumeDirty(true), + mTuningSpeakerVolume(0), + mTuningSpeakerVolumeDirty(true), + mTuningExitState(stateDisabled), + + mAreaVoiceDisabled(false), + mAudioSession(NULL), + mAudioSessionChanged(false), + mNextAudioSession(NULL), + + mCurrentParcelLocalID(0), + mNumberOfAliases(0), + mCommandCookie(0), + mLoginRetryCount(0), + + mBuddyListMapPopulated(false), + mBlockRulesListReceived(false), + mAutoAcceptRulesListReceived(false), + mCaptureDeviceDirty(false), + mRenderDeviceDirty(false), + mSpatialCoordsDirty(false), + + mPTTDirty(true), + mPTT(true), + mUsePTT(true), + mPTTIsMiddleMouse(false), + mPTTKey(0), + mPTTIsToggle(false), + mUserPTTState(false), + mMuteMic(false), + mFriendsListDirty(true), + + mEarLocation(0), + mSpeakerVolumeDirty(true), + mSpeakerMuteDirty(true), + mSpeakerVolume(0), + mMicVolume(0), + mMicVolumeDirty(true), - mTuningMode = false; - mTuningEnergy = 0.0f; - mTuningMicVolume = 0; - mTuningMicVolumeDirty = true; - mTuningSpeakerVolume = 0; - mTuningSpeakerVolumeDirty = true; - - // gMuteListp isn't set up at this point, so we defer this until later. -// gMuteListp->addObserver(&mutelist_listener); + mVoiceEnabled(false), + mWriteInProgress(false), - // stash the pump for later use - // This now happens when init() is called instead. - mPump = NULL; + mLipSyncEnabled(false) +{ + gVoiceClient = this; #if LL_DARWIN || LL_LINUX || LL_SOLARIS // HACK: THIS DOES NOT BELONG HERE @@ -5773,6 +5777,11 @@ void LLVoiceClient::setMuteMic(bool muted) mMuteMic = muted; } +bool LLVoiceClient::getMuteMic() const +{ + return mMuteMic; +} + void LLVoiceClient::setUserPTTState(bool ptt) { mUserPTTState = ptt; @@ -6901,11 +6910,11 @@ void LLVoiceClient::notifyFriendObservers() void LLVoiceClient::lookupName(const LLUUID &id) { - gCacheName->getName(id, onAvatarNameLookup); + gCacheName->get(id, FALSE, &LLVoiceClient::onAvatarNameLookup); } //static -void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data) +void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) { if(gVoiceClient) { diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index cfc336b27d..1066ac73f1 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -178,6 +178,7 @@ static void updatePosition(void); void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state. + bool getMuteMic() const; void setUserPTTState(bool ptt); bool getUserPTTState(); void toggleUserPTTState(void); @@ -461,7 +462,7 @@ static void updatePosition(void); void removeObserver(LLFriendObserver* observer); void lookupName(const LLUUID &id); - static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data); + static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group); void avatarNameResolved(const LLUUID &id, const std::string &name); typedef std::vector deviceList; @@ -727,7 +728,6 @@ static std::string nameFromsipURI(const std::string &uri); bool mVoiceEnabled; bool mWriteInProgress; std::string mWriteString; - size_t mWriteOffset; LLTimer mUpdateTimer; diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 5606398aaf..a361a1160c 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -131,13 +131,13 @@ LLVoiceVisualizer::LLVoiceVisualizer( const U8 type ) const char* sound_level_img[] = { - "041ee5a0-cb6a-9ac5-6e49-41e9320507d5.j2c", - "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", - "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", - "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", - "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", - "29de489d-0491-fb00-7dab-f9e686d31e83.j2c", - "29de489d-0491-fb00-7dab-f9e686d31e83.j2c" + "voice_meter_dot.j2c", + "voice_meter_rings.j2c", + "voice_meter_rings.j2c", + "voice_meter_rings.j2c", + "voice_meter_rings.j2c", + "voice_meter_rings.j2c", + "voice_meter_rings.j2c" }; for (int i=0; igetSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _1)); - gSavedSettings.getControl("LipSyncOohAahRate")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _1)); - gSavedSettings.getControl("LipSyncOoh")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _1)); - gSavedSettings.getControl("LipSyncAah")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _1)); - gSavedSettings.getControl("LipSyncOohPowerTransfer")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _1)); - gSavedSettings.getControl("LipSyncAahPowerTransfer")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _1)); + gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _2)); + gSavedSettings.getControl("LipSyncOohAahRate")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _2)); + gSavedSettings.getControl("LipSyncOoh")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _2)); + gSavedSettings.getControl("LipSyncAah")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _2)); + gSavedSettings.getControl("LipSyncOohPowerTransfer")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _2)); + gSavedSettings.getControl("LipSyncAahPowerTransfer")->getSignal()->connect(boost::bind(&handleVoiceVisualizerPrefsChanged, _2)); sPrefsInitialized = true; } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index c3366cad90..d99758edf8 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -368,7 +368,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) initSunDirection(mSunDefaultPosition, LLVector3(0, 0, 0)); } mAmbientScale = gSavedSettings.getF32("SkyAmbientScale"); - mNightColorShift = gSavedSettings.getColor3("SkyNightColorShift"); + mNightColorShift = gSavedSkinSettings.getColor3("SkyNightColorShift"); mFogColor.mV[VRED] = mFogColor.mV[VGREEN] = mFogColor.mV[VBLUE] = 0.5f; mFogColor.mV[VALPHA] = 0.0f; mFogRatio = 1.2f; @@ -1197,8 +1197,6 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline) LLDrawPoolSky *poolp = (LLDrawPoolSky*) gPipeline.getPool(LLDrawPool::POOL_SKY); poolp->setSkyTex(mSkyTex); - poolp->setSun(&mSun); - poolp->setMoon(&mMoon); mDrawable->setRenderType(LLPipeline::RENDER_TYPE_SKY); for (S32 i = 0; i < 6; ++i) @@ -1215,7 +1213,7 @@ LLDrawable *LLVOSky::createDrawable(LLPipeline *pipeline) //by bao //fake vertex buffer updating -//to guaranttee at least updating one VBO buffer every frame +//to guarantee at least updating one VBO buffer every frame //to walk around the bug caused by ATI card --> DEV-3855 // void LLVOSky::createDummyVertexBuffer() diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 3fd5054fd1..b602b93025 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -55,7 +55,7 @@ #include "noise.h" #include "pipeline.h" #include "llspatialpartition.h" -#include "llviewerwindow.h" +#include "llnotifications.h" extern LLPipeline gPipeline; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8f11661b30..aff8fe8f1d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -72,7 +72,7 @@ const F32 FORCE_CULL_AREA = 8.f; const S32 MAX_SCULPT_REZ = 128; BOOL gAnimateTextures = TRUE; -extern BOOL gHideSelectedObjects; +//extern BOOL gHideSelectedObjects; F32 LLVOVolume::sLODFactor = 1.f; F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop @@ -512,6 +512,7 @@ void LLVOVolume::updateTextures() mSculptTexture->addTextureStats(2.f * tex_size * tex_size); mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), (S32)LLViewerImage::BOOST_SCULPTED)); + mSculptTexture->setForSculpt() ; } S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture @@ -653,7 +654,8 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline) } updateRadius(); - mDrawable->updateDistance(*LLViewerCamera::getInstance()); + bool force_update = true; // avoid non-alpha mDistance update being optimized away + mDrawable->updateDistance(*LLViewerCamera::getInstance(), force_update); return mDrawable; } @@ -780,6 +782,11 @@ void LLVOVolume::sculpt() sculpt_width = 0; sculpt_height = 0; sculpt_data = NULL ; + + if(LLViewerImage::sTesterp) + { + LLViewerImage::sTesterp->updateGrayTextureBinding(); + } } else { @@ -788,6 +795,11 @@ void LLVOVolume::sculpt() << " < " << sculpt_height << " x " << sculpt_width << " x " <getData(); + + if(LLViewerImage::sTesterp) + { + mSculptTexture->updateBindStats() ; + } } getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); } @@ -1271,15 +1283,28 @@ S32 LLVOVolume::setTEColor(const U8 te, const LLColor3& color) S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color) { - S32 res = LLViewerObject::setTEColor(te, color); - if (res && mDrawable.notNull()) + S32 retval = 0; + const LLTextureEntry *tep = getTE(te); + if (!tep) { - //gPipeline.markTextured(mDrawable); - mDrawable->setState(LLDrawable::REBUILD_COLOR); - dirtyMesh(); - //mFaceMappingChanged = TRUE; + llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; } - return res; + else if (color != tep->getColor()) + { + if (color.mV[3] != tep->getColor().mV[3]) + { + gPipeline.markTextured(mDrawable); + } + retval = LLPrimitive::setTEColor(te, color); + if (mDrawable.notNull() && retval) + { + // These should only happen on updates which are not the initial update. + mDrawable->setState(LLDrawable::REBUILD_COLOR); + dirtyMesh(); + } + } + + return retval; } S32 LLVOVolume::setTEBumpmap(const U8 te, const U8 bumpmap) @@ -1304,6 +1329,17 @@ S32 LLVOVolume::setTETexGen(const U8 te, const U8 texgen) return res; } +S32 LLVOVolume::setTEMediaTexGen(const U8 te, const U8 media) +{ + S32 res = LLViewerObject::setTEMediaTexGen(te, media); + if (res) + { + gPipeline.markTextured(mDrawable); + mFaceMappingChanged = TRUE; + } + return res; +} + S32 LLVOVolume::setTEShiny(const U8 te, const U8 shiny) { S32 res = LLViewerObject::setTEShiny(te, shiny); @@ -1326,6 +1362,17 @@ S32 LLVOVolume::setTEFullbright(const U8 te, const U8 fullbright) return res; } +S32 LLVOVolume::setTEBumpShinyFullbright(const U8 te, const U8 bump) +{ + S32 res = LLViewerObject::setTEBumpShinyFullbright(te, bump); + if (res) + { + gPipeline.markTextured(mDrawable); + mFaceMappingChanged = TRUE; + } + return res; +} + S32 LLVOVolume::setTEMediaFlags(const U8 te, const U8 media_flags) { S32 res = LLViewerObject::setTEMediaFlags(te, media_flags); @@ -1941,10 +1988,9 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) { - if (!mbCanSelect || - (gHideSelectedObjects && isSelected()) || - mDrawable->isDead() || - !gPipeline.hasRenderType(mDrawable->getRenderType())) + if (!mbCanSelect + || mDrawable->isDead() + || !gPipeline.hasRenderType(mDrawable->getRenderType())) { return FALSE; } @@ -2084,7 +2130,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); - if (facep->getViewerObject()->isSelected() && gHideSelectedObjects) + if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) { return; } @@ -2812,7 +2858,7 @@ LLHUDPartition::LLHUDPartition() mPartitionType = LLViewerRegion::PARTITION_HUD; mDrawableType = LLPipeline::RENDER_TYPE_HUD; mSlopRatio = 0.f; - mLODPeriod = 16; + mLODPeriod = 1; } void LLHUDPartition::shift(const LLVector3 &offset) diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index f705531723..1e35a31cb6 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -32,92 +32,27 @@ #include "llviewerprecompiledheaders.h" -#include "imageids.h" -#include "llassetstorage.h" -#include "lldbstrings.h" -#include "lldir.h" -#include "llquantize.h" - #include "llagent.h" -#include "llassetuploadresponders.h" -#include "llviewerwindow.h" +#include "llagentwearables.h" #include "llfloatercustomize.h" -#include "llinventorymodel.h" #include "llviewerimagelist.h" -#include "llviewerinventory.h" +#include "llinventorymodel.h" #include "llviewerregion.h" #include "llvoavatar.h" +#include "llvoavatarself.h" +#include "llvoavatardefines.h" #include "llwearable.h" +#include "lldictionary.h" +#include "lltrans.h" using namespace LLVOAvatarDefines; // static S32 LLWearable::sCurrentDefinitionVersion = 1; -// static -const std::string LLWearable::sTypeName[ WT_COUNT+1 ] = -{ - "shape", - "skin", - "hair", - "eyes", - "shirt", - "pants", - "shoes", - "socks", - "jacket", - "gloves", - "undershirt", - "underpants", - "skirt", - "invalid" -}; - -// static -const std::string LLWearable::sTypeLabel[ WT_COUNT+1 ] = -{ - "Shape", - "Skin", - "Hair", - "Eyes", - "Shirt", - "Pants", - "Shoes", - "Socks", - "Jacket", - "Gloves", - "Undershirt", - "Underpants", - "Skirt", - "invalid" -}; - - -// static -LLAssetType::EType LLWearable::typeToAssetType(EWearableType wearable_type) -{ - switch( wearable_type ) - { - case WT_SHAPE: - case WT_SKIN: - case WT_HAIR: - case WT_EYES: - return LLAssetType::AT_BODYPART; - case WT_SHIRT: - case WT_PANTS: - case WT_SHOES: - case WT_SOCKS: - case WT_JACKET: - case WT_GLOVES: - case WT_UNDERSHIRT: - case WT_UNDERPANTS: - case WT_SKIRT: - return LLAssetType::AT_CLOTHING; - default: - return LLAssetType::AT_NONE; - } -} - +// Private local functions +static std::string terse_F32_to_string(F32 f); +static std::string asset_id_to_filename(const LLUUID &asset_id); LLWearable::LLWearable(const LLTransactionID& transaction_id) : mDefinitionVersion(LLWearable::sCurrentDefinitionVersion), @@ -139,56 +74,22 @@ LLWearable::~LLWearable() { } - -// static -EWearableType LLWearable::typeNameToType( const std::string& type_name ) +const std::string& LLWearable::getTypeLabel() const { - for( S32 i = 0; i < WT_COUNT; i++ ) - { - if( type_name == LLWearable::sTypeName[ i ] ) - { - return (EWearableType)i; - } - } - return WT_INVALID; + return LLWearableDictionary::getTypeLabel(mType); } - -std::string terse_F32_to_string( F32 f ) +const std::string& LLWearable::getTypeName() const { - std::string r = llformat( "%.2f", f ); - - // "1.20" -> "1.2" - // "24.00" -> "24." - S32 len = r.length(); - while( len > 0 && '0' == r[len - 1] ) - { - r.erase(len-1, 1); - len--; - } - - if( '.' == r[len - 1] ) - { - // "24." -> "24" - r.erase(len-1, 1); - } - else - if( ('-' == r[0]) && ('0' == r[1]) ) - { - // "-0.59" -> "-.59" - r.erase(1, 1); - } - else - if( '0' == r[0] ) - { - // "0.59" -> ".59" - r.erase(0, 1); - } + return LLWearableDictionary::getTypeName(mType); +} - return r; +LLAssetType::EType LLWearable::getAssetType() const +{ + return LLWearableDictionary::getAssetType(mType); } -BOOL LLWearable::exportFile( LLFILE* file ) +BOOL LLWearable::exportFile(LLFILE* file) const { // header and version if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 ) @@ -234,7 +135,7 @@ BOOL LLWearable::exportFile( LLFILE* file ) return FALSE; } - for (param_map_t::iterator iter = mVisualParamMap.begin(); + for (param_map_t::const_iterator iter = mVisualParamMap.begin(); iter != mVisualParamMap.end(); ++iter) { S32 param_id = iter->first; @@ -252,22 +153,18 @@ BOOL LLWearable::exportFile( LLFILE* file ) return FALSE; } - for (te_map_t::iterator iter = mTEMap.begin(); - iter != mTEMap.end(); ++iter) + for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) { S32 te = iter->first; - LLUUID& image_id = iter->second; + const LLUUID& image_id = iter->second; if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 ) { return FALSE; } } - return TRUE; } - - BOOL LLWearable::importFile( LLFILE* file ) { // *NOTE: changing the type or size of this buffer will require @@ -463,7 +360,7 @@ BOOL LLWearable::importFile( LLFILE* file ) // Avatar parameter and texture definitions can change over time. // This function returns true if parameters or textures have been added or removed // since this wearable was created. -BOOL LLWearable::isOldVersion() +BOOL LLWearable::isOldVersion() const { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); @@ -506,7 +403,7 @@ BOOL LLWearable::isOldVersion() S32 te_count = 0; for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_count++; if( !is_in_map(mTEMap, te ) ) @@ -530,7 +427,7 @@ BOOL LLWearable::isOldVersion() // * If parameters or textures have been ADDED since the wearable was created, // they are taken to have default values, so we consider the wearable clean // only if those values are the same as the defaults. -BOOL LLWearable::isDirty() +BOOL LLWearable::isDirty() const { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); @@ -560,7 +457,7 @@ BOOL LLWearable::isDirty() for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { LLViewerImage* avatar_image = avatar->getTEImage( te ); if( !avatar_image ) @@ -568,7 +465,7 @@ BOOL LLWearable::isDirty() llassert( 0 ); continue; } - const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); + const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te)); if( avatar_image->getID() != image_id ) { return TRUE; @@ -612,9 +509,9 @@ void LLWearable::setTexturesToDefaults() mTEMap.clear(); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { - mTEMap[te] = LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ); + mTEMap[te] = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); } } } @@ -622,7 +519,7 @@ void LLWearable::setTexturesToDefaults() // Updates the user's avatar's appearance void LLWearable::writeToAvatar( BOOL set_by_user ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { @@ -659,11 +556,11 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) // Pull texture entries for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { - const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); + const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te)); LLViewerImage* image = gImageList.getImage( image_id ); - avatar->setLocTexTE( te, image, set_by_user ); + avatar->setLocalTextureTE(te, image, set_by_user); } } @@ -672,7 +569,8 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) if( gFloaterCustomize ) { LLViewerInventoryItem* item; - item = (LLViewerInventoryItem*)gInventory.getItem(gAgent.getWearableItem(mType)); + // MULTI_WEARABLE: + item = (LLViewerInventoryItem*)gInventory.getItem(gAgentWearables.getWearableItem(mType,0)); U32 perm_mask = PERM_NONE; BOOL is_complete = FALSE; if(item) @@ -685,7 +583,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) } } gFloaterCustomize->setWearable(mType, this, perm_mask, is_complete); - LLFloaterCustomize::setCurrentWearableType( mType ); + gFloaterCustomize->setCurrentWearableType( mType ); } ESex new_sex = avatar->getSex(); @@ -706,7 +604,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) // static void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); llassert( avatar ); if( !avatar ) { @@ -736,9 +634,9 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user ) LLViewerImage* image = gImageList.getImage( IMG_DEFAULT_AVATAR ); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == type ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == type) { - avatar->setLocTexTE( te, image, set_by_user ); + avatar->setLocalTextureTE(te, image, set_by_user); } } @@ -782,7 +680,7 @@ void LLWearable::readFromAvatar() mTEMap.clear(); for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { LLViewerImage* image = avatar->getTEImage( te ); if( image ) @@ -800,7 +698,7 @@ void LLWearable::readFromAvatar() // Does not copy mAssetID. // Definition version is current: removes obsolete enties and creates default values for new ones. -void LLWearable::copyDataFrom( LLWearable* src ) +void LLWearable::copyDataFrom(const LLWearable* src) { LLVOAvatar* avatar = gAgent.getAvatarObject(); llassert( avatar ); @@ -833,9 +731,9 @@ void LLWearable::copyDataFrom( LLWearable* src ) // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType ) + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) { - const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) ); + const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te)); mTEMap[te] = image_id; } } @@ -846,15 +744,12 @@ struct LLWearableSaveData EWearableType mType; }; -void LLWearable::saveNewAsset() +void LLWearable::saveNewAsset() const { // llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl; //llinfos << *this << llendl; - std::string new_asset_id_string; - mAssetID.toString(new_asset_id_string); - std::string filename; - filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl"; + const std::string filename = asset_id_to_filename(mAssetID); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ BOOL successful_save = FALSE; if(fp && exportFile(fp)) @@ -909,7 +804,7 @@ void LLWearable::saveNewAsset() void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLWearableSaveData* data = (LLWearableSaveData*)userdata; - const std::string& type_name = LLWearable::typeToTypeName(data->mType); + const std::string& type_name = LLWearableDictionary::getTypeName(data->mType); if(0 == status) { // Success @@ -925,28 +820,16 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda } // Delete temp file - std::string new_asset_id_string; - new_asset_id.toString(new_asset_id_string); - std::string src_filename; - src_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl"; + const std::string src_filename = asset_id_to_filename(new_asset_id); LLFile::remove(src_filename); // delete the context data delete data; } -BOOL LLWearable::isMatchedToInventoryItem( LLViewerInventoryItem* item ) -{ - return - ( mName == item->getName() ) && - ( mDescription == item->getDescription() ) && - ( mPermissions == item->getPermissions() ) && - ( mSaleInfo == item->getSaleInfo() ); -} - std::ostream& operator<<(std::ostream &s, const LLWearable &w) { - s << "wearable " << LLWearable::typeToTypeName( w.mType ) << "\n"; + s << "wearable " << LLWearableDictionary::getTypeName(w.mType) << "\n"; s << " Name: " << w.mName << "\n"; s << " Desc: " << w.mDescription << "\n"; //w.mPermissions @@ -973,3 +856,40 @@ std::ostream& operator<<(std::ostream &s, const LLWearable &w) } +std::string terse_F32_to_string(F32 f) +{ + std::string r = llformat("%.2f", f); + S32 len = r.length(); + + // "1.20" -> "1.2" + // "24.00" -> "24." + while (len > 0 && ('0' == r[len - 1])) + { + r.erase(len-1, 1); + len--; + } + if ('.' == r[len - 1]) + { + // "24." -> "24" + r.erase(len-1, 1); + } + else if (('-' == r[0]) && ('0' == r[1])) + { + // "-0.59" -> "-.59" + r.erase(1, 1); + } + else if ('0' == r[0]) + { + // "0.59" -> ".59" + r.erase(0, 1); + } + return r; +} + +std::string asset_id_to_filename(const LLUUID &asset_id) +{ + std::string asset_id_string; + asset_id.toString(asset_id_string); + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl"; + return filename; +} diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 683a8fa928..7ebdd788ce 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -19,7 +19,7 @@ * in the file doc/FLOSS-exception.txt in this software distribution, or * online at * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * + * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, * and agree to abide by those obligations. @@ -38,92 +38,69 @@ #include "llpermissions.h" #include "llsaleinfo.h" #include "llassetstorage.h" +#include "llwearabledictionary.h" class LLViewerInventoryItem; -enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType() -{ - WT_SHAPE = 0, - WT_SKIN = 1, - WT_HAIR = 2, - WT_EYES = 3, - WT_SHIRT = 4, - WT_PANTS = 5, - WT_SHOES = 6, - WT_SOCKS = 7, - WT_JACKET = 8, - WT_GLOVES = 9, - WT_UNDERSHIRT = 10, - WT_UNDERPANTS = 11, - WT_SKIRT = 12, - WT_COUNT = 13, - WT_INVALID = 255 -}; - class LLWearable { friend class LLWearableList; + + //-------------------------------------------------------------------- + // Constructors and destructors + //-------------------------------------------------------------------- +private: + // Private constructors used by LLWearableList + LLWearable(const LLTransactionID& transactionID); + LLWearable(const LLAssetID& assetID); public: - ~LLWearable(); + virtual ~LLWearable(); + //-------------------------------------------------------------------- + // Accessors + //-------------------------------------------------------------------- +public: const LLAssetID& getID() const { return mAssetID; } const LLTransactionID& getTransactionID() const { return mTransactionID; } + EWearableType getType() const { return mType; } + void setType(EWearableType type) { mType = type; } + const std::string& getName() const { return mName; } + void setName(const std::string& name) { mName = name; } + const std::string& getDescription() const { return mDescription; } + void setDescription(const std::string& desc) { mDescription = desc; } + const LLPermissions& getPermissions() const { return mPermissions; } + void setPermissions(const LLPermissions& p) { mPermissions = p; } + const LLSaleInfo& getSaleInfo() const { return mSaleInfo; } + void setSaleInfo(const LLSaleInfo& info) { mSaleInfo = info; } + const std::string& getTypeLabel() const; + const std::string& getTypeName() const; + LLAssetType::EType getAssetType() const; - BOOL isDirty(); - BOOL isOldVersion(); +public: + BOOL isDirty() const; + BOOL isOldVersion() const; void writeToAvatar( BOOL set_by_user ); void readFromAvatar(); void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); } static void removeFromAvatar( EWearableType type, BOOL set_by_user ); - BOOL exportFile(LLFILE* file); + BOOL exportFile(LLFILE* file) const; BOOL importFile(LLFILE* file); - - EWearableType getType() const { return mType; } - void setType( EWearableType type ) { mType = type; } - - void setName( const std::string& name ) { mName = name; } - const std::string& getName() const { return mName; } - - void setDescription( const std::string& desc ) { mDescription = desc; } - const std::string& getDescription() const { return mDescription; } - - void setPermissions( const LLPermissions& p ) { mPermissions = p; } - const LLPermissions& getPermissions() const { return mPermissions; } - - void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; } - const LLSaleInfo& getSaleInfo() const { return mSaleInfo; } - - const std::string& getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; } - const std::string& getTypeName() const { return LLWearable::sTypeName[ mType ]; } - + void setParamsToDefaults(); void setTexturesToDefaults(); - LLAssetType::EType getAssetType() const { return LLWearable::typeToAssetType( mType ); } - - static EWearableType typeNameToType( const std::string& type_name ); - static const std::string& typeToTypeName( EWearableType type ) { return LLWearable::sTypeName[llmin(type,WT_COUNT)]; } - static const std::string& typeToTypeLabel( EWearableType type ) { return LLWearable::sTypeLabel[llmin(type,WT_COUNT)]; } - static LLAssetType::EType typeToAssetType( EWearableType wearable_type ); - - void saveNewAsset(); + void saveNewAsset() const; static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status ); - BOOL isMatchedToInventoryItem( LLViewerInventoryItem* item ); - - void copyDataFrom( LLWearable* src ); + void copyDataFrom(const LLWearable* src); static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; } friend std::ostream& operator<<(std::ostream &s, const LLWearable &w); private: - // Private constructor used by LLWearableList - LLWearable(const LLTransactionID& transactionID); - LLWearable(const LLAssetID& assetID); - static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. std::string mName; @@ -138,9 +115,6 @@ private: param_map_t mVisualParamMap; // maps visual param id to weight typedef std::map te_map_t; te_map_t mTEMap; // maps TE to Image ID - - static const std::string sTypeName[ WT_COUNT+1 ]; - static const std::string sTypeLabel[ WT_COUNT+1 ]; }; #endif // LL_LLWEARABLE_H diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 512c03fa4d..92de94636b 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -39,22 +39,18 @@ #include "llagent.h" #include "llvoavatar.h" #include "llviewerinventory.h" -//#include "llfloaterchat.h" #include "llviewerstats.h" #include "llnotify.h" +#include "llinventorymodel.h" +#include "lltrans.h" -// Globals -LLWearableList gWearableList; // Globally constructed; be careful that there's no dependency with gAgent. - - +// Callback struct struct LLWearableArrivedData { - LLWearableArrivedData( - LLAssetType::EType asset_type, + LLWearableArrivedData(LLAssetType::EType asset_type, const std::string& wearable_name, void(*asset_arrived_callback)(LLWearable*, void* userdata), - void* userdata ) - : + void* userdata) : mAssetType( asset_type ), mCallback( asset_arrived_callback ), mUserdata( userdata ), @@ -69,8 +65,6 @@ struct LLWearableArrivedData S32 mRetries; }; - - //////////////////////////////////////////////////////////////////////////// // LLWearableList @@ -80,8 +74,18 @@ LLWearableList::~LLWearableList() mList.clear(); } -void LLWearableList::getAsset( const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata ) +void LLWearableList::getAsset(const LLAssetID& _assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata) { + LLAssetID assetID = _assetID; + if (asset_type == LLAssetType::AT_LINK) + { + LLInventoryItem *linked_item = gInventory.getItem(_assetID); + if (linked_item) + { + assetID = linked_item->getAssetUUID(); + asset_type = linked_item->getType(); + } + } llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL ); if( instance ) @@ -90,8 +94,7 @@ void LLWearableList::getAsset( const LLAssetID& assetID, const std::string& wear } else { - gAssetStorage->getAssetData( - assetID, + gAssetStorage->getAssetData(assetID, asset_type, LLWearableList::processGetAssetReply, (void*)new LLWearableArrivedData( asset_type, wearable_name, asset_arrived_callback, userdata ), @@ -110,8 +113,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL; } - else - if( status >= 0 ) + else if (status >= 0) { // read the file LLFILE* fp = LLFile::fopen(std::string(filename), "rb"); /*Flawfinder: ignore*/ @@ -180,15 +182,14 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID if (wearable) // success { - gWearableList.mList[ uuid ] = wearable; + LLWearableList::instance().mList[ uuid ] = wearable; LL_DEBUGS("Wearable") << "processGetAssetReply()" << LL_ENDL; LL_DEBUGS("Wearable") << wearable << LL_ENDL; } else { LLSD args; - // *TODO:translate - args["TYPE"] = LLAssetType::lookupHumanReadable(data->mAssetType); + args["TYPE"] =LLTrans::getString(LLAssetType::lookupHumanReadable(data->mAssetType)); if (isNewWearable) { LLNotifications::instance().add("InvalidWearable"); @@ -214,42 +215,13 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } -// Creates a new wearable just like the old_wearable but with data copied over from item -LLWearable* LLWearableList::createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item ) -{ - lldebugs << "LLWearableList::createWearableMatchedToInventoryItem()" << llendl; - - LLTransactionID tid; - LLAssetID new_asset_id; - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - LLWearable* wearable = new LLWearable( tid ); - wearable->copyDataFrom( old_wearable ); - - wearable->setName( item->getName() ); - wearable->setDescription( item->getDescription() ); - wearable->setPermissions( item->getPermissions() ); - wearable->setSaleInfo( item->getSaleInfo() ); - - mList[ new_asset_id ] = wearable; - - // Send to the dataserver - wearable->saveNewAsset(); - - return wearable; -} - -LLWearable* LLWearableList::createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name ) +LLWearable* LLWearableList::createCopyFromAvatar(const LLWearable* old_wearable, const std::string& new_name) { lldebugs << "LLWearableList::createCopyFromAvatar()" << llendl; - LLTransactionID tid; - LLAssetID new_asset_id; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - LLWearable* wearable = new LLWearable( tid ); + LLWearable *wearable = generateNewWearable(); wearable->copyDataFrom( old_wearable ); + LLPermissions perm(old_wearable->getPermissions()); perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true); wearable->setPermissions(perm); @@ -257,8 +229,6 @@ LLWearable* LLWearableList::createCopyFromAvatar( LLWearable* old_wearable, cons if (!new_name.empty()) wearable->setName(new_name); - mList[ new_asset_id ] = wearable; - // Send to the dataserver wearable->saveNewAsset(); @@ -266,21 +236,16 @@ LLWearable* LLWearableList::createCopyFromAvatar( LLWearable* old_wearable, cons } -LLWearable* LLWearableList::createCopy( LLWearable* old_wearable ) +LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable) { lldebugs << "LLWearableList::createCopy()" << llendl; - LLTransactionID tid; - LLAssetID new_asset_id; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + LLWearable *wearable = generateNewWearable(); + wearable->copyDataFrom(old_wearable); - LLWearable* wearable = new LLWearable( tid ); - wearable->copyDataFrom( old_wearable ); LLPermissions perm(old_wearable->getPermissions()); perm.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true); wearable->setPermissions(perm); - mList[ new_asset_id ] = wearable; // Send to the dataserver wearable->saveNewAsset(); @@ -292,12 +257,7 @@ LLWearable* LLWearableList::createNewWearable( EWearableType type ) { lldebugs << "LLWearableList::createNewWearable()" << llendl; - LLTransactionID tid; - LLAssetID new_asset_id; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - LLWearable* wearable = new LLWearable( tid ); + LLWearable *wearable = generateNewWearable(); wearable->setType( type ); std::string name = "New "; @@ -314,10 +274,19 @@ LLWearable* LLWearableList::createNewWearable( EWearableType type ) wearable->setParamsToDefaults(); wearable->setTexturesToDefaults(); - mList[ new_asset_id ] = wearable; - // Send to the dataserver wearable->saveNewAsset(); return wearable; } + +LLWearable *LLWearableList::generateNewWearable() +{ + LLTransactionID tid; + tid.generate(); + LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + + LLWearable* wearable = new LLWearable(tid); + mList[new_asset_id] = wearable; + return wearable; +} diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index cda0cb11f9..f844c0f443 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -33,37 +33,37 @@ #ifndef LL_LLWEARABLELIST_H #define LL_LLWEARABLELIST_H +#include "llmemory.h" #include "llwearable.h" #include "lluuid.h" #include "llassetstorage.h" -class LLWearableList +// Globally constructed; be careful that there's no dependency with gAgent. +class LLWearableList : public LLSingleton { public: LLWearableList() {} ~LLWearableList(); - S32 getLength() { return mList.size(); } + S32 getLength() const { return mList.size(); } - void getAsset( - const LLAssetID& assetID, - const std::string& wearable_name, - LLAssetType::EType asset_type, - void(*asset_arrived_callback)(LLWearable*, void* userdata), - void* userdata ); + void getAsset(const LLAssetID& assetID, + const std::string& wearable_name, + LLAssetType::EType asset_type, + void(*asset_arrived_callback)(LLWearable*, void* userdata), + void* userdata); - LLWearable* createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item ); - LLWearable* createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name = std::string() ); - LLWearable* createCopy( LLWearable* old_wearable ); - LLWearable* createNewWearable( EWearableType type ); + LLWearable* createCopyFromAvatar(const LLWearable* old_wearable, const std::string& new_name = std::string()); + LLWearable* createCopy(const LLWearable* old_wearable); + LLWearable* createNewWearable(EWearableType type); // Callback static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status); protected: - std::map< LLUUID, LLWearable* > mList; + LLWearable* generateNewWearable(); // used for the create... functions +private: + std::map mList; }; -extern LLWearableList gWearableList; - #endif // LL_LLWEARABLELIST_H diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index a5691d8a1c..781f8298f7 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -35,10 +35,30 @@ #include "llweb.h" -#include "llviewerwindow.h" +// Library includes +#include "llwindow.h" // spawnWebBrowser() +#include "llviewerwindow.h" #include "llviewercontrol.h" #include "llfloaterhtmlhelp.h" +#include "llalertdialog.h" + +class URLLoader : public LLAlertDialog::URLLoader +{ + virtual void load(const std::string& url , bool force_open_externally) + { + if (force_open_externally) + { + LLWeb::loadURLExternal(url); + } + else + { + LLWeb::loadURL(url); + } + } +}; +static URLLoader sAlertURLLoader; + // static void LLWeb::initClass() @@ -93,12 +113,3 @@ std::string LLWeb::escapeURL(const std::string& url) } return escaped_url; } - -// virtual -void LLWeb::URLLoader::load(const std::string& url) -{ - loadURL(url); -} - -// static -LLWeb::URLLoader LLWeb::sAlertURLLoader; diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index 278821bac5..71cc236621 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -35,7 +35,6 @@ #define LL_LLWEB_H #include -#include "llalertdialog.h" class LLWeb { @@ -54,12 +53,6 @@ public: // Returns escaped (eg, " " to "%20") url static std::string escapeURL(const std::string& url); - class URLLoader : public LLAlertDialog::URLLoader - { - virtual void load(const std::string& url); - }; - - static URLLoader sAlertURLLoader; }; #endif diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index 1d17c6047f..10a9703d1a 100644 --- a/indra/newview/llwldaycycle.cpp +++ b/indra/newview/llwldaycycle.cpp @@ -35,8 +35,7 @@ #include "llwldaycycle.h" #include "llsdserialize.h" #include "llwlparammanager.h" - -#include "llviewerwindow.h" +#include "llnotifications.h" #include diff --git a/indra/newview/llwldaycycle.h b/indra/newview/llwldaycycle.h index f045a6d1b0..eed6a78c18 100644 --- a/indra/newview/llwldaycycle.h +++ b/indra/newview/llwldaycycle.h @@ -35,8 +35,6 @@ class LLWLDayCycle; -#include "llfloater.h" - #include #include #include diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 3fdef29540..692efd2b7a 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -632,6 +632,7 @@ void LLWorld::updateVisibilities() void LLWorld::updateRegions(F32 max_update_time) { + LLMemType mt_ur(LLMemType::MTYPE_IDLE_UPDATE_REGIONS); LLTimer update_timer; BOOL did_one = FALSE; diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index ce83cbd97c..b5380a6f6c 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -42,7 +42,7 @@ #include "llmath.h" #include "v3math.h" -#include "llmemory.h" +#include "llsingleton.h" #include "llstring.h" #include "llviewerpartsim.h" #include "llviewerimage.h" diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 572f31f566..827f12d19e 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -46,6 +46,7 @@ #include "llviewerimagelist.h" #include "llviewerregion.h" #include "llregionflags.h" +#include "lltrans.h" const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes @@ -757,18 +758,13 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { - struct tm* timep; - // Convert to Pacific, based on server's opinion of whether - // it's daylight savings time there. - timep = utc_to_pacific_time(extra, gPacificDaylightTime); - - S32 display_hour = timep->tm_hour % 12; - if (display_hour == 0) display_hour = 12; - - new_item.mToolTip = llformat( "%d:%02d %s", - display_hour, - timep->tm_min, - (timep->tm_hour < 12 ? "AM" : "PM") ); + std::string timeStr = "["+ LLTrans::getString ("TimeHour")+"]:[" + +LLTrans::getString ("TimeMin")+"] [" + +LLTrans::getString ("TimeAMPM")+"]"; + LLSD substitution; + substitution["datetime"] = (S32) extra; + LLStringUtil::format (timeStr, substitution); + new_item.mToolTip = timeStr; // HACK: store Z in extra2 new_item.mPosGlobal.mdV[VZ] = (F64)extra2; diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index bb3c97cfd9..1db081c74a 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -36,13 +36,15 @@ #include #include #include +#include #include "v3math.h" #include "v3dmath.h" #include "llframetimer.h" #include "llmapimagetype.h" #include "lluuid.h" -#include "llmemory.h" +#include "llpointer.h" +#include "llsingleton.h" #include "llviewerimage.h" #include "lleventinfo.h" #include "v3color.h" @@ -114,7 +116,8 @@ struct LLWorldMapLayer class LLWorldMap : public LLSingleton { public: - typedef void(*url_callback_t)(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport); + typedef boost::function + url_callback_t; LLWorldMap(); ~LLWorldMap(); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 2e18b710a7..9ac758433c 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -39,11 +39,11 @@ #include "llmath.h" // clampf() #include "llregionhandle.h" #include "lleventflags.h" +#include "llfloaterreg.h" #include "llrender.h" #include "llagent.h" #include "llcallingcard.h" -#include "llcolorscheme.h" #include "llviewercontrol.h" #include "llcylinder.h" #include "llfloaterdirectory.h" @@ -164,8 +164,8 @@ void LLWorldMapView::cleanupClass() sForSaleAdultImage = NULL; } -LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) -: LLPanel(name, rect, BORDER_NO), +LLWorldMapView::LLWorldMapView() +: LLPanel(), mBackgroundColor( LLColor4( 4.f/255.f, 4.f/255.f, 75.f/255.f, 1.f ) ), mItemPicked(FALSE), mPanning( FALSE ), @@ -177,47 +177,38 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect ) { sPixelsPerMeter = gMapScale / REGION_WIDTH_METERS; clearLastClick(); +} - const S32 DIR_WIDTH = 10; - const S32 DIR_HEIGHT = 10; - LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); - LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); - - mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); - mTextBoxNorth->setColor( minor_color ); - addChild( mTextBoxNorth ); - - mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); - mTextBoxEast->setColor( minor_color ); - addChild( mTextBoxEast ); - - major_dir_rect.mRight += 1 ; - mTextBoxWest = new LLTextBox( std::string("W"), major_dir_rect ); - mTextBoxWest->setColor( minor_color ); - addChild( mTextBoxWest ); - major_dir_rect.mRight -= 1 ; - - mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect ); - mTextBoxSouth->setColor( minor_color ); - addChild( mTextBoxSouth ); - - LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); - - mTextBoxSouthEast = new LLTextBox( std::string("SE"), minor_dir_rect ); - mTextBoxSouthEast->setColor( minor_color ); - addChild( mTextBoxSouthEast ); +BOOL LLWorldMapView::postBuild() +{ + mTextBoxNorth = getChild ("floater_map_north"); + mTextBoxEast = getChild ("floater_map_east"); + mTextBoxWest = getChild ("floater_map_west"); + mTextBoxSouth = getChild ("floater_map_south"); + mTextBoxSouthEast = getChild ("floater_map_southeast"); + mTextBoxNorthEast = getChild ("floater_map_northeast"); + mTextBoxSouthWest = getChild ("floater_map_southwest"); + mTextBoxNorthWest = getChild ("floater_map_northwest"); - mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect ); - mTextBoxNorthEast->setColor( minor_color ); - addChild( mTextBoxNorthEast ); + mTextBoxNorth->setText(getString("world_map_north")); + mTextBoxEast->setText(getString ("world_map_east")); + mTextBoxWest->setText(getString("world_map_west")); + mTextBoxSouth->setText(getString ("world_map_south")); + mTextBoxSouthEast ->setText(getString ("world_map_southeast")); + mTextBoxNorthEast ->setText(getString ("world_map_northeast")); + mTextBoxSouthWest->setText(getString ("world_map_southwest")); + mTextBoxNorthWest ->setText(getString("world_map_northwest")); - mTextBoxSouthWest = new LLTextBox( std::string("SW"), minor_dir_rect ); - mTextBoxSouthWest->setColor( minor_color ); - addChild( mTextBoxSouthWest ); + mTextBoxNorth->reshapeToFitText(); + mTextBoxEast->reshapeToFitText(); + mTextBoxWest->reshapeToFitText(); + mTextBoxSouth->reshapeToFitText(); + mTextBoxSouthEast ->reshapeToFitText(); + mTextBoxNorthEast ->reshapeToFitText(); + mTextBoxSouthWest->reshapeToFitText(); + mTextBoxNorthWest ->reshapeToFitText(); - mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); - mTextBoxNorthWest->setColor( minor_color ); - addChild( mTextBoxNorthWest ); + return true; } @@ -293,6 +284,8 @@ BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) void LLWorldMapView::draw() { + static LLCachedControl map_track_color(gSavedSkinSettings, "MapTrackColor", LLColor4::white); + LLTextureView::clearDebugImages(); F64 current_time = LLTimer::getElapsedSeconds(); @@ -698,6 +691,7 @@ void LLWorldMapView::draw() LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, + LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); // If map texture is still loading, @@ -713,6 +707,7 @@ void LLWorldMapView::draw() LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, + LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); } } @@ -801,7 +796,7 @@ void LLWorldMapView::draw() LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if ( LLTracker::TRACKING_AVATAR == tracking_status ) { - drawTracking( LLAvatarTracker::instance().getGlobalPos(), gTrackColor, TRUE, LLTracker::getLabel(), "" ); + drawTracking( LLAvatarTracker::instance().getGlobalPos(), map_track_color, TRUE, LLTracker::getLabel(), "" ); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status || LLTracker::TRACKING_LOCATION == tracking_status ) @@ -811,7 +806,7 @@ void LLWorldMapView::draw() LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); if (!pos_global.isExactlyZero()) { - drawTracking( pos_global, gTrackColor, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() ); + drawTracking( pos_global, map_track_color, TRUE, LLTracker::getLabel(), LLTracker::getToolTip() ); } } else if (LLWorldMap::getInstance()->mIsTrackingUnknownLocation) @@ -820,14 +815,14 @@ void LLWorldMapView::draw() { // We know this location to be invalid LLColor4 loading_color(0.0, 0.5, 1.0, 1.0); - drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Invalid Location", ""); + drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, getString("InvalidLocation"), ""); } else { double value = fmod(current_time, 2); value = 0.5 + 0.5*cos(value * 3.14159f); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); - drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, "Loading...", ""); + drawTracking( LLWorldMap::getInstance()->mUnknownLocation, loading_color, TRUE, getString("Loading"), ""); } } // #endif used to be here @@ -913,10 +908,10 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i void LLWorldMapView::drawAgents() { - F32 agents_scale = (gMapScale * 0.9f) / 256.f; + static LLCachedControl map_avatar_color(gSavedSkinSettings, "MapAvatarColor", LLColor4::white); + static LLCachedControl map_avatar_friend_color(gSavedSkinSettings, "MapAvatarFriendColor", LLColor4::white); - LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); - // LLColor4 friend_color = gColors.getColor( "MapFriend" ); + F32 agents_scale = (gMapScale * 0.9f) / 256.f; for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) { @@ -939,8 +934,8 @@ void LLWorldMapView::drawAgents() S32 agent_count = info.mExtra; sim_agent_count += info.mExtra; // Here's how we'd choose the color if info.mID were available but it's not being sent: - //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color; - drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, avatar_color); + //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? map_avatar_friend_color : map_avatar_color; + drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, map_avatar_color); } LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim } @@ -955,7 +950,7 @@ void LLWorldMapView::drawAgents() region_center[VY] += REGION_WIDTH_METERS / 2; // Reduce the stack size as you zoom out - always display at lease one agent where there is one or more S32 agent_count = (S32)(((num_agents-1) * agents_scale + (num_agents-1) * 0.1f)+.1f) + 1; - drawImageStack(region_center, sAvatarSmallImage, agent_count, 3.f, avatar_color); + drawImageStack(region_center, sAvatarSmallImage, agent_count, 3.f, map_avatar_color); } } } @@ -1142,7 +1137,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& text_x, text_y, LLColor4::white, LLFontGL::HCENTER, - LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); + LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); if (tooltip != "") { @@ -1153,7 +1148,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& text_x, text_y, LLColor4::white, LLFontGL::HCENTER, - LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); + LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); } } } @@ -1338,6 +1333,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels, color, LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); text_y -= llround(LLFontGL::getFontSansSerif()->getLineHeight()); @@ -1349,6 +1345,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels, color, LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); } @@ -1886,27 +1883,27 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) case MAP_ITEM_MATURE_EVENT: case MAP_ITEM_ADULT_EVENT: { - gFloaterWorldMap->close(); + LLFloaterReg::hideInstance("world_map"); // This is an ungainly hack std::string uuid_str; S32 event_id; id.toString(uuid_str); uuid_str = uuid_str.substr(28); sscanf(uuid_str.c_str(), "%X", &event_id); - LLFloaterDirectory::showEvents(event_id); + LLFloaterReg::showInstance("search", LLSD().insert("panel", "event").insert("id", event_id)); break; } case MAP_ITEM_LAND_FOR_SALE: case MAP_ITEM_LAND_FOR_SALE_ADULT: { - gFloaterWorldMap->close(); - LLFloaterDirectory::showLandForSale(id); + LLFloaterReg::hideInstance("world_map"); + LLFloaterReg::showInstance("search", LLSD().insert("panel", "land").insert("id", id)); break; } case MAP_ITEM_CLASSIFIED: { - gFloaterWorldMap->close(); - LLFloaterDirectory::showClassified(id); + LLFloaterReg::hideInstance("world_map"); + LLFloaterReg::showInstance("search", LLSD().insert("panel", "classified").insert("id", id)); break; } default: diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index 1717b76beb..dd64da1371 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -60,9 +60,11 @@ public: static void initClass(); static void cleanupClass(); - LLWorldMapView(const std::string& name, const LLRect& rect ); + LLWorldMapView(); virtual ~LLWorldMapView(); - + + virtual BOOL postBuild(); + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE ); virtual void setVisible(BOOL visible); diff --git a/indra/newview/macview_Prefix.h b/indra/newview/macview_Prefix.h index 8cbabb5103..33cf7d8cb0 100644 --- a/indra/newview/macview_Prefix.h +++ b/indra/newview/macview_Prefix.h @@ -69,7 +69,6 @@ #include "llfloatercustomize.h" #include "llfloaterdirectory.h" #include "llfloatergroups.h" -#include "llfloatermap.h" #include "llfloaterworldmap.h" #include "llfloatermute.h" #include "llconversation.h" @@ -92,7 +91,6 @@ #include "lltoolgrab.h" #include "lltoolmgr.h" #include "lltoolpie.h" -#include "lltoolview.h" #include "llui.h" // for make_ui_sound #include "llviewercamera.h" #include "llviewermenu.h" diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8dec9b9ba8..25ed853146 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -41,9 +41,9 @@ #include "llviewercontrol.h" #include "llfasttimer.h" #include "llfontgl.h" -#include "llmemory.h" #include "llmemtype.h" #include "llnamevalue.h" +#include "llpointer.h" #include "llprimitive.h" #include "llvolume.h" #include "material_codes.h" @@ -52,6 +52,7 @@ #include "llui.h" #include "llglheaders.h" #include "llrender.h" +#include "llwindow.h" // swapBuffers() // newview includes #include "llagent.h" @@ -65,7 +66,6 @@ #include "llface.h" #include "llfeaturemanager.h" #include "llfloatertelehub.h" -#include "llframestats.h" #include "llgldbg.h" #include "llhudmanager.h" #include "lllightconstants.h" @@ -82,7 +82,7 @@ #include "llviewerparcelmgr.h" #include "llviewerregion.h" // for audio debugging. #include "llviewerwindow.h" // For getSpinAxis -#include "llvoavatar.h" +#include "llvoavatarself.h" #include "llvoground.h" #include "llvosky.h" #include "llvotree.h" @@ -93,8 +93,8 @@ #include "llvopartgroup.h" #include "llworld.h" #include "llcubemap.h" -#include "lldebugmessagebox.h" #include "llviewershadermgr.h" +#include "llviewerstats.h" #include "llviewerjoystick.h" #include "llviewerdisplay.h" #include "llwlparammanager.h" @@ -121,8 +121,7 @@ const U32 REFLECTION_MAP_RES = 128; const S32 MAX_OCCLUDER_COUNT = 2; extern S32 gBoxFrame; -extern BOOL gRenderLightGlows; -extern BOOL gHideSelectedObjects; +//extern BOOL gHideSelectedObjects; extern BOOL gDisplaySwapBuffers; extern BOOL gDebugGL; @@ -317,7 +316,7 @@ LLPipeline::LLPipeline() : void LLPipeline::init() { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_INIT); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); @@ -337,7 +336,7 @@ void LLPipeline::init() getPool(LLDrawPool::POOL_BUMP); getPool(LLDrawPool::POOL_GLOW); - mTrianglesDrawnStat.reset(); + LLViewerStats::getInstance()->mTrianglesDrawnStat.reset(); resetFrameStats(); mRenderTypeMask = 0xffffffff; // All render types start on @@ -466,8 +465,8 @@ void LLPipeline::resizeScreenTexture() { if (gPipeline.canUseVertexShaders() && assertInitialized()) { - GLuint resX = gViewerWindow->getWindowDisplayWidth(); - GLuint resY = gViewerWindow->getWindowDisplayHeight(); + GLuint resX = gViewerWindow->getWorldViewWidth(); + GLuint resY = gViewerWindow->getWorldViewHeight(); U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); if (res_mod > 1 && res_mod < resX && res_mod < resY) @@ -577,6 +576,7 @@ void LLPipeline::releaseGLBuffers() void LLPipeline::createGLBuffers() { + LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS); assertInitialized(); updateRenderDeferred(); @@ -592,6 +592,9 @@ void LLPipeline::createGLBuffers() stop_glerror(); + GLuint resX = gViewerWindow->getWorldViewWidth(); + GLuint resY = gViewerWindow->getWorldViewHeight(); + if (LLPipeline::sRenderGlow) { //screen space glow buffers const U32 glow_res = llmax(1, @@ -601,13 +604,10 @@ void LLPipeline::createGLBuffers() { mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); } - } - GLuint resX = gViewerWindow->getWindowDisplayWidth(); - GLuint resY = gViewerWindow->getWindowDisplayHeight(); + allocateScreenBuffer(resX,resY); + } - allocateScreenBuffer(resX,resY); - if (sRenderDeferred) { mSunShadow[0].allocate(1024,1024, 0, TRUE, FALSE); @@ -639,6 +639,7 @@ void LLPipeline::createGLBuffers() void LLPipeline::restoreGL() { + LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_RESTORE_GL); assertInitialized(); if (mVertexShadersEnabled) @@ -693,6 +694,7 @@ BOOL LLPipeline::canUseWindLightShadersOnObjects() const void LLPipeline::unloadShaders() { + LLMemType mt_us(LLMemType::MTYPE_PIPELINE_UNLOAD_SHADERS); LLViewerShaderMgr::instance()->unloadShaders(); mVertexShadersLoaded = 0; @@ -724,6 +726,7 @@ S32 LLPipeline::getMaxLightingDetail() const S32 LLPipeline::setLightingDetail(S32 level) { + LLMemType mt_ld(LLMemType::MTYPE_PIPELINE_LIGHTING_DETAIL); assertInitialized(); if (level < 0) @@ -911,7 +914,7 @@ LLDrawPool* LLPipeline::getPoolFromTE(const LLTextureEntry* te, LLViewerImage* i //static U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerImage* imagep) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt_gpt(LLMemType::MTYPE_PIPELINE_GET_POOL_TYPE); if (!te || !imagep) { @@ -941,7 +944,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerImage* image void LLPipeline::addPool(LLDrawPool *new_poolp) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt_a(LLMemType::MTYPE_PIPELINE_ADD_POOL); assertInitialized(); mPools.insert(new_poolp); addToQuickLookup( new_poolp ); @@ -949,7 +952,7 @@ void LLPipeline::addPool(LLDrawPool *new_poolp) void LLPipeline::allocDrawable(LLViewerObject *vobj) { - LLMemType mt(LLMemType::MTYPE_DRAWABLE); + LLMemType mt_ad(LLMemType::MTYPE_PIPELINE_ALLOCATE_DRAWABLE); LLDrawable *drawable = new LLDrawable(); vobj->mDrawable = drawable; @@ -1010,6 +1013,7 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) U32 LLPipeline::addObject(LLViewerObject *vobj) { + LLMemType mt_ao(LLMemType::MTYPE_PIPELINE_ADD_OBJECT); if (gNoRender) { return 0; @@ -1030,7 +1034,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj) void LLPipeline::createObjects(F32 max_dtime) { LLFastTimer ftm(LLFastTimer::FTM_GEO_UPDATE); - LLMemType mt(LLMemType::MTYPE_DRAWABLE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS); LLTimer update_timer; @@ -1093,7 +1097,7 @@ void LLPipeline::resetFrameStats() { assertInitialized(); - mTrianglesDrawnStat.addValue(mTrianglesDrawn/1000.f); + LLViewerStats::getInstance()->mTrianglesDrawnStat.addValue(mTrianglesDrawn/1000.f); if (mBatchCount > 0) { @@ -1198,7 +1202,7 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list) void LLPipeline::updateMove() { LLFastTimer t(LLFastTimer::FTM_UPDATE_MOVE); - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt_um(LLMemType::MTYPE_PIPELINE_UPDATE_MOVE); if (gSavedSettings.getBOOL("FreezeTime")) { @@ -1352,7 +1356,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip) { LLFastTimer t(LLFastTimer::FTM_CULL); - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt_uc(LLMemType::MTYPE_PIPELINE_UPDATE_CULL); grabReferences(result); @@ -1563,7 +1567,7 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) void LLPipeline::updateGeom(F32 max_dtime) { LLTimer update_timer; - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_UPDATE_GEOM); LLPointer drawablep; LLFastTimer t(LLFastTimer::FTM_GEO_UPDATE); @@ -1666,7 +1670,7 @@ void LLPipeline::updateGeom(F32 max_dtime) void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_VISIBLE); if(!drawablep || drawablep->isDead()) { return; @@ -1686,7 +1690,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt_mm(LLMemType::MTYPE_PIPELINE_MARK_MOVED); if (!drawablep) { @@ -1732,7 +1736,7 @@ void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion) void LLPipeline::markShift(LLDrawable *drawablep) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_SHIFT); if (!drawablep || drawablep->isDead()) { @@ -1755,7 +1759,7 @@ void LLPipeline::markShift(LLDrawable *drawablep) void LLPipeline::shiftObjects(const LLVector3 &offset) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_SHIFT_OBJECTS); assertInitialized(); @@ -1795,7 +1799,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) void LLPipeline::markTextured(LLDrawable *drawablep) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_TEXTURED); if (drawablep && !drawablep->isDead() && assertInitialized()) { @@ -1805,7 +1809,7 @@ void LLPipeline::markTextured(LLDrawable *drawablep) void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, BOOL priority) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_REBUILD); if (drawablep && !drawablep->isDead() && assertInitialized()) { @@ -1851,7 +1855,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) } LLFastTimer ftm(LLFastTimer::FTM_STATESORT); - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT); //LLVertexBuffer::unbind(); @@ -1928,7 +1932,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT); if (!sSkipUpdate && group->changeLOD()) { for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) @@ -1942,16 +1946,17 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT); if (!sSkipUpdate && bridge->getSpatialGroup()->changeLOD()) { - bridge->updateDistance(camera); + bool force_update = false; + bridge->updateDistance(camera, force_update); } } void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT); if (!drawablep || drawablep->isDead() @@ -1960,7 +1965,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) return; } - if (gHideSelectedObjects) + if (LLSelectMgr::getInstance()->mHideSelectedObjects) { if (drawablep->getVObj().notNull() && drawablep->getVObj()->isSelected()) @@ -2006,11 +2011,13 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) { if (!drawablep->isActive()) { - drawablep->updateDistance(camera); + bool force_update = false; + drawablep->updateDistance(camera, force_update); } else if (drawablep->isAvatar()) { - drawablep->updateDistance(camera); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility() + bool force_update = false; + drawablep->updateDistance(camera, force_update); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility() } } } @@ -2178,7 +2185,7 @@ void renderSoundHighlights(LLDrawable* drawablep) void LLPipeline::postSort(LLCamera& camera) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_POST_SORT); LLFastTimer ftm(LLFastTimer::FTM_STATESORT_POSTSORT); assertInitialized(); @@ -2372,6 +2379,7 @@ void LLPipeline::postSort(LLCamera& camera) void render_hud_elements() { + LLMemType mt_rhe(LLMemType::MTYPE_PIPELINE_RENDER_HUD_ELS); LLFastTimer t(LLFastTimer::FTM_RENDER_UI); gPipeline.disableLights(); @@ -2416,7 +2424,7 @@ void render_hud_elements() void LLPipeline::renderHighlights() { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_HL); assertInitialized(); @@ -2484,7 +2492,7 @@ void LLPipeline::renderHighlights() void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_GEOM); LLFastTimer t(LLFastTimer::FTM_RENDER_GEOMETRY); assertInitialized(); @@ -2509,7 +2517,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) // stop_glerror(); - gFrameStats.start(LLFrameStats::RENDER_SYNC); LLVertexBuffer::unbind(); @@ -2535,7 +2542,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) if(forceVBOUpdate) gSky.mVOSkyp->updateDummyVertexBuffer() ; - gFrameStats.start(LLFrameStats::RENDER_GEOM); // Initialize lots of GL state to "safe" values glMatrixMode(GL_TEXTURE); @@ -2570,9 +2576,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) stop_glerror(); LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDrawPools"); - - LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect"); - LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDeferred"); for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) { LLDrawPool *poolp = *iter; @@ -2584,6 +2587,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING)) { + LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect"); gObjectList.renderObjectsForSelect(camera, gViewerWindow->getVirtualWindowRect()); } else @@ -2647,6 +2651,10 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); if (depth > 3) { + if (gDebugSession) + { + ll_fail("GL matrix stack corrupted."); + } llerrs << "GL matrix stack corrupted!" << llendl; } std::string msg = llformat("%s pass %d", gPoolNames[cur_type].c_str(), i); @@ -2747,6 +2755,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) void LLPipeline::renderGeomDeferred(LLCamera& camera) { + LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred"); + + LLMemType mt_rgd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED); LLFastTimer t(LLFastTimer::FTM_RENDER_GEOMETRY); LLFastTimer t2(LLFastTimer::FTM_POOLS); @@ -2848,6 +2859,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) void LLPipeline::renderGeomPostDeferred(LLCamera& camera) { + LLMemType mt_rgpd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF); LLFastTimer t(LLFastTimer::FTM_POOLS); U32 cur_type = 0; @@ -2959,6 +2971,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) void LLPipeline::renderGeomShadow(LLCamera& camera) { + LLMemType mt_rgs(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_SHADOW); U32 cur_type = 0; LLGLEnable cull(GL_CULL_FACE); @@ -3220,7 +3233,7 @@ void LLPipeline::renderForSelect(std::set& objects, BOOL render stateSort((*iter)->mDrawable, *LLViewerCamera::getInstance()); } - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_SELECT); @@ -3295,7 +3308,7 @@ void LLPipeline::renderForSelect(std::set& objects, BOOL render LLDrawable* drawable = vobj->mDrawable; if (vobj->isDead() || vobj->isHUDAttachment() || - (gHideSelectedObjects && vobj->isSelected()) || + (LLSelectMgr::getInstance()->mHideSelectedObjects && vobj->isSelected()) || drawable->isDead() || !hasRenderType(drawable->getRenderType())) { @@ -3385,7 +3398,7 @@ void LLPipeline::renderForSelect(std::set& objects, BOOL render void LLPipeline::rebuildPools() { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_REBUILD_POOLS); assertInitialized(); @@ -3425,7 +3438,7 @@ void LLPipeline::rebuildPools() void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) { - LLMemType mt(LLMemType::MTYPE_PIPELINE); + LLMemType mt(LLMemType::MTYPE_PIPELINE_QUICK_LOOKUP); assertInitialized(); @@ -4096,18 +4109,21 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) void LLPipeline::enableLights(U32 mask) { assertInitialized(); + if (mLightingDetail == 0) { mask &= 0xf003; // sun and backlight only (and fullbright bit) } if (mLightMask != mask) { + stop_glerror(); if (!mLightMask) { glEnable(GL_LIGHTING); } if (mask) { + stop_glerror(); for (S32 i=0; i<8; i++) { if (mask & (1<getWindowDisplayWidth()*2, - (F32) gViewerWindow->getWindowDisplayHeight()*2); + LLVector2 tc2((F32) gViewerWindow->getWorldViewWidth()*2, + (F32) gViewerWindow->getWorldViewHeight()*2); if (res_mod > 1) { @@ -5073,8 +5094,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) F32 minLum = llmax(gSavedSettings.getF32("RenderGlowMinLuminance"), 0.0f); F32 maxAlpha = gSavedSettings.getF32("RenderGlowMaxExtractAlpha"); F32 warmthAmount = gSavedSettings.getF32("RenderGlowWarmthAmount"); - LLVector3 lumWeights = gSavedSettings.getVector3("RenderGlowLumWeights"); - LLVector3 warmthWeights = gSavedSettings.getVector3("RenderGlowWarmthWeights"); + LLVector3 lumWeights = gSavedSkinSettings.getVector3("RenderGlowLumWeights"); + LLVector3 warmthWeights = gSavedSkinSettings.getVector3("RenderGlowWarmthWeights"); gGlowExtractProgram.uniform1f("minLuminance", minLum); gGlowExtractProgram.uniform1f("maxExtractAlpha", maxAlpha); gGlowExtractProgram.uniform3f("lumWeights", lumWeights.mV[0], lumWeights.mV[1], lumWeights.mV[2]); @@ -5182,7 +5203,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - gViewerWindow->setupViewport(); + gGLViewport[0] = gViewerWindow->getWorldViewRect().mLeft; + gGLViewport[1] = gViewerWindow->getWorldViewRect().mBottom; + gGLViewport[2] = gViewerWindow->getWorldViewRect().getWidth(); + gGLViewport[3] = gViewerWindow->getWorldViewRect().getHeight(); + glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); gGL.flush(); @@ -5191,8 +5216,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) - tc2.setVec((F32) gViewerWindow->getWindowDisplayWidth(), - (F32) gViewerWindow->getWindowDisplayHeight()); + tc2.setVec((F32) gViewerWindow->getWorldViewWidth(), + (F32) gViewerWindow->getWorldViewHeight()); if (res_mod > 1) { @@ -5785,15 +5810,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) { - LLVOAvatar* agent = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); if (gAgent.getCameraAnimating() || gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK) { - agent = NULL; + avatar = NULL; } - if (agent) + if (avatar) { - agent->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); + avatar->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); } LLVertexBuffer::unbind(); @@ -5983,7 +6008,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } glClearColor(0.f, 0.f, 0.f, 0.f); - gViewerWindow->setupViewport(); + gViewerWindow->setup3DViewport(); mRenderTypeMask = type_mask; LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; @@ -5994,9 +6019,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); - if (agent) + if (avatar) { - agent->updateAttachmentVisibility(gAgent.getCameraMode()); + avatar->updateAttachmentVisibility(gAgent.getCameraMode()); } } } @@ -6428,6 +6453,7 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu void LLPipeline::generateImpostor(LLVOAvatar* avatar) { + LLMemType mt_gi(LLMemType::MTYPE_PIPELINE_GENERATE_IMPOSTOR); LLGLState::checkStates(); LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); @@ -6668,3 +6694,4 @@ LLCullResult::sg_list_t::iterator LLPipeline::endAlphaGroups() return sCull->endAlphaGroups(); } + diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 1a32b30831..c017e9b64f 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -36,11 +36,10 @@ #include "llerror.h" #include "lldarrayptr.h" #include "lldqueueptr.h" -#include "llstat.h" #include "lldrawpool.h" #include "llspatialpartition.h" #include "m4math.h" -#include "llmemory.h" +#include "llpointer.h" #include "lldrawpool.h" #include "llgl.h" #include "lldrawable.h" @@ -383,7 +382,6 @@ public: S32 mMeanBatchSize; S32 mTrianglesDrawn; S32 mNumVisibleNodes; - LLStat mTrianglesDrawnStat; S32 mVerticesRelit; S32 mLightingChanges; diff --git a/indra/newview/res/bitmap2.bmp b/indra/newview/res/bitmap2.bmp new file mode 100644 index 0000000000..770b07558c Binary files /dev/null and b/indra/newview/res/bitmap2.bmp differ diff --git a/indra/newview/res/install_icon.BMP b/indra/newview/res/install_icon.BMP new file mode 100644 index 0000000000..09df573870 Binary files /dev/null and b/indra/newview/res/install_icon.BMP differ diff --git a/indra/newview/res/loginbackground.bmp b/indra/newview/res/loginbackground.bmp new file mode 100644 index 0000000000..288a0b0398 Binary files /dev/null and b/indra/newview/res/loginbackground.bmp differ diff --git a/indra/newview/res/uninstall_icon.BMP b/indra/newview/res/uninstall_icon.BMP new file mode 100644 index 0000000000..562b56676a Binary files /dev/null and b/indra/newview/res/uninstall_icon.BMP differ diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index cf9466fad3..49ea0bc8aa 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -1,3 +1,3157 @@ - - - + + + + AgentChatColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + AlertBoxColor + + Comment + Alert Box Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + AlertCautionBoxColor + + Comment + Alert Caution Box Color + Persist + 1 + Type + Color4 + Value + + 1 + 0.82 + 0.46 + 1 + + + AlertCautionTextColor + + Comment + Alert Caution Text Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + AlertTextColor + + Comment + Alert Text Color + Persist + 1 + Type + Color4 + Value + + 0.58 + 0.66 + 0.84 + 1 + + + AvatarNameColor + + Comment + Avatar Name Color + Persist + 1 + Type + Color4 + Value + + 0.98 + 0.69 + 0.36 + 1 + + + BackgroundChatColor + + Comment + Color of chat bubble background + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.0 + 0.0 + 1.0 + + + ButtonBorderColor + + Comment + Button Border Color + Persist + 1 + Type + Color4 + Value + + 0.94 + 0.61 + 0 + 1 + + + ButtonCautionImageColor + + Comment + Button Caution Image Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + ButtonColor + + Comment + Button Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + ButtonFlashBgColor + + Comment + Button Color + Persist + 1 + Type + Color4 + Value + + 1 + 0.75 + 0.24 + 0.5 + + + ButtonImageColor + + Comment + Button Image Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + ButtonLabelColor + + Comment + Button Label Color + Persist + 1 + Type + Color4 + Value + + 0.86 + 0.86 + 0.86 + 1 + + + ButtonLabelDisabledColor + + Comment + Button Label Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.58 + 0.66 + 0.84 + 0.78 + + + ButtonLabelSelectedColor + + Comment + Button Label Selected Color + Persist + 1 + Type + Color4 + Value + + 0.86 + 0.86 + 0.86 + 1 + + + ButtonLabelSelectedDisabledColor + + Comment + Button Label Selected Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.64 + 0.75 + 0.93 + 0.78 + + + ButtonSelectedBgColor + + Comment + Button Selected Bg Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + ButtonSelectedColor + + Comment + Button Selected Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + ButtonUnselectedBgColor + + Comment + Button Unselected Bg Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + ButtonUnselectedFgColor + + Comment + Button Unselected Fg Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + ChatHistoryBgColor + + Comment + Chat History Bg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0 + + + ChatHistoryTextColor + + Comment + Chat History Text Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + ColorDropShadow + + Comment + Color Drop Shadow + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.78 + + + ColorPaletteEntry01 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.0 + 0.0 + 1.0 + + + ColorPaletteEntry02 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.5 + 0.5 + 1.0 + + + ColorPaletteEntry03 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.0 + 0.0 + 1.0 + + + ColorPaletteEntry04 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.5 + 0.0 + 1.0 + + + ColorPaletteEntry05 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.5 + 0.0 + 1.0 + + + ColorPaletteEntry06 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.5 + 0.5 + 1.0 + + + ColorPaletteEntry07 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.0 + 0.5 + 1.0 + + + ColorPaletteEntry08 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.0 + 0.5 + 1.0 + + + ColorPaletteEntry09 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.5 + 0.0 + 1.0 + + + ColorPaletteEntry10 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.25 + 0.25 + 1.0 + + + ColorPaletteEntry11 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.5 + 1.0 + 1.0 + + + ColorPaletteEntry12 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.25 + 0.5 + 1.0 + + + ColorPaletteEntry13 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.0 + 1.0 + 1.0 + + + ColorPaletteEntry14 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.25 + 0.0 + 1.0 + + + ColorPaletteEntry15 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + ColorPaletteEntry16 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + ColorPaletteEntry17 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + ColorPaletteEntry18 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.75 + 0.75 + 0.75 + 1.0 + + + ColorPaletteEntry19 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 0.0 + 1.0 + + + ColorPaletteEntry20 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 0.0 + 1.0 + + + ColorPaletteEntry21 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 1.0 + 0.0 + 1.0 + + + ColorPaletteEntry22 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 1.0 + 1.0 + 1.0 + + + ColorPaletteEntry23 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.0 + 1.0 + 1.0 + + + ColorPaletteEntry24 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 1.0 + 1.0 + + + ColorPaletteEntry25 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 0.5 + 1.0 + + + ColorPaletteEntry26 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.0 + 1.0 + 0.5 + 1.0 + + + ColorPaletteEntry27 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 1.0 + 1.0 + 1.0 + + + ColorPaletteEntry28 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.5 + 1.0 + 1.0 + + + ColorPaletteEntry29 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 0.5 + 1.0 + + + ColorPaletteEntry30 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.5 + 0.0 + 1.0 + + + ColorPaletteEntry31 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + ColorPaletteEntry32 + + Comment + Color picker palette entry + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + ConsoleBackground + + Comment + Console Background + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + ContextSilhouetteColor + + Comment + Context Silhouette Color + Persist + 1 + Type + Color4 + Value + + 0.94 + 0.61 + 0 + 1 + + + DefaultHighlightDark + + Comment + Default Highlight Dark + Persist + 1 + Type + Color4 + Value + + 0.1 + 0.1 + 0.1 + 1 + + + DefaultHighlightLight + + Comment + Default Highlight Light + Persist + 1 + Type + Color4 + Value + + 0.45 + 0.52 + 0.61 + 1 + + + DefaultShadowDark + + Comment + Default Shadow Dark + Persist + 1 + Type + Color4 + Value + + 0.1 + 0.1 + 0.1 + 1 + + + DefaultShadowLight + + Comment + Default Shadow Light + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + EffectColor + + Comment + Particle effects color + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + FilterBackgroundColor + + Comment + Filter Background Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0.08 + 1 + + + FilterTextColor + + Comment + Filter Text Color + Persist + 1 + Type + Color4 + Value + + 1 + 0.78 + 0.27 + 1 + + + FloaterButtonImageColor + + Comment + Floater Button Image Color + Persist + 1 + Type + Color4 + Value + + 0.94 + 0.61 + 0 + 1 + + + FloaterDefaultBackgroundColor + + Comment + Default Background Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 0.55 + + + FloaterFocusBackgroundColor + + Comment + Focus Background Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + FloaterFocusBorderColor + + Comment + Floater Focus Border Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.31 + + + FloaterUnfocusBorderColor + + Comment + Floater Unfocus Border Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.31 + + + FocusColor + + Comment + Focus Color + Persist + 1 + Type + Color4 + Value + + 0.94 + 0.61 + 0 + 1 + + + FolderViewLoadingMessageTextColor + + Comment + Folder View Loading Message Text Color + Persist + 1 + Type + Color4 + Value + + 0.94 + 0.65 + 0.35 + 1 + + + GridFocusPointColor + + Comment + Grid Focus Point Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 0.5 + + + GridlineBGColor + + Comment + Gridline BGColor + Persist + 1 + Type + Color4 + Value + + 0.92 + 0.92 + 1 + 0.78 + + + GridlineColor + + Comment + Gridline Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + GridlineShadowColor + + Comment + Gridline Shadow Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.31 + + + GroupNotifyBoxColor + + Comment + Group Notify Box Color + Persist + 1 + Type + Color4 + Value + + 0.27 + 0.67 + 1 + 1 + + + GroupNotifyTextColor + + Comment + Group Notify Text Color + Persist + 1 + Type + Color4 + Value + + 0 + 0.12 + 0.24 + 1 + + + GroupOverTierColor + + Comment + Group Over Tier Color + Persist + 1 + Type + Color4 + Value + + 0.43 + 0.06 + 0.06 + 1 + + + HTMLLinkColor + + Comment + Color of hyperlinks + Persist + 1 + Type + Color4 + Value + + 0.60 + 0.60 + 1.0 + 1.0 + + + HealthTextColor + + Comment + Health Text Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + HelpBgColor + + Comment + Help Bg Color + Persist + 1 + Type + Color4 + Value + + 0.78 + 0.82 + 0.8 + 1 + + + HelpFgColor + + Comment + Help Fg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + HelpScrollHighlightColor + + Comment + Help Scroll Highlight Color + Persist + 1 + Type + Color4 + Value + + 0.45 + 0.52 + 0.61 + 1 + + + HelpScrollShadowColor + + Comment + Help Scroll Shadow Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + HelpScrollThumbColor + + Comment + Help Scroll Thumb Color + Persist + 1 + Type + Color4 + Value + + 0.31 + 0.38 + 0.49 + 1 + + + HelpScrollTrackColor + + Comment + Help Scroll Track Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 1 + + + HighlightChildColor + + Comment + Highlight Child Color + Persist + 1 + Type + Color4 + Value + + 0.67 + 0.83 + 0.96 + 1 + + + HighlightInspectColor + + Comment + Highlight Inspect Color + Persist + 1 + Type + Color4 + Value + + 1 + 0 + 1 + 1 + + + HighlightParentColor + + Comment + Highlight Parent Color + Persist + 1 + Type + Color4 + Value + + 0.67 + 0.83 + 0.96 + 1 + + + IMChatColor + + Comment + Color of instant messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + IMHistoryBgColor + + Comment + IMHistory Bg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0.12 + 0.31 + 0.78 + + + IMHistoryTextColor + + Comment + IMHistory Text Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + IconDisabledColor + + Comment + Icon Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.58 + 0.66 + 0.84 + 0.78 + + + IconEnabledColor + + Comment + Icon Enabled Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + InventoryBackgroundColor + + Comment + Inventory Background Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 0.31 + + + InventoryItemSuffixColor + + Comment + Inventory Item Suffix Color + Persist + 1 + Type + Color4 + Value + + 0.75 + 0.85 + 0.85 + 1 + + + InventorySearchStatusColor + + Comment + Inventory Search Status Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + LabelDisabledColor + + Comment + Label Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.58 + 0.66 + 0.84 + 0.3 + + + LabelSelectedColor + + Comment + Label Selected Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + LabelSelectedDisabledColor + + Comment + Label Selected Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.64 + 0.75 + 0.93 + 0.5 + + + LabelTextColor + + Comment + Label Text Color + Persist + 1 + Type + Color4 + Value + + 0.58 + 0.66 + 0.84 + 1 + + + LoginProgressBarBgColor + + Comment + Login Progress Bar Bg Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + LoginProgressBarFgColor + + Comment + Login Progress Bar Fg Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + LoginProgressBoxBorderColor + + Comment + Login Progress Box Border Color + Persist + 1 + Type + Color4 + Value + + 0 + 0.12 + 0.24 + 0 + + + LoginProgressBoxCenterColor + + Comment + Login Progress Box Center Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.78 + + + LoginProgressBoxShadowColor + + Comment + Login Progress Box Shadow Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.78 + + + LoginProgressBoxTextColor + + Comment + Login Progress Box Text Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + + MapAvatarColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 0.0 + 1.0 + 0.0 + 1.0 + + + MapAvatarFriendColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 0.0 + 1.0 + + + MapAvatarSelfColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + MapFrustumColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 0.1 + + + MapFrustumRotatingColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 0.2 + + + MapTrackColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 0.0 + 1.0 + + + MapTrackDisabledColor + + Comment + Color of chat messages from other residents + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.0 + 0.0 + 1.0 + + + + + MenuBarBgColor + + Comment + Menu Bar Bg Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + MenuBarGodBgColor + + Comment + Menu Bar God Bg Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.5 + 0.24 + 1 + + + MenuDefaultBgColor + + Comment + Menu Default Bg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + MenuItemDisabledColor + + Comment + Menu Item Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.52 + 0.52 + 0.64 + 0.5 + + + MenuItemEnabledColor + + Comment + Menu Item Enabled Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + MenuItemHighlightBgColor + + Comment + Menu Item Highlight Bg Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 0.39 + + + MenuItemHighlightFgColor + + Comment + Menu Item Highlight Fg Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + MenuNonProductionBgColor + + Comment + Menu Non Production Bg Color + Persist + 1 + Type + Color4 + Value + + 0.5 + 0 + 0 + 1 + + + MenuNonProductionGodBgColor + + Comment + Menu Non Production God Bg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0.5 + 0 + 1 + + + MenuPopupBgColor + + Comment + Menu Popup Bg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + MultiSliderDisabledThumbColor + + Comment + Multi Slider Disabled Thumb Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + MultiSliderThumbCenterColor + + Comment + Multi Slider Thumb Center Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 1 + + + MultiSliderThumbCenterSelectedColor + + Comment + Multi Slider Thumb Center Selected Color + Persist + 1 + Type + Color4 + Value + + 1 + 0.2 + 0.2 + 1 + + + MultiSliderThumbOutlineColor + + Comment + Multi Slider Thumb Outline Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + MultiSliderTrackColor + + Comment + Multi Slider Track Color + Persist + 1 + Type + Color4 + Value + + 0.12 + 0.12 + 0.12 + 1 + + + MultiSliderTriangleColor + + Comment + Multi Slider Triangle Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 0.2 + 1 + + + NetMapBackgroundColor + + Comment + Net Map Background Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.3 + + + NetMapGroupOwnAboveWater + + Comment + Net Map Group Own Above Water + Persist + 1 + Type + Color4 + Value + + 1 + 0 + 1 + 1 + + + NetMapGroupOwnBelowWater + + Comment + Net Map Group Own Below Water + Persist + 1 + Type + Color4 + Value + + 0.78 + 0 + 0.78 + 1 + + + NetMapOtherOwnAboveWater + + Comment + Net Map Other Own Above Water + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + NetMapOtherOwnBelowWater + + Comment + Net Map Other Own Below Water + Persist + 1 + Type + Color4 + Value + + 0.12 + 0.12 + 0.12 + 1 + + + NetMapYouOwnAboveWater + + Comment + Net Map You Own Above Water + Persist + 1 + Type + Color4 + Value + + 0 + 1 + 1 + 1 + + + NetMapYouOwnBelowWater + + Comment + Net Map You Own Below Water + Persist + 1 + Type + Color4 + Value + + 0 + 0.78 + 0.78 + 1 + + + NotifyBoxColor + + Comment + Notify Box Color + Persist + 1 + Type + Color4 + Value + + 0.27 + 0.67 + 1 + 1 + + + NotifyCautionBoxColor + + Comment + Notify Caution Box Color + Persist + 1 + Type + Color4 + Value + + 1 + 0.82 + 0.46 + 1 + + + NotifyCautionWarnColor + + Comment + Notify Caution Warn Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + NotifyTextColor + + Comment + Notify Text Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + ObjectChatColor + + Comment + Color of chat messages from objects + Persist + 0 + Type + Color4 + Value + + 0.7 + 0.9 + 0.7 + 1.0 + + + OverdrivenColor + + Comment + Color of various indicators when resident is speaking too loud. + Persist + 0 + Type + Color4 + Value + + 1.0 + 0.0 + 0.0 + 1.0 + + + PanelDefaultBackgroundColor + + Comment + Default Background Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 0.55 + + + PanelDefaultHighlightLight + + Comment + Default Highlight Light + Persist + 1 + Type + Color4 + Value + + 0.45 + 0.52 + 0.61 + 1 + + + PanelFocusBackgroundColor + + Comment + Focus Background Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 1 + + + ParcelHoverColor + + Comment + Parcel Hover Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + PieMenuBgColor + + Comment + Pie Menu Bg Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 0.59 + + + PieMenuLineColor + + Comment + Pie Menu Line Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.5 + + + PieMenuSelectedColor + + Comment + Pie Menu Selected Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 0.3 + + + PropertyColorAuction + + Comment + Property Color Auction + Persist + 1 + Type + Color4 + Value + + 0.50 + 0 + 1 + 0.4 + + + PropertyColorAvail + + Comment + Property Color Avail + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0 + + + PropertyColorForSale + + Comment + Property Color For Sale + Persist + 1 + Type + Color4 + Value + + 1 + 0.50 + 0 + 0.4 + + + PropertyColorGroup + + Comment + Property Color Group + Persist + 1 + Type + Color4 + Value + + 0 + 0.72 + 0.72 + 0.4 + + + PropertyColorOther + + Comment + Property Color Other + Persist + 1 + Type + Color4 + Value + + 1 + 0 + 0 + 0.4 + + + PropertyColorSelf + + Comment + Property Color Self + Persist + 1 + Type + Color4 + Value + + 0 + 1 + 0 + 0.4 + + + RenderGlowLumWeights + + Comment + Weights for each color channel to be used in calculating luminance (should add up to 1.0) + Persist + 1 + Type + Vector3 + Value + + 0.299 + 0.587 + 0.114 + + + RenderGlowWarmthWeights + + Comment + Weight of each color channel used before finding the max warmth + Persist + 1 + Type + Vector3 + Value + + 1.0 + 0.5 + 0.7 + + + ScriptBgReadOnlyColor + + Comment + Script Bg Read Only Color + Persist + 1 + Type + Color4 + Value + + 0.39 + 0.39 + 0.39 + 1 + + + ScriptErrorColor + + Comment + Color of script error messages + Persist + 1 + Type + Color4 + Value + + 0.82 + 0.27 + 0.27 + 1.0 + + + ScrollBGStripeColor + + Comment + Scroll BGStripe Color + Persist + 1 + Type + Color4 + Value + + 0.39 + 0.39 + 0.39 + 0.16 + + + ScrollBgReadOnlyColor + + Comment + Scroll Bg Read Only Color + Persist + 1 + Type + Color4 + Value + + 0.78 + 0.82 + 0.8 + 1 + + + ScrollBgWriteableColor + + Comment + Scroll Bg Writeable Color + Persist + 1 + Type + Color4 + Value + + 0.78 + 0.82 + 0.8 + 1 + + + ScrollDisabledColor + + Comment + Scroll Disabled Color + Persist + 1 + Type + Color4 + Value + + 0.5 + 0.5 + 0.5 + 0.8 + + + ScrollHighlightedColor + + Comment + Scroll Highlighted Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 0.5 + + + ScrollHoveredColor + + Comment + Scroll Hovered Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 0.5 + + + ScrollSelectedBGColor + + Comment + Scroll Selected BGColor + Persist + 1 + Type + Color4 + Value + + 0.39 + 0.39 + 0.74 + 0.59 + + + ScrollSelectedFGColor + + Comment + Scroll Selected FGColor + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.8 + + + ScrollUnselectedColor + + Comment + Scroll Unselected Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.8 + + + ScrollbarThumbColor + + Comment + Scrollbar Thumb Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.3 + 0.49 + 1 + + + ScrollbarTrackColor + + Comment + Scrollbar Track Color + Persist + 1 + Type + Color4 + Value + + 0.6 + 0.6 + 0.62 + 1 + + + SilhouetteChildColor + + Comment + Silhouette Child Color + Persist + 1 + Type + Color4 + Value + + 0.13 + 0.42 + 0.77 + 1 + + + SilhouetteParentColor + + Comment + Silhouette Parent Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 0 + 1 + + + SkyNightColorShift + + Comment + Controls moonlight color (base color applied to moon as light source) + Persist + 1 + Type + Color3 + Value + + 0.67 + 0.67 + 1.0 + + + SliderDisabledThumbColor + + Comment + Slider Disabled Thumb Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + SliderThumbCenterColor + + Comment + Slider Thumb Center Color + Persist + 1 + Type + Color4 + Value + + 0.78 + 0.78 + 0.78 + 1 + + + SliderThumbOutlineColor + + Comment + Slider Thumb Outline Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + SliderTrackColor + + Comment + Slider Track Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + SpeakingColor + + Comment + Color of various indicators when resident is speaking on a voice channel. + Persist + 1 + Type + Color4 + Value + + 0.0 + 1.0 + 0.0 + 1.0 + + + SystemChatColor + + Comment + Color of chat messages from SL System + Persist + 1 + Type + Color4 + Value + + 0.800000011921 + 1.0 + 1.0 + 1.0 + + + TextBgFocusColor + + Comment + Text Bg Focus Color + Persist + 1 + Type + Color4 + Value + + 0.78 + 0.82 + 0.8 + 1 + + + TextBgReadOnlyColor + + Comment + Text Bg Read Only Color + Persist + 1 + Type + Color4 + Value + + 0.24 + 0.24 + 0.24 + 0.63 + + + TextBgWriteableColor + + Comment + Text Bg Writeable Color + Persist + 1 + Type + Color4 + Value + + 0.78 + 0.82 + 0.8 + 0.9 + + + TextCursorColor + + Comment + Text Cursor Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + TextDefaultColor + + Comment + Text Default Color + Persist + 1 + Type + Color4 + Value + + 0 + 0.08 + 0 + 1 + + + TextEmbeddedItemColor + + Comment + Text Embedded Item Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0.5 + 1 + + + TextEmbeddedItemReadOnlyColor + + Comment + Text Embedded Item Read Only Color + Persist + 1 + Type + Color4 + Value + + 0.23 + 0.58 + 0.95 + 1 + + + TextFgColor + + Comment + Text Fg Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + TextFgReadOnlyColor + + Comment + Text Fg Read Only Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 0.78 + + + TextFgTentativeColor + + Comment + Text Fg Tentative Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 0.5 + + + TimeTextColor + + Comment + Time Text Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 1 + + + TitleBarFocusColor + + Comment + Title Bar Focus Color + Persist + 1 + Type + Color4 + Value + + 1 + 1 + 1 + 0.12 + + + ToolTipBgColor + + Comment + Tool Tip Bg Color + Persist + 1 + Type + Color4 + Value + + 0.72 + 0.72 + 0.74 + 0.78 + + + ToolTipBorderColor + + Comment + Tool Tip Border Color + Persist + 1 + Type + Color4 + Value + + 0.67 + 0.83 + 0.96 + 1 + + + ToolTipTextColor + + Comment + Tool Tip Text Color + Persist + 1 + Type + Color4 + Value + + 0 + 0 + 0 + 1 + + + UserChatColor + + Comment + Color of your chat messages + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + llOwnerSayChatColor + + Comment + Color of chat messages from objects only visible to the owner + Persist + 1 + Type + Color4 + Value + + 0.99 + 0.99 + 0.67 + 1.0 + + + + diff --git a/indra/newview/skins/default/textures/jump_left_in.tga b/indra/newview/skins/default/textures/jump_left_in.tga new file mode 100644 index 0000000000..e0656c901d Binary files /dev/null and b/indra/newview/skins/default/textures/jump_left_in.tga differ diff --git a/indra/newview/skins/default/textures/jump_left_out.tga b/indra/newview/skins/default/textures/jump_left_out.tga new file mode 100644 index 0000000000..fb6dac0c3d Binary files /dev/null and b/indra/newview/skins/default/textures/jump_left_out.tga differ diff --git a/indra/newview/skins/default/textures/jump_right_in.tga b/indra/newview/skins/default/textures/jump_right_in.tga new file mode 100644 index 0000000000..010c748c2a Binary files /dev/null and b/indra/newview/skins/default/textures/jump_right_in.tga differ diff --git a/indra/newview/skins/default/textures/jump_right_out.tga b/indra/newview/skins/default/textures/jump_right_out.tga new file mode 100644 index 0000000000..33355262d4 Binary files /dev/null and b/indra/newview/skins/default/textures/jump_right_out.tga differ diff --git a/indra/newview/skins/default/textures/menu_separator.png b/indra/newview/skins/default/textures/menu_separator.png new file mode 100644 index 0000000000..89dcdcdff5 Binary files /dev/null and b/indra/newview/skins/default/textures/menu_separator.png differ diff --git a/indra/newview/skins/default/textures/show_btn.tga b/indra/newview/skins/default/textures/show_btn.tga new file mode 100644 index 0000000000..5f05f377e3 Binary files /dev/null and b/indra/newview/skins/default/textures/show_btn.tga differ diff --git a/indra/newview/skins/default/textures/show_btn_selected.tga b/indra/newview/skins/default/textures/show_btn_selected.tga new file mode 100644 index 0000000000..00a2f34a37 Binary files /dev/null and b/indra/newview/skins/default/textures/show_btn_selected.tga differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 34c9dea7e6..84dd3ffd7a 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -1,21 +1,21 @@ - - - - + + + + - + - + - + - + - + - + @@ -23,7 +23,8 @@ - + + @@ -36,15 +37,15 @@ - + - + - - + + - - + + @@ -59,15 +60,15 @@ - - + + - - - - - - + + + + + + @@ -236,9 +237,9 @@ - - - + + + @@ -255,39 +256,32 @@ - - + + - + - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -295,82 +289,49 @@ - - - - - - - - - - - - - - - - - - + + + + - - - - + + - - - - + + - - - - + + - - - - - - - - - - - - - - + + + + + - - - + + - - - - - - - - - - + + + + + + + diff --git a/indra/newview/skins/default/textures/transparent.j2c b/indra/newview/skins/default/textures/transparent.j2c new file mode 100644 index 0000000000..1068e940b9 Binary files /dev/null and b/indra/newview/skins/default/textures/transparent.j2c differ diff --git a/indra/newview/skins/default/textures/voice_meter_dot.j2c b/indra/newview/skins/default/textures/voice_meter_dot.j2c new file mode 100644 index 0000000000..e536c3338a Binary files /dev/null and b/indra/newview/skins/default/textures/voice_meter_dot.j2c differ diff --git a/indra/newview/skins/default/textures/voice_meter_rings.j2c b/indra/newview/skins/default/textures/voice_meter_rings.j2c new file mode 100644 index 0000000000..17e7c6c6a1 Binary files /dev/null and b/indra/newview/skins/default/textures/voice_meter_rings.j2c differ diff --git a/indra/newview/skins/default/xui/da/floater_about_land.xml b/indra/newview/skins/default/xui/da/floater_about_land.xml index 8c1ed736a3..15ebffa302 100644 --- a/indra/newview/skins/default/xui/da/floater_about_land.xml +++ b/indra/newview/skins/default/xui/da/floater_about_land.xml @@ -1,80 +1,83 @@ - + - + Navn: - + Beskrivelse: - + + Type: + + + Mainland / Homestead + + + Rating: + + + Adult + + Ejer: - + Leyla Linden - + + + + + + + + + If unchecked, viewer will display full-screen when logged in. + + + Window Size: + + + + + + + + + + Display Resolution: + + + + Aspect Ratio: + + + + + + + + + + + + Quality and + + + Performance: + + + Faster + + + Low + + + Mid + + + High + + + Ultra + + + Higher + + + Quality + + + + + + + + + + + + Shaders: + + + + + + + + + + + + + Reflection Detail: + + + + + + + + + Avatar Rendering: + + + + + + + + m + + + m + + + + + + + + + + Mesh Detail: + + + + + + + + + + + + + + + + + + + + + Low + + + Low + + + Low + + + Low + + + Low + + + Low + + + Low + + + Lighting Detail: + + + + + + + Terrain Detail: + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml new file mode 100644 index 0000000000..a4363d5858 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -0,0 +1,574 @@ + + + + [ACCTTYPE] [PAYMENTINFO] [AGEVERIFICATION] + + + Resident. + + + Trial + + + Charter Member + + + Linden Lab Employee + + + Payment Info Used + + + Payment Info On File + + + No Payment Info On File + + + Age-verified + + + Not Age-verified + + + + + + + Second Life photo: + + + + + + First Life photo: + + + + + + + + + + + + + Status: + + + + + + + + What're you up to? + + + Type a message about what you're doing in SL! + + + + Second Life description: + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. + + + First Life description: + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. + + + Second Life groups: + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. + + + Homepage: + + + TODO + + + Member since: + + + 05/31/1976 + + + Account status: + + + Resident. No payment info on file. + + + + Update + + + My Account + + + + Partner: + + + + [FIRST] [LAST] + + + Edit + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/check_box.xml b/indra/newview/skins/default/xui/en/widgets/check_box.xml new file mode 100644 index 0000000000..ff01dcebd8 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/check_box.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/color_swatch.xml b/indra/newview/skins/default/xui/en/widgets/color_swatch.xml new file mode 100644 index 0000000000..304eda2d97 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/color_swatch.xml @@ -0,0 +1,10 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/combo_box.xml b/indra/newview/skins/default/xui/en/widgets/combo_box.xml new file mode 100644 index 0000000000..8a8f3f7f2c --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/combo_box.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/drop_down.xml b/indra/newview/skins/default/xui/en/widgets/drop_down.xml new file mode 100644 index 0000000000..c35d15ec92 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/drop_down.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/flyout_button.xml b/indra/newview/skins/default/xui/en/widgets/flyout_button.xml new file mode 100644 index 0000000000..e0033058c8 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/flyout_button.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/icon.xml b/indra/newview/skins/default/xui/en/widgets/icon.xml new file mode 100644 index 0000000000..adb743a628 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/icon.xml @@ -0,0 +1,7 @@ + + + diff --git a/indra/newview/skins/default/xui/en/widgets/line_editor.xml b/indra/newview/skins/default/xui/en/widgets/line_editor.xml new file mode 100644 index 0000000000..11081ae308 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/line_editor.xml @@ -0,0 +1,18 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml new file mode 100644 index 0000000000..32f5a18d1c --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml @@ -0,0 +1,66 @@ + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/menu.xml b/indra/newview/skins/default/xui/en/widgets/menu.xml new file mode 100644 index 0000000000..10bc124ea3 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/menu.xml @@ -0,0 +1,6 @@ + + + diff --git a/indra/newview/skins/default/xui/en/widgets/menu_item_call.xml b/indra/newview/skins/default/xui/en/widgets/menu_item_call.xml new file mode 100644 index 0000000000..24bda97f44 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/menu_item_call.xml @@ -0,0 +1,6 @@ + + + diff --git a/indra/newview/skins/default/xui/en/widgets/menu_item_check.xml b/indra/newview/skins/default/xui/en/widgets/menu_item_check.xml new file mode 100644 index 0000000000..f6b06cb50b --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/menu_item_check.xml @@ -0,0 +1,6 @@ + + + diff --git a/indra/newview/skins/default/xui/en/widgets/menu_item_separator.xml b/indra/newview/skins/default/xui/en/widgets/menu_item_separator.xml new file mode 100644 index 0000000000..e5cea476da --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/menu_item_separator.xml @@ -0,0 +1,6 @@ + + + diff --git a/indra/newview/skins/default/xui/en/widgets/multi_slider.xml b/indra/newview/skins/default/xui/en/widgets/multi_slider.xml new file mode 100644 index 0000000000..e0900b48f3 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/multi_slider.xml @@ -0,0 +1,6 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/multi_slider_bar.xml b/indra/newview/skins/default/xui/en/widgets/multi_slider_bar.xml new file mode 100644 index 0000000000..04a2cd635c --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/multi_slider_bar.xml @@ -0,0 +1,10 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/name_editor.xml b/indra/newview/skins/default/xui/en/widgets/name_editor.xml new file mode 100644 index 0000000000..21ba5c77f8 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/name_editor.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/panel.xml b/indra/newview/skins/default/xui/en/widgets/panel.xml new file mode 100644 index 0000000000..b81a70b845 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/panel.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/progress_bar.xml b/indra/newview/skins/default/xui/en/widgets/progress_bar.xml new file mode 100644 index 0000000000..3344de06b0 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/progress_bar.xml @@ -0,0 +1,21 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/radio_group.xml b/indra/newview/skins/default/xui/en/widgets/radio_group.xml new file mode 100644 index 0000000000..2d851042a5 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/radio_group.xml @@ -0,0 +1,6 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/radio_item.xml b/indra/newview/skins/default/xui/en/widgets/radio_item.xml new file mode 100644 index 0000000000..0a27ca509b --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/radio_item.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml b/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml new file mode 100644 index 0000000000..a6c9a56dfd --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/scroll_container.xml b/indra/newview/skins/default/xui/en/widgets/scroll_container.xml new file mode 100644 index 0000000000..cb9ef04797 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/scroll_container.xml @@ -0,0 +1,3 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/scroll_list.xml b/indra/newview/skins/default/xui/en/widgets/scroll_list.xml new file mode 100644 index 0000000000..9e2c52acca --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/scroll_list.xml @@ -0,0 +1,16 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/search_editor.xml b/indra/newview/skins/default/xui/en/widgets/search_editor.xml new file mode 100644 index 0000000000..10080e5e39 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/search_editor.xml @@ -0,0 +1,6 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/side_tray.xml b/indra/newview/skins/default/xui/en/widgets/side_tray.xml new file mode 100644 index 0000000000..e3b70ba6e2 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/side_tray.xml @@ -0,0 +1,8 @@ + + + diff --git a/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml b/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml new file mode 100644 index 0000000000..20af3bb58f --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/simple_text_editor.xml @@ -0,0 +1,11 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/slider.xml b/indra/newview/skins/default/xui/en/widgets/slider.xml new file mode 100644 index 0000000000..f735d09476 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/slider.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/slider_bar.xml b/indra/newview/skins/default/xui/en/widgets/slider_bar.xml new file mode 100644 index 0000000000..ba9ad21cc0 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/slider_bar.xml @@ -0,0 +1,7 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/spinner.xml b/indra/newview/skins/default/xui/en/widgets/spinner.xml new file mode 100644 index 0000000000..29bf1e8052 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/spinner.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/tab_container.xml b/indra/newview/skins/default/xui/en/widgets/tab_container.xml new file mode 100644 index 0000000000..8245e5ff23 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/tab_container.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/text.xml b/indra/newview/skins/default/xui/en/widgets/text.xml new file mode 100644 index 0000000000..3d98cd66f9 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/text.xml @@ -0,0 +1,16 @@ + + diff --git a/indra/newview/skins/default/xui/en/widgets/text_editor.xml b/indra/newview/skins/default/xui/en/widgets/text_editor.xml new file mode 100644 index 0000000000..dc4c430546 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/text_editor.xml @@ -0,0 +1,19 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/texture_picker.xml b/indra/newview/skins/default/xui/en/widgets/texture_picker.xml new file mode 100644 index 0000000000..33c3475eb2 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/texture_picker.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/indra/newview/skins/default/xui/en/widgets/view_border.xml b/indra/newview/skins/default/xui/en/widgets/view_border.xml new file mode 100644 index 0000000000..0b0a9beb95 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/view_border.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/web_browser.xml b/indra/newview/skins/default/xui/en/widgets/web_browser.xml new file mode 100644 index 0000000000..118d63bbf0 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/web_browser.xml @@ -0,0 +1,2 @@ + + diff --git a/indra/newview/skins/default/xui/en/xui_version.xml b/indra/newview/skins/default/xui/en/xui_version.xml new file mode 100644 index 0000000000..0e777751d3 --- /dev/null +++ b/indra/newview/skins/default/xui/en/xui_version.xml @@ -0,0 +1,4 @@ + + + 1.0 + diff --git a/indra/newview/skins/default/xui/es/floater_animation_preview.xml b/indra/newview/skins/default/xui/es/floater_animation_preview.xml index a5b9847c4f..5a03aa6370 100644 --- a/indra/newview/skins/default/xui/es/floater_animation_preview.xml +++ b/indra/newview/skins/default/xui/es/floater_animation_preview.xml @@ -6,145 +6,72 @@ Descripción: - - - - + + + + Posición de las manos - - - Extendidas - - - Relajadas - - - Ambas señalan - - - Puño - - - La izquierda relajada - - - La izquierda señala - - - Puño en la izquierda - - - La derecha relajada - - - La derecha señala - - - Puño en la derecha - - - La derecha saluda - - - Escribiendo - - - Paz en la derecha - + + + + + + + + + + + + + + Expresión - - - [Nada] - - - Aaaaah - - - Con miedo - - - Enfadada - - - Gran sonrisa - - - Aburrida - - - Llorar - - - Desdén - - - Avergonzada - - - Fruncir el ceño - - - Besar - - - Reír - - - Sacar la lengua - - - Rechazo - - - Triste - - - Encogerse de hombros - - - Sonrisa - - - Sorpresa - - - Guiño - - - Preocupación - + + + + + + + + + + + + + + + + + + + + + - + Vista previa mientras - - - Estar de pie - - - Caminar - - - Estar sentado - - - Volar - + + + + + - - - diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml index 0e29046500..0012294160 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml @@ -64,17 +64,17 @@ left_delta="0" name="Edit" top_pad="4" - width="132" /> + width="50" /> diff --git a/indra/newview/skins/default/xui/en/floater_notifications_console.xml b/indra/newview/skins/default/xui/en/floater_notifications_console.xml index 92ecb5908e..14aa12aed7 100644 --- a/indra/newview/skins/default/xui/en/floater_notifications_console.xml +++ b/indra/newview/skins/default/xui/en/floater_notifications_console.xml @@ -24,7 +24,10 @@ left_pad="3" name="add_notification" top_delta="0" - width="50" /> + width="50" > + + + width="200"> + + + + width="300" > + + + width="37" > + + + width="120" > + + + width="120"> + + + width="120"> + + + width="120" > + + diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 929f857e90..8db8c8f31d 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -165,6 +165,9 @@ enabled="true" label="16:9 (Widescreen)" value="1.7777777" /> + + width="150"> + + Date: Sun, 21 Jun 2009 17:51:35 +0000 Subject: Fixed a shutdown crash. --- indra/newview/llbottomtray.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index f33dd2a32a..616cbb1fdb 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -59,7 +59,10 @@ LLBottomTray::LLBottomTray() LLBottomTray::~LLBottomTray() { - LLIMMgr::getInstance()->removeSessionObserver(this); + if (!LLSingleton::destroyed()) + { + LLIMMgr::getInstance()->removeSessionObserver(this); + } } LLLineEditor* LLBottomTray::getChatBox() -- cgit v1.2.3 From 401d51231fca5e97a4327d38aa4daf2475d22bbb Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 21:52:41 +0000 Subject: Modified RecordToChatConsole to not construct LLFloaterChat if it doesn't already exist to avoid recursive floater construction. --- indra/newview/llviewerwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 46aa284258..fb501b023f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -260,7 +260,7 @@ public: // only log warnings to chat console if (level == LLError::LEVEL_WARN) { - LLFloaterChat* chat_floater = LLFloaterReg::getTypedInstance("chat"); + LLFloaterChat* chat_floater = LLFloaterReg::findTypedInstance("chat"); if (chat_floater && gSavedSettings.getBOOL("WarningsAsChat")) { LLChat chat; -- cgit v1.2.3 From fcaa1ad46fd1df4cfec9dee12caf6e7b5bf32136 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 22 Jun 2009 12:52:18 +0000 Subject: QAR-1383: convert new uses of Boost.Signals (arriving from other branches) to Boost.Signals2 like the rest of the event-system-n code. --- indra/newview/llchiclet.cpp | 6 +++--- indra/newview/llchiclet.h | 6 +++--- indra/newview/llfloatergroups.h | 6 +++--- indra/newview/llfolderview.h | 5 ++--- indra/newview/llrecentpeople.h | 6 +++--- indra/newview/llteleporthistory.cpp | 2 +- indra/newview/llteleporthistory.h | 11 +++++------ indra/newview/lltoolpipette.h | 6 +++--- indra/newview/llviewerparcelmgr.cpp | 6 +++--- indra/newview/llviewerparcelmgr.h | 11 +++++------ 10 files changed, 31 insertions(+), 34 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 1c72e9c5ac..d8e844d291 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -119,7 +119,7 @@ void LLNotificationChiclet::setCounter(S32 counter) mCounterText->setText(stream.str()); } -boost::signals::connection LLNotificationChiclet::setClickCallback( +boost::signals2::connection LLNotificationChiclet::setClickCallback( const commit_callback_t& cb) { return mButton->setClickedCallback(cb); @@ -142,7 +142,7 @@ LLChiclet::~LLChiclet() } -boost::signals::connection LLChiclet::setLeftButtonClickCallback( +boost::signals2::connection LLChiclet::setLeftButtonClickCallback( const commit_callback_t& cb) { return mCommitSignal.connect(cb); @@ -587,7 +587,7 @@ void LLChicletPanel::onRightScrollClick() scrollRight(); } -boost::signals::connection LLChicletPanel::setChicletClickCallback( +boost::signals2::connection LLChicletPanel::setChicletClickCallback( const commit_callback_t& cb) { return mCommitSignal.connect(cb); diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index f2b859a090..11c3356c46 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -60,7 +60,7 @@ public: virtual bool getShowCounter() {return mShowCounter;}; - virtual boost::signals::connection setLeftButtonClickCallback( + virtual boost::signals2::connection setLeftButtonClickCallback( const commit_callback_t& cb); protected: @@ -158,7 +158,7 @@ public: S32 getCounter() {return mCounter;}; - boost::signals::connection setClickCallback(const commit_callback_t& cb); + boost::signals2::connection setClickCallback(const commit_callback_t& cb); virtual ~ LLNotificationChiclet(); @@ -212,7 +212,7 @@ public: void onRightScrollClick(); - boost::signals::connection setChicletClickCallback( + boost::signals2::connection setChicletClickCallback( const commit_callback_t& cb); void onChicletClick(LLUICtrl*ctrl,const LLSD¶m); diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index b49d38ccd0..0425b81294 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -48,7 +48,7 @@ #include "llfloater.h" #include #include -#include +#include class LLUICtrl; class LLTextBox; @@ -62,8 +62,8 @@ class LLFloaterGroupPicker : public LLFloater, public LLUIFactory signal_t; + // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots + typedef boost::signals2::signal signal_t; void setSelectGroupCallback(const signal_t::slot_type& cb) { mGroupSelectSignal.connect(cb); } void setPowersMask(U64 powers_mask); BOOL postBuild(); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 848d289bb9..9d91f0d64e 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -45,8 +45,7 @@ #include #include #include -#include -#include +#include #include "lluictrl.h" #include "v4color.h" @@ -768,7 +767,7 @@ public: void setFilterPermMask(PermissionMask filter_perm_mask) { mFilter.setFilterPermissions(filter_perm_mask); } void setAllowMultiSelect(BOOL allow) { mAllowMultiSelect = allow; } - typedef boost::signal& items, BOOL user_action)> signal_t; + typedef boost::signals2::signal& items, BOOL user_action)> signal_t; void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h index fce4b8d42b..40ac80e8bc 100644 --- a/indra/newview/llrecentpeople.h +++ b/indra/newview/llrecentpeople.h @@ -39,7 +39,7 @@ #include #include -#include +#include /** * List of people the agent recently interacted with. @@ -56,7 +56,7 @@ class LLRecentPeople: public LLSingleton, public LLOldEvents::LL { LOG_CLASS(LLRecentPeople); public: - typedef boost::signal signal_t; + typedef boost::signals2::signal signal_t; /** * Add specified avatar to the list if it's not there already. @@ -84,7 +84,7 @@ public: * * Multiple callbacks can be set. * - * @return no connection; use boost::bind + boost::signal::trackable to disconnect slots. + * @return no connection; use boost::bind + boost::signals2::trackable to disconnect slots. */ void setChangedCallback(const signal_t::slot_type& cb) { mChangedSignal.connect(cb); } diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index 6fc120d920..99389017cb 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -162,7 +162,7 @@ void LLTeleportHistory::updateCurrentLocation() onHistoryChanged(); } -boost::signals::connection LLTeleportHistory::setHistoryChangedCallback(history_callback_t cb) +boost::signals2::connection LLTeleportHistory::setHistoryChangedCallback(history_callback_t cb) { return mHistoryChangedSignal.connect(cb); } diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h index 5be3dc171f..c68aabe9a1 100644 --- a/indra/newview/llteleporthistory.h +++ b/indra/newview/llteleporthistory.h @@ -38,8 +38,7 @@ #include #include #include -#include -#include +#include /** @@ -81,7 +80,7 @@ public: typedef std::vector slurl_list_t; typedef boost::function history_callback_t; - typedef boost::signal history_signal_t; + typedef boost::signals2::signal history_signal_t; LLTeleportHistory(); ~LLTeleportHistory(); @@ -126,7 +125,7 @@ public: * * Multiple callbacks can be set. */ - boost::signals::connection setHistoryChangedCallback(history_callback_t cb); + boost::signals2::connection setHistoryChangedCallback(history_callback_t cb); /** * Save history to a file so that we can restore it on startup. @@ -212,14 +211,14 @@ private: * Using this connection we get notified when a teleport finishes * or initial location update occurs. */ - boost::signals::connection mTeleportFinishedConn; + boost::signals2::connection mTeleportFinishedConn; /** * Teleport failure notification connection. * * Using this connection we get notified when a teleport fails. */ - boost::signals::connection mTeleportFailedConn; + boost::signals2::connection mTeleportFailedConn; }; #endif diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index fcccafe1a4..3b6ebec67e 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -41,7 +41,7 @@ #include "lltool.h" #include "lltextureentry.h" #include -#include +#include class LLViewerObject; class LLPickInfo; @@ -58,8 +58,8 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect *sticky_rect_screen); - // Note: Don't return connection; use boost::bind + boost::signal::trackable to disconnect slots - typedef boost::signal signal_t; + // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots + typedef boost::signals2::signal signal_t; void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); } void setResult(BOOL success, const std::string& msg); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 8aa1663bc1..bcb3853106 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -2392,17 +2392,17 @@ LLViewerImage* LLViewerParcelMgr::getPassImage() const return sPassImage; } -boost::signals::connection LLViewerParcelMgr::setAgentParcelChangedCallback(parcel_changed_callback_t cb) +boost::signals2::connection LLViewerParcelMgr::setAgentParcelChangedCallback(parcel_changed_callback_t cb) { return mAgentParcelChangedSignal.connect(cb); } -boost::signals::connection LLViewerParcelMgr::setTeleportFinishedCallback(parcel_changed_callback_t cb) +boost::signals2::connection LLViewerParcelMgr::setTeleportFinishedCallback(parcel_changed_callback_t cb) { return mTeleportFinishedSignal.connect(cb); } -boost::signals::connection LLViewerParcelMgr::setTeleportFailedCallback(parcel_changed_callback_t cb) +boost::signals2::connection LLViewerParcelMgr::setTeleportFailedCallback(parcel_changed_callback_t cb) { return mTeleportFailedSignal.connect(cb); } diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 4bed1c0486..dc6c2a6287 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -41,8 +41,7 @@ #include "llui.h" #include -#include -#include +#include class LLUUID; class LLMessageSystem; @@ -84,7 +83,7 @@ class LLViewerParcelMgr : public LLSingleton public: typedef boost::function parcel_changed_callback_t; - typedef boost::signal parcel_changed_signal_t; + typedef boost::signals2::signal parcel_changed_signal_t; LLViewerParcelMgr(); ~LLViewerParcelMgr(); @@ -263,9 +262,9 @@ public: // the agent is banned or not in the allowed group BOOL isCollisionBanned(); - boost::signals::connection setAgentParcelChangedCallback(parcel_changed_callback_t cb); - boost::signals::connection setTeleportFinishedCallback(parcel_changed_callback_t cb); - boost::signals::connection setTeleportFailedCallback(parcel_changed_callback_t cb); + boost::signals2::connection setAgentParcelChangedCallback(parcel_changed_callback_t cb); + boost::signals2::connection setTeleportFinishedCallback(parcel_changed_callback_t cb); + boost::signals2::connection setTeleportFailedCallback(parcel_changed_callback_t cb); void onTeleportFinished(); void onTeleportFailed(); -- cgit v1.2.3 From fe487f46e37f0db1e8cee7a3e52020e06a79d196 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 23 Jun 2009 21:59:31 +0000 Subject: Fixed a bunch of missing includes and forward declares. I was trying to benchmark with precompiled headers off, but we'll have to do a bunch more cleanup before it's possible to disable that feature cleanly. Not reviewed. --- indra/newview/llagent.cpp | 4 ++++ indra/newview/llappviewer.h | 11 ++++++++--- indra/newview/llassetuploadresponders.cpp | 2 ++ indra/newview/llavatariconctrl.cpp | 2 ++ indra/newview/llavatarpropertiesprocessor.h | 2 ++ indra/newview/llcapabilitylistener.cpp | 1 + indra/newview/llcapabilitylistener.h | 1 + indra/newview/llcaphttpsender.cpp | 3 ++- indra/newview/llcloud.cpp | 1 + indra/newview/llcompilequeue.cpp | 2 ++ indra/newview/lldynamictexture.h | 1 + indra/newview/lleventpoll.h | 3 +++ indra/newview/llfeaturemanager.h | 1 + indra/newview/llhudeffectpointat.h | 1 + indra/newview/llimview.h | 1 + indra/newview/llinventorymodel.h | 4 +++- indra/newview/llviewercamera.h | 3 ++- indra/newview/llviewermessage.h | 4 +++- indra/newview/llviewerobject.h | 1 + indra/newview/llviewerobjectlist.h | 2 ++ indra/newview/llviewerregion.h | 1 + indra/newview/llvoavatar.h | 2 ++ indra/newview/llvoiceclient.h | 1 + indra/newview/llvovolume.h | 4 ++++ indra/newview/pipeline.h | 1 + 25 files changed, 52 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index a70d31431f..a8094a5850 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -64,6 +64,9 @@ #include "llmorphview.h" #include "llmoveview.h" #include "llparcel.h" +#include "llquantize.h" +#include "llrand.h" +#include "llregionhandle.h" #include "llsdutil.h" #include "llselectmgr.h" #include "llsky.h" @@ -71,6 +74,7 @@ #include "llsmoothstep.h" #include "llsidetray.h" #include "llstatusbar.h" +#include "llteleportflags.h" #include "llteleporthistory.h" #include "lltool.h" #include "lltoolcomp.h" diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 75033698b6..3e3b523169 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -33,14 +33,19 @@ #ifndef LL_LLAPPVIEWER_H #define LL_LLAPPVIEWER_H +#include "llallocator.h" #include "llcontrol.h" +#include "llsys.h" // for LLOSInfo +class LLCommandLineParser; +class LLFrameTimer; +class LLPumpIO; class LLTextureCache; -class LLWorkerThread; class LLTextureFetch; +class LLTimer; +class LLVFS; class LLWatchdogTimeout; -class LLCommandLineParser; -class LLAllocator; +class LLWorkerThread; class LLAppViewer : public LLApp diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 4cd9647603..1379073bba 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -58,11 +58,13 @@ #include "lltexlayer.h" // library includes +#include "lldir.h" #include "lleconomy.h" #include "llfloaterreg.h" #include "llfocusmgr.h" #include "llscrolllistctrl.h" #include "llsdserialize.h" +#include "llvfs.h" // When uploading multiple files, don't display any of them when uploading more than this number. static const S32 FILE_COUNT_DISPLAY_THRESHOLD = 5; diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 807f2f035c..3cd6126739 100644 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -41,6 +41,8 @@ #include "llmenugl.h" #include "lluictrlfactory.h" +#include "llcachename.h" + #define MENU_ITEM_VIEW_PROFILE 0 #define MENU_ITEM_SEND_IM 1 diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 4d50541d9a..2e10dea834 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -34,6 +34,8 @@ #define LL_LLAVATARPROPERTIESPROCESSOR_H #include "lluuid.h" +#include "llsingleton.h" +#include "v3dmath.h" // LLVector3d #include /* diff --git a/indra/newview/llcapabilitylistener.cpp b/indra/newview/llcapabilitylistener.cpp index 3277da8930..4134e9e0a4 100644 --- a/indra/newview/llcapabilitylistener.cpp +++ b/indra/newview/llcapabilitylistener.cpp @@ -21,6 +21,7 @@ // other Linden headers #include "stringize.h" #include "llcapabilityprovider.h" +#include "message.h" class LLCapabilityListener::CapabilityMappers: public LLSingleton { diff --git a/indra/newview/llcapabilitylistener.h b/indra/newview/llcapabilitylistener.h index 061227e04d..ce16b7da5d 100644 --- a/indra/newview/llcapabilitylistener.h +++ b/indra/newview/llcapabilitylistener.h @@ -17,6 +17,7 @@ #include "llerror.h" // LOG_CLASS() class LLCapabilityProvider; +class LLMessageSystem; class LLSD; class LLCapabilityListener diff --git a/indra/newview/llcaphttpsender.cpp b/indra/newview/llcaphttpsender.cpp index 1127f43424..b44e1f11fa 100644 --- a/indra/newview/llcaphttpsender.cpp +++ b/indra/newview/llcaphttpsender.cpp @@ -32,9 +32,10 @@ #include "llviewerprecompiledheaders.h" -#include "linden_common.h" #include "llcaphttpsender.h" +#include "llhost.h" + LLCapHTTPSender::LLCapHTTPSender(const std::string& cap) : mCap(cap) { diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index 0099817de4..af6f4e3286 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -37,6 +37,7 @@ #include "v3math.h" #include "v4math.h" #include "llquaternion.h" +#include "llrand.h" #include "v4color.h" #include "llwind.h" diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 096777ddd4..9d3b92d937 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -56,10 +56,12 @@ #include "llviewerobject.h" #include "llviewerregion.h" #include "llresmgr.h" + #include "llbutton.h" #include "lldir.h" #include "llfloaterchat.h" #include "llviewerstats.h" +#include "llvfile.h" #include "lluictrlfactory.h" #include "lltrans.h" diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index 5a20eaef9b..22e5a4819d 100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -33,6 +33,7 @@ #ifndef LL_LLDYNAMICTEXTURE_H #define LL_LLDYNAMICTEXTURE_H +#include "llcamera.h" #include "llgl.h" #include "llcoord.h" #include "llimagegl.h" diff --git a/indra/newview/lleventpoll.h b/indra/newview/lleventpoll.h index 12e4b49d57..f2465a361e 100644 --- a/indra/newview/lleventpoll.h +++ b/indra/newview/lleventpoll.h @@ -35,6 +35,9 @@ #include "llhttpclient.h" +class LLHost; + + class LLEventPoll ///< implements the viewer side of server-to-viewer pushed events. { diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 537bf0c6a4..383963a41d 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -35,6 +35,7 @@ #include "stdtypes.h" +#include "llsingleton.h" #include "llstring.h" #include diff --git a/indra/newview/llhudeffectpointat.h b/indra/newview/llhudeffectpointat.h index 81db3da1c7..278c69fe2b 100644 --- a/indra/newview/llhudeffectpointat.h +++ b/indra/newview/llhudeffectpointat.h @@ -33,6 +33,7 @@ #ifndef LL_LLHUDEFFECTPOINTAT_H #define LL_LLHUDEFFECTPOINTAT_H +#include "llframetimer.h" #include "llhudeffect.h" class LLViewerObject; diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 469f6ec21d..37dcd1593f 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -33,6 +33,7 @@ #ifndef LL_LLIMVIEW_H #define LL_LLIMVIEW_H +#include "lldarray.h" #include "llmodaldialog.h" #include "llinstantmessage.h" #include "lluuid.h" diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 2193552f4a..77e604769e 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -35,6 +35,8 @@ #include "llassettype.h" #include "lldarray.h" +#include "llframetimer.h" +#include "llhttpclient.h" #include "lluuid.h" #include "llpermissionsflags.h" #include "llstring.h" @@ -111,7 +113,7 @@ public: LLInventoryModel(); ~LLInventoryModel(); - class fetchInventoryResponder: public LLHTTPClient::Responder + class fetchInventoryResponder : public LLHTTPClient::Responder { public: fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 9615d00200..b99dd39584 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -34,8 +34,9 @@ #define LL_LLVIEWERCAMERA_H #include "llcamera.h" -#include "lltimer.h" +#include "llsingleton.h" #include "llstat.h" +#include "lltimer.h" #include "m4math.h" class LLCoordGL; diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 90a54e2b9c..c15e5df675 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -34,6 +34,7 @@ #define LL_LLVIEWERMESSAGE_H #include "llinstantmessage.h" +#include "llpointer.h" #include "lltransactiontypes.h" #include "lluuid.h" #include "stdenums.h" @@ -42,10 +43,11 @@ // Forward declarations // class LLColor4; -class LLViewerObject; class LLInventoryObject; class LLInventoryItem; +class LLMeanCollisionData; class LLMessageSystem; +class LLViewerObject; class LLViewerRegion; // diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 21a99c58d9..72c713f2a6 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -64,6 +64,7 @@ class LLWorld; class LLNameValue; class LLNetMap; class LLMessageSystem; +class LLPartSysData; class LLPrimitive; class LLPipeline; class LLTextureEntry; diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 0f906a4d7f..ace5c5038e 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -39,11 +39,13 @@ // common includes #include "llstat.h" #include "lldarrayptr.h" +#include "llmap.h" // *TODO: switch to std::map #include "llstring.h" // project includes #include "llviewerobject.h" +class LLCamera; class LLNetMap; class LLDebugBeacon; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 35f374a4c8..49d0900f2a 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -51,6 +51,7 @@ #include "llweb.h" #include "llcapabilityprovider.h" #include "llcapabilitylistener.h" +#include "m4math.h" // LLMatrix4 // Surface id's #define LAND 1 diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 301c032b25..56a8e3cd11 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -39,6 +39,7 @@ #include #include +#include "imageids.h" // IMG_INVISIBLE #include "llchat.h" #include "lldrawpoolalpha.h" #include "llviewerobject.h" @@ -49,6 +50,7 @@ #include "llvoavatardefines.h" #include "lltexglobalcolor.h" #include "lldriverparam.h" +#include "material_codes.h" // LL_MCODE_END extern const LLUUID ANIM_AGENT_BODY_NOISE; extern const LLUUID ANIM_AGENT_BREATHE_ROT; diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 1066ac73f1..8b3bbb68bb 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -43,6 +43,7 @@ class LLVivoxProtocolParser; #include "llframetimer.h" #include "llviewerregion.h" #include "llcallingcard.h" // for LLFriendObserver +#include "m3math.h" // LLMatrix3 class LLVoiceClientParticipantObserver { diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 155775510e..f20e551671 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -37,6 +37,8 @@ #include "llviewerimage.h" #include "llframetimer.h" #include "llapr.h" +#include "m3math.h" // LLMatrix3 +#include "m4math.h" // LLMatrix4 #include class LLViewerTextureAnim; @@ -158,12 +160,14 @@ public: /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump); /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny); /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright); + /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump); /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags); /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow); /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s); /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t); /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen); + /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media); /*virtual*/ BOOL setMaterial(const U8 material); void setTexture(const S32 face); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c017e9b64f..5358fce766 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -33,6 +33,7 @@ #ifndef LL_PIPELINE_H #define LL_PIPELINE_H +#include "llcamera.h" #include "llerror.h" #include "lldarrayptr.h" #include "lldqueueptr.h" -- cgit v1.2.3 From 2ce76c7ed47b49f8a7bafe69bdea064189e1ccbd Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 23 Jun 2009 23:32:39 +0000 Subject: Set correct svn:eol-style native on XML files, converted several files to use consistent line feeds (had ^M after first header line). Not reviewed. --- .../skins/default/xui/en/floater_nearby_chat.xml | 64 ++-- .../skins/default/xui/en/floater_test_combobox.xml | 286 ++++++++-------- .../skins/default/xui/en/panel_script_ed.xml | 380 ++++++++++----------- .../default/xui/en/panel_side_tray_tab_caption.xml | 4 +- .../default/xui/en/panel_teleport_history.xml | 4 +- .../skins/default/xui/en/panel_world_map.xml | 256 +++++++------- 6 files changed, 497 insertions(+), 497 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml index f4fd6b01b4..afac4a4051 100644 --- a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml @@ -1,32 +1,32 @@ - - - - NEARBY CHAT - - - - - - + + + + NEARBY CHAT + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_test_combobox.xml b/indra/newview/skins/default/xui/en/floater_test_combobox.xml index 9e1253ec56..4bc1b8b644 100644 --- a/indra/newview/skins/default/xui/en/floater_test_combobox.xml +++ b/indra/newview/skins/default/xui/en/floater_test_combobox.xml @@ -1,143 +1,143 @@ - - - - Real world usage (login location): - - - - - - - - Minimal combobox: - - - - - - - Allow text input: - - - - - - - Allow text input, default to second item: - - - - - - - Two character max input: - - - - - - - + + + + Real world usage (login location): + + + + + + + + Minimal combobox: + + + + + + + Allow text input: + + + + + + + Allow text input, default to second item: + + + + + + + Two character max input: + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 5a452bd706..f059f4f3c1 100644 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -1,190 +1,190 @@ - - - - Loading... - - - You are not allowed to view this script. - - - Public Objects cannot run scripts - - - Running - - - Script: [NAME] - - - Loading... - - - - - - - - - If unchecked, viewer will display full-screen when logged in. - - Window Size: + Window size: - - - - - - - - - Display Resolution: - - - - Aspect Ratio: - + left_delta="30" + name="windowed mode" + top_pad="5" + width="100"> + - - - - - Quality and - - - Performance: + left="30" + name="QualitySpeed" + top_pad="5" + width="400"> + Quality and speed: Faster @@ -224,80 +100,20 @@ follows="left|top" height="12" layout="topleft" - left="158" - name="ShadersPrefText" - top="93" - width="40"> - Low - - - Mid - - - High - - - Ultra - - - Higher + Better - - Quality - - - - - - + Low + + + Mid + + + High + + + Ultra + + + diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml index f99d629aed..1af3c6511d 100644 --- a/indra/newview/skins/default/xui/en/panel_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -578,7 +578,7 @@ top="0" width="50" /> - - + --> diff --git a/indra/newview/skins/default/xui/en/panel_progress.xml b/indra/newview/skins/default/xui/en/panel_progress.xml index 6139bae874..4f23c4d26d 100644 --- a/indra/newview/skins/default/xui/en/panel_progress.xml +++ b/indra/newview/skins/default/xui/en/panel_progress.xml @@ -61,28 +61,28 @@ width="640" /> + width="593" /> + width="593" /> + width="610" /> + top="700" + width="90" /> diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml index 7bd548d464..8265ab3227 100644 --- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml +++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml @@ -2,13 +2,13 @@ + width="280"> Purchased land in this region may be resold. @@ -49,7 +49,7 @@ mouse_opaque="false" name="estate_name_lbl" top_pad="5" - width="100"> + width="75"> Name: + width="75"> Owner: + width="75"> Covenant: + width="167"> Last Modified Wed Dec 31 16:00:00 1969 diff --git a/indra/newview/skins/default/xui/en/floater_beacons.xml b/indra/newview/skins/default/xui/en/floater_beacons.xml index 41ddec6395..049ea9ab14 100644 --- a/indra/newview/skins/default/xui/en/floater_beacons.xml +++ b/indra/newview/skins/default/xui/en/floater_beacons.xml @@ -20,43 +20,64 @@ control_name="scripttouchbeacon" label="Scripted Objects with Touch Only" layout="topleft" - name="touch_only" /> + name="touch_only" > + + + name="scripted"> + + + name="physical" > + + + name="sounds" > + + + name="particles" > + + + name="highlights" > + + + name="beacons" > + + + width="100"> + + - + + + + width="100"> + + diff --git a/indra/newview/skins/default/xui/en/floater_god_tools.xml b/indra/newview/skins/default/xui/en/floater_god_tools.xml index e35ab3ea49..f3abad8cb2 100644 --- a/indra/newview/skins/default/xui/en/floater_god_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_god_tools.xml @@ -34,7 +34,10 @@ left="10" name="Kick all users" top="8" - width="100" /> + width="100"> + + + width="208"> + + + width="180"> + + + width="180"> + + + width="180"> + + + width="180"> + + + width="180"> + + + width="180"> + + + width="180"> + + + width="180"> + + + width="50"> + + + width="50"> + + + width="40"> + + + width="50"> + + + width="40"> + + + width="80"> + + + width="80"> + + + width="110"> + + + width="110"> + + + width="121"> + + + width="130"> + + + + width="380"> + + + + width="100"> + + diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml new file mode 100644 index 0000000000..7c95fcd96a --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_inspect.xml b/indra/newview/skins/default/xui/en/floater_inspect.xml index ed3b4f00f2..b11b3e4df5 100644 --- a/indra/newview/skins/default/xui/en/floater_inspect.xml +++ b/indra/newview/skins/default/xui/en/floater_inspect.xml @@ -40,6 +40,8 @@ label="Creation Date" name="creation_date" width="150" /> + diff --git a/indra/newview/skins/default/xui/en/floater_lagmeter.xml b/indra/newview/skins/default/xui/en/floater_lagmeter.xml index 8af4f74aa3..a326cd006f 100644 --- a/indra/newview/skins/default/xui/en/floater_lagmeter.xml +++ b/indra/newview/skins/default/xui/en/floater_lagmeter.xml @@ -201,7 +201,7 @@ Client: + width="55"> + + + width="540"> + + + width="200"> + + + width="185"> + + + width="70"> + + diff --git a/indra/newview/skins/default/xui/en/floater_mem_leaking.xml b/indra/newview/skins/default/xui/en/floater_mem_leaking.xml index e2a99e6614..da698f276b 100644 --- a/indra/newview/skins/default/xui/en/floater_mem_leaking.xml +++ b/indra/newview/skins/default/xui/en/floater_mem_leaking.xml @@ -20,7 +20,10 @@ max_val="4.29497e+009" name="leak_speed" top="30" - width="330" /> + width="330"> + + + width="330"> + + + width="70"> + + diff --git a/indra/newview/skins/default/xui/en/floater_openobject.xml b/indra/newview/skins/default/xui/en/floater_openobject.xml index 742934b57b..e0ac2c1d51 100644 --- a/indra/newview/skins/default/xui/en/floater_openobject.xml +++ b/indra/newview/skins/default/xui/en/floater_openobject.xml @@ -42,7 +42,10 @@ name="copy_to_inventory_button" tab_group="1" top_pad="285" - width="120" /> + width="120"> + + diff --git a/indra/newview/skins/default/xui/en/floater_perm_prefs.xml b/indra/newview/skins/default/xui/en/floater_perm_prefs.xml index 430cb940e5..e4cb97035c 100644 --- a/indra/newview/skins/default/xui/en/floater_perm_prefs.xml +++ b/indra/newview/skins/default/xui/en/floater_perm_prefs.xml @@ -24,7 +24,11 @@ left="260" name="help" top="7" - width="22" /> + width="22"> + + + width="88" > + + + width="100"> + + diff --git a/indra/newview/skins/default/xui/en/floater_test_list_view.xml b/indra/newview/skins/default/xui/en/floater_test_list_view.xml new file mode 100644 index 0000000000..3991a4a82b --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_test_list_view.xml @@ -0,0 +1,31 @@ + + + + + width="100"> + + + width="100"> + + diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 43f209546a..b179190819 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -144,7 +144,10 @@ name="Go Home" tool_tip="Teleport to your home" top="34" - width="88" /> + width="88" > + + + + + width="60"> + + + + width="48"> + + + width="48" > + + + width="48"> + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 1d1a1c063e..4ce3c18dcc 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -15,8 +15,17 @@ name="Preferences" shortcut="control|P"> + + + @@ -221,22 +230,22 @@ layout="topleft" name="Active Speakers"> + function="Floater.Visible" + parameter="active_speakers" /> + function="Floater.Toggle" + parameter="active_speakers" /> + function="Floater.Visible" + parameter="mute" /> + function="Floater.Toggle" + parameter="mute" /> + function="Floater.Visible" + parameter="camera" /> + function="Floater.Toggle" + parameter="camera" /> + function="Floater.Visible" + parameter="moveview" /> + function="Floater.Toggle" + parameter="moveview" /> @@ -273,16 +282,16 @@ layout="topleft" name="About Land"> + function="Floater.Show" + parameter="about_land" /> + function="Floater.Show" + parameter="region_info" /> @@ -350,9 +359,10 @@ name="Mini-Map" shortcut="control|shift|M"> + function="Floater.Visible" + parameter="mini_map" /> + function="Floater.Show" + parameter="hud" /> + function="Floater.Show" + parameter="bumps" /> + function="Floater.Show" + parameter="sl_about" /> @@ -573,8 +583,8 @@ layout="topleft" name="perm prefs"> + function="Floater.Toggle" + parameter="perm_prefs" /> + function="Floater.Show" + parameter="build_options" /> @@ -720,10 +730,10 @@ name="beacons" shortcut="control|alt|shift|N"> + function="Floater.Show" + parameter="lagmeter" /> + function="Floater.Show" + parameter="notifications_console" /> @@ -1999,8 +2009,8 @@ layout="topleft" name="Memory Leaking Simulation"> + function="Floater.Show" + parameter="mem_leaking" /> @@ -2843,7 +2853,8 @@ layout="topleft" name="Show Font Test"> + function="Floater.Show" + parameter="font_test" /> + + + + function="Floater.Show" + parameter="god_tools" /> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0a63da1463..d2c0ffd13d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -13,7 +13,7 @@ Close - + - Sua versão do Second Life não sabe como mostrar a mensagem de alerta que acabou de receber. + Sua versão do [APP_NAME] não sabe como mostrar a mensagem de alerta que acabou de receber. Detalhes do erro: O alerta chamado '[_NAME]' não foi encontrado em notifications.xml. @@ -96,7 +96,7 @@ Detalhes do erro: O alerta chamado '[_NAME]' não foi encontrado em no - Ocorreu um erro atualizando o Second Life. Por favor, faça o download da última versão em secondlife.com. + Ocorreu um erro atualizando o [APP_NAME]. Por favor, faça o download da última versão em secondlife.com. @@ -235,7 +235,7 @@ Clicando neste Box, será mostrado: Você pode propor a outro Residente ou dissolver uma parceria existente através do website [SECOND_LIFE]. -Ir para o site do Second Life para mais informações sobre parceria? +Ir para o site do [SECOND_LIFE] para mais informações sobre parceria? @@ -273,7 +273,7 @@ Seu preço de venda será L$[SALE_PRICE] e está autorizado para venda para [NA - ATENÇÃO: Ao clicar em 'vender para qualquer um' torna a sua terra disponível para toda a comunidade Second Life, mesmo aqueles que não estão nesta região. + ATENÇÃO: Ao clicar em 'vender para qualquer um' torna a sua terra disponível para toda a comunidade [SECOND_LIFE], mesmo aqueles que não estão nesta região. A área de [LAND_SIZE] m² de terra selecionada está posta para venda. Seu preço de venda será L$ [SALE_PRICE] e está autorizado para [NAME]. @@ -418,17 +418,17 @@ Não há reembolso por taxas já pagas. - O cache será limpo quando você reiniciar [SECOND_LIFE]. + O cache será limpo quando você reiniciar [APP_NAME]. - O Cache será removido após reiniciar [SECOND_LIFE]. + O Cache será removido após reiniciar [APP_NAME]. Nota: Isto limpará o cache. - Configuração de porta terá efeito após reiniciar [SECOND_LIFE]. + Configuração de porta terá efeito após reiniciar [APP_NAME]. - A nova pele será exibida após reiniciar [SECOND_LIFE]. + A nova pele será exibida após reiniciar [APP_NAME]. Ir para a página do [SECOND_LIFE] para ver os detalhes do leilão ou fazer um lance? @@ -487,7 +487,7 @@ O objeto pode estar fora de alcance ou ter sido deletado. Não foi possível escrever o arquivo [[FILE]] - Aviso: Seu sistema não é compatível com os requisitos mínimos exigidos pelo Second Life. Se você continuar usando o Second Life pode experimentar uma performance ruim. Infelizmente não podemos oferecer suporte técnico para configurações de sistema não suportado. + Aviso: Seu sistema não é compatível com os requisitos mínimos exigidos pelo [APP_NAME]. Se você continuar usando o [APP_NAME] pode experimentar uma performance ruim. Infelizmente não podemos oferecer suporte técnico para configurações de sistema não suportado. MINSPECS Você deseja visitar [_URL] para maiores informações? @@ -498,14 +498,14 @@ Você deseja visitar [_URL] para maiores informações? Seu sistema possui uma placa gráfica que nos é desconhecido neste momento. -Este é normalmente o caso de um novo hardware que nós não tivemos a chance de testar. Second Life vai muito provavelmente executar corretamente, mas talvez seja necessário ajustar suas configurações de gráficos para algo mais apropriado. +Este é normalmente o caso de um novo hardware que nós não tivemos a chance de testar. [APP_NAME] vai muito provavelmente executar corretamente, mas talvez seja necessário ajustar suas configurações de gráficos para algo mais apropriado. (Menu Editar > Preferências > Gráficos).
- [SECOND_LIFE] travou quando inicializava os drivers gráficos. + [APP_NAME] travou quando inicializava os drivers gráficos. A Qualidade Gráfica será ajustada para baixa, para evitar alguns erros comuns de drivers. Isto irá desabilitar alguns atributos gráficos. Nós recomendamos a atualização dos drivers de sua placa gráfica. @@ -785,7 +785,7 @@ Nenhum lote selecionado. Não é possível achar a região em que este terreno se encontra. - Você não pode fechar a janela de Compra de Terreno até que o Second Life calcule o preço desta transação. + Você não pode fechar a janela de Compra de Terreno até que o [APP_NAME] calcule o preço desta transação. Não é possível transferir posse do terreno: @@ -956,7 +956,7 @@ Se o problema persistir, por favor clicar sobre 'Ferramentas > Bug Repor Você foi deslogado do [SECOND_LIFE]: [MESSAGE] -Você ainda pode olhar o bate-papo e as mensagens instantâneas existentes, clicando em 'Exibir IM & bate-papo'. Caso contrário, clique em 'Sair' para sair do [SECOND_LIFE] imediatamente. +Você ainda pode olhar o bate-papo e as mensagens instantâneas existentes, clicando em 'Exibir IM & bate-papo'. Caso contrário, clique em 'Sair' para sair do [APP_NAME] imediatamente. @@ -1121,14 +1121,14 @@ Você pode usar o [SECOND_LIFE] normalmente e os outros o visualizarão corretam - A instalação do [SECOND_LIFE] está completa. + A instalação do [APP_NAME] está completa. Se esta é a primeira vez usando o[SECOND_LIFE], será necessário que você crie uma conta antes de poder se logar. Retornar a www.secondlife.com para criar uma nova conta? - Estamos com problemas de conexão. Pode ser problema com a conexão de sua internet ou com os servidores do Second Life. + Estamos com problemas de conexão. Pode ser problema com a conexão de sua internet ou com os servidores do [SECOND_LIFE]. Voce tanto pode checar a conexão de sua internet e tentar novamente em alguns minutos, ou clicar em Teletransporte para tentar teletransportar-se para sua casa.
@@ -1141,7 +1141,7 @@ Voce tanto pode checar a conexão de sua internet e tentar novamente em alguns m Seu personagem irá aparecer num momento. Use as teclas de seta para andar. -Pressione a tecla F1 para ajuda ou aprender mais sobre [SECOND_LIFE]. +Pressione a tecla F1 para ajuda ou aprender mais sobre [SECOND_LIFE]. Por favor, escolha se o seu avatar é feminino ou masculino. Você pode mudar de idéia depois. @@ -1229,33 +1229,33 @@ Por favor, ponha o objeto à venda e tente novamente. [DOWNLOAD_PATH] - Uma nova versão do [SECOND_LIFE] está disponível. + Uma nova versão do [APP_NAME] está disponível. [MESSAGE] -Você deve baixar essa atualização para utilizar o [SECOND_LIFE]. +Você deve baixar essa atualização para utilizar o [APP_NAME]. - Uma versão atualizada do [SECOND_LIFE] está disponível. + Uma versão atualizada do [APP_NAME] está disponível. [MESSAGE] Essa atualização não é mandatória, mas sugerimos que você a instale para melhorar a performance e a estabilidade. - Uma versão atualizada do [SECOND_LIFE] está disponível. + Uma versão atualizada do [APP_NAME] está disponível. [MESSAGE] Essa atualização não é mandatória, mas sugerimos que você a instale para melhorar a performance e a estabilidade. - Uma nova versão do [SECOND_LIFE] está disponível. + Uma nova versão do [APP_NAME] está disponível. [MESSAGE] -Você deve baixar esta atualização para utilizar o [SECOND_LIFE]. +Você deve baixar esta atualização para utilizar o [APP_NAME]. Baixar para sua pasta de Aplicativos? - Uma nova versão do [SECOND_LIFE] está disponível. + Uma nova versão do [APP_NAME] está disponível. [MESSAGE] Essa atualização não é mandatória, mas sugerimos que você a instale para melhorar a performance e a estabilidade. @@ -1263,7 +1263,7 @@ Baixar para a sua pasta de Aplicativos? - Uma nova versão do [SECOND_LIFE] está disponível. + Uma nova versão do [APP_NAME] está disponível. [MESSAGE] Essa atualização não é mandatória, mas sugerimos que você a instale para melhorar a performance e a estabilidade. @@ -1862,7 +1862,7 @@ Definí-lo em branco fará com que os relatórios de abuso sejam enviados apenas Padrão: desligado - Esta versão do Second Life não é compatível com as características do Canal de Voz desta região. Para que a Conversa por Voz funcione corretamente, você precisará atualizar o Second Life. + Esta versão do [APP_NAME] não é compatível com as características do Canal de Voz desta região. Para que a Conversa por Voz funcione corretamente, você precisará atualizar o [APP_NAME]. Definir um corretor da propriedade lhe permite vender lotes nesta propriedade. Se um corretor não for definido, você não pode vender terras. O cartão do seu corretor pode ficar vazio se você não desejar aplicar quaisquer regras ou avisar os compradores sobre qualquer coisa em relação ao lote antes da compra. @@ -1976,16 +1976,16 @@ Mover para o inventário o(s) item(s)? Não há itens neste objeto que você está autorizado a copiar. - Ir para o site do Second Life para visualizar o histórico de sua conta? + Ir para o site do [SECOND_LIFE] para visualizar o histórico de sua conta? - Visitar o website de Suporte do Second Life? - + Visitar o website de Suporte do [SECOND_LIFE]? + Tem certeza que deseja sair? - + Use esta ferramenta para reportar violações aos Termos de Serviço e aos Padrões da Comunidade. Veja: @@ -2005,8 +2005,8 @@ Como um serviço aos residentes e visitantes, o dono da região em que você se O dono da região resolverá as reportagens baseado nas regras locais desta região, como definido na Declaração da propriedade. (Veja as declarações indo ao menu Mundo e selecionando Sobre a Terra.) -A resolução desta reportagem se aplica apenas a esta região; o acesso de Residentes às outras áreas do Second Life não será afetado pelas decisões desta reportagem. -Apenas a Linden Lab pode restringir acesso a todo o Second Life. +A resolução desta reportagem se aplica apenas a esta região; o acesso de Residentes às outras áreas do [SECOND_LIFE] não será afetado pelas decisões desta reportagem. +Apenas a Linden Lab pode restringir acesso a todo o [SECOND_LIFE]. Use esta ferramenta para reportar *apenas* características técnicas que não atuem como descrito ou esperado. @@ -2059,9 +2059,9 @@ Fazer uma descrição precisa nos ajuda a arquivar e processar os relatórios de Você parece estar relatando violação de propriedade intelectual. Por favor, certifique-se de que está relatando corretamente: -(1) O Processo de abuso. Você pode apresentar um relatório de abuso se você acredita que um Residente está infringindo o sistema de permissões do Second Life, por exemplo, utilizando ferramentas CopyBot para copiar ou similar, para violar os direitos de propriedade intelectual. A Equipe de Abuso investiga e divulga a ação disciplinar adequada para o comportamento que viola o Estatuto da Comunidade do Second Life ou os Termos de Serviço. No entanto, a mesma não controla e não irá responder aos pedidos para remover o conteúdo do mundo Second Life. +(1) O Processo de abuso. Você pode apresentar um relatório de abuso se você acredita que um Residente está infringindo o sistema de permissões do [SECOND_LIFE], por exemplo, utilizando ferramentas CopyBot para copiar ou similar, para violar os direitos de propriedade intelectual. A Equipe de Abuso investiga e divulga a ação disciplinar adequada para o comportamento que viola o Estatuto da Comunidade do [SECOND_LIFE] ou os Termos de Serviço. No entanto, a mesma não controla e não irá responder aos pedidos para remover o conteúdo do mundo [SECOND_LIFE]. -(2) O processo de remoção de conteúdo ou DMCA. Para solicitar a remoção de conteúdo do Second Life, você deve enviar uma notificação válida de infração, conforme previsto em nossa Política de DMCA em http://secondlife.com/corporate/dmca.php. +(2) O processo de remoção de conteúdo ou DMCA. Para solicitar a remoção de conteúdo do [SECOND_LIFE], você deve enviar uma notificação válida de infração, conforme previsto em nossa Política de DMCA em http://secondlife.com/corporate/dmca.php. Se você ainda deseja prosseguir com o processo de abuso, por favor, feche esta janela e termine de enviar seu relatório. Pode ser necessário selecionar a categoria específica 'CopyBot Infração de Permissões'. @@ -2183,7 +2183,7 @@ Clique "Céu Avançado " para abrir um editor com configurações mais Clique "Água Avançada " para abrir um editor com configurações mais avançadas para a água. - O editor de Ciclo do Dia dá a você o controle do céu durante um ciclo de dia/noite do Second Life. Este é o ciclo usado pelo controle gradual da hora do dia do editor de ambiente básico. + O editor de Ciclo do Dia dá a você o controle do céu durante um ciclo de dia/noite do [SECOND_LIFE]. Este é o ciclo usado pelo controle gradual da hora do dia do editor de ambiente básico. O editor do ciclo de dia trabalha configurando quadros-chave. Estes são pontos (representados pelos ícones cinza no gráfico de horário) que possuem um pré-ajuste de céu associado a eles. Conforme o dia passa, o céu do Windlight " anima " a interpolação entre esses quadros-chave. @@ -2261,7 +2261,7 @@ Similar ao azimute. Controla a velocidade que as núvens se movem na direção Y. - Marque esta check box para permitir a reprodução das nuvens clássicas mais velhas do Second Life, além das nuvens WindLight. + Marque esta check box para permitir a reprodução das nuvens clássicas mais velhas do [SECOND_LIFE], além das nuvens WindLight. Escolhe a cor da neblina subaquática. @@ -2359,7 +2359,7 @@ Similar ao azimute. Você precisa ter a idade verificada para acessar este lote. -Gostaria de visitar o site do Second Life para verificação de idade? +Gostaria de visitar o site do [SECOND_LIFE] para verificação de idade? [_URL] @@ -2369,7 +2369,7 @@ Gostaria de visitar o site do Second Life para verificação de idade? Este lote exige que você tenha informações de pagamento no arquivo antes de poder acessá-lo. -Gostaria de visitar o site do Second Life para configurá-lo? +Gostaria de visitar o site do [SECOND_LIFE] para configurá-lo? [_URL] @@ -2680,13 +2680,13 @@ Por favor, tente novamente em alguns instantes. Impossível criar a conexão pendente. - Um erro interno ocorreu enquanto se tentava direcioná-lo para seu destino de Tele-transporte. O Second Life pode estar passando por problemas no serviço, neste momento. + Um erro interno ocorreu enquanto se tentava direcioná-lo para seu destino de Tele-transporte. O [SECOND_LIFE] pode estar passando por problemas no serviço, neste momento. Impossível encontrar um bom destino para tele-transporte nesta região. - Um erro interno ocorreu enquanto tentava-se definir as coordenadas globais da sua solicitação de tele-transporte. O Second Life pode estar passando por problemas no serviço, no momento. + Um erro interno ocorreu enquanto tentava-se definir as coordenadas globais da sua solicitação de tele-transporte. O [SECOND_LIFE] pode estar passando por problemas no serviço, no momento. Não se achou um ponto de aterrissagem válido. @@ -2807,7 +2807,7 @@ Do objeto: [OBJECTNAME], dono: [NAME]? Falhou ao procurar [TYPE] nomeado [DESC] no banco de dados. - O item que você está tentando vestir usa uma característica que seu Visualizador não lê. Por favor, atualize sua versão do Second Life para vestir este item. + O item que você está tentando vestir usa uma característica que seu Visualizador não lê. Por favor, atualize sua versão do [APP_NAME] para vestir este item. '[OBJECTNAME]', um objeto pertencente a '[NAME]', gostaria de: @@ -2912,7 +2912,7 @@ Objetos flexíveis não podem ser físicos e devem ser fantasmas até que a caix Você ativou o menu Avançado. -Este menu contém funcionalidades úteis para desenvolvedores debugarem o Second Life. +Este menu contém funcionalidades úteis para desenvolvedores debugarem o [SECOND_LIFE]. Para mostrar esse menu no Windows pressione Ctrl-Alt-D. No Mac pressione ⌘-Opt-D. @@ -3020,7 +3020,7 @@ Clique Aceitar para juntar-se à chamada ou Recusar para recusar o convite. Cliq - A velocidade da sua CPU não suporta os requisitos mínimos exigidos. - Você não parece ter os requisitos de hardware recomendados para rodar o Second Life. O Second Life exige uma placa gráfica OpenGL que tem apoio a multi- texturas. Se este for o caso, você pode se certificar de que tem os drivers mais recentes para sua placa gráfica, e os patches e pacotes de serviços para seu sistema operacional. + Você não parece ter os requisitos de hardware recomendados para rodar o [APP_NAME]. O [APP_NAME] exige uma placa gráfica OpenGL que tem apoio a multi- texturas. Se este for o caso, você pode se certificar de que tem os drivers mais recentes para sua placa gráfica, e os patches e pacotes de serviços para seu sistema operacional. Se continuar com problemas, por favor visite: http://www.secondlife.com/support diff --git a/indra/newview/skins/default/xui/pt/panel_status_bar.xml b/indra/newview/skins/default/xui/pt/panel_status_bar.xml index 2a5108b4cb..e9a02344ab 100644 --- a/indra/newview/skins/default/xui/pt/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/pt/panel_status_bar.xml @@ -27,8 +27,8 @@
-- cgit v1.2.3 From a1ed9ccf7330354d5df5083b44643f2a7e56b748 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sat, 29 Aug 2009 06:23:41 +0000 Subject: Partial merge of: viewer-2.0.0-3@131138 texture-pipeline-3@131862 -> viewer-2.0.0-3 Includes: * DEV-31909 VWR-13251: Revise lscript_library.cpp to allow localization of LSL editor hovertips * DEV-21938 llSHA1String does not appear where expected in the dropdown "Insert" menu in the LSL editor * Some cleanup to llerror so that it doesn't depend on llfixedbuffer * A few misc. server specific changes not related to the texture-pipeline changes (llapp, lloptioninterface) --- indra/newview/llappviewer.cpp | 8 +- indra/newview/llpreviewscript.cpp | 75 ++++-- indra/newview/llviewerprecompiledheaders.h | 1 - indra/newview/skins/default/xui/en/strings.xml | 356 ++++++++++++++++++++++++- 4 files changed, 419 insertions(+), 21 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 76c1d699f6..de4f7ab091 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1379,10 +1379,6 @@ bool LLAppViewer::cleanup() std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings")); gWarningSettings.saveToFile(warnings_settings_filename, TRUE); - gSavedSettings.cleanup(); - LLUIColorTable::instance().clear(); - gCrashSettings.cleanup(); - // Save URL history file LLURLHistory::saveFile("url_history.xml"); @@ -1485,6 +1481,10 @@ bool LLAppViewer::cleanup() gStaticVFS = NULL; delete gVFS; gVFS = NULL; + + gSavedSettings.cleanup(); + LLUIColorTable::instance().clear(); + gCrashSettings.cleanup(); LLWatchdog::getInstance()->cleanup(); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 6c73638475..b256914d29 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -85,12 +85,10 @@ #include "lluictrlfactory.h" #include "llmediactrl.h" #include "lluictrlfactory.h" - +#include "lltrans.h" #include "llviewercontrol.h" #include "llappviewer.h" - #include "llpanelinventory.h" -#include "lltrans.h" const std::string HELLO_LSL = "default\n" @@ -250,10 +248,20 @@ void LLFloaterScriptSearch::handleBtnReplaceAll() mEditorCore->mEditor->replaceTextAll(childGetText("search_text"), childGetText("replace_text"), caseChk->get()); } + + /// --------------------------------------------------------------------------- /// LLScriptEdCore /// --------------------------------------------------------------------------- +struct LLSECKeywordCompare +{ + bool operator()(const std::string& lhs, const std::string& rhs) + { + return (LLStringUtil::compareDictInsensitive( lhs, rhs ) < 0 ); + } +}; + LLScriptEdCore::LLScriptEdCore( const std::string& sample, const std::string& help_url, @@ -286,34 +294,71 @@ LLScriptEdCore::LLScriptEdCore( std::vector funcs; std::vector tooltips; - for (S32 i = 0; i < gScriptLibrary.mNextNumber; i++) + for (std::vector::const_iterator i = gScriptLibrary.mFunctions.begin(); + i != gScriptLibrary.mFunctions.end(); ++i) { // Make sure this isn't a god only function, or the agent is a god. - if (!gScriptLibrary.mFunctions[i]->mGodOnly || gAgent.isGodlike()) + if (!i->mGodOnly || gAgent.isGodlike()) { - funcs.push_back(ll_safe_string(gScriptLibrary.mFunctions[i]->mName)); - tooltips.push_back(ll_safe_string(gScriptLibrary.mFunctions[i]->mDesc)); + std::string name = i->mName; + funcs.push_back(name); + + std::string desc_name = "LSLTipText_"; + desc_name += name; + std::string desc = LLTrans::getString(desc_name); + + F32 sleep_time = i->mSleepTime; + if( sleep_time ) + { + desc += "\n"; + + LLStringUtil::format_map_t args; + args["[SLEEP_TIME]"] = llformat("%.1f", sleep_time ); + desc += LLTrans::getString("LSLTipSleepTime", args); + } + + // A \n linefeed is not part of xml. Let's add one to keep all + // the tips one-per-line in strings.xml + LLStringUtil::replaceString( desc, "\\n", "\n" ); + + tooltips.push_back(desc); } } + LLColor3 color(0.5f, 0.0f, 0.15f); - mEditor->loadKeywords(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords.ini"), funcs, tooltips, color); - + std::vector primary_keywords; + std::vector secondary_keywords; LLKeywordToken *token; LLKeywords::keyword_iterator_t token_it; for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) { token = token_it->second; - if (token->getColor() == color) - mFunctions->add(wstring_to_utf8str(token->getToken())); + if (token->getColor() == color) // Wow, what a disgusting hack. + { + primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + } + else + { + secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + } } - for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) + // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary + // keywords. They're intelligently grouped in keywords.ini. + std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); + + for (std::vector::const_iterator iter= primary_keywords.begin(); + iter!= primary_keywords.end(); ++iter) { - token = token_it->second; - if (token->getColor() != color) - mFunctions->add(wstring_to_utf8str(token->getToken())); + mFunctions->add(*iter); + } + + for (std::vector::const_iterator iter= secondary_keywords.begin(); + iter!= secondary_keywords.end(); ++iter) + { + mFunctions->add(*iter); } } diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 0296327378..8bf7364714 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -86,7 +86,6 @@ #include "llendianswizzle.h" #include "llerror.h" #include "llfasttimer.h" -#include "llfixedbuffer.h" #include "llframetimer.h" #include "llhash.h" #include "lllocalidhashmap.h" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 27b34d16a8..4c9b1897d5 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -286,7 +286,361 @@ Compressed Images Load Files Choose Directory - + + + Sleeps script for [SLEEP_TIME] seconds. + + float llSin(float theta)\ntheta in radians + float llCos(float theta)\ntheta in radians + float llTan(float theta)\ntheta radians + float llAtan2(float y, float x) + float llSqrt(float val)\nreturns 0 and triggers a Math Error for imaginary results + float llPow(float base, float exponent)\nreturns 0 and triggers Math Error for imaginary results + integer llAbs(integer val) + float llFabs(float val) + float llFrand(float mag)\nreturns random number in range [0,mag) + integer llFloor(float val)\nreturns largest integer value <= val + integer llCeil(float val)\nreturns smallest integer value >= val + integer llRound(float val)\nreturns val rounded to the nearest integer + float llVecMag(vector v)\nreturns the magnitude of v + vector llVecNorm(vector v)\nreturns the v normalized + float llVecDist(vector v1, vector v2)\nreturns the 3D distance between v1 and v2 + vector llRot2Euler(rotation q)\nreturns the Euler representation (roll, pitch, yaw) of q + rotation llEuler2Rot(vector v)\nreturns the rotation representation of Euler Angles v + rotation llAxes2Rot(vector fwd, vector left, vector up)\nreturns the rotation defined by the coordinate axes + vector llRot2Fwd(rotation q)\nreturns the forward vector defined by q + vector llRot2Left(rotation q)\nreturns the left vector defined by q + vector llRot2Up(rotation q)\nreturns the up vector defined by q + rotation llRotBetween(vector v1, vector v2)\nreturns the rotation to rotate v1 to v2 + llWhisper(integer channel, string msg)\nwhispers msg on channel + llSay(integer channel, string msg)\nsays msg on channel + llShout(integer channel, string msg)\nshouts msg on channel + integer llListen(integer channel, string name, key id, string msg)\nsets a callback for msg on channel from name and id (name, id, and/or msg can be empty) and returns an identifier that can be used to deactivate or remove the listen + llListenControl(integer number, integer active)\nmakes a listen event callback active or inactive + llListenRemove(integer number)\nremoves listen event callback number + llSensor(string name, key id, integer type, float range, float arc)\nPerforms a single scan for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name, id, and/or keytype can be empty or 0) + llSensorRepeat(string name, key id, integer type, float range, float arc, float rate)\nsets a callback for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name, id, and/or keytype can be empty or 0) and repeats every rate seconds + llSensorRemove()\nremoves sensor + string llDetectedName(integer number)\nreturns the name of detected object number (returns empty string if number is not valid sensed object) + key llDetectedKey(integer number)\nreturns the key of detected object number (returns empty key if number is not valid sensed object) + key llDetectedOwner(integer number)\nreturns the key of detected object's owner (returns empty key if number is not valid sensed object) + integer llDetectedType(integer number)\nreturns the type (AGENT, ACTIVE, PASSIVE, SCRIPTED) of detected object (returns 0 if number is not valid sensed object) + vector llDetectedPos(integer number)\nreturns the position of detected object number (returns <0,0,0> if number is not valid sensed object) + vector llDetectedVel(integer number)\nreturns the velocity of detected object number (returns <0,0,0> if number is not valid sensed object) + vector llDetectedGrab(integer number)\nreturns the grab offset of the user touching object (returns <0,0,0> if number is not valid sensed object) + rotation llDetectedRot(integer number)\nreturns the rotation of detected object number (returns <0,0,0,1> if number is not valid sensed object) + integer llDetectedGroup(integer number)\nReturns TRUE if detected object is part of same group as owner + integer llDetectedLinkNumber(integer number)\nreturns the link position of the triggered event for touches and collisions only + llDie()\ndeletes the object + float llGround(vector v)\nreturns the ground height below the object position + v + float llCloud(vector v)\nreturns the cloud density at the object position + v + vector llWind(vector v)\nreturns the wind velocity at the object position + v + llSetStatus(integer status, integer value)\nsets status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB,\nSTATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) to value + integer llGetStatus(integer status)\ngets value of status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB,\nSTATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) + llSetScale(vector scale)\nsets the scale + vector llGetScale()\ngets the scale + llSetColor(vector color, integer face)\nsets the color + float llGetAlpha(integer face)\ngets the alpha + llSetAlpha(float alpha, integer face)\nsets the alpha + vector llGetColor(integer face)\ngets the color + llSetTexture(string texture, integer face)\nsets the texture of face + llScaleTexture(float scales, float scalet, integer face)\nsets the texture s, t scales for the chosen face + llOffsetTexture(float offsets, float offsett, integer face)\nsets the texture s, t offsets for the chosen face + llRotateTexture(float rotation, integer face)\nsets the texture rotation for the chosen face + string llGetTexture(integer face)\ngets the texture of face (if it's a texture in the object inventory, otherwise the key in a string) + llSetPos(vector pos)\nsets the position (if the script isn't physical) + vector llGetPos()\ngets the position (if the script isn't physical) + vector llGetLocalPos()\ngets the position relative to the root (if the script isn't physical) + llSetRot(rotation rot)\nsets the rotation (if the script isn't physical) + rotation llGetRot()\ngets the rotation (if the script isn't physical) + rotation llGetLocalRot()\ngets the rotation local to the root (if the script isn't physical) + llSetForce(vector force, integer local)\nsets force on object, in local coords if local == TRUE (if the script is physical) + vector llGetForce()\ngets the force (if the script is physical) + integer llTarget(vector position, float range)\nset positions within range of position as a target and return an ID for the target + llTargetRemove(integer number)\nremoves target number + integer llRotTarget(rotation rot, float error)\nset rotations with error of rot as a rotational target and return an ID for the rotational target + llRotTargetRemove(integer number)\nremoves rotational target number + llMoveToTarget(vector target, float tau)\ncritically damp to target in tau seconds (if the script is physical) + llStopMoveToTarget()\nStops critically damped motion + llApplyImpulse(vector force, integer local)\napplies impulse to object, in local coords if local == TRUE (if the script is physical) + llApplyRotationalImpulse(vector force, integer local)\napplies rotational impulse to object, in local coords if local == TRUE (if the script is physical) + llSetTorque(vector torque, integer local)\nsets the torque of object, in local coords if local == TRUE (if the script is physical) + vector llGetTorque()\ngets the torque (if the script is physical) + llSetForceAndTorque(vector force, vector torque, integer local)\nsets the force and torque of object, in local coords if local == TRUE (if the script is physical) + vector llGetVel()\ngets the velocity + vector llGetAccel()\ngets the acceleration + vector llGetOmega()\ngets the omega + float llGetTimeOfDay()\ngets the time in seconds since Second Life server midnight (or since server up-time; whichever is smaller) + float llGetWallclock()\ngets the time in seconds since midnight + float llGetTime()\ngets the time in seconds since creation + llResetTime()\nsets the time to zero + float llGetAndResetTime()\ngets the time in seconds since creation and sets the time to zero + llSound(string sound, float volume, integer queue, integer loop)\nplays sound at volume and whether it should loop or not + llPlaySound(string sound, float volume)\nplays attached sound once at volume (0.0 - 1.0) + llLoopSound(string sound, float volume)\nplays attached sound looping indefinitely at volume (0.0 - 1.0) + llLoopSoundMaster(string sound, float volume)\nplays attached sound looping at volume (0.0 - 1.0), declares it a sync master + llLoopSoundSlave(string sound, float volume)\nplays attached sound looping at volume (0.0 - 1.0), synced to most audible sync master + llPlaySoundSlave(string sound, float volume)\nplays attached sound once at volume (0.0 - 1.0), synced to next loop of most audible sync master + llTriggerSound(string sound, float volume)\nplays sound at volume (0.0 - 1.0), centered at but not attached to object + llStopSound()\nStops currently attached sound + llPreloadSound(string sound)\npreloads a sound on viewers within range + string llGetSubString(string src, integer start, integer end)\nreturns the indicated substring + string llDeleteSubString(string src, integer start, integer end)\nremoves the indicated substring and returns the result + string llInsertString(string dst, integer position, string src)\ninserts src into dst at position and returns the result + string llToUpper(string src)\nconvert src to all upper case and returns the result + string llToLower(string src)\nconvert src to all lower case and returns the result + llGiveMoney(key destination, integer amount)\ntransfer amount of money from script owner to destination + llMakeExplosion(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake a round explosion of particles + llMakeFountain(integer particles, float scale, float vel, float lifetime, float arc, integer bounce, string texture, vector offset, float bounce_offset)\nMake a fountain of particles + llMakeSmoke(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake smoke like particles + llMakeFire(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake fire like particles + llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param)\nInstanciate owners inventory object at pos with velocity vel and rotation rot with start parameter param + llLookAt(vector target, F32 strength, F32 damping)\nCause object name to point it's forward axis towards target + llStopLookAt()\nStop causing object name to point at a target + llSetTimerEvent(float sec)\nCause the timer event to be triggered every sec seconds + llSleep(float sec)\nPut script to sleep for sec seconds + float llGetMass()\nGet the mass of task name that script is attached to + llCollisionFilter(string name, key id, integer accept)\nif accept == TRUE, only accept collisions with objects name and id (either is optional), otherwise with objects not name or id + llTakeControls(integer controls, integer accept, integer pass_on)\nTake controls from agent task has permissions for. If (accept == (controls & input)), send input to task. If pass_on send to agent also. + llReleaseControls()\nStop taking inputs + llAttachToAvatar(integer attachment)\nAttach to avatar task has permissions for at point attachment + llDetachFromAvatar()\nDrop off of avatar + llTakeCamera(key avatar)\nMove avatar's viewpoint to task + llReleaseCamera(key avatar)\nReturn camera to agent + key llGetOwner()\nReturns the owner of the task + llInstantMessage(key user, string message)\nIMs message to the user + llEmail(string address, string subject, string message)\nSends email to address with subject and message + llGetNextEmail(string address, string subject)\nGet the next waiting email with appropriate address and/or subject (if blank they are ignored) + key llGetKey()\nGet the key for the task the script is attached to + llSetBuoyancy(float buoyancy)\nSet the tasks buoyancy (0 is none, < 1.0 sinks, 1.0 floats, > 1.0 rises) + llSetHoverHeight(float height, integer water, float tau)\nCritically damps to a height (either above ground level or above the higher of land and water if water == TRUE) + llStopHover()\nStop hovering to a height + llMinEventDelay(float delay)\nSet the minimum time between events being handled + llSoundPreload(string sound)\npreloads a sound on viewers within range + llRotLookAt(rotation target, F32 strength, F32 damping)\nCause object name to point it's forward axis towards target + integer llStringLength(string str)\nReturns the length of string + llStartAnimation(string anim)\nStart animation anim for agent that owns object + llStopAnimation(string anim)\nStop animation anim for agent that owns object + llPointAt(vector pos)\nMake agent that owns object point at pos + llStopPointAt()\nStop agent that owns object pointing + llTargetOmega(vector axis, float spinrate, float gain)\nAttempt to spin at spinrate with strength gain + integer llGetStartParameter()\nGet's the start paramter passed to llRezObject + llGodLikeRezObject(key inventory, vector pos)\nrez directly off of a UUID if owner has dog-bit set + llRequestPermissions(key agent, integer perm)\nask agent to allow the script to do perm (NB: Debit, ownership, link, joint, and permission requests can only go to the task's owner) + key llGetPermissionsKey()\nReturn agent that permissions are enabled for. NULL_KEY if not enabled + integer llGetPermissions()\nreturn what permissions have been enabled + integer llGetLinkNumber()\nReturns what number in a link set the script is attached to (0 means no link, 1 the root, 2 for first child, etc) + llSetLinkColor(integer linknumber, vector color, integer face)\nIf a task exists in the link chain at linknumber, set face to color + llCreateLink(key target, integer parent)\nAttempt to link task script is attached to and target (requires permission PERMISSION_CHANGE_LINKS be set). If parent == TRUE, task script is attached to is the root + llBreakLink(integer linknum)\nDelinks the task with the given link number (requires permission PERMISSION_CHANGE_LINKS be set) + llBreakAllLinks()\nDelinks all tasks in the link set (requires permission PERMISSION_CHANGE_LINKS be set) + key llGetLinkKey(integer linknum)\nGet the key of linknumber in link set + string llGetLinkName(integer linknum)\nGet the name of linknumber in link set + integer llGetInventoryNumber(integer type)\nGet the number of items of a given type in the task's inventory.\nValid types: INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_OBJECT, INVENTORY_SCRIPT, INVENTORY_CLOTHING, INVENTORY_BODYPART, INVENTORY_NOTECARD, INVENTORY_LANDMARK, INVENTORY_ALL + string llGetInventoryName(integer type, integer number)\nGet the name of the inventory item number of type + llSetScriptState(string name, integer run)\nControl the state of a script name. + float llGetEnergy()\nReturns how much energy is in the object as a percentage of maximum + llGiveInventory(key destination, string inventory)\nGive inventory to destination + llRemoveInventory(string inventory)\nRemove the named inventory item + llSetText(string text, vector color, float alpha)\nSet text floating over object + float llWater(vector v)\nreturns the water height below the object position + v + llPassTouches(integer pass)\nif pass == TRUE, touches are passed from children on to parents (default is FALSE) + key llRequestAgentData(key id, integer data)\nRequests data about agent id. When data is available the dataserver event will be raised + key llRequestInventoryData(string name)\nRequests data from object's inventory object. When data is available the dataserver event will be raised + llSetDamage(float damage)\nSets the amount of damage that will be done to an object that this task hits. Task will be killed. + llTeleportAgentHome(key id)\nTeleports agent on owner's land to agent's home location + llModifyLand(integer action, integer size)\nModify land with action (LAND_LEVEL, LAND_RAISE, LAND_LOWER, LAND_SMOOTH, LAND_NOISE, LAND_REVERT)\non size (LAND_SMALL_BRUSH, LAND_MEDIUM_BRUSH, LAND_LARGE_BRUSH) + llCollisionSound(string impact_sound, float impact_volume)\nSuppress default collision sounds, replace default impact sounds with impact_sound (empty string to just suppress) + llCollisionSprite(string impact_sprite)\nSuppress default collision sprites, replace default impact sprite with impact_sprite (empty string to just suppress) + string llGetAnimation(key id)\nGet the currently playing locomotion animation for avatar id + llResetScript()\nResets the script + llMessageLinked(integer linknum, integer num, string str, key id)\nSends num, str, and id to members of the link set (LINK_ROOT sends to root task in a linked set,\nLINK_SET sends to all tasks,\nLINK_ALL_OTHERS to all other tasks,\nLINK_ALL_CHILDREN to all children,\nLINK_THIS to the task the script it is in) + llPushObject(key id, vector impulse, vector ang_impulse, integer local)\nApplies impulse and ang_impulse to object id + llPassCollisions(integer pass)\nif pass == TRUE, collisions are passed from children on to parents (default is FALSE) + llGetScriptName()\nReturns the script name + integer llGetNumberOfSides()\nReturns the number of sides + rotation llAxisAngle2Rot(vector axis, float angle)\nReturns the rotation generated angle about axis + vector llRot2Axis(rotation rot)\nReturns the rotation axis represented by rot + float llRot2Angle(rotation rot)\nReturns the rotation angle represented by rot + float llAcos(float val)\nReturns the arccosine in radians of val + float llAsin(float val)\nReturns the arcsine in radians of val + float llAngleBetween(rotation a, rotation b)\nReturns angle between rotation a and b + key llGetInventoryKey(string name)\nReturns the key of the inventory name + llAllowInventoryDrop(integer add)\nIf add == TRUE, users without permissions can still drop inventory items onto task + vector llGetSunDirection()\nReturns the sun direction on the simulator + vector llGetTextureOffset(integer side)\nReturns the texture offset of side in the x and y components of a vector + vector llGetTextureScale(integer side)\nReturns the texture scale of side in the x and y components of a vector + float llGetTextureRot(integer side)\nReturns the texture rotation of side + integer llSubStringIndex(string source, string pattern)\nFinds index in source where pattern first appears (returns -1 if not found) + key llGetOwnerKey(key id)\nFind the owner of id + vector llGetCenterOfMass()\nGet the object's center of mass + list llListSort(list src, integer stride, integer ascending)\nSort the list into blocks of stride in ascending order if ascending == TRUE. Note that sort only works between same types. + integer llGetListLength(list src)\nGet the number of elements in the list + integer llList2Integer(list src, integer index)\nCopy the integer at index in the list + float llList2Float(list src, integer index)\nCopy the float at index in the list + string llList2String(list src, integer index)\nCopy the string at index in the list + key llList2Key(list src, integer index)\nCopy the key at index in the list + vector llList2Vector(list src, integer index)\nCopy the vector at index in the list + rotation llList2Rot(list src, integer index)\nCopy the rotation at index in the list + list llList2List(list src, integer start, integer end)\nCopy the slice of the list from start to end + list llDeleteSubList(list src, integer start, integer end)\nRemove the slice from the list and return the remainder + integer llGetListEntryType(list src, integer index)\nReturns the type of the index entry in the list\n(TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_KEY, TYPE_VECTOR, TYPE_ROTATION, or TYPE_INVALID if index is off list) + string llList2CSV(list src)\nCreate a string of comma separated values from list + list llCSV2List(string src)\nCreate a list from a string of comma separated values + list llListRandomize(list src, integer stride)\nReturns a randomized list of blocks of size stride + list llList2ListStrided(list src, integer start, integer end, integer stride)\nCopy the strided slice of the list from start to end + vector llGetRegionCorner()\nReturns a vector with the south west corner x,y position of the region the object is in + list llListInsertList(list dest, list src, integer start)\nInserts src into dest at position start + integer llListFindList(list src, list test)\nReturns the start of the first instance of test in src, -1 if not found + string llGetObjectName()\nReturns the name of the object script is attached to + llSetObjectName(string name)\nSets the objects name + string llGetDate()\nGets the date as YYYY-MM-DD + integer llEdgeOfWorld(vector pos, vector dir)\nChecks to see whether the border hit by dir from pos is the edge of the world (has no neighboring simulator) + integer llGetAgentInfo(key id)\nGets information about agent ID.\nReturns AGENT_FLYING, AGENT_ATTACHMENTS, AGENT_SCRIPTED, AGENT_SITTING, AGENT_ON_OBJECT, AGENT_MOUSELOOK, AGENT_AWAY, AGENT_BUSY, AGENT_TYPING, AGENT_CROUCHING, AGENT_ALWAYS_RUN, AGENT_WALKING and/or AGENT_IN_AIR. + llAdjustSoundVolume(float volume)\nadjusts volume of attached sound (0.0 - 1.0) + llSetSoundQueueing(integer queue)\ndetermines whether attached sound calls wait for the current sound to finish (0 = no [default], nonzero = yes) + llSetSoundRadius(float radius)\nestablishes a hard cut-off radius for audibility of scripted sounds (both attached and triggered) + string llKey2Name(key id)\nReturns the name of the object key, iff the object is in the current simulator, otherwise the empty string + llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate)\nAnimate the texture on the specified face/faces + llTriggerSoundLimited(string sound, float volume, vector tne, vector bsw)\nplays sound at volume (0.0 - 1.0), centered at but not attached to object, limited to AABB defined by vectors top-north-east and bottom-south-west + llEjectFromLand(key pest)\nEjects pest from land that you own + list llParseString2List(string src, list separators, list spacers)\nBreaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each) + integer llOverMyLand(key id)\nReturns TRUE if id is over land owner of object owns, FALSE otherwise + key llGetLandOwnerAt(vector pos)\nReturns the key of the land owner, NULL_KEY if public + key llGetNotecardLine(string name, integer line)\nReturns line line of notecard name via the dataserver event + vector llGetAgentSize(key id)\nIf the agent is in the same sim as the object, returns the size of the avatar + integer llSameGroup(key id)\nReturns TRUE if ID is in the same sim and has the same active group, otherwise FALSE + key llUnSit(key id)\nIf agent identified by id is sitting on the object the script is attached to or is over land owned by the objects owner, the agent is forced to stand up + vector llGroundSlope(vector v)\nreturns the ground slope below the object position + v + vector llGroundNormal(vector v)\nreturns the ground normal below the object position + v + vector llGroundCountour(vector v)\nreturns the ground contour below the object position + v + integer llGetAttached()\nreturns the object attachment point or 0 if not attached + integer llGetFreeMemory()\nreturns the available heap space for the current script + string llGetRegionName()\nreturns the current region name + float llGetRegionTimeDilation()\nreturns the current time dilation as a float between 0 and 1 + float llGetRegionFPS()\nreturns the mean region frames per second + llParticleSystem(list rules)\nCreates a particle system based on rules. Empty list removes particle system from object.\nList format is [ rule1, data1, rule2, data2 . . . rulen, datan ] + llGroundRepel(float height, integer water, float tau)\nCritically damps to height if within height*0.5 of level (either above ground level or above the higher of land and water if water == TRUE) + llGiveInventoryList(key destination, string category, list inventory)\nGive inventory to destination in a new category + llSetVehicleType(integer type)\nsets vehicle to one of the default types + llSetVehicleFloatParam(integer param, float value)\nsets the specified vehicle float parameter + llSetVehicleVectorParam(integer param, vector vec)\nsets the specified vehicle vector parameter + llSetVehicleVectorParam(integer param, rotation rot)\nsets the specified vehicle rotation parameter + llSetVehicleFlags(integer flags)\nsets the enabled bits in 'flags' + llRemoveVehicleFlags(integer flags)\nremoves the enabled bits in 'flags' + llSitTarget(vector offset, rotation rot)\nSet the sit location for this object (if offset == <0,0,0> clear it) + key llAvatarOnSitTarget()\nIf an avatar is sitting on the sit target, return the avatar's key, NULL_KEY otherwise + llAddToLandPassList(key avatar, float hours)\nAdd avatar to the land pass list for hours + llSetTouchText(string text)\nDisplays text in pie menu that acts as a touch + llSetSitText(string text)\nDisplays text rather than sit in pie menu + llSetCameraEyeOffset(vector offset)\nSets the camera eye offset used in this object if an avatar sits on it + llSetCameraAtOffset(vector offset)\nSets the camera at offset used in this object if an avatar sits on it + string llDumpList2String(list src, string separator)\nWrite the list out in a single string using separator between values + integer llScriptDanger(vector pos)\nReturns true if pos is over public land, sandbox land, land that doesn't allow everyone to edit and build, or land that doesn't allow outside scripts + llDialog(key avatar, string message, list buttons, integer chat_channel\nShows a dialog box on the avatar's screen with the message.\nUp to 12 strings in the list form buttons.\nIf a button is clicked, the name is chatted on chat_channel. + llVolumeDetect(integer detect)\nIf detect = TRUE, object becomes phantom but triggers collision_start and collision_end events\nwhen other objects start and stop interpenetrating.\nMust be applied to the root object. + llResetOtherScript(string name)\nResets script name + integer llGetScriptState(string name)\nResets TRUE if script name is running + Deprecated. Please use llRemoteLoadScriptPin instead. + llSetRemoteScriptAccessPin(integer pin)\nIf pin is set to a non-zero number, the task will accept remote script\nloads via llRemoteLoadScriptPin if it passes in the correct pin.\nOthersise, llRemoteLoadScriptPin is ignored. + llRemoteLoadScriptPin(key target, string name, integer pin, integer running, integer start_param)\nIf the owner of the object this script is attached can modify target,\nthey are in the same region,\nand the matching pin is used,\ncopy script name onto target,\nif running == TRUE, start the script with param. + llOpenRemoteDataChannel()\nCreates a channel to listen for XML-RPC calls. Will trigger a remote_data event with channel id once it is available. + key llSendRemoteData(key channel, string dest, integer idata, string sdata)\nSend an XML-RPC request to dest through channel with payload of channel (in a string), integer idata and string sdata.\nA message identifier key is returned.\nAn XML-RPC reply will trigger a remote_data event and reference the message id.\nThe message_id is returned. + llRemoteDataReply(key channel, key message_id, string sdata, integer idata)\nSend an XML-RPC reply to message_id on channel with payload of string sdata and integer idata + llCloseRemoteDataChannel(key channel)\nCloses XML-RPC channel. + string llMD5String(string src, integer nonce)\nPerforms a RSA Data Security, Inc. MD5 Message-Digest Algorithm on string with nonce. Returns a 32 character hex string. + llSetPrimitiveParams(list rules)\nSet primitive parameters based on rules. + string llStringToBase64(string str)\nConverts a string to the Base 64 representation of the string. + string llBase64ToString(string str)\nConverts a Base 64 string to a conventional string. If the conversion creates any unprintable characters, they are converted to spaces. + string llXorBase64Strings(string s1, string s2)\nDEPRECATED! Please use llXorBase64StringsCorrect instead!! Incorrectly performs an exclusive or on two Base 64 strings and returns a Base 64 string. s2 repeats if it is shorter than s1. Retained for backwards compatability. + llRemoteDataSetRegion()\nIf an object using remote data channels changes regions, you must call this function to reregister the remote data channels.\nYou do not need to make this call if you don't change regions. + float llLog10(float val)\nReturns the base 10 log of val if val > 0, otherwise returns 0. + float llLog(float val)\nReturns the base e log of val if val > 0, otherwise returns 0. + list llGetAnimationList(key id)\nGets a list of all playing animations for avatar id + llSetParcelMusicURL(string url)\nSets the streaming audio URL for the parcel object is on + vector llGetRootPosition()\nGets the global position of the root object of the object script is attached to + rotation llGetRootRotation()\nGets the global rotation of the root object of the object script is attached to + string llGetObjectDesc()\nReturns the description of the object the script is attached to + llSetObjectDesc(string name)\nSets the object's description + key llGetCreator()\nReturns the creator of the object + string llGetTimestamp()\nGets the timestamp in the format: YYYY-MM-DDThh:mm:ss.ff..fZ + llSetLinkAlpha(integer linknumber, float alpha, integer face)\nIf a prim exists in the link chain at linknumber, set face to alpha + integer llGetNumberOfPrims()\nReturns the number of prims in a link set the script is attached to + key llGetNumberOfNotecardLines(string name)\nReturns number of lines in notecard 'name' via the dataserver event (cast return value to integer) + list llGetBoundingBox(key object)\nReturns the bounding box around an object (including any linked prims) relative to the root prim, in a list: [ (vector) min_corner, (vector) max_corner ] + vector llGetGeometricCenter()\nReturns the geometric center of the linked set the script is attached to. + list llGetPrimitiveParams(list params)\nGets primitive parameters specified in the params list. + string llIntegerToBase64(integer number)\nBig endian encode of of integer as a Base64 string. + integer llBase64ToInteger(string str)\nBig endian decode of a Base64 string into an integer. + float llGetGMTclock()\nGets the time in seconds since midnight in GMT + string llGetSimulatorHostname()\nGets the hostname of the machine script is running on (same as string in viewer Help dialog) + llSetLocalRot(rotation rot)\nsets the rotation of a child prim relative to the root prim + list llParseStringKeepNulls(string src, list separators, list spacers)\nBreaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each), keeping any null values generated. + llRezAtRoot(string inventory, vector pos, vector vel, rotation rot, integer param)\nInstantiate owner's inventory object at pos with velocity vel and rotation rot with start parameter param.\nThe last selected root object's location will be set to pos + integer llGetObjectPermMask(integer mask)\nReturns the requested permission mask for the root object the task is attached to. + llSetObjectPermMask(integer mask, integer value)\nSets the given permission mask to the new value on the root object the task is attached to. + integer llGetInventoryPermMask(string item, integer mask)\nReturns the requested permission mask for the inventory item. + llSetInventoryPermMask(string item, integer mask, integer value)\nSets the given permission mask to the new value on the inventory item. + key llGetInventoryCreator(string item)\nReturns the key for the creator of the inventory item. + llOwnerSay(string msg)\nsays msg to owner only (if owner in sim) + key llRequestSimulatorData(string simulator, integer data)\nRequests data about simulator. When data is available the dataserver event will be raised + llForceMouselook(integer mouselook)\nIf mouselook is TRUE any avatar that sits on this object is forced into mouselook mode + float llGetObjectMass(key id)\nGet the mass of the object with key id + list llListReplaceList(list dest, list src, integer start, integer end)\nReplaces start through end of dest with src. + llLoadURL(key avatar_id, string message, string url)\nShows dialog to avatar avatar_id offering to load web page at URL. If user clicks yes, launches their web browser. + llParcelMediaCommandList(list command)\nSends a list of commands, some with arguments, to a parcel. + list llParcelMediaQuery(list query)\nSends a list of queries, returns a list of results. + integer llModPow(integer a, integer b, integer c)\nReturns a raised to the b power, mod c. ( (a**b)%c ). b is capped at 0xFFFF (16 bits). + integer llGetInventoryType(string name)\nReturns the type of the inventory name + llSetPayPrice(integer price, list quick_pay_buttons)\nSets the default amount when someone chooses to pay this object. + vector llGetCameraPos()\nGets current camera position for agent task has permissions for. + rotation llGetCameraRot()\nGets current camera orientation for agent task has permissions for. + llSetPrimURL(string url)\nUpdates the URL for the web page shown on the sides of the object. + llRefreshPrimURL()\nReloads the web page shown on the sides of the object. + string llEscapeURL(string url)\nReturns and escaped/encoded version of url, replacing spaces with %20 etc. + string llUnescapeURL(string url)\nReturns and unescaped/unencoded version of url, replacing %20 with spaces etc. + llMapDestination(string simname, vector pos, vector look_at)\nOpens world map centered on region with pos highlighted.\nOnly works for scripts attached to avatar, or during touch events.\n(NOTE: look_at currently does nothing) + llAddToLandBanList(key avatar, float hours)\nAdd avatar to the land ban list for hours + llRemoveFromLandPassList(key avatar)\nRemove avatar from the land pass list + llRemoveFromLandBanList(key avatar)\nRemove avatar from the land ban list + llSetCameraParams(list rules)\nSets multiple camera parameters at once.\nList format is [ rule1, data1, rule2, data2 . . . rulen, datan ] + llClearCameraParams()\nResets all camera parameters to default values and turns off scripted camera control. + float llListStatistics(integer operation, list l)\nPerform statistical aggregate functions on list l using LIST_STAT_* operations. + integer llGetUnixTime()\nGet the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock. + integer llGetParcelFlags(vector pos)\nGet the parcel flags (PARCEL_FLAG_*) for the parcel including the point pos. + integer llGetRegionFlags()\nGet the region flags (REGION_FLAG_*) for the region the object is in. + string llXorBase64StringsCorrect(string s1, string s2)\nCorrectly performs an exclusive or on two Base 64 strings and returns a Base 64 string. s2 repeats if it is shorter than s1. + llHTTPRequest(string url, list parameters, string body)\nSend an HTTP request. + llResetLandBanList()\nRemoves all residents from the land ban list. + llResetLandPassList()\nRemoves all residents from the land access/pass list. + integer llGetObjectPrimCount(key object_id)\nReturns the total number of prims for an object. + list llGetParcelPrimOwners(vector pos)\nReturns a list of all residents who own objects on the parcel and the number of objects they own.\nRequires owner-like permissions for the parcel. + integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)\nGets the number of prims on the parcel of the given category.\nCategories: PARCEL_COUNT_TOTAL, _OWNER, _GROUP, _OTHER, _SELECTED, _TEMP. + integer llGetParcelMaxPrims(vector pos, integer sim_wide)\nGets the maximum number of prims allowed on the parcel at pos. + list llGetParcelDetails(vector pos, list params)\nGets the parcel details specified in params for the parcel at pos.\nParams is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA + llSetLinkPrimitiveParams(integer linknumber, list rules)\nSet primitive parameters for linknumber based on rules. + llSetLinkTexture(integer link_pos, string texture, integer face)\nSets the texture of face for link_pos + string llStringTrim(string src, integer trim_type)\nTrim leading and/or trailing spaces from a string.\nUses trim_type of STRING_TRIM, STRING_TRIM_HEAD or STRING_TRIM_TAIL. + llRegionSay(integer channel, string msg)\nbroadcasts msg to entire region on channel (not 0.) + list llGetObjectDetails(key id, list params)\nGets the object details specified in params for the object with key id.\nDetails are OBJECT_NAME, _DESC, _POS, _ROT, _VELOCITY, _OWNER, _GROUP, _CREATOR. + llSetClickAction(integer action)\nSets the action performed when a prim is clicked upon. + int llGetRegionAgentCount()\nreturns the number of agents in a region + llTextBox(key avatar, string message, integer chat_channel\nShows a dialog box on the avatar's screen with the message.\nA text box asks for input, and if entered the text is chatted on chat_channel. + string llGetAgentLanguage(key id)\nGets the agents preferred language.. + vector llDetectedTouchUV(integer number)\nreturns the u and v coordinates in the first two components of a vector, for a triggered touch event + integer llDetectedTouchFace(integer number)\nreturns the index of the face on the object for a triggered touch event + vector llDetectedTouchPos(integer number)\nreturns the position touched for a triggered touch event + vector llDetectedTouchNormal(integer number)\nreturns the surface normal for a triggered touch event + vector llDetectedTouchBinormal(integer number)\nreturns the surface binormal for a triggered touch event + vector llDetectedTouchST(integer number)\nreturns the s and t coordinates in the first two components of a vector, for a triggered touch event + string llSHA1String(string sr)\nPerforms a SHA1 security Hash. Returns a 40 character hex string. + integer llGetFreeURLs()\nreturns the available urls for the current script + key llRequestURL()\nRequests one HTTP:// url for use by this object\nTriggers an http_server event with results. + key llRequestSecureURL()\nRequests one HTTPS:// (SSL) url for use by this object\nTriggers an http_server event with results. + llReleaseURL(string url)\nReleases the specified URL, it will no longer be usable. + llHTTPResponse(key id, integer status, string body)\nResponds to request id with status and body. + string llGetHTTPHeader(key id, string header)\nGet the value for header for request id. + Set Not Away Set Away -- cgit v1.2.3 From 6dbef5f2a41d5ee974b808b8e863d4f973dfa2c3 Mon Sep 17 00:00:00 2001 From: Erica Olsen Date: Mon, 31 Aug 2009 05:21:50 +0000 Subject: Standardized layouts, changed commitment model labels to ok/cancel, modernized advanced floaters. --- .../skins/default/xui/en/floater_color_picker.xml | 31 ++-- .../skins/default/xui/en/floater_god_tools.xml | 172 ++++++++++----------- .../default/xui/en/floater_hardware_settings.xml | 31 ++-- .../default/xui/en/floater_preview_notecard.xml | 25 ++- .../skins/default/xui/en/floater_preview_sound.xml | 57 ++++--- .../default/xui/en/floater_preview_texture.xml | 27 ++-- .../default/xui/en/floater_settings_debug.xml | 12 +- .../skins/default/xui/en/floater_sound_preview.xml | 29 ++-- 8 files changed, 185 insertions(+), 199 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/floater_color_picker.xml b/indra/newview/skins/default/xui/en/floater_color_picker.xml index 08e47f7ef6..cda2020fca 100644 --- a/indra/newview/skins/default/xui/en/floater_color_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_color_picker.xml @@ -166,40 +166,37 @@ @@ -44,10 +44,10 @@ label="Flush This Region's Map Visibility Caches" label_selected="Flush This Region's Map Visibility Caches" layout="topleft" - left_delta="0" + left="10" name="Flush This Region's Map Visibility Caches" - top_pad="8" - width="250"> + top_pad="30" + width="350"> @@ -71,21 +71,21 @@ layout="topleft" left="10" name="Sim Name:" - top="10" - width="50"> + top="12" + width="80"> Sim Name:
+ width="250"> @@ -96,7 +96,7 @@ left="10" name="check prelude" tool_tip="Set this to make the region a prelude." - top="30" + top_pad="10" width="180"> @@ -188,11 +188,11 @@ + + - + + + + + + Destination: Request:
Parameter:
@@ -777,7 +773,7 @@ border_style="line" border_thickness="1" follows="left|top" - height="16" + height="22" layout="topleft" left_pad="10" max_length="63" @@ -792,8 +788,8 @@ layout="topleft" left="10" name="Make Request" - top="96" - width="100"> + top_pad="10" + width="140"> diff --git a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml index 19fba52500..b7733c6388 100644 --- a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml @@ -13,7 +13,7 @@ layout="topleft" left="10" name="Filtering:" - top="30" + top="20" width="128"> Filtering: @@ -34,20 +34,20 @@ layout="topleft" left="10" name="Antialiasing:" - top="49" + top_pad="7" width="128"> Antialiasing: + width="130"> - (brightness, lower is brighter, 0=use default) + (brightness, lower = brighter, 0 = default) Enable VBO: @@ -117,13 +117,12 @@ left_pad="10" name="vbo" tool_tip="Enabling this on modern hardware gives a performance gain. However, older hardware often has poor implementations of VBOs and you may get crashes when this is enabled." - top_delta="1" width="315" />