diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloaterbump.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterbump.cpp | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterbump.cpp b/linden/indra/newview/llfloaterbump.cpp new file mode 100644 index 0000000..265970f --- /dev/null +++ b/linden/indra/newview/llfloaterbump.cpp | |||
@@ -0,0 +1,157 @@ | |||
1 | /** | ||
2 | * @file llfloaterbump.cpp | ||
3 | * @brief Floater showing recent bumps, hits with objects, pushes, etc. | ||
4 | * @author Cory Ondrejka, James Cook | ||
5 | * | ||
6 | * Copyright (c) 2003-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #include "llviewerprecompiledheaders.h" | ||
30 | |||
31 | #include "llfloaterbump.h" | ||
32 | |||
33 | #include "llscrolllistctrl.h" | ||
34 | |||
35 | #include "llvieweruictrlfactory.h" | ||
36 | #include "viewer.h" // gPacificDaylightTime | ||
37 | |||
38 | ///---------------------------------------------------------------------------- | ||
39 | /// Local function declarations, constants, enums, and typedefs | ||
40 | ///---------------------------------------------------------------------------- | ||
41 | extern LLLinkedList<LLMeanCollisionData> gMeanCollisionList; | ||
42 | |||
43 | LLFloaterBump* LLFloaterBump::sInstance = NULL; | ||
44 | |||
45 | ///---------------------------------------------------------------------------- | ||
46 | /// Class LLFloaterBump | ||
47 | ///---------------------------------------------------------------------------- | ||
48 | |||
49 | // Default constructor | ||
50 | LLFloaterBump::LLFloaterBump() | ||
51 | : LLFloater() | ||
52 | { | ||
53 | sInstance = this; | ||
54 | |||
55 | gUICtrlFactory->buildFloater(this, "floater_bumps.xml"); | ||
56 | } | ||
57 | |||
58 | |||
59 | // Destroys the object | ||
60 | LLFloaterBump::~LLFloaterBump() | ||
61 | { | ||
62 | sInstance = NULL; | ||
63 | } | ||
64 | |||
65 | // static | ||
66 | void LLFloaterBump::show(void *contents) | ||
67 | { | ||
68 | if (gNoRender) | ||
69 | { | ||
70 | return; | ||
71 | } | ||
72 | |||
73 | if (!sInstance) | ||
74 | { | ||
75 | sInstance = new LLFloaterBump(); | ||
76 | } | ||
77 | |||
78 | LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "bump_list"); | ||
79 | if (!list) return; | ||
80 | list->deleteAllItems(); | ||
81 | |||
82 | if (gMeanCollisionList.isEmpty()) | ||
83 | { | ||
84 | LLString none_detected = sInstance->childGetText("none_detected"); | ||
85 | LLScrollListItem *item = new LLScrollListItem(); | ||
86 | item->addColumn(none_detected, LLFontGL::sSansSerifBold); | ||
87 | list->addItem(item); | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | for (LLMeanCollisionData* mcd = gMeanCollisionList.getFirstData(); | ||
92 | mcd; | ||
93 | mcd = gMeanCollisionList.getNextData()) | ||
94 | { | ||
95 | LLFloaterBump::add(list, mcd); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | sInstance->open(); | ||
100 | } | ||
101 | |||
102 | void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) | ||
103 | { | ||
104 | if (!sInstance) | ||
105 | { | ||
106 | new LLFloaterBump(); | ||
107 | } | ||
108 | |||
109 | if (!mcd->mFirstName[0] | ||
110 | || list->getItemCount() >= 20) | ||
111 | { | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | // There's only one internal tm buffer. | ||
116 | struct tm* timep; | ||
117 | |||
118 | // Convert to Pacific, based on server's opinion of whether | ||
119 | // it's daylight savings time there. | ||
120 | timep = utc_to_pacific_time(mcd->mTime, gPacificDaylightTime); | ||
121 | |||
122 | LLString time = llformat("[%d:%02d]", timep->tm_hour, timep->tm_min); | ||
123 | |||
124 | LLString action; | ||
125 | switch(mcd->mType) | ||
126 | { | ||
127 | case MEAN_BUMP: | ||
128 | action = "bump"; | ||
129 | break; | ||
130 | case MEAN_LLPUSHOBJECT: | ||
131 | action = "llpushobject"; | ||
132 | break; | ||
133 | case MEAN_SELECTED_OBJECT_COLLIDE: | ||
134 | action = "selected_object_collide"; | ||
135 | break; | ||
136 | case MEAN_SCRIPTED_OBJECT_COLLIDE: | ||
137 | action = "scripted_object_collide"; | ||
138 | break; | ||
139 | case MEAN_PHYSICAL_OBJECT_COLLIDE: | ||
140 | action = "physical_object_collide"; | ||
141 | break; | ||
142 | default: | ||
143 | llinfos << "LLFloaterBump::add unknown mean collision type " | ||
144 | << mcd->mType << llendl; | ||
145 | return; | ||
146 | } | ||
147 | |||
148 | // All above action strings are in XML file | ||
149 | LLUIString text = sInstance->childGetText(action); | ||
150 | text.setArg("[TIME]", time); | ||
151 | text.setArg("[FIRST]", mcd->mFirstName); | ||
152 | text.setArg("[LAST]", mcd->mLastName); | ||
153 | |||
154 | LLScrollListItem *item = new LLScrollListItem(TRUE, NULL, mcd->mPerp); | ||
155 | item->addColumn(text, LLFontGL::sSansSerifBold); | ||
156 | list->addItem(item); | ||
157 | } | ||