diff options
Diffstat (limited to 'linden/indra/newview/llfloaterinspect.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterinspect.cpp | 442 |
1 files changed, 221 insertions, 221 deletions
diff --git a/linden/indra/newview/llfloaterinspect.cpp b/linden/indra/newview/llfloaterinspect.cpp index 40132ce..8bb73e3 100644 --- a/linden/indra/newview/llfloaterinspect.cpp +++ b/linden/indra/newview/llfloaterinspect.cpp | |||
@@ -1,221 +1,221 @@ | |||
1 | #include "llviewerprecompiledheaders.h" | 1 | #include "llviewerprecompiledheaders.h" |
2 | #include "llfloateravatarinfo.h" | 2 | #include "llfloateravatarinfo.h" |
3 | #include "llfloaterinspect.h" | 3 | #include "llfloaterinspect.h" |
4 | #include "llfloatertools.h" | 4 | #include "llfloatertools.h" |
5 | #include "llcachename.h" | 5 | #include "llcachename.h" |
6 | #include "llscrolllistctrl.h" | 6 | #include "llscrolllistctrl.h" |
7 | #include "llselectmgr.h" | 7 | #include "llselectmgr.h" |
8 | #include "lltoolcomp.h" | 8 | #include "lltoolcomp.h" |
9 | #include "lltoolmgr.h" | 9 | #include "lltoolmgr.h" |
10 | #include "llviewercontrol.h" | 10 | #include "llviewercontrol.h" |
11 | #include "llviewerobject.h" | 11 | #include "llviewerobject.h" |
12 | #include "llvieweruictrlfactory.h" | 12 | #include "llvieweruictrlfactory.h" |
13 | 13 | ||
14 | LLFloaterInspect* LLFloaterInspect::sInstance = NULL; | 14 | LLFloaterInspect* LLFloaterInspect::sInstance = NULL; |
15 | 15 | ||
16 | LLFloaterInspect::LLFloaterInspect(void) : | 16 | LLFloaterInspect::LLFloaterInspect(void) : |
17 | LLFloater("Inspect Object"), | 17 | LLFloater("Inspect Object"), |
18 | mDirty(FALSE) | 18 | mDirty(FALSE) |
19 | { | 19 | { |
20 | sInstance = this; | 20 | sInstance = this; |
21 | gUICtrlFactory->buildFloater(this, "floater_inspect.xml"); | 21 | gUICtrlFactory->buildFloater(this, "floater_inspect.xml"); |
22 | } | 22 | } |
23 | 23 | ||
24 | LLFloaterInspect::~LLFloaterInspect(void) | 24 | LLFloaterInspect::~LLFloaterInspect(void) |
25 | { | 25 | { |
26 | if(!gFloaterTools->getVisible()) | 26 | if(!gFloaterTools->getVisible()) |
27 | { | 27 | { |
28 | if(gToolMgr->getCurrentTool(MASK_NONE) == gToolInspect) | 28 | if(gToolMgr->getBaseTool() == gToolInspect) |
29 | { | 29 | { |
30 | select_tool(gToolNull); | 30 | select_tool(gToolNull); |
31 | } | 31 | } |
32 | gSelectMgr->deselectAll(); | 32 | // Switch back to basic toolset |
33 | // Switch back to basic toolset | 33 | gToolMgr->setCurrentToolset(gBasicToolset); |
34 | gCurrentToolset = gBasicToolset; | 34 | } |
35 | gBasicToolset->selectFirstTool(); | 35 | else |
36 | gToolMgr->useSelectedTool( gBasicToolset ); | 36 | { |
37 | } | 37 | gFloaterTools->setFocus(TRUE); |
38 | else | 38 | } |
39 | { | 39 | sInstance = NULL; |
40 | gFloaterTools->setFocus(TRUE); | 40 | } |
41 | } | 41 | |
42 | sInstance = NULL; | 42 | BOOL LLFloaterInspect::isVisible() |
43 | } | 43 | { |
44 | 44 | return (!!sInstance); | |
45 | BOOL LLFloaterInspect::isVisible() | 45 | } |
46 | { | 46 | |
47 | return (!!sInstance); | 47 | void LLFloaterInspect::show(void* ignored) |
48 | } | 48 | { |
49 | 49 | if(sInstance) | |
50 | void LLFloaterInspect::show(void* ignored) | 50 | { |
51 | { | 51 | sInstance->open(); |
52 | if(sInstance) | 52 | } |
53 | { | 53 | else |
54 | sInstance->open(); | 54 | { |
55 | } | 55 | LLFloaterInspect* self = new LLFloaterInspect; |
56 | else | 56 | self->open(); |
57 | { | 57 | } |
58 | LLFloaterInspect* self = new LLFloaterInspect; | 58 | |
59 | self->open(); | 59 | sInstance->mObjectSelection = gSelectMgr->getSelection(); |
60 | } | 60 | select_tool(gToolInspect); |
61 | select_tool(gToolInspect); | 61 | sInstance->refresh(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void LLFloaterInspect::onClickCreatorProfile(void* ctrl) | 64 | void LLFloaterInspect::onClickCreatorProfile(void* ctrl) |
65 | { | 65 | { |
66 | if(sInstance->mObjectList->getAllSelected().size() == 0) return; | 66 | if(sInstance->mObjectList->getAllSelected().size() == 0) return; |
67 | LLSelectNode* obj = gSelectMgr->getFirstNode(); | 67 | LLSelectNode* obj = sInstance->mObjectSelection->getFirstNode(); |
68 | LLUUID obj_id, creator_id; | 68 | LLUUID obj_id, creator_id; |
69 | obj_id = sInstance->mObjectList->getFirstSelected()->getUUID(); | 69 | obj_id = sInstance->mObjectList->getFirstSelected()->getUUID(); |
70 | while(obj) | 70 | while(obj) |
71 | { | 71 | { |
72 | if(obj_id == obj->getObject()->getID()) | 72 | if(obj_id == obj->getObject()->getID()) |
73 | { | 73 | { |
74 | creator_id = obj->mPermissions->getCreator(); | 74 | creator_id = obj->mPermissions->getCreator(); |
75 | break; | 75 | break; |
76 | } | 76 | } |
77 | obj = gSelectMgr->getNextNode(); | 77 | obj = sInstance->mObjectSelection->getNextNode(); |
78 | } | 78 | } |
79 | if(obj) | 79 | if(obj) |
80 | { | 80 | { |
81 | LLFloaterAvatarInfo::showFromDirectory(creator_id); | 81 | LLFloaterAvatarInfo::showFromDirectory(creator_id); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | void LLFloaterInspect::onClickOwnerProfile(void* ctrl) | 85 | void LLFloaterInspect::onClickOwnerProfile(void* ctrl) |
86 | { | 86 | { |
87 | if(sInstance->mObjectList->getAllSelected().size() == 0) return; | 87 | if(sInstance->mObjectList->getAllSelected().size() == 0) return; |
88 | LLSelectNode* obj = gSelectMgr->getFirstNode(); | 88 | LLSelectNode* obj = sInstance->mObjectSelection->getFirstNode(); |
89 | LLUUID obj_id, owner_id; | 89 | LLUUID obj_id, owner_id; |
90 | obj_id = sInstance->mObjectList->getFirstSelected()->getUUID(); | 90 | obj_id = sInstance->mObjectList->getFirstSelected()->getUUID(); |
91 | while(obj) | 91 | while(obj) |
92 | { | 92 | { |
93 | if(obj_id == obj->getObject()->getID()) | 93 | if(obj_id == obj->getObject()->getID()) |
94 | { | 94 | { |
95 | owner_id = obj->mPermissions->getOwner(); | 95 | owner_id = obj->mPermissions->getOwner(); |
96 | break; | 96 | break; |
97 | } | 97 | } |
98 | obj = gSelectMgr->getNextNode(); | 98 | obj = sInstance->mObjectSelection->getNextNode(); |
99 | } | 99 | } |
100 | if(obj) | 100 | if(obj) |
101 | { | 101 | { |
102 | LLFloaterAvatarInfo::showFromDirectory(owner_id); | 102 | LLFloaterAvatarInfo::showFromDirectory(owner_id); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | BOOL LLFloaterInspect::postBuild() | 106 | BOOL LLFloaterInspect::postBuild() |
107 | { | 107 | { |
108 | mObjectList = LLUICtrlFactory::getScrollListByName(this, "object_list"); | 108 | mObjectList = LLUICtrlFactory::getScrollListByName(this, "object_list"); |
109 | childSetAction("button owner",onClickOwnerProfile, this); | 109 | childSetAction("button owner",onClickOwnerProfile, this); |
110 | childSetAction("button creator",onClickCreatorProfile, this); | 110 | childSetAction("button creator",onClickCreatorProfile, this); |
111 | childSetCommitCallback("object_list", onSelectObject); | 111 | childSetCommitCallback("object_list", onSelectObject); |
112 | refresh(); | 112 | return TRUE; |
113 | return TRUE; | 113 | } |
114 | } | 114 | |
115 | 115 | void LLFloaterInspect::onSelectObject(LLUICtrl* ctrl, void* user_data) | |
116 | void LLFloaterInspect::onSelectObject(LLUICtrl* ctrl, void* user_data) | 116 | { |
117 | { | 117 | if(LLFloaterInspect::getSelectedUUID() != LLUUID::null) |
118 | if(LLFloaterInspect::getSelectedUUID() != LLUUID::null) | 118 | { |
119 | { | 119 | sInstance->childSetEnabled("button owner", true); |
120 | sInstance->childSetEnabled("button owner", true); | 120 | sInstance->childSetEnabled("button creator", true); |
121 | sInstance->childSetEnabled("button creator", true); | 121 | } |
122 | } | 122 | } |
123 | } | 123 | |
124 | 124 | LLUUID LLFloaterInspect::getSelectedUUID() | |
125 | LLUUID LLFloaterInspect::getSelectedUUID() | 125 | { |
126 | { | 126 | if(sInstance) |
127 | if(sInstance) | 127 | { |
128 | { | 128 | if(sInstance->mObjectList->getAllSelected().size() > 0) return sInstance->mObjectList->getFirstSelected()->getUUID(); |
129 | if(sInstance->mObjectList->getAllSelected().size() > 0) return sInstance->mObjectList->getFirstSelected()->getUUID(); | 129 | } |
130 | } | 130 | return LLUUID::null; |
131 | return LLUUID::null; | 131 | } |
132 | } | 132 | |
133 | 133 | void LLFloaterInspect::refresh() | |
134 | void LLFloaterInspect::refresh() | 134 | { |
135 | { | 135 | LLUUID creator_id; |
136 | LLUUID creator_id; | 136 | LLString creator_name; |
137 | LLString creator_name; | 137 | S32 pos = mObjectList->getScrollPos(); |
138 | S32 pos = mObjectList->getScrollPos(); | 138 | childSetEnabled("button owner", false); |
139 | childSetEnabled("button owner", false); | 139 | childSetEnabled("button creator", false); |
140 | childSetEnabled("button creator", false); | 140 | LLUUID selected_uuid; |
141 | LLUUID selected_uuid; | 141 | S32 selected_index = mObjectList->getFirstSelectedIndex(); |
142 | S32 selected_index = mObjectList->getFirstSelectedIndex(); | 142 | if(selected_index > -1) selected_uuid = mObjectList->getFirstSelected()->getUUID(); |
143 | if(selected_index > -1) selected_uuid = mObjectList->getFirstSelected()->getUUID(); | 143 | mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE); |
144 | mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE); | 144 | //List all transient objects, then all linked objects |
145 | //List all transient objects, then all linked objects | 145 | LLSelectNode* obj = mObjectSelection->getFirstNode(); |
146 | LLSelectNode* obj = gSelectMgr->getFirstNode(); | 146 | LLSD row; |
147 | LLSD row; | 147 | while(obj) |
148 | while(obj) | 148 | { |
149 | { | 149 | char owner_first_name[MAX_STRING], owner_last_name[MAX_STRING]; |
150 | char owner_first_name[MAX_STRING], owner_last_name[MAX_STRING]; | 150 | char creator_first_name[MAX_STRING], creator_last_name[MAX_STRING]; |
151 | char creator_first_name[MAX_STRING], creator_last_name[MAX_STRING]; | 151 | char time[MAX_STRING]; |
152 | char time[MAX_STRING]; | 152 | std::ostringstream owner_name, creator_name, date; |
153 | std::ostringstream owner_name, creator_name, date; | 153 | time_t timestamp = (time_t) (obj->mCreationDate/1000000); |
154 | time_t timestamp = (time_t) (obj->mCreationDate/1000000); | 154 | LLString::copy(time, ctime(×tamp), MAX_STRING); |
155 | LLString::copy(time, ctime(×tamp), MAX_STRING); | 155 | time[24] = '\0'; |
156 | time[24] = '\0'; | 156 | date << obj->mCreationDate; |
157 | date << obj->mCreationDate; | 157 | gCacheName->getName(obj->mPermissions->getOwner(), owner_first_name, owner_last_name); |
158 | gCacheName->getName(obj->mPermissions->getOwner(), owner_first_name, owner_last_name); | 158 | owner_name << owner_first_name << " " << owner_last_name; |
159 | owner_name << owner_first_name << " " << owner_last_name; | 159 | gCacheName->getName(obj->mPermissions->getCreator(), creator_first_name, creator_last_name); |
160 | gCacheName->getName(obj->mPermissions->getCreator(), creator_first_name, creator_last_name); | 160 | creator_name << creator_first_name << " " << creator_last_name; |
161 | creator_name << creator_first_name << " " << creator_last_name; | 161 | row["id"] = obj->getObject()->getID(); |
162 | row["id"] = obj->getObject()->getID(); | 162 | row["columns"][0]["column"] = "object_name"; |
163 | row["columns"][0]["column"] = "object_name"; | 163 | row["columns"][0]["type"] = "text"; |
164 | row["columns"][0]["type"] = "text"; | 164 | // make sure we're either at the top of the link chain |
165 | // make sure we're either at the top of the link chain | 165 | // or top of the editable chain, for attachments |
166 | // or top of the editable chain, for attachments | 166 | if(!(obj->getObject()->isRoot() || obj->getObject()->isRootEdit())) |
167 | if(!(obj->getObject()->isRoot() || obj->getObject()->isRootEdit())) | 167 | { |
168 | { | 168 | row["columns"][0]["value"] = LLString(" ") + obj->mName; |
169 | row["columns"][0]["value"] = LLString(" ") + obj->mName; | 169 | } |
170 | } | 170 | else |
171 | else | 171 | { |
172 | { | 172 | row["columns"][0]["value"] = obj->mName; |
173 | row["columns"][0]["value"] = obj->mName; | 173 | } |
174 | } | 174 | row["columns"][1]["column"] = "owner_name"; |
175 | row["columns"][1]["column"] = "owner_name"; | 175 | row["columns"][1]["type"] = "text"; |
176 | row["columns"][1]["type"] = "text"; | 176 | row["columns"][1]["value"] = owner_name.str().c_str(); |
177 | row["columns"][1]["value"] = owner_name.str().c_str(); | 177 | row["columns"][2]["column"] = "creator_name"; |
178 | row["columns"][2]["column"] = "creator_name"; | 178 | row["columns"][2]["type"] = "text"; |
179 | row["columns"][2]["type"] = "text"; | 179 | row["columns"][2]["value"] = creator_name.str().c_str(); |
180 | row["columns"][2]["value"] = creator_name.str().c_str(); | 180 | row["columns"][3]["column"] = "creation_date"; |
181 | row["columns"][3]["column"] = "creation_date"; | 181 | row["columns"][3]["type"] = "text"; |
182 | row["columns"][3]["type"] = "text"; | 182 | row["columns"][3]["value"] = time; |
183 | row["columns"][3]["value"] = time; | 183 | mObjectList->addElement(row, ADD_TOP); |
184 | mObjectList->addElement(row, ADD_TOP); | 184 | obj = mObjectSelection->getNextNode(); |
185 | obj = gSelectMgr->getNextNode(); | 185 | } |
186 | } | 186 | if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) |
187 | if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) | 187 | { |
188 | { | 188 | mObjectList->selectNthItem(selected_index); |
189 | mObjectList->selectNthItem(selected_index); | 189 | } |
190 | } | 190 | else |
191 | else | 191 | { |
192 | { | 192 | mObjectList->selectNthItem(0); |
193 | mObjectList->selectNthItem(0); | 193 | } |
194 | } | 194 | onSelectObject(this, NULL); |
195 | onSelectObject(this, NULL); | 195 | mObjectList->setScrollPos(pos); |
196 | mObjectList->setScrollPos(pos); | 196 | } |
197 | } | 197 | |
198 | 198 | void LLFloaterInspect::onFocusReceived() | |
199 | void LLFloaterInspect::onFocusReceived() | 199 | { |
200 | { | 200 | select_tool(gToolInspect); |
201 | select_tool(gToolInspect); | 201 | } |
202 | } | 202 | |
203 | 203 | void LLFloaterInspect::dirty() | |
204 | void LLFloaterInspect::dirty() | 204 | { |
205 | { | 205 | if(sInstance) |
206 | if(sInstance) | 206 | { |
207 | { | 207 | sInstance->setDirty(); |
208 | sInstance->setDirty(); | 208 | } |
209 | } | 209 | } |
210 | } | 210 | |
211 | 211 | void LLFloaterInspect::draw() | |
212 | void LLFloaterInspect::draw() | 212 | { |
213 | { | 213 | if (mDirty) |
214 | if (mDirty) | 214 | { |
215 | { | 215 | refresh(); |
216 | refresh(); | 216 | mDirty = FALSE; |
217 | mDirty = FALSE; | 217 | } |
218 | } | 218 | |
219 | 219 | LLFloater::draw(); | |
220 | LLFloater::draw(); | 220 | } |
221 | } \ No newline at end of file | 221 | |