aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewertexteditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewertexteditor.cpp')
-rw-r--r--linden/indra/newview/llviewertexteditor.cpp96
1 files changed, 46 insertions, 50 deletions
diff --git a/linden/indra/newview/llviewertexteditor.cpp b/linden/indra/newview/llviewertexteditor.cpp
index b421c73..fcc73b4 100644
--- a/linden/indra/newview/llviewertexteditor.cpp
+++ b/linden/indra/newview/llviewertexteditor.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -606,54 +606,50 @@ void LLViewerTextEditor::makePristine()
606 606
607BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen) 607BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen)
608{ 608{
609 if (pointInView(x, y) && getVisible()) 609 for (child_list_const_iter_t child_iter = getChildList()->begin();
610 child_iter != getChildList()->end(); ++child_iter)
610 { 611 {
611 for (child_list_const_iter_t child_iter = getChildList()->begin(); 612 LLView *viewp = *child_iter;
612 child_iter != getChildList()->end(); ++child_iter) 613 S32 local_x = x - viewp->getRect().mLeft;
614 S32 local_y = y - viewp->getRect().mBottom;
615 if( viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen ) )
613 { 616 {
614 LLView *viewp = *child_iter; 617 return TRUE;
615 S32 local_x = x - viewp->getRect().mLeft;
616 S32 local_y = y - viewp->getRect().mBottom;
617 if( viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen ) )
618 {
619 return TRUE;
620 }
621 } 618 }
619 }
620
621 if( mSegments.empty() )
622 {
623 return TRUE;
624 }
622 625
623 if( mSegments.empty() ) 626 LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
627 if( cur_segment )
628 {
629 BOOL has_tool_tip = FALSE;
630 if( cur_segment->getStyle().getIsEmbeddedItem() )
624 { 631 {
625 return TRUE; 632 LLWString wtip;
633 has_tool_tip = getEmbeddedItemToolTipAtPos(cur_segment->getStart(), wtip);
634 msg = wstring_to_utf8str(wtip);
626 } 635 }
627 636 else
628 LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
629 if( cur_segment )
630 { 637 {
631 BOOL has_tool_tip = FALSE; 638 has_tool_tip = cur_segment->getToolTip( msg );
632 if( cur_segment->getStyle().getIsEmbeddedItem() ) 639 }
633 { 640 if( has_tool_tip )
634 LLWString wtip; 641 {
635 has_tool_tip = getEmbeddedItemToolTipAtPos(cur_segment->getStart(), wtip); 642 // Just use a slop area around the cursor
636 msg = wstring_to_utf8str(wtip); 643 // Convert rect local to screen coordinates
637 } 644 S32 SLOP = 8;
638 else 645 localPointToScreen(
639 { 646 x - SLOP, y - SLOP,
640 has_tool_tip = cur_segment->getToolTip( msg ); 647 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
641 } 648 sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
642 if( has_tool_tip ) 649 sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
643 {
644 // Just use a slop area around the cursor
645 // Convert rect local to screen coordinates
646 S32 SLOP = 8;
647 localPointToScreen(
648 x - SLOP, y - SLOP,
649 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
650 sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
651 sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
652 }
653 } 650 }
654 return TRUE;
655 } 651 }
656 return FALSE; 652 return TRUE;
657} 653}
658 654
659BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) 655BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -760,9 +756,9 @@ BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
760 handled = TRUE; 756 handled = TRUE;
761 } 757 }
762 758
763 if (mTakesFocus) 759 if (hasTabStop())
764 { 760 {
765 setFocus( TRUE ); 761 setFocus(TRUE);
766 handled = TRUE; 762 handled = TRUE;
767 } 763 }
768 764
@@ -1017,11 +1013,7 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
1017 } 1013 }
1018 } 1014 }
1019 1015
1020 if (mTakesFocus) 1016
1021 {
1022 setFocus( TRUE );
1023 }
1024
1025 setCursorAtLocalPos( x, y, FALSE ); 1017 setCursorAtLocalPos( x, y, FALSE );
1026 deselect(); 1018 deselect();
1027 1019
@@ -1363,7 +1355,11 @@ BOOL LLViewerTextEditor::openEmbeddedItem(LLInventoryItem* item, BOOL saved)
1363void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item ) 1355void LLViewerTextEditor::openEmbeddedTexture( LLInventoryItem* item )
1364{ 1356{
1365 // See if we can bring an existing preview to the front 1357 // See if we can bring an existing preview to the front
1366 if( !LLPreview::show( item->getUUID() ) ) 1358 // *NOTE: Just for embedded Texture , we should use getAssetUUID(),
1359 // not getUUID(), because LLPreviewTexture pass in AssetUUID into
1360 // LLPreview constructor ItemUUID parameter.
1361
1362 if( !LLPreview::show( item->getAssetUUID() ) )
1367 { 1363 {
1368 // There isn't one, so make a new preview 1364 // There isn't one, so make a new preview
1369 if(item) 1365 if(item)
@@ -1391,7 +1387,7 @@ void LLViewerTextEditor::openEmbeddedSound( LLInventoryItem* item )
1391 const F32 SOUND_GAIN = 1.0f; 1387 const F32 SOUND_GAIN = 1.0f;
1392 if(gAudiop) 1388 if(gAudiop)
1393 { 1389 {
1394 F32 volume = SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX"); 1390 F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (SOUND_GAIN * gSavedSettings.getF32("AudioLevelSFX"));
1395 gAudiop->triggerSound(item->getAssetUUID(), gAgentID, volume, lpos_global); 1391 gAudiop->triggerSound(item->getAssetUUID(), gAgentID, volume, lpos_global);
1396 } 1392 }
1397 showCopyToInvDialog( item ); 1393 showCopyToInvDialog( item );