diff options
author | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
commit | e4b0e7c82d670081c071d8a3da31b5ec407b8e07 (patch) | |
tree | 9410962bbb582eedbec448139e217f2714050777 /linden/indra/newview/llviewerwindow.cpp | |
parent | Started 1.3.0 branch (diff) | |
parent | Updated and added some Linux libs. (diff) | |
download | meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.zip meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.gz meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.bz2 meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.xz |
Merged working branch of 1.2 into LL 1.23 merge
Diffstat (limited to 'linden/indra/newview/llviewerwindow.cpp')
-rw-r--r-- | linden/indra/newview/llviewerwindow.cpp | 586 |
1 files changed, 179 insertions, 407 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index c0e4fed..022515a 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp | |||
@@ -589,19 +589,42 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh) | |||
589 | return false; | 589 | return false; |
590 | } | 590 | } |
591 | 591 | ||
592 | BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) | 592 | BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) |
593 | { | 593 | { |
594 | std::string buttonname; | ||
595 | std::string buttonstatestr; | ||
596 | BOOL handled = FALSE; | ||
594 | S32 x = pos.mX; | 597 | S32 x = pos.mX; |
595 | S32 y = pos.mY; | 598 | S32 y = pos.mY; |
596 | x = llround((F32)x / mDisplayScale.mV[VX]); | 599 | x = llround((F32)x / mDisplayScale.mV[VX]); |
597 | y = llround((F32)y / mDisplayScale.mV[VY]); | 600 | y = llround((F32)y / mDisplayScale.mV[VY]); |
598 | 601 | ||
599 | LLView::sMouseHandlerMessage.clear(); | 602 | if (down) |
600 | 603 | buttonstatestr = "down" ; | |
601 | if (gDebugClicks) | 604 | else |
605 | buttonstatestr = "up" ; | ||
606 | |||
607 | switch (clicktype) | ||
602 | { | 608 | { |
603 | llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; | 609 | case LLMouseHandler::CLICK_LEFT: |
610 | mLeftMouseDown = down; | ||
611 | buttonname = "Left"; | ||
612 | break; | ||
613 | case LLMouseHandler::CLICK_RIGHT: | ||
614 | mRightMouseDown = down; | ||
615 | buttonname = "Right"; | ||
616 | break; | ||
617 | case LLMouseHandler::CLICK_MIDDLE: | ||
618 | mMiddleMouseDown = down; | ||
619 | buttonname = "Middle"; | ||
620 | break; | ||
621 | case LLMouseHandler::CLICK_DOUBLELEFT: | ||
622 | mLeftMouseDown = down; | ||
623 | buttonname = "Left Double Click"; | ||
624 | break; | ||
604 | } | 625 | } |
626 | |||
627 | LLView::sMouseHandlerMessage.clear(); | ||
605 | 628 | ||
606 | if (gMenuBarView) | 629 | if (gMenuBarView) |
607 | { | 630 | { |
@@ -609,18 +632,28 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask | |||
609 | gMenuBarView->resetMenuTrigger(); | 632 | gMenuBarView->resetMenuTrigger(); |
610 | } | 633 | } |
611 | 634 | ||
612 | mLeftMouseDown = TRUE; | 635 | if (gDebugClicks) |
636 | { | ||
637 | llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; | ||
638 | } | ||
613 | 639 | ||
614 | // Make sure we get a coresponding mouseup event, even if the mouse leaves the window | 640 | // Make sure we get a coresponding mouseup event, even if the mouse leaves the window |
615 | mWindow->captureMouse(); | 641 | if (down) |
642 | { | ||
643 | mWindow->captureMouse(); | ||
644 | } | ||
645 | else | ||
646 | { | ||
647 | mWindow->releaseMouse(); | ||
648 | } | ||
616 | 649 | ||
617 | // Indicate mouse was active | 650 | // Indicate mouse was active |
618 | gMouseIdleTimer.reset(); | 651 | gMouseIdleTimer.reset(); |
619 | 652 | ||
620 | // Hide tooltips on mousedown | 653 | // Hide tooltips on mousedown |
621 | mToolTipBlocked = TRUE; | 654 | mToolTipBlocked = down; |
622 | 655 | ||
623 | // Also hide hover info on mousedown | 656 | // Also hide hover info on mousedown/mouseup |
624 | if (gHoverView) | 657 | if (gHoverView) |
625 | { | 658 | { |
626 | gHoverView->cancelHover(); | 659 | gHoverView->cancelHover(); |
@@ -629,7 +662,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask | |||
629 | // Don't let the user move the mouse out of the window until mouse up. | 662 | // Don't let the user move the mouse out of the window until mouse up. |
630 | if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) | 663 | if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) |
631 | { | 664 | { |
632 | mWindow->setMouseClipping(TRUE); | 665 | mWindow->setMouseClipping(down); |
633 | } | 666 | } |
634 | 667 | ||
635 | LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); | 668 | LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); |
@@ -640,10 +673,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask | |||
640 | mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); | 673 | mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); |
641 | if (LLView::sDebugMouseHandling) | 674 | if (LLView::sDebugMouseHandling) |
642 | { | 675 | { |
643 | llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; | 676 | llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl; |
644 | } | 677 | } |
645 | 678 | return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); | |
646 | return mouse_captor->handleMouseDown(local_x, local_y, mask); | ||
647 | } | 679 | } |
648 | 680 | ||
649 | // Topmost view gets a chance before the hierarchy | 681 | // Topmost view gets a chance before the hierarchy |
@@ -652,215 +684,95 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask | |||
652 | { | 684 | { |
653 | S32 local_x, local_y; | 685 | S32 local_x, local_y; |
654 | top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); | 686 | top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); |
655 | if (top_ctrl->pointInView(local_x, local_y)) | 687 | if (down) |
656 | { | 688 | { |
657 | return top_ctrl->handleMouseDown(local_x, local_y, mask); | 689 | if (top_ctrl->pointInView(local_x, local_y)) |
658 | } | 690 | { |
659 | else | 691 | return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ; |
660 | { | 692 | } |
661 | gFocusMgr.setTopCtrl(NULL); | 693 | else |
694 | { | ||
695 | gFocusMgr.setTopCtrl(NULL); | ||
696 | } | ||
662 | } | 697 | } |
663 | } | 698 | else |
699 | handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); | ||
700 | |||
664 | 701 | ||
702 | } | ||
665 | // Give the UI views a chance to process the click | 703 | // Give the UI views a chance to process the click |
666 | if( mRootView->handleMouseDown(x, y, mask) ) | 704 | if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) ) |
667 | { | 705 | { |
668 | if (LLView::sDebugMouseHandling) | 706 | if (LLView::sDebugMouseHandling) |
669 | { | 707 | { |
670 | llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; | 708 | llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl; |
671 | } | 709 | } |
672 | return TRUE; | 710 | return TRUE; |
673 | } | 711 | } |
674 | else if (LLView::sDebugMouseHandling) | 712 | else if (LLView::sDebugMouseHandling) |
675 | { | 713 | { |
676 | llinfos << "Left Mouse Down not handled by view" << llendl; | 714 | llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl; |
677 | } | 715 | } |
678 | 716 | if (down) | |
679 | if (gDisconnected) | ||
680 | { | 717 | { |
681 | return FALSE; | 718 | if (gDisconnected) |
682 | } | ||
683 | |||
684 | if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) ) | ||
685 | { | ||
686 | // This is necessary to force clicks in the world to cause edit | ||
687 | // boxes that might have keyboard focus to relinquish it, and hence | ||
688 | // cause a commit to update their value. JC | ||
689 | gFocusMgr.setKeyboardFocus(NULL); | ||
690 | return TRUE; | ||
691 | } | ||
692 | |||
693 | return FALSE; | ||
694 | } | ||
695 | |||
696 | BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) | ||
697 | { | ||
698 | S32 x = pos.mX; | ||
699 | S32 y = pos.mY; | ||
700 | x = llround((F32)x / mDisplayScale.mV[VX]); | ||
701 | y = llround((F32)y / mDisplayScale.mV[VY]); | ||
702 | |||
703 | LLView::sMouseHandlerMessage.clear(); | ||
704 | |||
705 | if (gDebugClicks) | ||
706 | { | ||
707 | llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl; | ||
708 | } | ||
709 | |||
710 | mLeftMouseDown = TRUE; | ||
711 | |||
712 | // Hide tooltips | ||
713 | if( mToolTip ) | ||
714 | { | ||
715 | mToolTip->setVisible( FALSE ); | ||
716 | } | ||
717 | |||
718 | LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); | ||
719 | if( mouse_captor ) | ||
720 | { | ||
721 | S32 local_x; | ||
722 | S32 local_y; | ||
723 | mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); | ||
724 | if (LLView::sDebugMouseHandling) | ||
725 | { | 719 | { |
726 | llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; | 720 | return FALSE; |
727 | } | ||
728 | |||
729 | return mouse_captor->handleDoubleClick(local_x, local_y, mask); | ||
730 | } | ||
731 | |||
732 | // Check for hit on UI. | ||
733 | LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); | ||
734 | if (top_ctrl) | ||
735 | { | ||
736 | S32 local_x, local_y; | ||
737 | top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); | ||
738 | if (top_ctrl->pointInView(local_x, local_y)) | ||
739 | { | ||
740 | return top_ctrl->handleDoubleClick(local_x, local_y, mask); | ||
741 | } | 721 | } |
742 | else | 722 | |
723 | if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) ) | ||
743 | { | 724 | { |
744 | gFocusMgr.setTopCtrl(NULL); | 725 | // This is necessary to force clicks in the world to cause edit |
726 | // boxes that might have keyboard focus to relinquish it, and hence | ||
727 | // cause a commit to update their value. JC | ||
728 | gFocusMgr.setKeyboardFocus(NULL); | ||
729 | return TRUE; | ||
745 | } | 730 | } |
746 | } | 731 | } |
747 | 732 | else | |
748 | if (mRootView->handleDoubleClick(x, y, mask)) | ||
749 | { | 733 | { |
750 | if (LLView::sDebugMouseHandling) | 734 | |
735 | mWindow->releaseMouse(); | ||
736 | |||
737 | LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); | ||
738 | if( !handled ) | ||
751 | { | 739 | { |
752 | llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; | 740 | handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down); |
741 | } | ||
742 | |||
743 | |||
744 | |||
745 | if( !handled ) | ||
746 | { | ||
747 | if (tool) | ||
748 | { | ||
749 | handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down); | ||
750 | } | ||
753 | } | 751 | } |
754 | return TRUE; | ||
755 | } | ||
756 | else if (LLView::sDebugMouseHandling) | ||
757 | { | ||
758 | llinfos << "Left Mouse Down not handled by view" << llendl; | ||
759 | } | 752 | } |
760 | 753 | ||
761 | // Why is this here? JC 9/3/2002 | 754 | return (!down); |
762 | if (gNoRender) | 755 | } |
763 | { | ||
764 | return TRUE; | ||
765 | } | ||
766 | 756 | ||
767 | if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) | 757 | BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) |
768 | { | 758 | { |
769 | return TRUE; | 759 | BOOL down = TRUE; |
770 | } | 760 | return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); |
761 | } | ||
771 | 762 | ||
772 | // if we got this far and nothing handled a double click, pass a normal mouse down | 763 | BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask) |
773 | return handleMouseDown(window, pos, mask); | 764 | { |
765 | // try handling as a double-click first, then a single-click if that | ||
766 | // wasn't handled. | ||
767 | BOOL down = TRUE; | ||
768 | return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) || | ||
769 | handleMouseDown(window, pos, mask); | ||
774 | } | 770 | } |
775 | 771 | ||
776 | BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) | 772 | BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) |
777 | { | 773 | { |
778 | S32 x = pos.mX; | 774 | BOOL down = FALSE; |
779 | S32 y = pos.mY; | 775 | return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); |
780 | x = llround((F32)x / mDisplayScale.mV[VX]); | ||
781 | y = llround((F32)y / mDisplayScale.mV[VY]); | ||
782 | |||
783 | LLView::sMouseHandlerMessage.clear(); | ||
784 | |||
785 | if (gDebugClicks) | ||
786 | { | ||
787 | llinfos << "ViewerWindow left mouse up" << llendl; | ||
788 | } | ||
789 | |||
790 | mLeftMouseDown = FALSE; | ||
791 | |||
792 | // Indicate mouse was active | ||
793 | gMouseIdleTimer.reset(); | ||
794 | |||
795 | // Hide tooltips on mouseup | ||
796 | if( mToolTip ) | ||
797 | { | ||
798 | mToolTip->setVisible( FALSE ); | ||
799 | } | ||
800 | |||
801 | // Also hide hover info on mouseup | ||
802 | if (gHoverView) gHoverView->cancelHover(); | ||
803 | |||
804 | BOOL handled = FALSE; | ||
805 | |||
806 | mWindow->releaseMouse(); | ||
807 | |||
808 | LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); | ||
809 | |||
810 | if( tool->clipMouseWhenDown() ) | ||
811 | { | ||
812 | mWindow->setMouseClipping(FALSE); | ||
813 | } | ||
814 | |||
815 | LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); | ||
816 | if( mouse_captor ) | ||
817 | { | ||
818 | S32 local_x; | ||
819 | S32 local_y; | ||
820 | mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); | ||
821 | if (LLView::sDebugMouseHandling) | ||
822 | { | ||
823 | llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl; | ||
824 | } | ||
825 | |||
826 | return mouse_captor->handleMouseUp(local_x, local_y, mask); | ||
827 | } | ||
828 | |||
829 | LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); | ||
830 | if (top_ctrl) | ||
831 | { | ||
832 | S32 local_x, local_y; | ||
833 | top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); | ||
834 | handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); | ||
835 | } | ||
836 | |||
837 | if( !handled ) | ||
838 | { | ||
839 | handled = mRootView->handleMouseUp(x, y, mask); | ||
840 | } | ||
841 | |||
842 | if (LLView::sDebugMouseHandling) | ||
843 | { | ||
844 | if (handled) | ||
845 | { | ||
846 | llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl; | ||
847 | } | ||
848 | else | ||
849 | { | ||
850 | llinfos << "Left Mouse Up not handled by view" << llendl; | ||
851 | } | ||
852 | } | ||
853 | |||
854 | if( !handled ) | ||
855 | { | ||
856 | if (tool) | ||
857 | { | ||
858 | handled = tool->handleMouseUp(x, y, mask); | ||
859 | } | ||
860 | } | ||
861 | |||
862 | // Always handled as far as the OS is concerned. | ||
863 | return TRUE; | ||
864 | } | 776 | } |
865 | 777 | ||
866 | 778 | ||
@@ -871,91 +783,10 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK | |||
871 | x = llround((F32)x / mDisplayScale.mV[VX]); | 783 | x = llround((F32)x / mDisplayScale.mV[VX]); |
872 | y = llround((F32)y / mDisplayScale.mV[VY]); | 784 | y = llround((F32)y / mDisplayScale.mV[VY]); |
873 | 785 | ||
874 | LLView::sMouseHandlerMessage.clear(); | 786 | BOOL down = TRUE; |
875 | 787 | BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); | |
876 | if (gDebugClicks) | 788 | if (handle) |
877 | { | 789 | return handle; |
878 | llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; | ||
879 | } | ||
880 | |||
881 | if (gMenuBarView) | ||
882 | { | ||
883 | // stop ALT-key access to menu | ||
884 | gMenuBarView->resetMenuTrigger(); | ||
885 | } | ||
886 | |||
887 | mRightMouseDown = TRUE; | ||
888 | |||
889 | // Make sure we get a coresponding mouseup event, even if the mouse leaves the window | ||
890 | mWindow->captureMouse(); | ||
891 | |||
892 | // Hide tooltips | ||
893 | if( mToolTip ) | ||
894 | { | ||
895 | mToolTip->setVisible( FALSE ); | ||
896 | } | ||
897 | |||
898 | // Also hide hover info on mousedown | ||
899 | if (gHoverView) | ||
900 | { | ||
901 | gHoverView->cancelHover(); | ||
902 | } | ||
903 | |||
904 | // Don't let the user move the mouse out of the window until mouse up. | ||
905 | if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) | ||
906 | { | ||
907 | mWindow->setMouseClipping(TRUE); | ||
908 | } | ||
909 | |||
910 | LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); | ||
911 | if( mouse_captor ) | ||
912 | { | ||
913 | S32 local_x; | ||
914 | S32 local_y; | ||
915 | mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); | ||
916 | if (LLView::sDebugMouseHandling) | ||
917 | { | ||
918 | llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl; | ||
919 | } | ||
920 | return mouse_captor->handleRightMouseDown(local_x, local_y, mask); | ||
921 | } | ||
922 | |||
923 | LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); | ||
924 | if (top_ctrl) | ||
925 | { | ||
926 | S32 local_x, local_y; | ||
927 | top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); | ||
928 | if (top_ctrl->pointInView(local_x, local_y)) | ||
929 | { | ||
930 | return top_ctrl->handleRightMouseDown(local_x, local_y, mask); | ||
931 | } | ||
932 | else | ||
933 | { | ||
934 | gFocusMgr.setTopCtrl(NULL); | ||
935 | } | ||
936 | } | ||
937 | |||
938 | if( mRootView->handleRightMouseDown(x, y, mask) ) | ||
939 | { | ||
940 | if (LLView::sDebugMouseHandling) | ||
941 | { | ||
942 | llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl; | ||
943 | } | ||
944 | return TRUE; | ||
945 | } | ||
946 | else if (LLView::sDebugMouseHandling) | ||
947 | { | ||
948 | llinfos << "Right Mouse Down not handled by view" << llendl; | ||
949 | } | ||
950 | |||
951 | if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) | ||
952 | { | ||
953 | // This is necessary to force clicks in the world to cause edit | ||
954 | // boxes that might have keyboard focus to relinquish it, and hence | ||
955 | // cause a commit to update their value. JC | ||
956 | gFocusMgr.setKeyboardFocus(NULL); | ||
957 | return TRUE; | ||
958 | } | ||
959 | 790 | ||
960 | // *HACK: this should be rolled into the composite tool logic, not | 791 | // *HACK: this should be rolled into the composite tool logic, not |
961 | // hardcoded at the top level. | 792 | // hardcoded at the top level. |
@@ -973,107 +804,27 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK | |||
973 | 804 | ||
974 | BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) | 805 | BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) |
975 | { | 806 | { |
976 | S32 x = pos.mX; | 807 | BOOL down = FALSE; |
977 | S32 y = pos.mY; | 808 | return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); |
978 | x = llround((F32)x / mDisplayScale.mV[VX]); | ||
979 | y = llround((F32)y / mDisplayScale.mV[VY]); | ||
980 | |||
981 | LLView::sMouseHandlerMessage.clear(); | ||
982 | |||
983 | // Don't care about caps lock for mouse events. | ||
984 | if (gDebugClicks) | ||
985 | { | ||
986 | llinfos << "ViewerWindow right mouse up" << llendl; | ||
987 | } | ||
988 | |||
989 | mRightMouseDown = FALSE; | ||
990 | |||
991 | // Indicate mouse was active | ||
992 | gMouseIdleTimer.reset(); | ||
993 | |||
994 | // Hide tooltips on mouseup | ||
995 | if( mToolTip ) | ||
996 | { | ||
997 | mToolTip->setVisible( FALSE ); | ||
998 | } | ||
999 | |||
1000 | // Also hide hover info on mouseup | ||
1001 | if (gHoverView) gHoverView->cancelHover(); | ||
1002 | |||
1003 | BOOL handled = FALSE; | ||
1004 | |||
1005 | mWindow->releaseMouse(); | ||
1006 | |||
1007 | LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); | ||
1008 | |||
1009 | if( tool->clipMouseWhenDown() ) | ||
1010 | { | ||
1011 | mWindow->setMouseClipping(FALSE); | ||
1012 | } | ||
1013 | |||
1014 | LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); | ||
1015 | if( mouse_captor ) | ||
1016 | { | ||
1017 | S32 local_x; | ||
1018 | S32 local_y; | ||
1019 | mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); | ||
1020 | if (LLView::sDebugMouseHandling) | ||
1021 | { | ||
1022 | llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl; | ||
1023 | } | ||
1024 | return mouse_captor->handleRightMouseUp(local_x, local_y, mask); | ||
1025 | } | ||
1026 | |||
1027 | LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); | ||
1028 | if (top_ctrl) | ||
1029 | { | ||
1030 | S32 local_x, local_y; | ||
1031 | top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); | ||
1032 | handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask); | ||
1033 | } | ||
1034 | |||
1035 | if( !handled ) | ||
1036 | { | ||
1037 | handled = mRootView->handleRightMouseUp(x, y, mask); | ||
1038 | } | ||
1039 | |||
1040 | if (LLView::sDebugMouseHandling) | ||
1041 | { | ||
1042 | if (handled) | ||
1043 | { | ||
1044 | llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl; | ||
1045 | } | ||
1046 | else | ||
1047 | { | ||
1048 | llinfos << "Right Mouse Up not handled by view" << llendl; | ||
1049 | } | ||
1050 | } | ||
1051 | |||
1052 | if( !handled ) | ||
1053 | { | ||
1054 | if (tool) | ||
1055 | { | ||
1056 | handled = tool->handleRightMouseUp(x, y, mask); | ||
1057 | } | ||
1058 | } | ||
1059 | |||
1060 | // Always handled as far as the OS is concerned. | ||
1061 | return TRUE; | ||
1062 | } | 809 | } |
1063 | 810 | ||
1064 | BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) | 811 | BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) |
1065 | { | 812 | { |
813 | BOOL down = TRUE; | ||
1066 | gVoiceClient->middleMouseState(true); | 814 | gVoiceClient->middleMouseState(true); |
1067 | 815 | handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); | |
1068 | // Always handled as far as the OS is concerned. | 816 | |
817 | // Always handled as far as the OS is concerned. | ||
1069 | return TRUE; | 818 | return TRUE; |
1070 | } | 819 | } |
1071 | 820 | ||
1072 | BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) | 821 | BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) |
1073 | { | 822 | { |
823 | BOOL down = FALSE; | ||
1074 | gVoiceClient->middleMouseState(false); | 824 | gVoiceClient->middleMouseState(false); |
1075 | 825 | handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); | |
1076 | // Always handled as far as the OS is concerned. | 826 | |
827 | // Always handled as far as the OS is concerned. | ||
1077 | return TRUE; | 828 | return TRUE; |
1078 | } | 829 | } |
1079 | 830 | ||
@@ -1447,6 +1198,7 @@ LLViewerWindow::LLViewerWindow( | |||
1447 | mWindowRect(0, height, width, 0), | 1198 | mWindowRect(0, height, width, 0), |
1448 | mVirtualWindowRect(0, height, width, 0), | 1199 | mVirtualWindowRect(0, height, width, 0), |
1449 | mLeftMouseDown(FALSE), | 1200 | mLeftMouseDown(FALSE), |
1201 | mMiddleMouseDown(FALSE), | ||
1450 | mRightMouseDown(FALSE), | 1202 | mRightMouseDown(FALSE), |
1451 | mToolTip(NULL), | 1203 | mToolTip(NULL), |
1452 | mToolTipBlocked(FALSE), | 1204 | mToolTipBlocked(FALSE), |
@@ -1887,69 +1639,82 @@ void LLViewerWindow::initWorldUI() | |||
1887 | S32 width = mRootView->getRect().getWidth(); | 1639 | S32 width = mRootView->getRect().getWidth(); |
1888 | LLRect full_window(0, height, width, 0); | 1640 | LLRect full_window(0, height, width, 0); |
1889 | 1641 | ||
1890 | if ( gBottomPanel == NULL ) // Don't re-enter if objects are alreay created | 1642 | if (gBottomPanel) |
1891 | { | 1643 | mRootView->removeChild(gBottomPanel, TRUE); |
1892 | // panel containing chatbar, toolbar, and overlay, over floaters | 1644 | // panel containing chatbar, toolbar, and overlay, over floaters |
1893 | gBottomPanel = new LLBottomPanel(mRootView->getRect()); | 1645 | gBottomPanel = new LLBottomPanel(mRootView->getRect()); |
1894 | mRootView->addChild(gBottomPanel); | 1646 | mRootView->addChild(gBottomPanel); |
1895 | 1647 | ||
1896 | // View for hover information | 1648 | if (gHoverView) |
1897 | gHoverView = new LLHoverView(std::string("gHoverView"), full_window); | 1649 | mRootView->removeChild(gHoverView, TRUE); |
1898 | gHoverView->setVisible(TRUE); | 1650 | // View for hover information |
1899 | mRootView->addChild(gHoverView); | 1651 | gHoverView = new LLHoverView(std::string("gHoverView"), full_window); |
1652 | gHoverView->setVisible(TRUE); | ||
1653 | mRootView->addChild(gHoverView); | ||
1900 | 1654 | ||
1901 | gIMMgr = LLIMMgr::getInstance(); | 1655 | gIMMgr = LLIMMgr::getInstance(); |
1902 | 1656 | ||
1903 | if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) | 1657 | if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) |
1904 | { | 1658 | { |
1905 | LLFloaterChat::getInstance(LLSD())->loadHistory(); | 1659 | LLFloaterChat::getInstance(LLSD())->loadHistory(); |
1906 | } | 1660 | } |
1907 | 1661 | ||
1908 | LLRect morph_view_rect = full_window; | 1662 | LLRect morph_view_rect = full_window; |
1909 | morph_view_rect.stretch( -STATUS_BAR_HEIGHT ); | 1663 | morph_view_rect.stretch( -STATUS_BAR_HEIGHT ); |
1910 | morph_view_rect.mTop = full_window.mTop - 32; | 1664 | morph_view_rect.mTop = full_window.mTop - 32; |
1911 | gMorphView = new LLMorphView(std::string("gMorphView"), morph_view_rect ); | 1665 | if (gMorphView) |
1912 | mRootView->addChild(gMorphView); | 1666 | mRootView->removeChild(gMorphView, TRUE); |
1913 | gMorphView->setVisible(FALSE); | ||
1914 | 1667 | ||
1915 | // *Note: this is where gFloaterMute used to be initialized. | 1668 | gMorphView = new LLMorphView(std::string("gMorphView"), morph_view_rect ); |
1669 | mRootView->addChild(gMorphView); | ||
1670 | gMorphView->setVisible(FALSE); | ||
1916 | 1671 | ||
1917 | LLWorldMapView::initClass(); | 1672 | // *Note: this is where gFloaterMute used to be initialized. |
1918 | 1673 | ||
1919 | adjust_rect_centered_partial_zoom("FloaterWorldMapRect2", full_window); | 1674 | LLWorldMapView::initClass(); |
1920 | 1675 | ||
1676 | adjust_rect_centered_partial_zoom("FloaterWorldMapRect2", full_window); | ||
1677 | |||
1678 | if (!gFloaterWorldMap) | ||
1679 | { | ||
1921 | gFloaterWorldMap = new LLFloaterWorldMap(); | 1680 | gFloaterWorldMap = new LLFloaterWorldMap(); |
1922 | gFloaterWorldMap->setVisible(FALSE); | 1681 | gFloaterWorldMap->setVisible(FALSE); |
1682 | } | ||
1923 | 1683 | ||
1924 | // | 1684 | // |
1925 | // Tools for building | 1685 | // Tools for building |
1926 | // | 1686 | // |
1927 | |||
1928 | // Toolbox floater | ||
1929 | init_menus(); | ||
1930 | 1687 | ||
1688 | // Toolbox floater | ||
1689 | init_menus(); | ||
1690 | if (!gFloaterTools) | ||
1691 | { | ||
1931 | gFloaterTools = new LLFloaterTools(); | 1692 | gFloaterTools = new LLFloaterTools(); |
1932 | gFloaterTools->setVisible(FALSE); | 1693 | gFloaterTools->setVisible(FALSE); |
1694 | } | ||
1933 | 1695 | ||
1696 | if (!gStatusBar) | ||
1697 | { | ||
1934 | // Status bar | 1698 | // Status bar |
1935 | S32 menu_bar_height = gMenuBarView->getRect().getHeight(); | 1699 | S32 menu_bar_height = gMenuBarView->getRect().getHeight(); |
1936 | LLRect root_rect = getRootView()->getRect(); | 1700 | LLRect root_rect = mRootView->getRect(); |
1937 | LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height); | 1701 | LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height); |
1938 | gStatusBar = new LLStatusBar(std::string("status"), status_rect); | 1702 | gStatusBar = new LLStatusBar(std::string("status"), status_rect); |
1939 | gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); | 1703 | gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); |
1940 | 1704 | ||
1941 | gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); | 1705 | gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); |
1942 | gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight()); | 1706 | gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight()); |
1943 | // sync bg color with menu bar | 1707 | // sync bg color with menu bar |
1944 | gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() ); | 1708 | gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() ); |
1709 | mRootView->addChild(gStatusBar); | ||
1710 | } | ||
1945 | 1711 | ||
1946 | LLFloaterChatterBox::createInstance(LLSD()); | 1712 | LLFloaterChatterBox::createInstance(LLSD()); |
1947 | 1713 | ||
1948 | getRootView()->addChild(gStatusBar); | ||
1949 | 1714 | ||
1950 | // menu holder appears on top to get first pass at all mouse events | 1715 | // menu holder appears on top to get first pass at all mouse events |
1951 | getRootView()->sendChildToFront(gMenuHolder); | 1716 | |
1952 | } | 1717 | mRootView->sendChildToFront(gMenuHolder); |
1953 | } | 1718 | } |
1954 | 1719 | ||
1955 | // Destroy the UI | 1720 | // Destroy the UI |
@@ -3311,6 +3076,16 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, | |||
3311 | { | 3076 | { |
3312 | moveable_object_selected = TRUE; | 3077 | moveable_object_selected = TRUE; |
3313 | this_object_movable = TRUE; | 3078 | this_object_movable = TRUE; |
3079 | |||
3080 | // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0g | ||
3081 | if ( (rlv_handler_t::isEnabled()) && | ||
3082 | ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) | ||
3083 | { | ||
3084 | LLVOAvatar* pAvatar = gAgent.getAvatarObject(); | ||
3085 | if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == object->getRootEdit()) ) | ||
3086 | moveable_object_selected = this_object_movable = FALSE; | ||
3087 | } | ||
3088 | // [/RLVa:KB] | ||
3314 | } | 3089 | } |
3315 | all_selected_objects_move = all_selected_objects_move && this_object_movable; | 3090 | all_selected_objects_move = all_selected_objects_move && this_object_movable; |
3316 | all_selected_objects_modify = all_selected_objects_modify && object->permModify(); | 3091 | all_selected_objects_modify = all_selected_objects_modify && object->permModify(); |
@@ -5151,7 +4926,6 @@ void LLBottomPanel::draw() | |||
5151 | 4926 | ||
5152 | void* LLBottomPanel::createHUD(void* data) | 4927 | void* LLBottomPanel::createHUD(void* data) |
5153 | { | 4928 | { |
5154 | delete gHUDView; | ||
5155 | gHUDView = new LLHUDView(); | 4929 | gHUDView = new LLHUDView(); |
5156 | return gHUDView; | 4930 | return gHUDView; |
5157 | } | 4931 | } |
@@ -5159,14 +4933,12 @@ void* LLBottomPanel::createHUD(void* data) | |||
5159 | 4933 | ||
5160 | void* LLBottomPanel::createOverlayBar(void* data) | 4934 | void* LLBottomPanel::createOverlayBar(void* data) |
5161 | { | 4935 | { |
5162 | delete gOverlayBar; | ||
5163 | gOverlayBar = new LLOverlayBar(); | 4936 | gOverlayBar = new LLOverlayBar(); |
5164 | return gOverlayBar; | 4937 | return gOverlayBar; |
5165 | } | 4938 | } |
5166 | 4939 | ||
5167 | void* LLBottomPanel::createToolBar(void* data) | 4940 | void* LLBottomPanel::createToolBar(void* data) |
5168 | { | 4941 | { |
5169 | delete gToolBar; | ||
5170 | gToolBar = new LLToolBar(); | 4942 | gToolBar = new LLToolBar(); |
5171 | return gToolBar; | 4943 | return gToolBar; |
5172 | } | 4944 | } |