diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llnamelistctrl.cpp | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/linden/indra/newview/llnamelistctrl.cpp b/linden/indra/newview/llnamelistctrl.cpp index 90bfb86..98745b4 100644 --- a/linden/indra/newview/llnamelistctrl.cpp +++ b/linden/indra/newview/llnamelistctrl.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2003-2007, Linden Research, Inc. | 5 | * Copyright (c) 2003-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -177,6 +178,13 @@ BOOL LLNameListCtrl::addNameItem(LLScrollListItem* item, EAddPosition pos) | |||
177 | 178 | ||
178 | addItem(item, pos); | 179 | addItem(item, pos); |
179 | 180 | ||
181 | // this column is resizable | ||
182 | LLScrollListColumn* columnp = getColumn(mNameColumnIndex); | ||
183 | if (columnp && columnp->mHeader) | ||
184 | { | ||
185 | columnp->mHeader->setHasResizableElement(TRUE); | ||
186 | } | ||
187 | |||
180 | return result; | 188 | return result; |
181 | } | 189 | } |
182 | 190 | ||
@@ -187,16 +195,41 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& value, EAddPosition pos | |||
187 | char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | 195 | char first[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ |
188 | char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | 196 | char last[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ |
189 | 197 | ||
190 | gCacheName->getName(item->getUUID(), first, last); | 198 | // use supplied name by default |
191 | 199 | LLString fullname = value["name"].asString(); | |
192 | LLString fullname; | 200 | if (value["target"].asString() == "GROUP") |
193 | fullname.assign(first); | 201 | { |
194 | fullname.append(1, ' '); | 202 | char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ |
195 | fullname.append(last); | 203 | gCacheName->getGroupName(item->getUUID(), group_name); |
196 | 204 | // fullname will be "nobody" if group not found | |
205 | fullname = group_name; | ||
206 | } | ||
207 | else if (value["target"].asString() == "SPECIAL") | ||
208 | { | ||
209 | // just use supplied name | ||
210 | } | ||
211 | else // normal resident | ||
212 | { | ||
213 | if (gCacheName->getName(item->getUUID(), first, last)) | ||
214 | { | ||
215 | fullname.assign(first); | ||
216 | fullname.append(1, ' '); | ||
217 | fullname.append(last); | ||
218 | } | ||
219 | } | ||
220 | |||
197 | LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); | 221 | LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); |
198 | ((LLScrollListText*)cell)->setText( fullname ); | 222 | ((LLScrollListText*)cell)->setText( fullname ); |
199 | 223 | ||
224 | updateMaxContentWidth(item); | ||
225 | |||
226 | // this column is resizable | ||
227 | LLScrollListColumn* columnp = getColumn(mNameColumnIndex); | ||
228 | if (columnp && columnp->mHeader) | ||
229 | { | ||
230 | columnp->mHeader->setHasResizableElement(TRUE); | ||
231 | } | ||
232 | |||
200 | return item; | 233 | return item; |
201 | } | 234 | } |
202 | 235 | ||
@@ -241,6 +274,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const char* first, | |||
241 | cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); | 274 | cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex); |
242 | 275 | ||
243 | ((LLScrollListText*)cell)->setText( fullname ); | 276 | ((LLScrollListText*)cell)->setText( fullname ); |
277 | updateMaxContentWidth(item); | ||
244 | } | 278 | } |
245 | } | 279 | } |
246 | } | 280 | } |
@@ -318,13 +352,6 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto | |||
318 | node->getAttributeS32("heading_height", heading_height); | 352 | node->getAttributeS32("heading_height", heading_height); |
319 | name_list->setHeadingHeight(heading_height); | 353 | name_list->setHeadingHeight(heading_height); |
320 | } | 354 | } |
321 | if (node->hasAttribute("heading_font")) | ||
322 | { | ||
323 | LLString heading_font(""); | ||
324 | node->getAttributeString("heading_font", heading_font); | ||
325 | LLFontGL* gl_font = LLFontGL::fontFromName(heading_font.c_str()); | ||
326 | name_list->setHeadingFont(gl_font); | ||
327 | } | ||
328 | name_list->setCollapseEmptyColumns(collapse_empty_columns); | 355 | name_list->setCollapseEmptyColumns(collapse_empty_columns); |
329 | 356 | ||
330 | BOOL allow_calling_card_drop = FALSE; | 357 | BOOL allow_calling_card_drop = FALSE; |
@@ -363,8 +390,12 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto | |||
363 | columns[index]["width"] = columnwidth; | 390 | columns[index]["width"] = columnwidth; |
364 | } | 391 | } |
365 | 392 | ||
393 | LLFontGL::HAlign h_align = LLFontGL::LEFT; | ||
394 | h_align = LLView::selectFontHAlign(child); | ||
395 | |||
366 | columns[index]["name"] = columnname; | 396 | columns[index]["name"] = columnname; |
367 | columns[index]["label"] = labelname; | 397 | columns[index]["label"] = labelname; |
398 | columns[index]["halign"] = (S32)h_align; | ||
368 | index++; | 399 | index++; |
369 | } | 400 | } |
370 | } | 401 | } |
@@ -426,3 +457,4 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto | |||
426 | return name_list; | 457 | return name_list; |
427 | } | 458 | } |
428 | 459 | ||
460 | |||