diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llhoverview.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llhoverview.cpp')
-rw-r--r-- | linden/indra/newview/llhoverview.cpp | 241 |
1 files changed, 104 insertions, 137 deletions
diff --git a/linden/indra/newview/llhoverview.cpp b/linden/indra/newview/llhoverview.cpp index cadd11a..316ba0b 100644 --- a/linden/indra/newview/llhoverview.cpp +++ b/linden/indra/newview/llhoverview.cpp | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "llfontgl.h" | 38 | #include "llfontgl.h" |
39 | #include "message.h" | 39 | #include "message.h" |
40 | #include "llgl.h" | 40 | #include "llgl.h" |
41 | #include "llglimmediate.h" | ||
41 | #include "llfontgl.h" | 42 | #include "llfontgl.h" |
42 | #include "llparcel.h" | 43 | #include "llparcel.h" |
43 | #include "lldbstrings.h" | 44 | #include "lldbstrings.h" |
@@ -103,8 +104,6 @@ LLHoverView::LLHoverView(const std::string& name, const LLRect& rect) | |||
103 | 104 | ||
104 | LLHoverView::~LLHoverView() | 105 | LLHoverView::~LLHoverView() |
105 | { | 106 | { |
106 | // children all deleted by LLView destructor | ||
107 | mText.deleteAllData(); | ||
108 | } | 107 | } |
109 | 108 | ||
110 | EWidgetType LLHoverView::getWidgetType() const | 109 | EWidgetType LLHoverView::getWidgetType() const |
@@ -135,8 +134,8 @@ void LLHoverView::updateHover(LLTool* current_tool) | |||
135 | { | 134 | { |
136 | mStartHoverTimer.reset(); | 135 | mStartHoverTimer.reset(); |
137 | mStartHoverPickTimer = TRUE; | 136 | mStartHoverPickTimer = TRUE; |
138 | // Delete the existing text so that we do not briefly show the wrong data. | 137 | // Clear the existing text so that we do not briefly show the wrong data. |
139 | mText.deleteAllData(); | 138 | mText.clear(); |
140 | } | 139 | } |
141 | 140 | ||
142 | if (mDoneHoverPick) | 141 | if (mDoneHoverPick) |
@@ -216,13 +215,10 @@ void LLHoverView::resetLastHoverObject() | |||
216 | 215 | ||
217 | void LLHoverView::updateText() | 216 | void LLHoverView::updateText() |
218 | { | 217 | { |
219 | char first_name[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | ||
220 | char last_name[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | ||
221 | char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ | ||
222 | |||
223 | LLViewerObject* hit_object = getLastHoverObject(); | 218 | LLViewerObject* hit_object = getLastHoverObject(); |
219 | std::string line; | ||
224 | 220 | ||
225 | mText.deleteAllData(); | 221 | mText.clear(); |
226 | if ( hit_object ) | 222 | if ( hit_object ) |
227 | { | 223 | { |
228 | if ( hit_object->isHUDAttachment() ) | 224 | if ( hit_object->isHUDAttachment() ) |
@@ -249,9 +245,9 @@ void LLHoverView::updateText() | |||
249 | } | 245 | } |
250 | } | 246 | } |
251 | 247 | ||
248 | line.clear(); | ||
252 | if (hit_object->isAvatar()) | 249 | if (hit_object->isAvatar()) |
253 | { | 250 | { |
254 | LLString *line = new LLString(""); | ||
255 | LLNameValue* title = hit_object->getNVPair("Title"); | 251 | LLNameValue* title = hit_object->getNVPair("Title"); |
256 | LLNameValue* firstname = hit_object->getNVPair("FirstName"); | 252 | LLNameValue* firstname = hit_object->getNVPair("FirstName"); |
257 | LLNameValue* lastname = hit_object->getNVPair("LastName"); | 253 | LLNameValue* lastname = hit_object->getNVPair("LastName"); |
@@ -259,18 +255,18 @@ void LLHoverView::updateText() | |||
259 | { | 255 | { |
260 | if (title) | 256 | if (title) |
261 | { | 257 | { |
262 | line->append(title->getString()); | 258 | line.append(title->getString()); |
263 | line->append(1, ' '); | 259 | line.append(1, ' '); |
264 | } | 260 | } |
265 | line->append(firstname->getString()); | 261 | line.append(firstname->getString()); |
266 | line->append(1, ' '); | 262 | line.append(1, ' '); |
267 | line->append(lastname->getString()); | 263 | line.append(lastname->getString()); |
268 | } | 264 | } |
269 | else | 265 | else |
270 | { | 266 | { |
271 | line->append("Person"); | 267 | line.append("Person"); |
272 | } | 268 | } |
273 | mText.addDataAtEnd(line); | 269 | mText.push_back(line); |
274 | } | 270 | } |
275 | else | 271 | else |
276 | { | 272 | { |
@@ -286,75 +282,69 @@ void LLHoverView::updateText() | |||
286 | LLSelectNode *nodep = gSelectMgr->getHoverNode();; | 282 | LLSelectNode *nodep = gSelectMgr->getHoverNode();; |
287 | if (nodep) | 283 | if (nodep) |
288 | { | 284 | { |
289 | char cstring[256]; /*Flawfinder: ignore*/ | 285 | line.clear(); |
290 | LLString *temp_str = NULL; | ||
291 | |||
292 | temp_str = new LLString(); | ||
293 | if (nodep->mName.empty()) | 286 | if (nodep->mName.empty()) |
294 | { | 287 | { |
295 | temp_str->append("(no name)"); | 288 | line.append("(no name)"); |
296 | } | 289 | } |
297 | else | 290 | else |
298 | { | 291 | { |
299 | temp_str->append( nodep->mName ); | 292 | line.append( nodep->mName ); |
300 | } | 293 | } |
301 | 294 | mText.push_back(line); | |
302 | mText.addDataAtEnd(temp_str); | ||
303 | 295 | ||
304 | if (!nodep->mDescription.empty() | 296 | if (!nodep->mDescription.empty() |
305 | && nodep->mDescription != DEFAULT_DESC) | 297 | && nodep->mDescription != DEFAULT_DESC) |
306 | { | 298 | { |
307 | temp_str = new LLString( nodep->mDescription ); | 299 | mText.push_back( nodep->mDescription ); |
308 | mText.addDataAtEnd( temp_str ); | ||
309 | } | 300 | } |
310 | 301 | ||
311 | // Line: "Owner: James Linden" | 302 | // Line: "Owner: James Linden" |
312 | temp_str = new LLString(); | 303 | line.clear(); |
313 | temp_str->append("Owner: "); | 304 | line.append("Owner: "); |
314 | 305 | ||
315 | if (nodep->mValid) | 306 | if (nodep->mValid) |
316 | { | 307 | { |
317 | LLUUID owner; | 308 | LLUUID owner; |
309 | std::string name; | ||
318 | if (!nodep->mPermissions->isGroupOwned()) | 310 | if (!nodep->mPermissions->isGroupOwned()) |
319 | { | 311 | { |
320 | owner = nodep->mPermissions->getOwner(); | 312 | owner = nodep->mPermissions->getOwner(); |
321 | if (LLUUID::null == owner) | 313 | if (LLUUID::null == owner) |
322 | { | 314 | { |
323 | temp_str->append("Public"); | 315 | line.append("Public"); |
324 | } | 316 | } |
325 | else if(gCacheName->getName( | 317 | else if(gCacheName->getFullName(owner, name)) |
326 | owner, first_name, last_name)) | ||
327 | { | 318 | { |
328 | temp_str->append(first_name); | 319 | line.append(name); |
329 | temp_str->append(" "); | ||
330 | temp_str->append(last_name); | ||
331 | } | 320 | } |
332 | else | 321 | else |
333 | { | 322 | { |
334 | temp_str->append("Retrieving..."); | 323 | line.append("Retrieving..."); |
335 | } | 324 | } |
336 | }else | 325 | } |
326 | else | ||
337 | { | 327 | { |
328 | std::string name; | ||
338 | owner = nodep->mPermissions->getGroup(); | 329 | owner = nodep->mPermissions->getGroup(); |
339 | if (gCacheName->getGroupName(owner, group_name)) | 330 | if (gCacheName->getGroupName(owner, name)) |
340 | { | 331 | { |
341 | temp_str->append(group_name); | 332 | line.append(name); |
342 | temp_str->append("(Group)"); | 333 | line.append("(Group)"); |
343 | } | 334 | } |
344 | else | 335 | else |
345 | { | 336 | { |
346 | temp_str->append("Retrieving..."); | 337 | line.append("Retrieving..."); |
347 | } | 338 | } |
348 | } | 339 | } |
349 | } | 340 | } |
350 | else | 341 | else |
351 | { | 342 | { |
352 | temp_str->append("Retrieving..."); | 343 | line.append("Retrieving..."); |
353 | } | 344 | } |
354 | mText.addDataAtEnd(temp_str); | 345 | mText.push_back(line); |
355 | 346 | ||
356 | // Build a line describing any special properties | 347 | // Build a line describing any special properties of this object. |
357 | // of this object. | ||
358 | LLViewerObject *object = hit_object; | 348 | LLViewerObject *object = hit_object; |
359 | LLViewerObject *parent = (LLViewerObject *)object->getParent(); | 349 | LLViewerObject *parent = (LLViewerObject *)object->getParent(); |
360 | 350 | ||
@@ -367,54 +357,56 @@ void LLHoverView::updateText() | |||
367 | object->flagTemporary() || | 357 | object->flagTemporary() || |
368 | object->flagPhantom()) ) | 358 | object->flagPhantom()) ) |
369 | { | 359 | { |
370 | temp_str = new LLString(); | 360 | line.clear(); |
371 | if (object->flagScripted()) | 361 | if (object->flagScripted()) |
372 | { | 362 | { |
373 | temp_str->append("Script "); | 363 | line.append("Script "); |
374 | } | 364 | } |
375 | 365 | ||
376 | if (object->usePhysics()) | 366 | if (object->usePhysics()) |
377 | { | 367 | { |
378 | temp_str->append("Physics "); | 368 | line.append("Physics "); |
379 | } | 369 | } |
380 | 370 | ||
381 | if (object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) | 371 | if (object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ) |
382 | { | 372 | { |
383 | temp_str->append("Touch "); | 373 | line.append("Touch "); |
384 | suppressObjectHoverDisplay = FALSE; // Show tip | 374 | suppressObjectHoverDisplay = FALSE; // Show tip |
385 | } | 375 | } |
386 | 376 | ||
387 | if (object->flagTakesMoney() || (parent && parent->flagTakesMoney()) ) | 377 | if (object->flagTakesMoney() || (parent && parent->flagTakesMoney()) ) |
388 | { | 378 | { |
389 | temp_str->append("L$ "); | 379 | line.append("L$ "); |
390 | suppressObjectHoverDisplay = FALSE; // Show tip | 380 | suppressObjectHoverDisplay = FALSE; // Show tip |
391 | } | 381 | } |
392 | 382 | ||
393 | if (object->flagAllowInventoryAdd()) | 383 | if (object->flagAllowInventoryAdd()) |
394 | { | 384 | { |
395 | temp_str->append("Drop Inventory "); | 385 | line.append("Drop Inventory "); |
396 | suppressObjectHoverDisplay = FALSE; // Show tip | 386 | suppressObjectHoverDisplay = FALSE; // Show tip |
397 | } | 387 | } |
398 | 388 | ||
399 | if (object->flagPhantom()) | 389 | if (object->flagPhantom()) |
400 | { | 390 | { |
401 | temp_str->append("Phantom "); | 391 | line.append("Phantom "); |
402 | } | 392 | } |
403 | 393 | ||
404 | if (object->flagTemporary()) | 394 | if (object->flagTemporary()) |
405 | { | 395 | { |
406 | temp_str->append("Temporary "); | 396 | line.append("Temporary "); |
407 | } | 397 | } |
408 | 398 | ||
409 | if (object->usePhysics() || | 399 | if (object->usePhysics() || |
410 | object->flagHandleTouch() || | 400 | object->flagHandleTouch() || |
411 | (parent && parent->flagHandleTouch()) ) | 401 | (parent && parent->flagHandleTouch()) ) |
412 | { | 402 | { |
413 | temp_str->append("(Right-click for menu) "); | 403 | line.append("(Right-click for menu) "); |
414 | } | 404 | } |
415 | mText.addDataAtEnd(temp_str); | 405 | mText.push_back(line); |
416 | } | 406 | } |
417 | 407 | ||
408 | // Free to copy / For Sale: L$ | ||
409 | line.clear(); | ||
418 | if (nodep->mValid) | 410 | if (nodep->mValid) |
419 | { | 411 | { |
420 | BOOL for_copy = nodep->mPermissions->getMaskEveryone() & PERM_COPY && object->permCopy(); | 412 | BOOL for_copy = nodep->mPermissions->getMaskEveryone() & PERM_COPY && object->permCopy(); |
@@ -424,44 +416,36 @@ void LLHoverView::updateText() | |||
424 | nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY); | 416 | nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY); |
425 | if (for_copy) | 417 | if (for_copy) |
426 | { | 418 | { |
427 | temp_str = new LLString(); | 419 | line.append("Free to copy"); |
428 | temp_str->append("Free to copy"); | ||
429 | mText.addDataAtEnd(temp_str); | ||
430 | suppressObjectHoverDisplay = FALSE; // Show tip | 420 | suppressObjectHoverDisplay = FALSE; // Show tip |
431 | } | 421 | } |
432 | else if (for_sale) | 422 | else if (for_sale) |
433 | { | 423 | { |
434 | temp_str = new LLString(); | 424 | line.append(llformat("For Sale: L$%d", nodep->mSaleInfo.getSalePrice())); |
435 | temp_str->append("For Sale: "); | ||
436 | snprintf(cstring, sizeof(cstring), "L$%d", nodep->mSaleInfo.getSalePrice()); /* Flawfinder: ignore */ | ||
437 | temp_str->append(cstring); | ||
438 | mText.addDataAtEnd(temp_str); | ||
439 | suppressObjectHoverDisplay = FALSE; // Show tip | 425 | suppressObjectHoverDisplay = FALSE; // Show tip |
440 | } | 426 | } |
441 | else | 427 | else |
442 | { | 428 | { |
443 | // Nothing if not for sale | 429 | // Nothing if not for sale |
444 | // temp_str = new LLString(); | 430 | // line.append("Not for sale"); |
445 | // temp_str->append("Not for sale"); | ||
446 | } | 431 | } |
447 | } | 432 | } |
448 | else | 433 | else |
449 | { | 434 | { |
450 | temp_str = new LLString(); | 435 | line.append("For Sale: Retrieving..."); |
451 | temp_str->append("For Sale: Retrieving..."); | ||
452 | mText.addDataAtEnd(temp_str); | ||
453 | } | 436 | } |
437 | mText.push_back(line); | ||
454 | } | 438 | } |
439 | |||
455 | // If the hover tip shouldn't be shown, delete all the object text | 440 | // If the hover tip shouldn't be shown, delete all the object text |
456 | if (suppressObjectHoverDisplay) | 441 | if (suppressObjectHoverDisplay) |
457 | { | 442 | { |
458 | mText.deleteAllData(); | 443 | mText.clear(); |
459 | } | 444 | } |
460 | } | 445 | } |
461 | } | 446 | } |
462 | else if ( mHoverLandGlobal != LLVector3d::zero ) | 447 | else if ( mHoverLandGlobal != LLVector3d::zero ) |
463 | { | 448 | { |
464 | |||
465 | // | 449 | // |
466 | // Do not show hover for land unless prefs are set to allow it. | 450 | // Do not show hover for land unless prefs are set to allow it. |
467 | // | 451 | // |
@@ -470,7 +454,6 @@ void LLHoverView::updateText() | |||
470 | 454 | ||
471 | // Didn't hit an object, but since we have a land point we | 455 | // Didn't hit an object, but since we have a land point we |
472 | // must be hovering over land. | 456 | // must be hovering over land. |
473 | LLString *line = NULL; | ||
474 | 457 | ||
475 | LLParcel* hover_parcel = gParcelMgr->getHoverParcel(); | 458 | LLParcel* hover_parcel = gParcelMgr->getHoverParcel(); |
476 | LLUUID owner; | 459 | LLUUID owner; |
@@ -485,54 +468,51 @@ void LLHoverView::updateText() | |||
485 | } | 468 | } |
486 | 469 | ||
487 | // Line: "Land" | 470 | // Line: "Land" |
488 | line = new LLString(); | 471 | line.clear(); |
489 | mText.addDataAtEnd(line); | 472 | line.append("Land: "); |
490 | |||
491 | line->append("Land: "); | ||
492 | if (hover_parcel) | 473 | if (hover_parcel) |
493 | { | 474 | { |
494 | line->append(hover_parcel->getName()); | 475 | line.append(hover_parcel->getName()); |
495 | } | 476 | } |
477 | mText.push_back(line); | ||
496 | 478 | ||
497 | // Line: "Owner: James Linden" | 479 | // Line: "Owner: James Linden" |
498 | line = new LLString(); | 480 | line.clear(); |
499 | mText.addDataAtEnd(line); | 481 | line.append("Owner: "); |
500 | |||
501 | line->append("Owner: "); | ||
502 | 482 | ||
503 | if ( hover_parcel ) | 483 | if ( hover_parcel ) |
504 | { | 484 | { |
485 | std::string name; | ||
505 | if (LLUUID::null == owner) | 486 | if (LLUUID::null == owner) |
506 | { | 487 | { |
507 | line->append("Public"); | 488 | line.append("Public"); |
508 | } | 489 | } |
509 | else if (hover_parcel->getIsGroupOwned()) | 490 | else if (hover_parcel->getIsGroupOwned()) |
510 | { | 491 | { |
511 | if (gCacheName->getGroupName(owner, group_name)) | 492 | if (gCacheName->getGroupName(owner, name)) |
512 | { | 493 | { |
513 | line->append(group_name); | 494 | line.append(name); |
514 | line->append("(Group)"); | 495 | line.append("(Group)"); |
515 | } | 496 | } |
516 | else | 497 | else |
517 | { | 498 | { |
518 | line->append("Retrieving..."); | 499 | line.append("Retrieving..."); |
519 | } | 500 | } |
520 | } | 501 | } |
521 | else if(gCacheName->getName(owner, first_name, last_name)) | 502 | else if(gCacheName->getFullName(owner, name)) |
522 | { | 503 | { |
523 | line->append(first_name); | 504 | line.append(name); |
524 | line->append(" "); | ||
525 | line->append(last_name); | ||
526 | } | 505 | } |
527 | else | 506 | else |
528 | { | 507 | { |
529 | line->append("Retrieving..."); | 508 | line.append("Retrieving..."); |
530 | } | 509 | } |
531 | } | 510 | } |
532 | else | 511 | else |
533 | { | 512 | { |
534 | line->append("Retrieving..."); | 513 | line.append("Retrieving..."); |
535 | } | 514 | } |
515 | mText.push_back(line); | ||
536 | 516 | ||
537 | // Line: "no fly, not safe, no build" | 517 | // Line: "no fly, not safe, no build" |
538 | 518 | ||
@@ -541,19 +521,19 @@ void LLHoverView::updateText() | |||
541 | if ( hover_parcel && owner != gAgent.getID() ) | 521 | if ( hover_parcel && owner != gAgent.getID() ) |
542 | { | 522 | { |
543 | S32 words = 0; | 523 | S32 words = 0; |
544 | line = new LLString(""); | 524 | |
545 | 525 | line.clear(); | |
546 | // JC - Keep this in the same order as the checkboxes | 526 | // JC - Keep this in the same order as the checkboxes |
547 | // on the land info panel | 527 | // on the land info panel |
548 | if ( !hover_parcel->getAllowModify() ) | 528 | if ( !hover_parcel->getAllowModify() ) |
549 | { | 529 | { |
550 | if ( hover_parcel->getAllowGroupModify() ) | 530 | if ( hover_parcel->getAllowGroupModify() ) |
551 | { | 531 | { |
552 | line->append("Group Build"); | 532 | line.append("Group Build"); |
553 | } | 533 | } |
554 | else | 534 | else |
555 | { | 535 | { |
556 | line->append("No Build"); | 536 | line.append("No Build"); |
557 | } | 537 | } |
558 | 538 | ||
559 | words++; | 539 | words++; |
@@ -561,36 +541,36 @@ void LLHoverView::updateText() | |||
561 | 541 | ||
562 | if ( !hover_parcel->getAllowTerraform() ) | 542 | if ( !hover_parcel->getAllowTerraform() ) |
563 | { | 543 | { |
564 | if (words) line->append(", "); | 544 | if (words) line.append(", "); |
565 | line->append("No Edit"); | 545 | line.append("No Edit"); |
566 | words++; | 546 | words++; |
567 | } | 547 | } |
568 | 548 | ||
569 | if ( hover_parcel->getAllowDamage() ) | 549 | if ( hover_parcel->getAllowDamage() ) |
570 | { | 550 | { |
571 | if (words) line->append(", "); | 551 | if (words) line.append(", "); |
572 | line->append("Not Safe"); | 552 | line.append("Not Safe"); |
573 | words++; | 553 | words++; |
574 | } | 554 | } |
575 | 555 | ||
576 | // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04 | 556 | // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04 |
577 | if ( !hover_parcel->getAllowFly() ) | 557 | if ( !hover_parcel->getAllowFly() ) |
578 | { | 558 | { |
579 | if (words) line->append(", "); | 559 | if (words) line.append(", "); |
580 | line->append("No Fly"); | 560 | line.append("No Fly"); |
581 | words++; | 561 | words++; |
582 | } | 562 | } |
583 | 563 | ||
584 | if ( !hover_parcel->getAllowOtherScripts() ) | 564 | if ( !hover_parcel->getAllowOtherScripts() ) |
585 | { | 565 | { |
586 | if (words) line->append(", "); | 566 | if (words) line.append(", "); |
587 | if ( hover_parcel->getAllowGroupScripts() ) | 567 | if ( hover_parcel->getAllowGroupScripts() ) |
588 | { | 568 | { |
589 | line->append("Group Scripts"); | 569 | line.append("Group Scripts"); |
590 | } | 570 | } |
591 | else | 571 | else |
592 | { | 572 | { |
593 | line->append("No Scripts"); | 573 | line.append("No Scripts"); |
594 | } | 574 | } |
595 | 575 | ||
596 | words++; | 576 | words++; |
@@ -598,12 +578,7 @@ void LLHoverView::updateText() | |||
598 | 578 | ||
599 | if (words) | 579 | if (words) |
600 | { | 580 | { |
601 | mText.addDataAtEnd(line); | 581 | mText.push_back(line); |
602 | } | ||
603 | else | ||
604 | { | ||
605 | delete line; | ||
606 | line = NULL; | ||
607 | } | 582 | } |
608 | } | 583 | } |
609 | 584 | ||
@@ -612,21 +587,14 @@ void LLHoverView::updateText() | |||
612 | /* | 587 | /* |
613 | if ( hover_parcel && LLUUID::null != owner) | 588 | if ( hover_parcel && LLUUID::null != owner) |
614 | { | 589 | { |
615 | line = new LLString(); | 590 | line = llformat("Size: %dx%d", width, height ); |
616 | mText.addDataAtEnd(line); | 591 | mText.push_back(line); |
617 | |||
618 | char buffer[MAX_STRING]; | ||
619 | sprintf(buffer, "Size: %dx%d", width, height ); | ||
620 | line->append(buffer); | ||
621 | } | 592 | } |
622 | */ | 593 | */ |
623 | if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE)) | 594 | if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE)) |
624 | { | 595 | { |
625 | char buffer[MAX_STRING]; /*Flawfinder: ignore*/ | 596 | line = llformat("For Sale: L$%d", hover_parcel->getSalePrice() ); |
626 | snprintf(buffer, sizeof(buffer), "For Sale: L$%d", hover_parcel->getSalePrice() ); /* Flawfinder: ignore */ | 597 | mText.push_back(line); |
627 | |||
628 | line = new LLString(buffer); | ||
629 | mText.addDataAtEnd(line); | ||
630 | } | 598 | } |
631 | } | 599 | } |
632 | } | 600 | } |
@@ -683,7 +651,7 @@ void LLHoverView::draw() | |||
683 | } | 651 | } |
684 | 652 | ||
685 | // Bail out if no text to display | 653 | // Bail out if no text to display |
686 | if (mText.isEmpty()) | 654 | if (mText.empty()) |
687 | { | 655 | { |
688 | return; | 656 | return; |
689 | } | 657 | } |
@@ -711,11 +679,10 @@ void LLHoverView::draw() | |||
711 | //bg_color.mV[VALPHA] = alpha; | 679 | //bg_color.mV[VALPHA] = alpha; |
712 | 680 | ||
713 | S32 max_width = 0; | 681 | S32 max_width = 0; |
714 | S32 num_lines = mText.getLength(); | 682 | S32 num_lines = mText.size(); |
715 | LLString *cur_stringp; | 683 | for (text_list_t::iterator iter = mText.begin(); iter != mText.end(); ++iter) |
716 | for (cur_stringp = mText.getFirstData(); cur_stringp; cur_stringp = mText.getNextData()) | ||
717 | { | 684 | { |
718 | max_width = llmax(max_width, (S32)fontp->getWidth(*cur_stringp)); | 685 | max_width = llmax(max_width, (S32)fontp->getWidth(*iter)); |
719 | } | 686 | } |
720 | 687 | ||
721 | S32 left = mHoverPos.mX + 10; | 688 | S32 left = mHoverPos.mX + 10; |
@@ -734,32 +701,32 @@ void LLHoverView::draw() | |||
734 | } | 701 | } |
735 | 702 | ||
736 | // Make sure the rect is completely visible | 703 | // Make sure the rect is completely visible |
737 | LLRect old_rect = mRect; | 704 | LLRect old_rect = getRect(); |
738 | mRect.set( left, top, right, bottom ); | 705 | setRect( LLRect(left, top, right, bottom ) ); |
739 | translateIntoRect( gViewerWindow->getVirtualWindowRect(), FALSE ); | 706 | translateIntoRect( gViewerWindow->getVirtualWindowRect(), FALSE ); |
740 | left = mRect.mLeft; | 707 | left = getRect().mLeft; |
741 | top = mRect.mTop; | 708 | top = getRect().mTop; |
742 | right = mRect.mRight; | 709 | right = getRect().mRight; |
743 | bottom = mRect.mBottom; | 710 | bottom = getRect().mBottom; |
744 | mRect = old_rect; | 711 | setRect(old_rect); |
745 | 712 | ||
746 | LLGLSUIDefault gls_ui; | 713 | LLGLSUIDefault gls_ui; |
747 | 714 | ||
748 | shadow_color.mV[VALPHA] = 0.7f * alpha; | 715 | shadow_color.mV[VALPHA] = 0.7f * alpha; |
749 | S32 shadow_offset = gSavedSettings.getS32("DropShadowTooltip"); | 716 | S32 shadow_offset = gSavedSettings.getS32("DropShadowTooltip"); |
750 | glColor4fv(shadow_color.mV); | 717 | gGL.color4fv(shadow_color.mV); |
751 | LLViewerImage::bindTexture(shadow_imagep); | 718 | LLViewerImage::bindTexture(shadow_imagep); |
752 | gl_segmented_rect_2d_tex(left + shadow_offset, top - shadow_offset, right + shadow_offset, bottom - shadow_offset, shadow_imagep->getWidth(), shadow_imagep->getHeight(), 16); | 719 | gl_segmented_rect_2d_tex(left + shadow_offset, top - shadow_offset, right + shadow_offset, bottom - shadow_offset, shadow_imagep->getWidth(), shadow_imagep->getHeight(), 16); |
753 | 720 | ||
754 | bg_color.mV[VALPHA] = alpha; | 721 | bg_color.mV[VALPHA] = alpha; |
755 | glColor4fv(bg_color.mV); | 722 | gGL.color4fv(bg_color.mV); |
756 | LLViewerImage::bindTexture(box_imagep); | 723 | LLViewerImage::bindTexture(box_imagep); |
757 | gl_segmented_rect_2d_tex(left, top, right, bottom, box_imagep->getWidth(), box_imagep->getHeight(), 16); | 724 | gl_segmented_rect_2d_tex(left, top, right, bottom, box_imagep->getWidth(), box_imagep->getHeight(), 16); |
758 | 725 | ||
759 | S32 cur_offset = top - 4; | 726 | S32 cur_offset = top - 4; |
760 | for (cur_stringp = mText.getFirstData(); cur_stringp; cur_stringp = mText.getNextData()) | 727 | for (text_list_t::iterator iter = mText.begin(); iter != mText.end(); ++iter) |
761 | { | 728 | { |
762 | fontp->renderUTF8(*cur_stringp, 0, left + 10, cur_offset, text_color, LLFontGL::LEFT, LLFontGL::TOP); | 729 | fontp->renderUTF8(*iter, 0, left + 10, cur_offset, text_color, LLFontGL::LEFT, LLFontGL::TOP); |
763 | cur_offset -= llfloor(fontp->getLineHeight()); | 730 | cur_offset -= llfloor(fontp->getLineHeight()); |
764 | } | 731 | } |
765 | } | 732 | } |