aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llui
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llalertdialog.cpp2
-rw-r--r--linden/indra/llui/llbutton.cpp2
-rw-r--r--linden/indra/llui/llcombobox.cpp10
-rw-r--r--linden/indra/llui/llcombobox.h3
-rw-r--r--linden/indra/llui/llctrlselectioninterface.cpp88
-rw-r--r--linden/indra/llui/llctrlselectioninterface.h168
-rw-r--r--linden/indra/llui/llfloater.cpp265
-rw-r--r--linden/indra/llui/llfloater.h16
-rw-r--r--linden/indra/llui/llkeywords.cpp24
-rw-r--r--linden/indra/llui/llmenugl.cpp206
-rw-r--r--linden/indra/llui/llmenugl.h79
-rw-r--r--linden/indra/llui/llpanel.cpp34
-rw-r--r--linden/indra/llui/llpanel.h2
-rw-r--r--linden/indra/llui/llresmgr.cpp4
-rw-r--r--linden/indra/llui/llrootview.cpp50
-rw-r--r--linden/indra/llui/llrootview.h46
-rw-r--r--linden/indra/llui/llscrollbar.cpp32
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp123
-rw-r--r--linden/indra/llui/llscrolllistctrl.h48
-rw-r--r--linden/indra/llui/llsliderctrl.cpp2
-rw-r--r--linden/indra/llui/llspinctrl.cpp2
-rw-r--r--linden/indra/llui/lltexteditor.cpp13
-rw-r--r--linden/indra/llui/llui.cpp6
-rw-r--r--linden/indra/llui/llui_vc8.vcproj588
-rw-r--r--linden/indra/llui/lluictrl.h1
-rw-r--r--linden/indra/llui/lluictrlfactory.cpp14
-rw-r--r--linden/indra/llui/lluictrlfactory.h2
-rw-r--r--linden/indra/llui/llview.cpp29
-rw-r--r--linden/indra/llui/llview.h6
-rw-r--r--linden/indra/llui/llviewquery.cpp252
-rw-r--r--linden/indra/llui/llviewquery.h178
31 files changed, 1501 insertions, 794 deletions
diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp
index 861bbc6..6523e44 100644
--- a/linden/indra/llui/llalertdialog.cpp
+++ b/linden/indra/llui/llalertdialog.cpp
@@ -218,7 +218,7 @@ bool LLAlertDialog::show()
218 } 218 }
219 startModal(); 219 startModal();
220 gFloaterView->adjustToFitScreen(this, FALSE); 220 gFloaterView->adjustToFitScreen(this, FALSE);
221 open(); 221 open(); /* Flawfinder: ignore */
222 setFocus(TRUE); 222 setFocus(TRUE);
223 if (mLineEditor) 223 if (mLineEditor)
224 { 224 {
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp
index 736bc59..41c2269 100644
--- a/linden/indra/llui/llbutton.cpp
+++ b/linden/indra/llui/llbutton.cpp
@@ -603,7 +603,7 @@ void LLButton::draw()
603 else 603 else
604 { 604 {
605 // no image 605 // no image
606 llalerts << "No image for button " << mName << llendl; 606 llwarns << "No image for button " << mName << llendl;
607 // draw it in pink so we can find it 607 // draw it in pink so we can find it
608 gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4::pink1, FALSE); 608 gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4::pink1, FALSE);
609 } 609 }
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp
index b19be9a..7c3755a 100644
--- a/linden/indra/llui/llcombobox.cpp
+++ b/linden/indra/llui/llcombobox.cpp
@@ -62,6 +62,7 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString
62 mDrawButton(TRUE), 62 mDrawButton(TRUE),
63 mTextEntry(NULL), 63 mTextEntry(NULL),
64 mArrowImage(NULL), 64 mArrowImage(NULL),
65 mArrowImageWidth(8),
65 mAllowTextEntry(FALSE), 66 mAllowTextEntry(FALSE),
66 mMaxChars(20), 67 mMaxChars(20),
67 mTextEntryTentative(TRUE), 68 mTextEntryTentative(TRUE),
@@ -118,6 +119,7 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString
118 119
119 LLUUID arrow_image_id( LLUI::sAssetsGroup->getString("combobox_arrow.tga") ); 120 LLUUID arrow_image_id( LLUI::sAssetsGroup->getString("combobox_arrow.tga") );
120 mArrowImage = LLUI::sImageProvider->getUIImageByID(arrow_image_id); 121 mArrowImage = LLUI::sImageProvider->getUIImageByID(arrow_image_id);
122 mArrowImageWidth = llmax(8,mArrowImage->getWidth()); // In case image hasn't loaded yet
121} 123}
122 124
123 125
@@ -521,7 +523,7 @@ void LLComboBox::setButtonVisible(BOOL visible)
521 LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 523 LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
522 if (visible) 524 if (visible)
523 { 525 {
524 text_entry_rect.mRight -= mArrowImage->getWidth() + 2 * LLUI::sConfigGroup->getS32("DropShadowButton"); 526 text_entry_rect.mRight -= mArrowImageWidth + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
525 } 527 }
526 //mTextEntry->setRect(text_entry_rect); 528 //mTextEntry->setRect(text_entry_rect);
527 mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); 529 mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE);
@@ -544,7 +546,7 @@ void LLComboBox::draw()
544 // Paste the graphic on the right edge 546 // Paste the graphic on the right edge
545 if (!mArrowImage.isNull()) 547 if (!mArrowImage.isNull())
546 { 548 {
547 S32 left = mRect.getWidth() - mArrowImage->getWidth() - LLUI::sConfigGroup->getS32("DropShadowButton"); 549 S32 left = mRect.getWidth() - mArrowImageWidth - LLUI::sConfigGroup->getS32("DropShadowButton");
548 550
549 gl_draw_image( left, 0, mArrowImage, 551 gl_draw_image( left, 0, mArrowImage,
550 LLColor4::white); 552 LLColor4::white);
@@ -844,7 +846,7 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative
844 if (allow && !mAllowTextEntry) 846 if (allow && !mAllowTextEntry)
845 { 847 {
846 S32 shadow_size = LLUI::sConfigGroup->getS32("DropShadowButton"); 848 S32 shadow_size = LLUI::sConfigGroup->getS32("DropShadowButton");
847 mButton->setRect(LLRect( mRect.getWidth() - mArrowImage->getWidth() - 2 * shadow_size, 849 mButton->setRect(LLRect( mRect.getWidth() - mArrowImageWidth - 2 * shadow_size,
848 rect.mTop, rect.mRight, rect.mBottom)); 850 rect.mTop, rect.mRight, rect.mBottom));
849 mButton->setTabStop(FALSE); 851 mButton->setTabStop(FALSE);
850 852
@@ -854,7 +856,7 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative
854 if (!mTextEntry) 856 if (!mTextEntry)
855 { 857 {
856 LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0); 858 LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
857 text_entry_rect.mRight -= mArrowImage->getWidth() + 2 * LLUI::sConfigGroup->getS32("DropShadowButton"); 859 text_entry_rect.mRight -= mArrowImageWidth + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
858 mTextEntry = new LLLineEditor("combo_text_entry", 860 mTextEntry = new LLLineEditor("combo_text_entry",
859 text_entry_rect, 861 text_entry_rect,
860 "", 862 "",
diff --git a/linden/indra/llui/llcombobox.h b/linden/indra/llui/llcombobox.h
index b1dd468..5de9463 100644
--- a/linden/indra/llui/llcombobox.h
+++ b/linden/indra/llui/llcombobox.h
@@ -186,8 +186,9 @@ protected:
186 BOOL mDrawButton; 186 BOOL mDrawButton;
187 LLLineEditor* mTextEntry; 187 LLLineEditor* mTextEntry;
188 LLPointer<LLImageGL> mArrowImage; 188 LLPointer<LLImageGL> mArrowImage;
189 S32 mArrowImageWidth;
189 BOOL mAllowTextEntry; 190 BOOL mAllowTextEntry;
190 S32 mMaxChars; 191 S32 mMaxChars;
191 BOOL mTextEntryTentative; 192 BOOL mTextEntryTentative;
192 void (*mPrearrangeCallback)(LLUICtrl*,void*); 193 void (*mPrearrangeCallback)(LLUICtrl*,void*);
193 void (*mTextEntryCallback)(LLLineEditor*, void*); 194 void (*mTextEntryCallback)(LLLineEditor*, void*);
diff --git a/linden/indra/llui/llctrlselectioninterface.cpp b/linden/indra/llui/llctrlselectioninterface.cpp
index 5478d61..446eb63 100644
--- a/linden/indra/llui/llctrlselectioninterface.cpp
+++ b/linden/indra/llui/llctrlselectioninterface.cpp
@@ -1,8 +1,8 @@
1/** 1/**
2 * @file llctrlselectioninterface.cpp 2 * @file llctrlselectioninterface.cpp
3 * @brief Programmatic selection of items in a list. 3 * @brief Programmatic selection of items in a list.
4 * 4 *
5 * Copyright (c) 2006-2007, Linden Research, Inc. 5 * Copyright (c) 2006-2007, Linden Research, Inc.
6 * 6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab 7 * 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 8 * to you under the terms of the GNU General Public License, version 2.0
@@ -22,42 +22,42 @@
22 * 22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 25 * COMPLETENESS OR PERFORMANCE.
26 */ 26 */
27 27
28#include "llctrlselectioninterface.h" 28#include "llctrlselectioninterface.h"
29 29
30#include "llsd.h" 30#include "llsd.h"
31 31
32// virtual 32// virtual
33LLCtrlSelectionInterface::~LLCtrlSelectionInterface() 33LLCtrlSelectionInterface::~LLCtrlSelectionInterface()
34{ } 34{ }
35 35
36BOOL LLCtrlSelectionInterface::selectByValue(LLSD value) 36BOOL LLCtrlSelectionInterface::selectByValue(LLSD value)
37{ 37{
38 return setSelectedByValue(value, TRUE); 38 return setSelectedByValue(value, TRUE);
39} 39}
40 40
41BOOL LLCtrlSelectionInterface::deselectByValue(LLSD value) 41BOOL LLCtrlSelectionInterface::deselectByValue(LLSD value)
42{ 42{
43 return setSelectedByValue(value, FALSE); 43 return setSelectedByValue(value, FALSE);
44} 44}
45 45
46 46
47// virtual 47// virtual
48LLCtrlListInterface::~LLCtrlListInterface() 48LLCtrlListInterface::~LLCtrlListInterface()
49{ } 49{ }
50 50
51LLScrollListItem* LLCtrlListInterface::addSimpleElement(const LLString& value) 51LLScrollListItem* LLCtrlListInterface::addSimpleElement(const LLString& value)
52{ 52{
53 return addSimpleElement(value, ADD_BOTTOM, LLSD()); 53 return addSimpleElement(value, ADD_BOTTOM, LLSD());
54} 54}
55 55
56LLScrollListItem* LLCtrlListInterface::addSimpleElement(const LLString& value, EAddPosition pos) 56LLScrollListItem* LLCtrlListInterface::addSimpleElement(const LLString& value, EAddPosition pos)
57{ 57{
58 return addSimpleElement(value, pos, LLSD()); 58 return addSimpleElement(value, pos, LLSD());
59} 59}
60 60
61// virtual 61// virtual
62LLCtrlScrollInterface::~LLCtrlScrollInterface() 62LLCtrlScrollInterface::~LLCtrlScrollInterface()
63{ } 63{ }
diff --git a/linden/indra/llui/llctrlselectioninterface.h b/linden/indra/llui/llctrlselectioninterface.h
index 8f422f4..189d2e1 100644
--- a/linden/indra/llui/llctrlselectioninterface.h
+++ b/linden/indra/llui/llctrlselectioninterface.h
@@ -1,8 +1,8 @@
1/** 1/**
2 * @file llctrlselectioninterface.h 2 * @file llctrlselectioninterface.h
3 * @brief Programmatic selection of items in a list. 3 * @brief Programmatic selection of items in a list.
4 * 4 *
5 * Copyright (c) 2006-2007, Linden Research, Inc. 5 * Copyright (c) 2006-2007, Linden Research, Inc.
6 * 6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab 7 * 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 8 * to you under the terms of the GNU General Public License, version 2.0
@@ -22,82 +22,82 @@
22 * 22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 25 * COMPLETENESS OR PERFORMANCE.
26 */ 26 */
27 27
28#ifndef LLCTRLSELECTIONINTERFACE_H 28#ifndef LLCTRLSELECTIONINTERFACE_H
29#define LLCTRLSELECTIONINTERFACE_H 29#define LLCTRLSELECTIONINTERFACE_H
30 30
31#include "stdtypes.h" 31#include "stdtypes.h"
32#include "stdenums.h" 32#include "stdenums.h"
33#include "llstring.h" 33#include "llstring.h"
34 34
35class LLSD; 35class LLSD;
36class LLUUID; 36class LLUUID;
37class LLScrollListItem; 37class LLScrollListItem;
38 38
39class LLCtrlSelectionInterface 39class LLCtrlSelectionInterface
40{ 40{
41public: 41public:
42 virtual ~LLCtrlSelectionInterface(); 42 virtual ~LLCtrlSelectionInterface();
43 43
44 enum EOperation 44 enum EOperation
45 { 45 {
46 OP_DELETE = 1, 46 OP_DELETE = 1,
47 OP_SELECT, 47 OP_SELECT,
48 OP_DESELECT, 48 OP_DESELECT,
49 }; 49 };
50 50
51 virtual BOOL getCanSelect() const = 0; 51 virtual BOOL getCanSelect() const = 0;
52 52
53 virtual BOOL selectFirstItem() = 0; 53 virtual BOOL selectFirstItem() = 0;
54 virtual BOOL selectNthItem( S32 index ) = 0; 54 virtual BOOL selectNthItem( S32 index ) = 0;
55 55
56 virtual S32 getFirstSelectedIndex() = 0; 56 virtual S32 getFirstSelectedIndex() = 0;
57 57
58 // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function 58 // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function
59 virtual BOOL setCurrentByID( const LLUUID& id ) = 0; 59 virtual BOOL setCurrentByID( const LLUUID& id ) = 0;
60 virtual LLUUID getCurrentID() = 0; 60 virtual LLUUID getCurrentID() = 0;
61 61
62 BOOL selectByValue(LLSD value); 62 BOOL selectByValue(LLSD value);
63 BOOL deselectByValue(LLSD value); 63 BOOL deselectByValue(LLSD value);
64 virtual BOOL setSelectedByValue(LLSD value, BOOL selected) = 0; 64 virtual BOOL setSelectedByValue(LLSD value, BOOL selected) = 0;
65 virtual LLSD getSimpleSelectedValue() = 0; 65 virtual LLSD getSimpleSelectedValue() = 0;
66 66
67 virtual BOOL isSelected(LLSD value) = 0; 67 virtual BOOL isSelected(LLSD value) = 0;
68 68
69 virtual BOOL operateOnSelection(EOperation op) = 0; 69 virtual BOOL operateOnSelection(EOperation op) = 0;
70 virtual BOOL operateOnAll(EOperation op) = 0; 70 virtual BOOL operateOnAll(EOperation op) = 0;
71}; 71};
72 72
73class LLCtrlListInterface : public LLCtrlSelectionInterface 73class LLCtrlListInterface : public LLCtrlSelectionInterface
74{ 74{
75public: 75public:
76 virtual ~LLCtrlListInterface(); 76 virtual ~LLCtrlListInterface();
77 77
78 virtual S32 getItemCount() const = 0; 78 virtual S32 getItemCount() const = 0;
79 virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) = 0; 79 virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) = 0;
80 virtual void clearColumns() = 0; 80 virtual void clearColumns() = 0;
81 virtual void setColumnLabel(const LLString& column, const LLString& label) = 0; 81 virtual void setColumnLabel(const LLString& column, const LLString& label) = 0;
82 // TomY TODO: Document this 82 // TomY TODO: Document this
83 virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0; 83 virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0;
84 84
85 LLScrollListItem* addSimpleElement(const LLString& value); // defaults to bottom 85 LLScrollListItem* addSimpleElement(const LLString& value); // defaults to bottom
86 LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos); // defaults to no LLSD() id 86 LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos); // defaults to no LLSD() id
87 virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos, const LLSD& id) = 0; 87 virtual LLScrollListItem* addSimpleElement(const LLString& value, EAddPosition pos, const LLSD& id) = 0;
88 88
89 virtual void clearRows() = 0; 89 virtual void clearRows() = 0;
90 virtual void sortByColumn(LLString name, BOOL ascending) = 0; 90 virtual void sortByColumn(LLString name, BOOL ascending) = 0;
91}; 91};
92 92
93class LLCtrlScrollInterface 93class LLCtrlScrollInterface
94{ 94{
95public: 95public:
96 virtual ~LLCtrlScrollInterface(); 96 virtual ~LLCtrlScrollInterface();
97 97
98 virtual S32 getScrollPos() = 0; 98 virtual S32 getScrollPos() = 0;
99 virtual void setScrollPos( S32 pos ) = 0; 99 virtual void setScrollPos( S32 pos ) = 0;
100 virtual void scrollToShowSelected() = 0; 100 virtual void scrollToShowSelected() = 0;
101}; 101};
102 102
103#endif 103#endif
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp
index bc5f197..02a410e 100644
--- a/linden/indra/llui/llfloater.cpp
+++ b/linden/indra/llui/llfloater.cpp
@@ -506,26 +506,25 @@ void LLFloater::setVisible( BOOL visible )
506 } 506 }
507} 507}
508 508
509LLView* LLFloater::getRootMostFastFrameView() 509void LLFloater::open() /* Flawfinder: ignore */
510{ 510{
511 // trying to render a background floater in a fast frame, abort!!! 511 if (mSoundFlags != SILENT
512 //if (!isFrontmost()) 512 // don't play open sound for hosted (tabbed) windows
513 //{ 513 && !getHost()
514 // gViewerWindow->finishFastFrame(); 514 && !sHostp
515 //} 515 && (!getVisible() || isMinimized()))
516 516 {
517 return LLView::getRootMostFastFrameView(); 517 make_ui_sound("UISndWindowOpen");
518} 518 }
519 519
520void LLFloater::open()
521{
522 //RN: for now, we don't allow rehosting from one multifloater to another 520 //RN: for now, we don't allow rehosting from one multifloater to another
523 // just need to fix the bugs 521 // just need to fix the bugs
524 LLMultiFloater* hostp = getHost(); 522 LLMultiFloater* hostp = getHost();
525 if (sHostp != NULL && hostp == NULL) 523 if (sHostp != NULL && hostp == NULL)
526 { 524 {
527 // needs a host 525 // needs a host
528 sHostp->addFloater(this, TRUE); 526 // only select tabs if window they are hosted in is visible
527 sHostp->addFloater(this, sHostp->getVisible());
529 } 528 }
530 else if (hostp != NULL) 529 else if (hostp != NULL)
531 { 530 {
@@ -538,13 +537,7 @@ void LLFloater::open()
538 setVisibleAndFrontmost(mAutoFocus); 537 setVisibleAndFrontmost(mAutoFocus);
539 } 538 }
540 539
541 if (mSoundFlags != SILENT) 540 onOpen();
542 {
543 if (!getVisible() || isMinimized())
544 {
545 make_ui_sound("UISndWindowOpen");
546 }
547 }
548} 541}
549 542
550void LLFloater::close(bool app_quitting) 543void LLFloater::close(bool app_quitting)
@@ -562,6 +555,7 @@ void LLFloater::close(bool app_quitting)
562 555
563 if (mSoundFlags != SILENT 556 if (mSoundFlags != SILENT
564 && getVisible() 557 && getVisible()
558 && !getHost()
565 && !app_quitting) 559 && !app_quitting)
566 { 560 {
567 make_ui_sound("UISndWindowClose"); 561 make_ui_sound("UISndWindowClose");
@@ -689,7 +683,7 @@ const LLString& LLFloater::getTitle() const
689 683
690void LLFloater::translate(S32 x, S32 y) 684void LLFloater::translate(S32 x, S32 y)
691{ 685{
692 LLView::translate(x, y); 686 LLPanel::translate(x, y);
693 687
694 if (x != 0 || y != 0) 688 if (x != 0 || y != 0)
695 { 689 {
@@ -719,7 +713,7 @@ BOOL LLFloater::canSnapTo(LLView* other_view)
719 } 713 }
720 } 714 }
721 715
722 return LLView::canSnapTo(other_view); 716 return LLPanel::canSnapTo(other_view);
723} 717}
724 718
725void LLFloater::snappedTo(LLView* snap_view) 719void LLFloater::snappedTo(LLView* snap_view)
@@ -783,8 +777,6 @@ void LLFloater::setMinimized(BOOL minimize)
783 777
784 if (minimize) 778 if (minimize)
785 { 779 {
786 mMinimized = TRUE;
787
788 mPreviousRect = mRect; 780 mPreviousRect = mRect;
789 781
790 reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE); 782 reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE);
@@ -830,6 +822,8 @@ void LLFloater::setMinimized(BOOL minimize)
830 ++dependent_it; 822 ++dependent_it;
831 } 823 }
832 824
825 mMinimized = TRUE;
826
833 // Lose keyboard focus when minimized 827 // Lose keyboard focus when minimized
834 releaseFocus(); 828 releaseFocus();
835 } 829 }
@@ -1207,12 +1201,12 @@ void LLFloater::onClickTearOff(void *userdata)
1207 1201
1208 new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight()); 1202 new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - LLFLOATER_HEADER_SIZE - 5, self->mRect.getWidth(), self->mRect.getHeight());
1209 1203
1210 self->open(); 1204 self->open(); /* Flawfinder: ignore */
1211 self->setRect(new_rect); 1205 self->setRect(new_rect);
1212 gFloaterView->adjustToFitScreen(self, FALSE); 1206 gFloaterView->adjustToFitScreen(self, FALSE);
1213 self->setCanDrag(TRUE); 1207 self->setCanDrag(TRUE);
1214 self->setCanResize(TRUE); 1208 // give focus to new window to keep continuity for the user
1215 self->setCanMinimize(TRUE); 1209 self->setFocus(TRUE);
1216 } 1210 }
1217 else //Attach to parent. 1211 else //Attach to parent.
1218 { 1212 {
@@ -1234,24 +1228,36 @@ void LLFloater::onClickEdit(void *userdata)
1234} 1228}
1235 1229
1236// static 1230// static
1237void LLFloater::closeByMenu( void* userdata ) 1231void LLFloater::closeFocusedFloater()
1238{ 1232{
1239 LLFloater* self = (LLFloater*) userdata; 1233 LLFloater* focused_floater = NULL;
1240 if (!self || self->getHost()) return;
1241 1234
1242 LLFloaterView* parent = (LLFloaterView*) self->getParent(); 1235 std::map<LLViewHandle, LLFloater*>::iterator iter;
1236 for(iter = sFloaterMap.begin(); iter != sFloaterMap.end(); ++iter)
1237 {
1238 focused_floater = iter->second;
1239 if (focused_floater->hasFocus())
1240 {
1241 break;
1242 }
1243 }
1243 1244
1244 // grab focus status before close just in case floater is deleted 1245 if (iter == sFloaterMap.end())
1245 BOOL has_focus = gFocusMgr.childHasKeyboardFocus(self); 1246 {
1246 self->close(); 1247 // nothing found, return
1248 return;
1249 }
1250
1251 focused_floater->close();
1247 1252
1248 // if this floater used to have focus and now nothing took focus 1253 // if nothing took focus after closing focused floater
1249 // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) 1254 // give it to next floater (to allow closing multiple windows via keyboard in rapid succession)
1250 if (has_focus && gFocusMgr.getKeyboardFocus() == NULL) 1255 if (gFocusMgr.getKeyboardFocus() == NULL)
1251 { 1256 {
1252 parent->focusFrontFloater(); 1257 // HACK: use gFloaterView directly in case we are using Ctrl-W to close snapshot window
1258 // which sits in gSnapshotFloaterView, and needs to pass focus on to normal floater view
1259 gFloaterView->focusFrontFloater();
1253 } 1260 }
1254
1255} 1261}
1256 1262
1257 1263
@@ -1351,10 +1357,26 @@ void LLFloater::draw()
1351 focused_child->setVisible(TRUE); 1357 focused_child->setVisible(TRUE);
1352 } 1358 }
1353 drawChild(focused_child); 1359 drawChild(focused_child);
1360
1361 // update tearoff button for torn off floaters
1362 // when last host goes away
1363 if (mCanTearOff && !getHost())
1364 {
1365 LLFloater* old_host = gFloaterView->getFloaterByHandle(mLastHostHandle);
1366 if (!old_host)
1367 {
1368 setCanTearOff(FALSE);
1369 }
1370 }
1354 } 1371 }
1355} 1372}
1356 1373
1357// virtual 1374// virtual
1375void LLFloater::onOpen()
1376{
1377}
1378
1379// virtual
1358void LLFloater::onClose(bool app_quitting) 1380void LLFloater::onClose(bool app_quitting)
1359{ 1381{
1360 destroy(); 1382 destroy();
@@ -2018,23 +2040,52 @@ void LLFloaterView::focusFrontFloater()
2018 2040
2019void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) 2041void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom)
2020{ 2042{
2021 // count the number of minimized children 2043 S32 col = 0;
2022 S32 count = 0; 2044 LLRect snap_rect_local = getSnapRect();
2023 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 2045 snap_rect_local.translate(-mRect.mLeft, -mRect.mBottom);
2024 { 2046 for(S32 row = snap_rect_local.mBottom;
2025 LLView* viewp = *child_it; 2047 row < snap_rect_local.getHeight() - LLFLOATER_HEADER_SIZE;
2026 LLFloater *floater = (LLFloater *)viewp; 2048 row += LLFLOATER_HEADER_SIZE ) //loop rows
2027 if (floater->isMinimized()) 2049 {
2028 { 2050 for(col = snap_rect_local.mLeft;
2029 count++; 2051 col < snap_rect_local.getWidth() - MINIMIZED_WIDTH;
2030 } 2052 col += MINIMIZED_WIDTH)
2053 {
2054 bool foundGap = TRUE;
2055 for(child_list_const_iter_t child_it = getChildList()->begin();
2056 child_it != getChildList()->end();
2057 ++child_it) //loop floaters
2058 {
2059 // Examine minimized children.
2060 LLFloater* floater = (LLFloater*)((LLView*)*child_it);
2061 if(floater->isMinimized())
2062 {
2063 LLRect r = floater->getRect();
2064 if((r.mBottom < (row + LLFLOATER_HEADER_SIZE))
2065 && (r.mBottom > (row - LLFLOATER_HEADER_SIZE))
2066 && (r.mLeft < (col + MINIMIZED_WIDTH))
2067 && (r.mLeft > (col - MINIMIZED_WIDTH)))
2068 {
2069 // needs the check for off grid. can't drag,
2070 // but window resize makes them off
2071 foundGap = FALSE;
2072 break;
2073 }
2074 }
2075 } //done floaters
2076 if(foundGap)
2077 {
2078 *left = col;
2079 *bottom = row;
2080 return; //done
2081 }
2082 } //done this col
2031 } 2083 }
2032 2084
2033 // space over for that many and up if necessary 2085 // crude - stack'em all at 0,0 when screen is full of minimized
2034 S32 tiles_per_row = mRect.getWidth() / MINIMIZED_WIDTH; 2086 // floaters.
2035 2087 *left = snap_rect_local.mLeft;
2036 *left = (count % tiles_per_row) * MINIMIZED_WIDTH; 2088 *bottom = snap_rect_local.mBottom;
2037 *bottom = (count / tiles_per_row) * LLFLOATER_HEADER_SIZE;
2038} 2089}
2039 2090
2040 2091
@@ -2211,7 +2262,7 @@ LLFloater *LLFloaterView::getFrontmost()
2211 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 2262 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
2212 { 2263 {
2213 LLView* viewp = *child_it; 2264 LLView* viewp = *child_it;
2214 if ( viewp->getVisible() ) 2265 if ( viewp->getVisible() && !viewp->isDead())
2215 { 2266 {
2216 return (LLFloater *)viewp; 2267 return (LLFloater *)viewp;
2217 } 2268 }
@@ -2423,31 +2474,11 @@ LLString LLMultiFloater::getWidgetTag() const
2423 return LL_MULTI_FLOATER_TAG; 2474 return LL_MULTI_FLOATER_TAG;
2424} 2475}
2425 2476
2426void LLMultiFloater::init(const LLString& title, BOOL resizable, 2477void LLMultiFloater::open() /* Flawfinder: ignore */
2427 S32 min_width, S32 min_height, BOOL drag_on_left,
2428 BOOL minimizable, BOOL close_btn)
2429{
2430 LLFloater::init(title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
2431
2432 /*mTabContainer = new LLTabContainer("Preview Tabs",
2433 LLRect(LLPANEL_BORDER_WIDTH, mRect.getHeight() - LLFLOATER_HEADER_SIZE, mRect.getWidth() - LLPANEL_BORDER_WIDTH, 0),
2434 mTabPos,
2435 NULL,
2436 NULL);
2437 mTabContainer->setFollowsAll();
2438 if (mResizable && mTabPos == LLTabContainerCommon::BOTTOM)
2439 {
2440 mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
2441 }
2442
2443 addChild(mTabContainer);*/
2444}
2445
2446void LLMultiFloater::open()
2447{ 2478{
2448 if (mTabContainer->getTabCount() > 0) 2479 if (mTabContainer->getTabCount() > 0)
2449 { 2480 {
2450 LLFloater::open(); 2481 LLFloater::open(); /* Flawfinder: ignore */
2451 } 2482 }
2452 else 2483 else
2453 { 2484 {
@@ -2519,16 +2550,9 @@ void LLMultiFloater::growToFit(LLFloater* floaterp, S32 width, S32 height)
2519 // store new width and height with this floater so that it will keep its size when detached 2550 // store new width and height with this floater so that it will keep its size when detached
2520 found_data_it->second.mWidth = width; 2551 found_data_it->second.mWidth = width;
2521 found_data_it->second.mHeight = height; 2552 found_data_it->second.mHeight = height;
2522
2523 S32 cur_height = mRect.getHeight();
2524 reshape(llmax(mRect.getWidth(), width + LLPANEL_BORDER_WIDTH * 2), llmax(mRect.getHeight(), height + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT + (LLPANEL_BORDER_WIDTH * 2)));
2525
2526 // make sure upper left corner doesn't move
2527 translate(0, mRect.getHeight() - cur_height);
2528
2529 // Try to keep whole view onscreen, don't allow partial offscreen.
2530 gFloaterView->adjustToFitScreen(this, FALSE);
2531 } 2553 }
2554
2555 resizeToContents();
2532} 2556}
2533 2557
2534/** 2558/**
@@ -2597,8 +2621,6 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
2597 if ( select_added_floater ) 2621 if ( select_added_floater )
2598 { 2622 {
2599 mTabContainer->selectLastTab(); 2623 mTabContainer->selectLastTab();
2600 // explicitly call tabopen to load preview assets, etc.
2601 tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), true);
2602 } 2624 }
2603 2625
2604 floaterp->setHost(this); 2626 floaterp->setHost(this);
@@ -2671,24 +2693,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp)
2671 2693
2672 if (mAutoResize) 2694 if (mAutoResize)
2673 { 2695 {
2674 floater_data_map_t::iterator floater_it; 2696 resizeToContents();
2675 S32 new_width = 0;
2676 S32 new_height = 0;
2677 for (floater_it = mFloaterDataMap.begin(); floater_it != mFloaterDataMap.end(); ++floater_it)
2678 {
2679 new_width = llmax(new_width, floater_it->second.mWidth + LLPANEL_BORDER_WIDTH * 2);
2680 new_height = llmax(new_height, floater_it->second.mHeight + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
2681 }
2682
2683 S32 cur_height = mRect.getHeight();
2684
2685 reshape(new_width, new_height);
2686
2687 // make sure upper left corner doesn't move
2688 translate(0, cur_height - new_height);
2689
2690 // Try to keep whole view onscreen, don't allow partial offscreen.
2691 gFloaterView->adjustToFitScreen(this, FALSE);
2692 } 2697 }
2693 2698
2694 tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false); 2699 tabOpen((LLFloater*)mTabContainer->getCurrentPanel(), false);
@@ -2721,6 +2726,13 @@ void LLMultiFloater::setVisible(BOOL visible)
2721 { 2726 {
2722 cur_floaterp->setVisible(visible); 2727 cur_floaterp->setVisible(visible);
2723 } 2728 }
2729
2730 // if no tab selected, and we're being shown,
2731 // select last tab to be added
2732 if (visible && !cur_floaterp)
2733 {
2734 mTabContainer->selectLastTab();
2735 }
2724 } 2736 }
2725} 2737}
2726 2738
@@ -2823,6 +2835,43 @@ BOOL LLMultiFloater::postBuild()
2823 return FALSE; 2835 return FALSE;
2824} 2836}
2825 2837
2838void LLMultiFloater::resizeToContents()
2839{
2840 // we're already in the middle of a reshape, don't interrupt it
2841 floater_data_map_t::iterator floater_it;
2842 S32 new_width = 0;
2843 S32 new_height = 0;
2844 for (floater_it = mFloaterDataMap.begin(); floater_it != mFloaterDataMap.end(); ++floater_it)
2845 {
2846 new_width = llmax(new_width, floater_it->second.mWidth + LLPANEL_BORDER_WIDTH * 2);
2847 new_height = llmax(new_height, floater_it->second.mHeight + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
2848 }
2849
2850 S32 new_min_width = 0;
2851 S32 new_min_height = 0;
2852 S32 tab_idx;
2853 for (tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx)
2854 {
2855 LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(tab_idx);
2856 if (floaterp)
2857 {
2858 new_min_width = llmax(new_min_width, floaterp->getMinWidth() + LLPANEL_BORDER_WIDTH * 2);
2859 new_min_height = llmax(new_min_height, floaterp->getMinHeight() + LLFLOATER_HEADER_SIZE + TABCNTR_HEADER_HEIGHT);
2860 }
2861 }
2862 setResizeLimits(new_min_width, new_min_height);
2863
2864 S32 cur_height = mRect.getHeight();
2865
2866 reshape(new_width, new_height);
2867
2868 // make sure upper left corner doesn't move
2869 translate(0, cur_height - new_height);
2870
2871 // Try to keep whole view onscreen, don't allow partial offscreen.
2872 gFloaterView->adjustToFitScreen(this, FALSE);
2873}
2874
2826// virtual 2875// virtual
2827LLXMLNodePtr LLFloater::getXML(bool save_children) const 2876LLXMLNodePtr LLFloater::getXML(bool save_children) const
2828{ 2877{
@@ -2872,7 +2921,7 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
2872 return floaterp; 2921 return floaterp;
2873} 2922}
2874 2923
2875void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) 2924void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */
2876{ 2925{
2877 LLString name(getName()); 2926 LLString name(getName());
2878 LLString title(getTitle()); 2927 LLString title(getTitle());
@@ -2946,8 +2995,8 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
2946 } 2995 }
2947 2996
2948 applyRectControl(); 2997 applyRectControl();
2949 if (open) 2998 if (open) /* Flawfinder: ignore */
2950 { 2999 {
2951 this->open(); 3000 this->open(); /* Flawfinder: ignore */
2952 } 3001 }
2953} 3002}
diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h
index 4826648..25b2697 100644
--- a/linden/indra/llui/llfloater.h
+++ b/linden/indra/llui/llfloater.h
@@ -122,7 +122,7 @@ public:
122 virtual EWidgetType getWidgetType() const; 122 virtual EWidgetType getWidgetType() const;
123 virtual LLString getWidgetTag() const; 123 virtual LLString getWidgetTag() const;
124 124
125 virtual void open(); 125 virtual void open(); /* Flawfinder: ignore */
126 126
127 // If allowed, close the floater cleanly, releasing focus. 127 // If allowed, close the floater cleanly, releasing focus.
128 // app_quitting is passed to onClose() below. 128 // app_quitting is passed to onClose() below.
@@ -176,6 +176,9 @@ public:
176 176
177 virtual void draw(); 177 virtual void draw();
178 178
179 // does nothing by default
180 virtual void onOpen();
181
179 // Call destroy() to free memory, or setVisible(FALSE) to keep it 182 // Call destroy() to free memory, or setVisible(FALSE) to keep it
180 // If app_quitting, you might not want to save your visibility. 183 // If app_quitting, you might not want to save your visibility.
181 // Defaults to destroy(). 184 // Defaults to destroy().
@@ -197,9 +200,8 @@ public:
197 void clearSnapTarget() { mSnappedTo.markDead(); } 200 void clearSnapTarget() { mSnappedTo.markDead(); }
198 LLViewHandle getSnapTarget() { return mSnappedTo; } 201 LLViewHandle getSnapTarget() { return mSnappedTo; }
199 202
200 /*virtual*/ LLView* getRootMostFastFrameView(); 203 static void closeFocusedFloater();
201 204
202 static void closeByMenu(void *userdata);
203 static void onClickClose(void *userdata); 205 static void onClickClose(void *userdata);
204 static void onClickMinimize(void *userdata); 206 static void onClickMinimize(void *userdata);
205 static void onClickTearOff(void *userdata); 207 static void onClickTearOff(void *userdata);
@@ -356,12 +358,8 @@ public:
356 LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = FALSE); 358 LLMultiFloater(const LLString& name, const LLString& rect_control, LLTabContainer::TabPosition tab_pos = LLTabContainer::TOP, BOOL auto_resize = FALSE);
357 virtual ~LLMultiFloater(); 359 virtual ~LLMultiFloater();
358 360
359 virtual void init(const LLString& title, BOOL resizable,
360 S32 min_width, S32 min_height, BOOL drag_on_left,
361 BOOL minimizable, BOOL close_btn);
362
363 virtual BOOL postBuild(); 361 virtual BOOL postBuild();
364 /*virtual*/ void open(); 362 /*virtual*/ void open(); /* Flawfinder: ignore */
365 /*virtual*/ void onClose(bool app_quitting); 363 /*virtual*/ void onClose(bool app_quitting);
366 /*virtual*/ void draw(); 364 /*virtual*/ void draw();
367 /*virtual*/ void setVisible(BOOL visible); 365 /*virtual*/ void setVisible(BOOL visible);
@@ -393,6 +391,8 @@ public:
393 void setTabContainer(LLTabContainerCommon* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } 391 void setTabContainer(LLTabContainerCommon* tab_container) { if (!mTabContainer) mTabContainer = tab_container; }
394 static void onTabSelected(void* userdata, bool); 392 static void onTabSelected(void* userdata, bool);
395 393
394 virtual void resizeToContents();
395
396protected: 396protected:
397 struct LLFloaterData 397 struct LLFloaterData
398 { 398 {
diff --git a/linden/indra/llui/llkeywords.cpp b/linden/indra/llui/llkeywords.cpp
index fd224d8..05ec652 100644
--- a/linden/indra/llui/llkeywords.cpp
+++ b/linden/indra/llui/llkeywords.cpp
@@ -73,10 +73,10 @@ BOOL LLKeywords::loadFromFile( const LLString& filename )
73 // File header 73 // File header
74 74
75 const S32 BUFFER_SIZE = 1024; 75 const S32 BUFFER_SIZE = 1024;
76 char buffer[BUFFER_SIZE]; 76 char buffer[BUFFER_SIZE]; /* Flawfinder: ignore */
77 77
78 llifstream file; 78 llifstream file;
79 file.open(filename.c_str()); 79 file.open(filename.c_str()); /* Flawfinder: ignore */
80 if( file.fail() ) 80 if( file.fail() )
81 { 81 {
82 llinfos << "LLKeywords::loadFromFile() Unable to open file: " << filename << llendl; 82 llinfos << "LLKeywords::loadFromFile() Unable to open file: " << filename << llendl;
@@ -114,34 +114,34 @@ BOOL LLKeywords::loadFromFile( const LLString& filename )
114 while (!file.eof()) 114 while (!file.eof())
115 { 115 {
116 file.getline( buffer, BUFFER_SIZE ); 116 file.getline( buffer, BUFFER_SIZE );
117 if( !strncmp( buffer, SOL_COMMENT, strlen(SOL_COMMENT) ) ) 117 if( !strncmp( buffer, SOL_COMMENT, strlen(SOL_COMMENT) ) ) /* Flawfinder: ignore */
118 { 118 {
119 continue; 119 continue;
120 } 120 }
121 else 121 else
122 if( !strncmp( buffer, SOL_WORD, strlen(SOL_WORD) ) ) 122 if( !strncmp( buffer, SOL_WORD, strlen(SOL_WORD) ) ) /* Flawfinder: ignore */
123 { 123 {
124 cur_color = readColor( buffer + strlen(SOL_WORD) ); 124 cur_color = readColor( buffer + strlen(SOL_WORD) ); /* Flawfinder: ignore */
125 cur_type = LLKeywordToken::WORD; 125 cur_type = LLKeywordToken::WORD;
126 continue; 126 continue;
127 } 127 }
128 else 128 else
129 if( !strncmp( buffer, SOL_LINE, strlen(SOL_LINE) ) ) 129 if( !strncmp( buffer, SOL_LINE, strlen(SOL_LINE) ) ) /* Flawfinder: ignore */
130 { 130 {
131 cur_color = readColor( buffer + strlen(SOL_LINE) ); 131 cur_color = readColor( buffer + strlen(SOL_LINE) ); /* Flawfinder: ignore */
132 cur_type = LLKeywordToken::LINE; 132 cur_type = LLKeywordToken::LINE;
133 continue; 133 continue;
134 } 134 }
135 else 135 else
136 if( !strncmp( buffer, SOL_TWO_SIDED_DELIMITER, strlen(SOL_TWO_SIDED_DELIMITER) ) ) 136 if( !strncmp( buffer, SOL_TWO_SIDED_DELIMITER, strlen(SOL_TWO_SIDED_DELIMITER) ) ) /* Flawfinder: ignore */
137 { 137 {
138 cur_color = readColor( buffer + strlen(SOL_TWO_SIDED_DELIMITER) ); 138 cur_color = readColor( buffer + strlen(SOL_TWO_SIDED_DELIMITER) ); /* Flawfinder: ignore */
139 cur_type = LLKeywordToken::TWO_SIDED_DELIMITER; 139 cur_type = LLKeywordToken::TWO_SIDED_DELIMITER;
140 continue; 140 continue;
141 } 141 }
142 if( !strncmp( buffer, SOL_ONE_SIDED_DELIMITER, strlen(SOL_ONE_SIDED_DELIMITER) ) ) 142 if( !strncmp( buffer, SOL_ONE_SIDED_DELIMITER, strlen(SOL_ONE_SIDED_DELIMITER) ) ) /* Flawfinder: ignore */
143 { 143 {
144 cur_color = readColor( buffer + strlen(SOL_ONE_SIDED_DELIMITER) ); 144 cur_color = readColor( buffer + strlen(SOL_ONE_SIDED_DELIMITER) ); /* Flawfinder: ignore */
145 cur_type = LLKeywordToken::ONE_SIDED_DELIMITER; 145 cur_type = LLKeywordToken::ONE_SIDED_DELIMITER;
146 continue; 146 continue;
147 } 147 }
@@ -220,7 +220,7 @@ LLColor3 LLKeywords::readColor( const LLString& s )
220 F32 r, g, b; 220 F32 r, g, b;
221 r = g = b = 0.0f; 221 r = g = b = 0.0f;
222 S32 read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b ); 222 S32 read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b );
223 if( read != 3 ) 223 if( read != 3 ) /* Flawfinder: ignore */
224 { 224 {
225 llinfos << " poorly formed color in keyword file" << llendl; 225 llinfos << " poorly formed color in keyword file" << llendl;
226 } 226 }
diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp
index 97069fa..1748956 100644
--- a/linden/indra/llui/llmenugl.cpp
+++ b/linden/indra/llui/llmenugl.cpp
@@ -62,7 +62,7 @@
62#include <boost/tokenizer.hpp> 62#include <boost/tokenizer.hpp>
63 63
64// static 64// static
65LLView *LLMenuGL::sDefaultMenuContainer = NULL; 65LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL;
66 66
67S32 MENU_BAR_HEIGHT = 0; 67S32 MENU_BAR_HEIGHT = 0;
68S32 MENU_BAR_WIDTH = 0; 68S32 MENU_BAR_WIDTH = 0;
@@ -404,14 +404,10 @@ void LLMenuItemGL::doIt( void )
404{ 404{
405 // close all open menus by default 405 // close all open menus by default
406 // if parent menu is actually visible (and we are not triggering menu item via accelerator) 406 // if parent menu is actually visible (and we are not triggering menu item via accelerator)
407 // HACK: do not call hidemenus() from a pie menu item, as most pie menu operations 407 if (!getMenu()->getTornOff()
408 // assume that the thing you clicked on stays selected (parcel and/or object) after the
409 // pie menu is gone --RN
410 if (getMenu()->getWidgetType() != WIDGET_TYPE_PIE_MENU
411 && !getMenu()->getTornOff()
412 && getMenu()->getVisible()) 408 && getMenu()->getVisible())
413 { 409 {
414 ((LLMenuHolderGL*)getMenu()->getParent())->hideMenus(); 410 LLMenuGL::sMenuContainer->hideMenus();
415 } 411 }
416} 412}
417 413
@@ -473,18 +469,28 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
473 469
474BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK ) 470BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK )
475{ 471{
476 //llinfos << mLabel.c_str() << " handleMouseUp " << x << "," << y
477 // << llendl;
478 if (mEnabled) 472 if (mEnabled)
479 { 473 {
480 // switch to mouse navigation mode 474 // switch to mouse navigation mode
481 LLMenuGL::setKeyboardMode(FALSE); 475 LLMenuGL::setKeyboardMode(FALSE);
482 476
483 doIt(); 477 doIt();
484 setHighlight(FALSE);
485 make_ui_sound("UISndClickRelease"); 478 make_ui_sound("UISndClickRelease");
486 return TRUE; 479 return TRUE;
487 } 480 }
481 return FALSE;
482}
483
484BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK )
485{
486 if (mEnabled)
487 {
488 // switch to mouse navigation mode
489 LLMenuGL::setKeyboardMode(FALSE);
490
491 setHighlight(TRUE);
492 return TRUE;
493 }
488 else 494 else
489 { 495 {
490 return FALSE; 496 return FALSE;
@@ -1168,70 +1174,6 @@ void LLMenuItemToggleGL::doIt( void )
1168} 1174}
1169 1175
1170 1176
1171//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1172// Class LLMenuItemBranchGL
1173//
1174// The LLMenuItemBranchGL represents a menu item that has a
1175// sub-menu. This is used to make cascading menus.
1176//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1177
1178class LLMenuItemBranchGL : public LLMenuItemGL
1179{
1180protected:
1181 LLMenuGL* mBranch;
1182
1183public:
1184 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
1185 KEY key = KEY_NONE, MASK mask = MASK_NONE );
1186 virtual LLXMLNodePtr getXML(bool save_children = true) const;
1187
1188 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
1189
1190 virtual LLString getType() const { return "menu"; }
1191
1192 virtual EWidgetType getWidgetType() const;
1193 virtual LLString getWidgetTag() const;
1194
1195 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
1196
1197 virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
1198
1199 // check if we've used these accelerators already
1200 virtual BOOL addToAcceleratorList(std::list <LLKeyBinding*> *listp);
1201
1202 // called to rebuild the draw label
1203 virtual void buildDrawLabel( void );
1204
1205 // doIt() - do the primary funcationality of the menu item.
1206 virtual void doIt( void );
1207
1208 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
1209 virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
1210
1211 // set the hover status (called by it's menu) and if the object is
1212 // active. This is used for behavior transfer.
1213 virtual void setHighlight( BOOL highlight );
1214
1215 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
1216
1217 virtual BOOL isActive() const;
1218
1219 virtual BOOL isOpen() const;
1220
1221 LLMenuGL *getBranch() const { return mBranch; }
1222
1223 virtual void updateBranchParent( LLView* parentp );
1224
1225 // LLView Functionality
1226 virtual void onVisibilityChange( BOOL curVisibilityIn );
1227
1228 virtual void draw();
1229
1230 virtual void setEnabledSubMenus(BOOL enabled);
1231
1232 virtual void openMenu();
1233};
1234
1235LLMenuItemBranchGL::LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch, 1177LLMenuItemBranchGL::LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
1236 KEY key, MASK mask ) : 1178 KEY key, MASK mask ) :
1237 LLMenuItemGL( name, label, key, mask ), 1179 LLMenuItemGL( name, label, key, mask ),
@@ -1502,6 +1444,9 @@ void LLMenuItemBranchGL::openMenu()
1502 } 1444 }
1503 else if( !mBranch->getVisible() ) 1445 else if( !mBranch->getVisible() )
1504 { 1446 {
1447 // get valid rectangle for menus
1448 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
1449
1505 mBranch->arrange(); 1450 mBranch->arrange();
1506 1451
1507 LLRect rect = mBranch->getRect(); 1452 LLRect rect = mBranch->getRect();
@@ -1524,13 +1469,13 @@ void LLMenuItemBranchGL::openMenu()
1524 mBranch->localPointToOtherView( 0, 0, &x, &y, mBranch->getParent() ); 1469 mBranch->localPointToOtherView( 0, 0, &x, &y, mBranch->getParent() );
1525 S32 delta_x = 0; 1470 S32 delta_x = 0;
1526 S32 delta_y = 0; 1471 S32 delta_y = 0;
1527 if( y < 0 ) 1472 if( y < menu_region_rect.mBottom )
1528 { 1473 {
1529 delta_y = -y; 1474 delta_y = menu_region_rect.mBottom - y;
1530 } 1475 }
1531 1476
1532 S32 window_width = mBranch->getParent()->getRect().getWidth(); 1477 S32 menu_region_width = menu_region_rect.getWidth();
1533 if( x > window_width - rect.getWidth() ) 1478 if( x - menu_region_rect.mLeft > menu_region_width - rect.getWidth() )
1534 { 1479 {
1535 // move sub-menu over to left side 1480 // move sub-menu over to left side
1536 delta_x = llmax(-x, (-1 * (rect.getWidth() + mRect.getWidth()))); 1481 delta_x = llmax(-x, (-1 * (rect.getWidth() + mRect.getWidth())));
@@ -1709,7 +1654,7 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
1709{ 1654{
1710 BOOL branch_visible = mBranch->getVisible(); 1655 BOOL branch_visible = mBranch->getVisible();
1711 BOOL handled = mBranch->handleAcceleratorKey(key, mask); 1656 BOOL handled = mBranch->handleAcceleratorKey(key, mask);
1712 if (handled && !branch_visible) 1657 if (handled && !branch_visible && getVisible())
1713 { 1658 {
1714 // flash this menu entry because we triggered an invisible menu item 1659 // flash this menu entry because we triggered an invisible menu item
1715 LLMenuHolderGL::setActivatedItem(this); 1660 LLMenuHolderGL::setActivatedItem(this);
@@ -1721,7 +1666,8 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
1721BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 1666BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
1722{ 1667{
1723 BOOL menu_open = mBranch->getVisible(); 1668 BOOL menu_open = mBranch->getVisible();
1724 if (getHighlight() && getMenu()->getVisible()) 1669 // don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded
1670 if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode()))
1725 { 1671 {
1726 if (key == KEY_LEFT) 1672 if (key == KEY_LEFT)
1727 { 1673 {
@@ -1961,9 +1907,9 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
1961 // SUBMENU 1907 // SUBMENU
1962 LLMenuGL *submenu = (LLMenuGL*)LLMenuGL::fromXML(child, parent, factory); 1908 LLMenuGL *submenu = (LLMenuGL*)LLMenuGL::fromXML(child, parent, factory);
1963 appendMenu(submenu); 1909 appendMenu(submenu);
1964 if (LLMenuGL::sDefaultMenuContainer != NULL) 1910 if (LLMenuGL::sMenuContainer != NULL)
1965 { 1911 {
1966 submenu->updateParent(LLMenuGL::sDefaultMenuContainer); 1912 submenu->updateParent(LLMenuGL::sMenuContainer);
1967 } 1913 }
1968 else 1914 else
1969 { 1915 {
@@ -2337,6 +2283,12 @@ void LLMenuGL::setBackgroundColor( const LLColor4& color )
2337 mBackgroundColor = color; 2283 mBackgroundColor = color;
2338} 2284}
2339 2285
2286LLColor4 LLMenuGL::getBackgroundColor()
2287{
2288 return mBackgroundColor;
2289}
2290
2291
2340// rearrange the child rects so they fit the shape of the menu. 2292// rearrange the child rects so they fit the shape of the menu.
2341void LLMenuGL::arrange( void ) 2293void LLMenuGL::arrange( void )
2342{ 2294{
@@ -2350,8 +2302,10 @@ void LLMenuGL::arrange( void )
2350 2302
2351 if( mItems.size() ) 2303 if( mItems.size() )
2352 { 2304 {
2353 U32 max_width = (getParent() != NULL) ? getParent()->getRect().getWidth() : U32_MAX; 2305 const LLRect menu_region_rect = LLMenuGL::sMenuContainer ? LLMenuGL::sMenuContainer->getMenuRect() : LLRect(0, S32_MAX, S32_MAX, 0);
2354 U32 max_height = (getParent() != NULL) ? getParent()->getRect().getHeight() : U32_MAX; 2306
2307 U32 max_width = menu_region_rect.getWidth();
2308 U32 max_height = menu_region_rect.getHeight();
2355 // *FIX: create the item first and then ask for its dimensions? 2309 // *FIX: create the item first and then ask for its dimensions?
2356 S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" ); 2310 S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( "More" );
2357 S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING; 2311 S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING;
@@ -2472,7 +2426,7 @@ void LLMenuGL::createSpilloverBranch()
2472 // technically, you can't tear off spillover menus, but we're passing the handle 2426 // technically, you can't tear off spillover menus, but we're passing the handle
2473 // along just to be safe 2427 // along just to be safe
2474 mSpilloverMenu = new LLMenuGL("More", "More", mParentFloaterHandle); 2428 mSpilloverMenu = new LLMenuGL("More", "More", mParentFloaterHandle);
2475 mSpilloverMenu->updateParent(getParent()); 2429 mSpilloverMenu->updateParent(LLMenuGL::sMenuContainer);
2476 // Inherit colors 2430 // Inherit colors
2477 mSpilloverMenu->setBackgroundColor( mBackgroundColor ); 2431 mSpilloverMenu->setBackgroundColor( mBackgroundColor );
2478 mSpilloverMenu->setCanTearOff(FALSE); 2432 mSpilloverMenu->setCanTearOff(FALSE);
@@ -3110,7 +3064,6 @@ void LLMenuGL::setVisible(BOOL visible)
3110 mFadeTimer.stop(); 3064 mFadeTimer.stop();
3111 } 3065 }
3112 3066
3113 //gViewerWindow->finishFastFrame();
3114 LLView::setVisible(visible); 3067 LLView::setVisible(visible);
3115 } 3068 }
3116} 3069}
@@ -3157,6 +3110,8 @@ void hide_top_view( LLView* view )
3157// static 3110// static
3158void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) 3111void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
3159{ 3112{
3113 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
3114
3160 const S32 HPAD = 2; 3115 const S32 HPAD = 2;
3161 LLRect rect = menu->getRect(); 3116 LLRect rect = menu->getRect();
3162 //LLView* cur_view = spawning_view; 3117 //LLView* cur_view = spawning_view;
@@ -3177,13 +3132,15 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
3177 // &left, &bottom ); 3132 // &left, &bottom );
3178 S32 delta_x = 0; 3133 S32 delta_x = 0;
3179 S32 delta_y = 0; 3134 S32 delta_y = 0;
3180 if( bottom < 0 ) 3135 if( bottom < menu_region_rect.mBottom )
3181 { 3136 {
3182 delta_y = -bottom; 3137 // At this point, we need to move the context menu to the
3138 // other side of the mouse.
3139 //delta_y = menu_region_rect.mBottom - bottom;
3140 delta_y = (rect.getHeight() + 2 * HPAD);
3183 } 3141 }
3184 3142
3185 S32 parent_width = menu->getParent()->getRect().getWidth(); 3143 if( left > menu_region_rect.mRight - rect.getWidth() )
3186 if( left > parent_width - rect.getWidth() )
3187 { 3144 {
3188 // At this point, we need to move the context menu to the 3145 // At this point, we need to move the context menu to the
3189 // other side of the mouse. 3146 // other side of the mouse.
@@ -3283,7 +3240,7 @@ void LLPieMenuBranch::doIt( void )
3283 S32 center_y; 3240 S32 center_y;
3284 parent->localPointToScreen(rect.getWidth() / 2, rect.getHeight() / 2, &center_x, &center_y); 3241 parent->localPointToScreen(rect.getWidth() / 2, rect.getHeight() / 2, &center_x, &center_y);
3285 3242
3286 parent->hide(TRUE); 3243 parent->hide(FALSE);
3287 mBranch->show( center_x, center_y, FALSE ); 3244 mBranch->show( center_x, center_y, FALSE );
3288} 3245}
3289 3246
@@ -3473,6 +3430,11 @@ BOOL LLPieMenu::handleMouseDown( S32 x, S32 y, MASK mask )
3473 // to make sure it's within the item's rectangle 3430 // to make sure it's within the item's rectangle
3474 handled = item->handleMouseDown( 0, 0, mask ); 3431 handled = item->handleMouseDown( 0, 0, mask );
3475 } 3432 }
3433 else if (!mRightMouseDown)
3434 {
3435 // call hidemenus to make sure transient selections get cleared
3436 ((LLMenuHolderGL*)getParent())->hideMenus();
3437 }
3476 3438
3477 // always handle mouse down as mouse up will close open menus 3439 // always handle mouse down as mouse up will close open menus
3478 return handled; 3440 return handled;
@@ -3546,6 +3508,11 @@ BOOL LLPieMenu::handleMouseUp( S32 x, S32 y, MASK mask )
3546 hide(TRUE); 3508 hide(TRUE);
3547 } 3509 }
3548 } 3510 }
3511 else if (!mRightMouseDown)
3512 {
3513 // call hidemenus to make sure transient selections get cleared
3514 ((LLMenuHolderGL*)getParent())->hideMenus();
3515 }
3549 3516
3550 if (handled) 3517 if (handled)
3551 { 3518 {
@@ -3555,7 +3522,7 @@ BOOL LLPieMenu::handleMouseUp( S32 x, S32 y, MASK mask )
3555 if (!handled && !mUseInfiniteRadius) 3522 if (!handled && !mUseInfiniteRadius)
3556 { 3523 {
3557 // call hidemenus to make sure transient selections get cleared 3524 // call hidemenus to make sure transient selections get cleared
3558 ((LLMenuHolderGL*)getParent())->hideMenus(); 3525 sMenuContainer->hideMenus();
3559 } 3526 }
3560 3527
3561 if (mFirstMouseDown) 3528 if (mFirstMouseDown)
@@ -3866,10 +3833,9 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3866 S32 width = mRect.getWidth(); 3833 S32 width = mRect.getWidth();
3867 S32 height = mRect.getHeight(); 3834 S32 height = mRect.getHeight();
3868 3835
3869 LLView* parent_view = getParent(); 3836 const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
3870 S32 menu_region_width = parent_view->getRect().getWidth();
3871 S32 menu_region_height = parent_view->getRect().getHeight();
3872 3837
3838 LLView* parent_view = getParent();
3873 BOOL moved = FALSE; 3839 BOOL moved = FALSE;
3874 3840
3875 S32 local_x, local_y; 3841 S32 local_x, local_y;
@@ -3879,36 +3845,36 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
3879 arrange(); 3845 arrange();
3880 3846
3881 // Adjust the pie rectangle to keep it on screen 3847 // Adjust the pie rectangle to keep it on screen
3882 if (mRect.mLeft < 0) 3848 if (mRect.mLeft < menu_region_rect.mLeft)
3883 { 3849 {
3884 //mShiftHoriz = 0 - mRect.mLeft; 3850 //mShiftHoriz = menu_region_rect.mLeft - mRect.mLeft;
3885 //mRect.translate( mShiftHoriz, 0 ); 3851 //mRect.translate( mShiftHoriz, 0 );
3886 mRect.translate( 0 - mRect.mLeft, 0 ); 3852 mRect.translate( menu_region_rect.mLeft - mRect.mLeft, 0 );
3887 moved = TRUE; 3853 moved = TRUE;
3888 } 3854 }
3889 3855
3890 if (mRect.mRight > menu_region_width) 3856 if (mRect.mRight > menu_region_rect.mRight)
3891 { 3857 {
3892 //mShiftHoriz = menu_region_width - mRect.mRight; 3858 //mShiftHoriz = menu_region_rect.mRight - mRect.mRight;
3893 //mRect.translate( mShiftHoriz, 0); 3859 //mRect.translate( mShiftHoriz, 0);
3894 mRect.translate( menu_region_width - mRect.mRight, 0 ); 3860 mRect.translate( menu_region_rect.mRight - mRect.mRight, 0 );
3895 moved = TRUE; 3861 moved = TRUE;
3896 } 3862 }
3897 3863
3898 if (mRect.mBottom < 0) 3864 if (mRect.mBottom < menu_region_rect.mBottom)
3899 { 3865 {
3900 //mShiftVert = -mRect.mBottom; 3866 //mShiftVert = menu_region_rect.mBottom - mRect.mBottom;
3901 //mRect.translate( 0, mShiftVert ); 3867 //mRect.translate( 0, mShiftVert );
3902 mRect.translate( 0, 0 - mRect.mBottom ); 3868 mRect.translate( 0, menu_region_rect.mBottom - mRect.mBottom );
3903 moved = TRUE; 3869 moved = TRUE;
3904 } 3870 }
3905 3871
3906 3872
3907 if (mRect.mTop > menu_region_height) 3873 if (mRect.mTop > menu_region_rect.mTop)
3908 { 3874 {
3909 //mShiftVert = menu_region_height - mRect.mTop; 3875 //mShiftVert = menu_region_rect.mTop - mRect.mTop;
3910 //mRect.translate( 0, mShiftVert ); 3876 //mRect.translate( 0, mShiftVert );
3911 mRect.translate( 0, menu_region_height - mRect.mTop ); 3877 mRect.translate( 0, menu_region_rect.mTop - mRect.mTop );
3912 moved = TRUE; 3878 moved = TRUE;
3913 } 3879 }
3914 3880
@@ -4067,9 +4033,9 @@ LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
4067 menu->setCanTearOff(TRUE, parent_handle); 4033 menu->setCanTearOff(TRUE, parent_handle);
4068 } 4034 }
4069 menubar->appendMenu(menu); 4035 menubar->appendMenu(menu);
4070 if (LLMenuGL::sDefaultMenuContainer != NULL) 4036 if (LLMenuGL::sMenuContainer != NULL)
4071 { 4037 {
4072 menu->updateParent(LLMenuGL::sDefaultMenuContainer); 4038 menu->updateParent(LLMenuGL::sMenuContainer);
4073 } 4039 }
4074 else 4040 else
4075 { 4041 {
@@ -4198,9 +4164,9 @@ void LLMenuBarGL::checkMenuTrigger()
4198 4164
4199BOOL LLMenuBarGL::jumpKeysActive() 4165BOOL LLMenuBarGL::jumpKeysActive()
4200{ 4166{
4201 // require item to be highlighted to activate key triggers 4167 // require user to be in keyboard navigation mode to activate key triggers
4202 // as menu bars are always visible 4168 // as menu bars are always visible and it is easy to leave the mouse cursor over them
4203 return getHighlightedItem() && LLMenuGL::jumpKeysActive(); 4169 return LLMenuGL::getKeyboardMode() && getHighlightedItem() && LLMenuGL::jumpKeysActive();
4204} 4170}
4205 4171
4206// rearrange the child rects so they fit the shape of the menu bar. 4172// rearrange the child rects so they fit the shape of the menu bar.
@@ -4218,6 +4184,7 @@ void LLMenuBarGL::arrange( void )
4218 item->setRect( rect ); 4184 item->setRect( rect );
4219 item->buildDrawLabel(); 4185 item->buildDrawLabel();
4220 } 4186 }
4187 reshape(rect.mRight, rect.getHeight());
4221} 4188}
4222 4189
4223 4190
@@ -4430,12 +4397,12 @@ void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
4430 LLView::reshape(width, height, called_from_parent); 4397 LLView::reshape(width, height, called_from_parent);
4431} 4398}
4432 4399
4433BOOL LLMenuHolderGL::hasVisibleMenu() 4400BOOL LLMenuHolderGL::hasVisibleMenu() const
4434{ 4401{
4435 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 4402 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
4436 { 4403 {
4437 LLView* viewp = *child_it; 4404 LLView* viewp = *child_it;
4438 if (viewp->getVisible()) 4405 if (viewp->getVisible() && viewp->getWidgetType() != WIDGET_TYPE_MENU_BAR)
4439 { 4406 {
4440 return TRUE; 4407 return TRUE;
4441 } 4408 }
@@ -4443,6 +4410,11 @@ BOOL LLMenuHolderGL::hasVisibleMenu()
4443 return FALSE; 4410 return FALSE;
4444} 4411}
4445 4412
4413const LLRect LLMenuHolderGL::getMenuRect() const
4414{
4415 return getLocalRect();
4416}
4417
4446BOOL LLMenuHolderGL::hideMenus() 4418BOOL LLMenuHolderGL::hideMenus()
4447{ 4419{
4448 if (!mCanHide) 4420 if (!mCanHide)
@@ -4452,11 +4424,13 @@ BOOL LLMenuHolderGL::hideMenus()
4452 BOOL menu_visible = hasVisibleMenu(); 4424 BOOL menu_visible = hasVisibleMenu();
4453 if (menu_visible) 4425 if (menu_visible)
4454 { 4426 {
4427 LLMenuGL::setKeyboardMode(FALSE);
4455 // clicked off of menu, hide them all 4428 // clicked off of menu, hide them all
4456 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) 4429 for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
4457 { 4430 {
4458 LLView* viewp = *child_it; 4431 LLView* viewp = *child_it;
4459 if (viewp->getVisible()) 4432 // clicks off of menu do not hide menu bar
4433 if (viewp->getWidgetType() != WIDGET_TYPE_MENU_BAR && viewp->getVisible())
4460 { 4434 {
4461 viewp->setVisible(FALSE); 4435 viewp->setVisible(FALSE);
4462 } 4436 }
@@ -4598,7 +4572,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup)
4598 LLTearOffMenu* tearoffp = new LLTearOffMenu(menup); 4572 LLTearOffMenu* tearoffp = new LLTearOffMenu(menup);
4599 // keep onscreen 4573 // keep onscreen
4600 gFloaterView->adjustToFitScreen(tearoffp, FALSE); 4574 gFloaterView->adjustToFitScreen(tearoffp, FALSE);
4601 tearoffp->open(); 4575 tearoffp->open(); /* Flawfinder: ignore */
4602 return tearoffp; 4576 return tearoffp;
4603} 4577}
4604 4578
diff --git a/linden/indra/llui/llmenugl.h b/linden/indra/llui/llmenugl.h
index 77e2b31..c4a0043 100644
--- a/linden/indra/llui/llmenugl.h
+++ b/linden/indra/llui/llmenugl.h
@@ -41,6 +41,7 @@
41#include "llview.h" 41#include "llview.h"
42 42
43class LLMenuItemGL; 43class LLMenuItemGL;
44class LLMenuHolderGL;
44 45
45extern S32 MENU_BAR_HEIGHT; 46extern S32 MENU_BAR_HEIGHT;
46extern S32 MENU_BAR_WIDTH; 47extern S32 MENU_BAR_WIDTH;
@@ -163,6 +164,7 @@ public:
163 164
164 // LLView Functionality 165 // LLView Functionality
165 virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ); 166 virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
167 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
166 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); 168 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
167 virtual void draw( void ); 169 virtual void draw( void );
168 170
@@ -441,6 +443,7 @@ public:
441 443
442 static void setDefaultBackgroundColor( const LLColor4& color ); 444 static void setDefaultBackgroundColor( const LLColor4& color );
443 void setBackgroundColor( const LLColor4& color ); 445 void setBackgroundColor( const LLColor4& color );
446 LLColor4 getBackgroundColor();
444 void setBackgroundVisible( BOOL b ) { mBgVisible = b; } 447 void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
445 void setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle = LLViewHandle::sDeadHandle); 448 void setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle = LLViewHandle::sDeadHandle);
446 449
@@ -523,7 +526,8 @@ public:
523 static BOOL getKeyboardMode() { return sKeyboardMode; } 526 static BOOL getKeyboardMode() { return sKeyboardMode; }
524 527
525 static void onFocusLost(LLView* old_focus); 528 static void onFocusLost(LLView* old_focus);
526 static LLView *sDefaultMenuContainer; 529
530 static LLMenuHolderGL* sMenuContainer;
527 531
528protected: 532protected:
529 void createSpilloverBranch(); 533 void createSpilloverBranch();
@@ -558,6 +562,75 @@ protected:
558 KEY mJumpKey; 562 KEY mJumpKey;
559}; 563};
560 564
565
566
567//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
568// Class LLMenuItemBranchGL
569//
570// The LLMenuItemBranchGL represents a menu item that has a
571// sub-menu. This is used to make cascading menus.
572//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
573
574class LLMenuItemBranchGL : public LLMenuItemGL
575{
576protected:
577 LLMenuGL* mBranch;
578
579public:
580 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
581 KEY key = KEY_NONE, MASK mask = MASK_NONE );
582 virtual LLXMLNodePtr getXML(bool save_children = true) const;
583
584 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
585
586 virtual LLString getType() const { return "menu"; }
587
588 virtual EWidgetType getWidgetType() const;
589 virtual LLString getWidgetTag() const;
590
591 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
592
593 virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
594
595 // check if we've used these accelerators already
596 virtual BOOL addToAcceleratorList(std::list <LLKeyBinding*> *listp);
597
598 // called to rebuild the draw label
599 virtual void buildDrawLabel( void );
600
601 // doIt() - do the primary funcationality of the menu item.
602 virtual void doIt( void );
603
604 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
605 virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
606
607 // set the hover status (called by it's menu) and if the object is
608 // active. This is used for behavior transfer.
609 virtual void setHighlight( BOOL highlight );
610
611 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
612
613 virtual BOOL isActive() const;
614
615 virtual BOOL isOpen() const;
616
617 LLMenuGL *getBranch() const { return mBranch; }
618
619 virtual void updateBranchParent( LLView* parentp );
620
621 // LLView Functionality
622 virtual void onVisibilityChange( BOOL curVisibilityIn );
623
624 virtual void draw();
625
626 virtual void setEnabledSubMenus(BOOL enabled);
627
628 virtual void openMenu();
629};
630
631
632
633
561//----------------------------------------------------------------------------- 634//-----------------------------------------------------------------------------
562// class LLPieMenu 635// class LLPieMenu
563// A circular menu of items, icons, etc. 636// A circular menu of items, icons, etc.
@@ -698,8 +771,10 @@ public:
698 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); 771 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
699 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); 772 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
700 773
774 virtual const LLRect getMenuRect() const;
775 virtual BOOL hasVisibleMenu() const;
776
701 static void setActivatedItem(LLMenuItemGL* item); 777 static void setActivatedItem(LLMenuItemGL* item);
702 BOOL hasVisibleMenu();
703 778
704protected: 779protected:
705 static LLViewHandle sItemLastSelectedHandle; 780 static LLViewHandle sItemLastSelectedHandle;
diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp
index c2c29bb..8d3fba6 100644
--- a/linden/indra/llui/llpanel.cpp
+++ b/linden/indra/llui/llpanel.cpp
@@ -183,10 +183,11 @@ void LLPanel::draw()
183 // draw background 183 // draw background
184 if( mBgVisible ) 184 if( mBgVisible )
185 { 185 {
186 S32 left = LLPANEL_BORDER_WIDTH; 186 //RN: I don't see the point of this
187 S32 top = mRect.getHeight() - LLPANEL_BORDER_WIDTH; 187 S32 left = 0;//LLPANEL_BORDER_WIDTH;
188 S32 right = mRect.getWidth() - LLPANEL_BORDER_WIDTH; 188 S32 top = mRect.getHeight();// - LLPANEL_BORDER_WIDTH;
189 S32 bottom = LLPANEL_BORDER_WIDTH; 189 S32 right = mRect.getWidth();// - LLPANEL_BORDER_WIDTH;
190 S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
190 191
191 if (mBgOpaque ) 192 if (mBgOpaque )
192 { 193 {
@@ -357,16 +358,6 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
357 gFocusMgr.childHasKeyboardFocus(this) && !called_from_parent ) 358 gFocusMgr.childHasKeyboardFocus(this) && !called_from_parent )
358 { 359 {
359 LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); 360 LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
360 if (key == KEY_RETURN && mask == MASK_NONE)
361 {
362 // set keyboard focus to self to trigger commitOnFocusLost behavior on current ctrl
363 if (cur_focus && cur_focus->acceptsTextInput())
364 {
365 cur_focus->onCommit();
366 handled = TRUE;
367 }
368 }
369
370 // If we have a default button, click it when 361 // If we have a default button, click it when
371 // return is pressed, unless current focus is a return-capturing button 362 // return is pressed, unless current focus is a return-capturing button
372 // in which case *that* button will handle the return key 363 // in which case *that* button will handle the return key
@@ -382,6 +373,16 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask, BOOL called_from_parent )
382 handled = TRUE; 373 handled = TRUE;
383 } 374 }
384 } 375 }
376
377 if (key == KEY_RETURN && mask == MASK_NONE)
378 {
379 // set keyboard focus to self to trigger commitOnFocusLost behavior on current ctrl
380 if (cur_focus && cur_focus->acceptsTextInput())
381 {
382 cur_focus->onCommit();
383 handled = TRUE;
384 }
385 }
385 } 386 }
386 387
387 return handled; 388 return handled;
@@ -478,6 +479,11 @@ void LLPanel::setBackgroundColor(const LLColor4& color)
478 mBgColorOpaque = color; 479 mBgColorOpaque = color;
479} 480}
480 481
482LLColor4 LLPanel::getBackgroundColor()
483{
484 return mBgColorOpaque;
485}
486
481void LLPanel::setTransparentColor(const LLColor4& color) 487void LLPanel::setTransparentColor(const LLColor4& color)
482{ 488{
483 mBgColorAlpha = color; 489 mBgColorAlpha = color;
diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h
index 975c747..d9bd19c 100644
--- a/linden/indra/llui/llpanel.h
+++ b/linden/indra/llui/llpanel.h
@@ -36,6 +36,7 @@
36#include "llviewborder.h" 36#include "llviewborder.h"
37#include "v4color.h" 37#include "v4color.h"
38#include <list> 38#include <list>
39#include <queue>
39 40
40const S32 LLPANEL_BORDER_WIDTH = 1; 41const S32 LLPANEL_BORDER_WIDTH = 1;
41const BOOL BORDER_YES = TRUE; 42const BOOL BORDER_YES = TRUE;
@@ -105,6 +106,7 @@ public:
105 static BOOL nextAlert(LLAlertInfo &alert); 106 static BOOL nextAlert(LLAlertInfo &alert);
106 107
107 void setBackgroundColor( const LLColor4& color ); 108 void setBackgroundColor( const LLColor4& color );
109 LLColor4 getBackgroundColor();
108 void setTransparentColor(const LLColor4& color); 110 void setTransparentColor(const LLColor4& color);
109 void setBackgroundVisible( BOOL b ) { mBgVisible = b; } 111 void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
110 void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } 112 void setBackgroundOpaque(BOOL b) { mBgOpaque = b; }
diff --git a/linden/indra/llui/llresmgr.cpp b/linden/indra/llui/llresmgr.cpp
index 3c54cf6..a73b487 100644
--- a/linden/indra/llui/llresmgr.cpp
+++ b/linden/indra/llui/llresmgr.cpp
@@ -321,8 +321,8 @@ void LLResMgr::getMonetaryString( LLString& output, S32 input ) const
321 } 321 }
322 S32 group_count = cur_group; 322 S32 group_count = cur_group;
323 323
324 char reversed_output[20] = ""; 324 char reversed_output[20] = ""; /* Flawfinder: ignore */
325 char forward_output[20] = ""; 325 char forward_output[20] = ""; /* Flawfinder: ignore */
326 S32 output_pos = 0; 326 S32 output_pos = 0;
327 327
328 cur_group = 0; 328 cur_group = 0;
diff --git a/linden/indra/llui/llrootview.cpp b/linden/indra/llui/llrootview.cpp
index 699a2f6..49e512c 100644
--- a/linden/indra/llui/llrootview.cpp
+++ b/linden/indra/llui/llrootview.cpp
@@ -1,8 +1,8 @@
1/** 1/**
2 * @file llrootview.cpp 2 * @file llrootview.cpp
3 * @brief Container for all other views in an application 3 * @brief Container for all other views in an application
4 * 4 *
5 * Copyright (c) 2006-2007, Linden Research, Inc. 5 * Copyright (c) 2006-2007, Linden Research, Inc.
6 * 6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab 7 * 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 8 * to you under the terms of the GNU General Public License, version 2.0
@@ -22,23 +22,23 @@
22 * 22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 25 * COMPLETENESS OR PERFORMANCE.
26 */ 26 */
27 27
28#include "llrootview.h" 28#include "llrootview.h"
29 29
30LLRootView::LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows) 30LLRootView::LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows)
31: LLView(name,rect,mouse_opaque,follows) 31: LLView(name,rect,mouse_opaque,follows)
32{ } 32{ }
33 33
34// virtual 34// virtual
35EWidgetType LLRootView::getWidgetType() const 35EWidgetType LLRootView::getWidgetType() const
36{ 36{
37 return WIDGET_TYPE_ROOT_VIEW; 37 return WIDGET_TYPE_ROOT_VIEW;
38} 38}
39 39
40// virtual 40// virtual
41LLString LLRootView::getWidgetTag() const 41LLString LLRootView::getWidgetTag() const
42{ 42{
43 return LL_ROOT_VIEW_TAG; 43 return LL_ROOT_VIEW_TAG;
44} 44}
diff --git a/linden/indra/llui/llrootview.h b/linden/indra/llui/llrootview.h
index 212b93b..84a989b 100644
--- a/linden/indra/llui/llrootview.h
+++ b/linden/indra/llui/llrootview.h
@@ -1,8 +1,8 @@
1/** 1/**
2 * @file llrootview.h 2 * @file llrootview.h
3 * @brief Container for all other views in an application 3 * @brief Container for all other views in an application
4 * 4 *
5 * Copyright (c) 2006-2007, Linden Research, Inc. 5 * Copyright (c) 2006-2007, Linden Research, Inc.
6 * 6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab 7 * 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 8 * to you under the terms of the GNU General Public License, version 2.0
@@ -22,21 +22,21 @@
22 * 22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 25 * COMPLETENESS OR PERFORMANCE.
26 */ 26 */
27 27
28#ifndef LLROOTVIEW_H 28#ifndef LLROOTVIEW_H
29#define LLROOTVIEW_H 29#define LLROOTVIEW_H
30 30
31#include "llview.h" 31#include "llview.h"
32 32
33class LLRootView : public LLView 33class LLRootView : public LLView
34{ 34{
35public: 35public:
36 LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE); 36 LLRootView(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows=FOLLOWS_NONE);
37 37
38 /*virtual*/ EWidgetType getWidgetType() const; 38 /*virtual*/ EWidgetType getWidgetType() const;
39 /*virtual*/ LLString getWidgetTag() const; 39 /*virtual*/ LLString getWidgetTag() const;
40}; 40};
41 41
42#endif 42#endif
diff --git a/linden/indra/llui/llscrollbar.cpp b/linden/indra/llui/llscrollbar.cpp
index da3e472..578fdb1 100644
--- a/linden/indra/llui/llscrollbar.cpp
+++ b/linden/indra/llui/llscrollbar.cpp
@@ -405,21 +405,23 @@ BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
405BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, 405BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
406 EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg) 406 EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg)
407{ 407{
408 if (!drop) 408 // enable this to get drag and drop to control scrollbars
409 { 409 //if (!drop)
410 //TODO: refactor this 410 //{
411 S32 variable_lines = getDocPosMax(); 411 // //TODO: refactor this
412 S32 pos = (VERTICAL == mOrientation) ? y : x; 412 // S32 variable_lines = getDocPosMax();
413 S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth(); 413 // S32 pos = (VERTICAL == mOrientation) ? y : x;
414 S32 thumb_track_length = (VERTICAL == mOrientation) ? (mRect.getHeight() - 2 * SCROLLBAR_SIZE) : (mRect.getWidth() - 2 * SCROLLBAR_SIZE); 414 // S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth();
415 S32 usable_track_length = thumb_track_length - thumb_length; 415 // S32 thumb_track_length = (VERTICAL == mOrientation) ? (mRect.getHeight() - 2 * SCROLLBAR_SIZE) : (mRect.getWidth() - 2 * SCROLLBAR_SIZE);
416 F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length 416 // S32 usable_track_length = thumb_track_length - thumb_length;
417 : F32(pos - SCROLLBAR_SIZE) / usable_track_length; 417 // F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length
418 S32 new_pos = (VERTICAL == mOrientation) ? llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ) 418 // : F32(pos - SCROLLBAR_SIZE) / usable_track_length;
419 : llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines ); 419 // S32 new_pos = (VERTICAL == mOrientation) ? llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines )
420 changeLine( new_pos - mDocPos, TRUE ); 420 // : llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines );
421 } 421 // changeLine( new_pos - mDocPos, TRUE );
422 return TRUE; 422 //}
423 //return TRUE;
424 return FALSE;
423} 425}
424 426
425BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) 427BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask)
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index df4ca64..4d5c49f 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -95,7 +95,7 @@ protected:
95// LLScrollListIcon 95// LLScrollListIcon
96// 96//
97LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) : 97LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) :
98mIcon(icon), mImageUUID(image_id.getString()) 98mIcon(icon), mImageUUID(image_id.asString())
99{ 99{
100 if (width) 100 if (width)
101 { 101 {
@@ -156,13 +156,15 @@ BOOL LLScrollListCheck::handleClick()
156// 156//
157U32 LLScrollListText::sCount = 0; 157U32 LLScrollListText::sCount = 0;
158 158
159LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font, S32 width, U8 font_style, LLColor4& color, BOOL use_color, BOOL visible) 159LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible)
160: mText( text ), 160: mText( text ),
161 mFont( font ), 161 mFont( font ),
162 mFontStyle( font_style ), 162 mFontStyle( font_style ),
163 mFontAlignment( font_alignment ),
163 mWidth( width ), 164 mWidth( width ),
164 mVisible( visible ), 165 mVisible( visible ),
165 mHighlightChars( 0 ) 166 mHighlightCount( 0 ),
167 mHighlightOffset( 0 )
166{ 168{
167 if (use_color) 169 if (use_color)
168 { 170 {
@@ -181,10 +183,6 @@ LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font,
181 { 183 {
182 mRoundedRectImage = LLUI::sImageProvider->getUIImageByID(LLUUID(LLUI::sAssetsGroup->getString("rounded_square.tga"))); 184 mRoundedRectImage = LLUI::sImageProvider->getUIImageByID(LLUUID(LLUI::sAssetsGroup->getString("rounded_square.tga")));
183 } 185 }
184
185 // Yes, that's four dots, because we want it to have a little
186 // padding, in proportion to the font size.
187 mEllipsisWidth = (S32)mFont->getWidth("....");
188} 186}
189 187
190LLScrollListText::~LLScrollListText() 188LLScrollListText::~LLScrollListText()
@@ -216,13 +214,26 @@ void LLScrollListText::drawToWidth(S32 width, const LLColor4& color, const LLCol
216 display_color = &color; 214 display_color = &color;
217 } 215 }
218 216
219 if (mHighlightChars > 0) 217 if (mHighlightCount > 0)
220 { 218 {
221 mRoundedRectImage->bind(); 219 mRoundedRectImage->bind();
222 glColor4fv(highlight_color.mV); 220 glColor4fv(highlight_color.mV);
223 gl_segmented_rect_2d_tex(-2, 221 S32 left = 0;
222 switch(mFontAlignment)
223 {
224 case LLFontGL::LEFT:
225 left = mFont->getWidth(mText.getString(), 0, mHighlightOffset);
226 break;
227 case LLFontGL::RIGHT:
228 left = width - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX);
229 break;
230 case LLFontGL::HCENTER:
231 left = (width - mFont->getWidth(mText.getString())) / 2;
232 break;
233 }
234 gl_segmented_rect_2d_tex(left - 2,
224 llround(mFont->getLineHeight()) + 1, 235 llround(mFont->getLineHeight()) + 1,
225 mFont->getWidth(mText.getString(), 0, mHighlightChars) + 1, 236 left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1,
226 1, 237 1,
227 mRoundedRectImage->getWidth(), 238 mRoundedRectImage->getWidth(),
228 mRoundedRectImage->getHeight(), 239 mRoundedRectImage->getHeight(),
@@ -232,21 +243,28 @@ void LLScrollListText::drawToWidth(S32 width, const LLColor4& color, const LLCol
232 // Try to draw the entire string 243 // Try to draw the entire string
233 F32 right_x; 244 F32 right_x;
234 U32 string_chars = mText.length(); 245 U32 string_chars = mText.length();
235 U32 drawn_chars = mFont->render(mText.getWString(), 0, 0, 2, 246 F32 start_x = 0.f;
236 *display_color, 247 switch(mFontAlignment)
237 LLFontGL::LEFT, 248 {
238 LLFontGL::BOTTOM, 249 case LLFontGL::LEFT:
239 mFontStyle, 250 start_x = 0.f;
240 string_chars, 251 break;
241 width - mEllipsisWidth, 252 case LLFontGL::RIGHT:
242 &right_x, FALSE); 253 start_x = (F32)width;
243 254 break;
244 // If we didn't get the whole string, abbreviate 255 case LLFontGL::HCENTER:
245 if (drawn_chars < string_chars && drawn_chars) 256 start_x = (F32)width * 0.5f;
246 { 257 break;
247 mFont->renderUTF8("...", 0, right_x, 0.f, color, LLFontGL::LEFT, LLFontGL::BOTTOM, mFontStyle, 258 }
248 S32_MAX, S32_MAX, NULL, FALSE); 259 mFont->render(mText.getWString(), 0,
249 } 260 start_x, 2.f,
261 *display_color,
262 mFontAlignment,
263 LLFontGL::BOTTOM,
264 mFontStyle,
265 string_chars,
266 width,
267 &right_x, FALSE, TRUE);
250} 268}
251 269
252 270
@@ -378,20 +396,21 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
378 mFgUnselectedColor( LLUI::sColorsGroup->getColor("ScrollUnselectedColor") ), 396 mFgUnselectedColor( LLUI::sColorsGroup->getColor("ScrollUnselectedColor") ),
379 mFgDisabledColor( LLUI::sColorsGroup->getColor("ScrollDisabledColor") ), 397 mFgDisabledColor( LLUI::sColorsGroup->getColor("ScrollDisabledColor") ),
380 mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ), 398 mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ),
381 mHighlightedItem(-1),
382 mBorderThickness( 2 ), 399 mBorderThickness( 2 ),
383 mOnDoubleClickCallback( NULL ), 400 mOnDoubleClickCallback( NULL ),
384 mOnMaximumSelectCallback( NULL ), 401 mOnMaximumSelectCallback( NULL ),
385 mOnSortChangedCallback( NULL ), 402 mOnSortChangedCallback( NULL ),
386 mDrewSelected(FALSE), 403 mHighlightedItem(-1),
387 mBorder(NULL), 404 mBorder(NULL),
388 mSearchColumn(0),
389 mDefaultColumn("SIMPLE"), 405 mDefaultColumn("SIMPLE"),
406 mSearchColumn(0),
390 407
391 mNumDynamicWidthColumns(0), 408 mNumDynamicWidthColumns(0),
392 mTotalStaticColumnWidth(0), 409 mTotalStaticColumnWidth(0),
393 mSortColumn(0), 410 mSortColumn(0),
394 mSortAscending(TRUE) 411 mSortAscending(TRUE),
412
413 mDrewSelected(FALSE)
395{ 414{
396 mItemListRect.setOriginAndSize( 415 mItemListRect.setOriginAndSize(
397 mBorderThickness + LIST_BORDER_PAD, 416 mBorderThickness + LIST_BORDER_PAD,
@@ -1160,11 +1179,17 @@ BOOL LLScrollListCtrl::selectSimpleItemByPrefix(const LLWString& target, BOOL ca
1160 { 1179 {
1161 LLWString::toLower(item_label); 1180 LLWString::toLower(item_label);
1162 } 1181 }
1182 // remove extraneous whitespace from searchable label
1183 LLWString trimmed_label = item_label;
1184 LLWString::trim(trimmed_label);
1163 1185
1164 BOOL select = item->getEnabled() && !item_label.compare(0, target_len, target_trimmed); 1186 BOOL select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0;
1165 1187
1166 if (select) 1188 if (select)
1167 { 1189 {
1190 // find offset of matching text (might have leading whitespace)
1191 S32 offset = item_label.find(target_trimmed);
1192 cellp->highlightText(offset, target_trimmed.size());
1168 selectItem(item); 1193 selectItem(item);
1169 found = TRUE; 1194 found = TRUE;
1170 break; 1195 break;
@@ -1466,6 +1491,9 @@ BOOL LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
1466{ 1491{
1467 BOOL handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; 1492 BOOL handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL;
1468 1493
1494 // set keyboard focus first, in case click action wants to move focus elsewhere
1495 setFocus(TRUE);
1496
1469 if( !handled && mCanSelect) 1497 if( !handled && mCanSelect)
1470 { 1498 {
1471 LLScrollListItem* hit_item = hitItem(x, y); 1499 LLScrollListItem* hit_item = hitItem(x, y);
@@ -1558,8 +1586,6 @@ BOOL LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
1558 } 1586 }
1559 } 1587 }
1560 1588
1561 gFocusMgr.setKeyboardFocus(this, NULL);
1562
1563 return TRUE; 1589 return TRUE;
1564} 1590}
1565 1591
@@ -1758,7 +1784,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask, BOOL called_from_parent
1758 LLScrollListCell* cellp = getFirstSelected()->getColumn(mSearchColumn); 1784 LLScrollListCell* cellp = getFirstSelected()->getColumn(mSearchColumn);
1759 if (cellp) 1785 if (cellp)
1760 { 1786 {
1761 cellp->highlightText(0); 1787 cellp->highlightText(0, 0);
1762 } 1788 }
1763 } 1789 }
1764 } 1790 }
@@ -1767,13 +1793,6 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask, BOOL called_from_parent
1767 // update search string only on successful match 1793 // update search string only on successful match
1768 mSearchTimer.reset(); 1794 mSearchTimer.reset();
1769 1795
1770 // highlight current search on matching item
1771 LLScrollListCell* cellp = getFirstSelected()->getColumn(mSearchColumn);
1772 if (cellp)
1773 {
1774 cellp->highlightText(mSearchString.size());
1775 }
1776
1777 if (mCommitOnKeyboardMovement 1796 if (mCommitOnKeyboardMovement
1778 && !mCommitOnSelectionChange) 1797 && !mCommitOnSelectionChange)
1779 { 1798 {
@@ -1813,13 +1832,6 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_
1813 mSearchString += uni_char; 1832 mSearchString += uni_char;
1814 mSearchTimer.reset(); 1833 mSearchTimer.reset();
1815 1834
1816 // highlight current search on matching item
1817 LLScrollListCell* cellp = getFirstSelected()->getColumn(mSearchColumn);
1818 if (cellp)
1819 {
1820 cellp->highlightText(mSearchString.size());
1821 }
1822
1823 if (mCommitOnKeyboardMovement 1835 if (mCommitOnKeyboardMovement
1824 && !mCommitOnSelectionChange) 1836 && !mCommitOnSelectionChange)
1825 { 1837 {
@@ -1862,7 +1874,7 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_
1862 if (item->getEnabled() && LLStringOps::toLower(item_label[0]) == uni_char) 1874 if (item->getEnabled() && LLStringOps::toLower(item_label[0]) == uni_char)
1863 { 1875 {
1864 selectItem(item); 1876 selectItem(item);
1865 cellp->highlightText(1); 1877 cellp->highlightText(0, 1);
1866 mSearchTimer.reset(); 1878 mSearchTimer.reset();
1867 1879
1868 if (mCommitOnKeyboardMovement 1880 if (mCommitOnKeyboardMovement
@@ -1925,7 +1937,7 @@ void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, BOOL select_single_it
1925 LLScrollListCell* cellp = mLastSelected->getColumn(mSearchColumn); 1937 LLScrollListCell* cellp = mLastSelected->getColumn(mSearchColumn);
1926 if (cellp) 1938 if (cellp)
1927 { 1939 {
1928 cellp->highlightText(0); 1940 cellp->highlightText(0, 0);
1929 } 1941 }
1930 } 1942 }
1931 if (select_single_item) 1943 if (select_single_item)
@@ -1953,7 +1965,7 @@ void LLScrollListCtrl::deselectItem(LLScrollListItem* itemp)
1953 LLScrollListCell* cellp = itemp->getColumn(mSearchColumn); 1965 LLScrollListCell* cellp = itemp->getColumn(mSearchColumn);
1954 if (cellp) 1966 if (cellp)
1955 { 1967 {
1956 cellp->highlightText(0); 1968 cellp->highlightText(0, 0);
1957 } 1969 }
1958 mSelectionChanged = TRUE; 1970 mSelectionChanged = TRUE;
1959 } 1971 }
@@ -2195,7 +2207,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2195 NULL, 2207 NULL,
2196 multi_select, 2208 multi_select,
2197 draw_border); 2209 draw_border);
2198 2210
2199 scroll_list->setDisplayHeading(draw_heading); 2211 scroll_list->setDisplayHeading(draw_heading);
2200 if (node->hasAttribute("heading_height")) 2212 if (node->hasAttribute("heading_height"))
2201 { 2213 {
@@ -2250,6 +2262,8 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2250 F32 columnrelwidth = 0.f; 2262 F32 columnrelwidth = 0.f;
2251 child->getAttributeF32("relwidth", columnrelwidth); 2263 child->getAttributeF32("relwidth", columnrelwidth);
2252 2264
2265 LLFontGL::HAlign h_align = LLFontGL::LEFT;
2266 h_align = LLView::selectFontHAlign(child);
2253 2267
2254 columns[index]["name"] = columnname; 2268 columns[index]["name"] = columnname;
2255 columns[index]["sort"] = sortname; 2269 columns[index]["sort"] = sortname;
@@ -2258,6 +2272,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2258 columns[index]["width"] = columnwidth; 2272 columns[index]["width"] = columnwidth;
2259 columns[index]["relwidth"] = columnrelwidth; 2273 columns[index]["relwidth"] = columnrelwidth;
2260 columns[index]["dynamicwidth"] = columndynamicwidth; 2274 columns[index]["dynamicwidth"] = columndynamicwidth;
2275 columns[index]["halign"] = (S32)h_align;
2261 index++; 2276 index++;
2262 } 2277 }
2263 } 2278 }
@@ -2604,6 +2619,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
2604 2619
2605 S32 index = column_itor->second.mIndex; 2620 S32 index = column_itor->second.mIndex;
2606 S32 width = column_itor->second.mWidth; 2621 S32 width = column_itor->second.mWidth;
2622 LLFontGL::HAlign font_alignment = column_itor->second.mFontAlignment;
2607 2623
2608 LLSD value = (*itor)["value"]; 2624 LLSD value = (*itor)["value"];
2609 LLString fontname = (*itor)["font"].asString(); 2625 LLString fontname = (*itor)["font"].asString();
@@ -2631,7 +2647,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
2631 } 2647 }
2632 else 2648 else
2633 { 2649 {
2634 new_item->setColumn(index, new LLScrollListText(value.asString(), font, width, font_style)); 2650 new_item->setColumn(index, new LLScrollListText(value.asString(), font, width, font_style, font_alignment));
2635 } 2651 }
2636 } 2652 }
2637 2653
@@ -2724,7 +2740,7 @@ void LLScrollListCtrl::setFocus(BOOL b)
2724 if (!getFirstSelected()) 2740 if (!getFirstSelected())
2725 { 2741 {
2726 selectFirstItem(); 2742 selectFirstItem();
2727 onCommit(); 2743 //onCommit(); // SJB: selectFirstItem() will call onCommit() if appropriate
2728 } 2744 }
2729 LLUICtrl::setFocus(b); 2745 LLUICtrl::setFocus(b);
2730} 2746}
@@ -2739,3 +2755,4 @@ void LLScrollListCtrl::onFocusLost()
2739 } 2755 }
2740 } 2756 }
2741} 2757}
2758
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h
index d097cb5..a1c4853 100644
--- a/linden/indra/llui/llscrolllistctrl.h
+++ b/linden/indra/llui/llscrolllistctrl.h
@@ -57,7 +57,7 @@ public:
57 virtual const LLString& getTextLower() const { return LLString::null; } 57 virtual const LLString& getTextLower() const { return LLString::null; }
58 virtual const BOOL getVisible() const { return TRUE; } 58 virtual const BOOL getVisible() const { return TRUE; }
59 virtual void setWidth(S32 width) = 0; 59 virtual void setWidth(S32 width) = 0;
60 virtual void highlightText(S32 num_chars) {} 60 virtual void highlightText(S32 offset, S32 num_chars) {}
61 61
62 virtual BOOL handleClick() { return FALSE; } 62 virtual BOOL handleClick() { return FALSE; }
63 virtual void setEnabled(BOOL enable) { } 63 virtual void setEnabled(BOOL enable) { }
@@ -65,9 +65,8 @@ public:
65 65
66class LLScrollListText : public LLScrollListCell 66class LLScrollListText : public LLScrollListCell
67{ 67{
68 static U32 sCount;
69public: 68public:
70 LLScrollListText( const LLString& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE); 69 LLScrollListText( const LLString& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
71 /*virtual*/ ~LLScrollListText(); 70 /*virtual*/ ~LLScrollListText();
72 71
73 virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const; 72 virtual void drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const;
@@ -76,7 +75,7 @@ public:
76 virtual S32 getHeight() const { return llround(mFont->getLineHeight()); } 75 virtual S32 getHeight() const { return llround(mFont->getLineHeight()); }
77 virtual const LLString& getText() const { return mText.getString(); } 76 virtual const LLString& getText() const { return mText.getString(); }
78 virtual const BOOL getVisible() const { return mVisible; } 77 virtual const BOOL getVisible() const { return mVisible; }
79 virtual void highlightText(S32 num_chars) {mHighlightChars = num_chars;} 78 virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;}
80 void setText(const LLString& text); 79 void setText(const LLString& text);
81 80
82private: 81private:
@@ -84,12 +83,15 @@ private:
84 const LLFontGL* mFont; 83 const LLFontGL* mFont;
85 LLColor4* mColor; 84 LLColor4* mColor;
86 const U8 mFontStyle; 85 const U8 mFontStyle;
86 LLFontGL::HAlign mFontAlignment;
87 S32 mWidth; 87 S32 mWidth;
88 S32 mEllipsisWidth; // in pixels, of "..."
89 BOOL mVisible; 88 BOOL mVisible;
90 S32 mHighlightChars; 89 S32 mHighlightCount;
90 S32 mHighlightOffset;
91 91
92 LLPointer<LLImageGL> mRoundedRectImage; 92 LLPointer<LLImageGL> mRoundedRectImage;
93
94 static U32 sCount;
93}; 95};
94 96
95class LLScrollListIcon : public LLScrollListCell 97class LLScrollListIcon : public LLScrollListCell
@@ -134,9 +136,10 @@ class LLScrollListColumn
134{ 136{
135public: 137public:
136 // Default constructor 138 // Default constructor
137 LLScrollListColumn() : mName(""), mSortingColumn(""), mLabel(""), mWidth(-1), mRelWidth(-1.0), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL) { } 139 LLScrollListColumn() : mName(""), mSortingColumn(""), mLabel(""), mWidth(-1), mRelWidth(-1.0), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL), mFontAlignment(LLFontGL::LEFT)
140 { }
138 141
139 LLScrollListColumn(LLString name, LLString label, S32 width, F32 relwidth) 142 LLScrollListColumn(LLString name, LLString label, S32 width, F32 relwidth)
140 : mName(name), mSortingColumn(name), mLabel(label), mWidth(width), mRelWidth(relwidth), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL) { } 143 : mName(name), mSortingColumn(name), mLabel(label), mWidth(width), mRelWidth(relwidth), mDynamicWidth(FALSE), mIndex(-1), mParentCtrl(NULL), mButton(NULL) { }
141 144
142 LLScrollListColumn(const LLSD &sd) 145 LLScrollListColumn(const LLSD &sd)
@@ -168,20 +171,27 @@ public:
168 mDynamicWidth = FALSE; 171 mDynamicWidth = FALSE;
169 mRelWidth = -1; 172 mRelWidth = -1;
170 } 173 }
174
175 if (sd.has("halign"))
176 {
177 mFontAlignment = (LLFontGL::HAlign)llclamp(sd.get("halign").asInteger(), (S32)LLFontGL::LEFT, (S32)LLFontGL::HCENTER);
178 }
179
171 mIndex = -1; 180 mIndex = -1;
172 mParentCtrl = NULL; 181 mParentCtrl = NULL;
173 mButton = NULL; 182 mButton = NULL;
174 } 183 }
175 184
176 LLString mName; 185 LLString mName;
177 LLString mSortingColumn; 186 LLString mSortingColumn;
178 LLString mLabel; 187 LLString mLabel;
179 S32 mWidth; 188 S32 mWidth;
180 F32 mRelWidth; 189 F32 mRelWidth;
181 BOOL mDynamicWidth; 190 BOOL mDynamicWidth;
182 S32 mIndex; 191 S32 mIndex;
183 LLScrollListCtrl *mParentCtrl; 192 LLScrollListCtrl* mParentCtrl;
184 LLButton *mButton; 193 LLButton* mButton;
194 LLFontGL::HAlign mFontAlignment;
185}; 195};
186 196
187class LLScrollListItem 197class LLScrollListItem
@@ -208,8 +218,8 @@ public:
208 218
209 // If width = 0, just use the width of the text. Otherwise override with 219 // If width = 0, just use the width of the text. Otherwise override with
210 // specified width in pixels. 220 // specified width in pixels.
211 void addColumn( const LLString& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, BOOL visible = TRUE) 221 void addColumn( const LLString& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE)
212 { mColumns.push_back( new LLScrollListText(text, font, width, font_style, LLColor4::black, FALSE, visible) ); } 222 { mColumns.push_back( new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, FALSE, visible) ); }
213 223
214 void addColumn( LLImageGL* icon, S32 width = 0 ) 224 void addColumn( LLImageGL* icon, S32 width = 0 )
215 { mColumns.push_back( new LLScrollListIcon(icon, width) ); } 225 { mColumns.push_back( new LLScrollListIcon(icon, width) ); }
diff --git a/linden/indra/llui/llsliderctrl.cpp b/linden/indra/llui/llsliderctrl.cpp
index ca8f3ad..c62ec9a 100644
--- a/linden/indra/llui/llsliderctrl.cpp
+++ b/linden/indra/llui/llsliderctrl.cpp
@@ -215,7 +215,7 @@ void LLSliderCtrl::updateText()
215 LLLocale locale(LLLocale::USER_LOCALE); 215 LLLocale locale(LLLocale::USER_LOCALE);
216 216
217 // Don't display very small negative values as -0.000 217 // Don't display very small negative values as -0.000
218 F32 displayed_value = (F32)(floor(getValueF32() * pow(10, mPrecision) + 0.5) / pow(10, mPrecision)); 218 F32 displayed_value = (F32)(floor(getValueF32() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision));
219 219
220 LLString format = llformat("%%.%df", mPrecision); 220 LLString format = llformat("%%.%df", mPrecision);
221 LLString text = llformat(format.c_str(), displayed_value); 221 LLString text = llformat(format.c_str(), displayed_value);
diff --git a/linden/indra/llui/llspinctrl.cpp b/linden/indra/llui/llspinctrl.cpp
index b93ed02..1f33279 100644
--- a/linden/indra/llui/llspinctrl.cpp
+++ b/linden/indra/llui/llspinctrl.cpp
@@ -248,7 +248,7 @@ void LLSpinCtrl::updateEditor()
248 LLLocale locale(LLLocale::USER_LOCALE); 248 LLLocale locale(LLLocale::USER_LOCALE);
249 249
250 // Don't display very small negative values as -0.000 250 // Don't display very small negative values as -0.000
251 F32 displayed_value = (F32)floor(getValue().asReal() * pow(10, mPrecision) + 0.5) / (F32)pow(10, mPrecision); 251 F32 displayed_value = (F32)floor(getValue().asReal() * pow(10.0, (F64)mPrecision) + 0.5) / (F32)pow(10.0, (F64)mPrecision);
252 252
253// if( S32( displayed_value * pow( 10, mPrecision ) ) == 0 ) 253// if( S32( displayed_value * pow( 10, mPrecision ) ) == 0 )
254// { 254// {
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp
index b0f8b5a..8f22545 100644
--- a/linden/indra/llui/lltexteditor.cpp
+++ b/linden/indra/llui/lltexteditor.cpp
@@ -3782,7 +3782,7 @@ BOOL LLTextEditor::importBuffer(const LLString& buffer )
3782 // <text without \0> (text may contain ext_char_values) 3782 // <text without \0> (text may contain ext_char_values)
3783 // }\n 3783 // }\n
3784 3784
3785 char tbuf[MAX_STRING]; 3785 char tbuf[MAX_STRING]; /* Flawfinder: ignore */
3786 3786
3787 S32 version = 0; 3787 S32 version = 0;
3788 instream.getline(tbuf, MAX_STRING); 3788 instream.getline(tbuf, MAX_STRING);
@@ -3822,11 +3822,16 @@ BOOL LLTextEditor::importBuffer(const LLString& buffer )
3822 BOOL success = TRUE; 3822 BOOL success = TRUE;
3823 3823
3824 char* text = new char[ text_len + 1]; 3824 char* text = new char[ text_len + 1];
3825 if (text == NULL)
3826 {
3827 llerrs << "Memory allocation failure." << llendl;
3828 return FALSE;
3829 }
3825 instream.get(text, text_len + 1, '\0'); 3830 instream.get(text, text_len + 1, '\0');
3826 text[text_len] = '\0'; 3831 text[text_len] = '\0';
3827 if( text_len != (S32)strlen(text) ) 3832 if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */
3828 { 3833 {
3829 llwarns << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << llendl; 3834 llwarns << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << llendl;/* Flawfinder: ignore */
3830 success = FALSE; 3835 success = FALSE;
3831 } 3836 }
3832 3837
@@ -3948,6 +3953,8 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const
3948 3953
3949 node->createChild("word_wrap", TRUE)->setBoolValue(mWordWrap); 3954 node->createChild("word_wrap", TRUE)->setBoolValue(mWordWrap);
3950 3955
3956 node->createChild("hide_scrollbar", TRUE)->setBoolValue(mHideScrollbarForShortDocs);
3957
3951 addColorXML(node, mCursorColor, "cursor_color", "TextCursorColor"); 3958 addColorXML(node, mCursorColor, "cursor_color", "TextCursorColor");
3952 addColorXML(node, mFgColor, "text_color", "TextFgColor"); 3959 addColorXML(node, mFgColor, "text_color", "TextFgColor");
3953 addColorXML(node, mReadOnlyFgColor, "text_readonly_color", "TextFgReadOnlyColor"); 3960 addColorXML(node, mReadOnlyFgColor, "text_readonly_color", "TextFgReadOnlyColor");
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp
index c62f353..61dede2 100644
--- a/linden/indra/llui/llui.cpp
+++ b/linden/indra/llui/llui.cpp
@@ -1497,7 +1497,7 @@ void load_tr(const LLString& lang)
1497 LLString filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, inname.c_str()); 1497 LLString filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, inname.c_str());
1498 1498
1499 llifstream file; 1499 llifstream file;
1500 file.open(filename.c_str(), std::ios_base::binary); 1500 file.open(filename.c_str(), std::ios_base::binary); /* Flawfinder: ignore */
1501 if (!file) 1501 if (!file)
1502 { 1502 {
1503 llinfos << "No translation dictionary for: " << filename << llendl; 1503 llinfos << "No translation dictionary for: " << filename << llendl;
@@ -1510,7 +1510,7 @@ void load_tr(const LLString& lang)
1510 gUntranslated.clear(); 1510 gUntranslated.clear();
1511 1511
1512 const S32 MAX_LINE_LEN = 1024; 1512 const S32 MAX_LINE_LEN = 1024;
1513 char buffer[MAX_LINE_LEN]; 1513 char buffer[MAX_LINE_LEN]; /* Flawfinder: ignore */
1514 while (!file.eof()) 1514 while (!file.eof())
1515 { 1515 {
1516 file.getline(buffer, MAX_LINE_LEN); 1516 file.getline(buffer, MAX_LINE_LEN);
@@ -1550,7 +1550,7 @@ void cleanup_tr()
1550 LLString outname = "untranslated_" + gLanguage + ".txt"; 1550 LLString outname = "untranslated_" + gLanguage + ".txt";
1551 LLString outfilename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, outname.c_str()); 1551 LLString outfilename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, outname.c_str());
1552 llofstream outfile; 1552 llofstream outfile;
1553 outfile.open(outfilename.c_str()); 1553 outfile.open(outfilename.c_str()); /* Flawfinder: ignore */
1554 if (!outfile) 1554 if (!outfile)
1555 { 1555 {
1556 return; 1556 return;
diff --git a/linden/indra/llui/llui_vc8.vcproj b/linden/indra/llui/llui_vc8.vcproj
new file mode 100644
index 0000000..a78c71c
--- /dev/null
+++ b/linden/indra/llui/llui_vc8.vcproj
@@ -0,0 +1,588 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8.00"
5 Name="llui"
6 ProjectGUID="{DE55D666-6A3D-476C-937F-109269B83681}"
7 Keyword="Win32Proj"
8 >
9 <Platforms>
10 <Platform
11 Name="Win32"
12 />
13 </Platforms>
14 <ToolFiles>
15 </ToolFiles>
16 <Configurations>
17 <Configuration
18 Name="Debug|Win32"
19 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
20 IntermediateDirectory="Debug"
21 ConfigurationType="4"
22 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
23 CharacterSet="1"
24 >
25 <Tool
26 Name="VCPreBuildEventTool"
27 />
28 <Tool
29 Name="VCCustomBuildTool"
30 />
31 <Tool
32 Name="VCXMLDataGeneratorTool"
33 />
34 <Tool
35 Name="VCWebServiceProxyGeneratorTool"
36 />
37 <Tool
38 Name="VCMIDLTool"
39 />
40 <Tool
41 Name="VCCLCompilerTool"
42 Optimization="0"
43 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
44 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG"
45 MinimalRebuild="true"
46 BasicRuntimeChecks="3"
47 RuntimeLibrary="1"
48 StructMemberAlignment="4"
49 TreatWChar_tAsBuiltInType="false"
50 ForceConformanceInForLoopScope="true"
51 UsePrecompiledHeader="0"
52 WarningLevel="3"
53 WarnAsError="true"
54 Detect64BitPortabilityProblems="false"
55 DebugInformationFormat="4"
56 />
57 <Tool
58 Name="VCManagedResourceCompilerTool"
59 />
60 <Tool
61 Name="VCResourceCompilerTool"
62 />
63 <Tool
64 Name="VCPreLinkEventTool"
65 />
66 <Tool
67 Name="VCLibrarianTool"
68 OutputFile="$(OutDir)/llui.lib"
69 />
70 <Tool
71 Name="VCALinkTool"
72 />
73 <Tool
74 Name="VCXDCMakeTool"
75 />
76 <Tool
77 Name="VCBscMakeTool"
78 />
79 <Tool
80 Name="VCFxCopTool"
81 />
82 <Tool
83 Name="VCPostBuildEventTool"
84 />
85 </Configuration>
86 <Configuration
87 Name="Release|Win32"
88 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
89 IntermediateDirectory="Release"
90 ConfigurationType="4"
91 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
92 CharacterSet="1"
93 >
94 <Tool
95 Name="VCPreBuildEventTool"
96 />
97 <Tool
98 Name="VCCustomBuildTool"
99 />
100 <Tool
101 Name="VCXMLDataGeneratorTool"
102 />
103 <Tool
104 Name="VCWebServiceProxyGeneratorTool"
105 />
106 <Tool
107 Name="VCMIDLTool"
108 />
109 <Tool
110 Name="VCCLCompilerTool"
111 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
112 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
113 RuntimeLibrary="0"
114 StructMemberAlignment="0"
115 TreatWChar_tAsBuiltInType="false"
116 ForceConformanceInForLoopScope="true"
117 UsePrecompiledHeader="0"
118 WarningLevel="3"
119 WarnAsError="true"
120 Detect64BitPortabilityProblems="false"
121 DebugInformationFormat="3"
122 />
123 <Tool
124 Name="VCManagedResourceCompilerTool"
125 />
126 <Tool
127 Name="VCResourceCompilerTool"
128 />
129 <Tool
130 Name="VCPreLinkEventTool"
131 />
132 <Tool
133 Name="VCLibrarianTool"
134 OutputFile="$(OutDir)/llui.lib"
135 />
136 <Tool
137 Name="VCALinkTool"
138 />
139 <Tool
140 Name="VCXDCMakeTool"
141 />
142 <Tool
143 Name="VCBscMakeTool"
144 />
145 <Tool
146 Name="VCFxCopTool"
147 />
148 <Tool
149 Name="VCPostBuildEventTool"
150 />
151 </Configuration>
152 <Configuration
153 Name="ReleaseNoOpt|Win32"
154 OutputDirectory="../lib_$(ConfigurationName)/i686-win32"
155 IntermediateDirectory="$(ConfigurationName)"
156 ConfigurationType="4"
157 InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
158 CharacterSet="1"
159 >
160 <Tool
161 Name="VCPreBuildEventTool"
162 />
163 <Tool
164 Name="VCCustomBuildTool"
165 />
166 <Tool
167 Name="VCXMLDataGeneratorTool"
168 />
169 <Tool
170 Name="VCWebServiceProxyGeneratorTool"
171 />
172 <Tool
173 Name="VCMIDLTool"
174 />
175 <Tool
176 Name="VCCLCompilerTool"
177 Optimization="0"
178 AdditionalIncludeDirectories="..\llmath;..\llvfs;..\llcommon;..\llprimitive;..\llwindow;..\llrender;..\llimage;..\llaudio;..\llxml;..\llmessage;&quot;..\..\libraries\i686-win32\include&quot;;..\..\libraries\include\"
179 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE"
180 RuntimeLibrary="0"
181 StructMemberAlignment="0"
182 TreatWChar_tAsBuiltInType="false"
183 ForceConformanceInForLoopScope="true"
184 UsePrecompiledHeader="0"
185 WarningLevel="3"
186 WarnAsError="true"
187 Detect64BitPortabilityProblems="false"
188 DebugInformationFormat="3"
189 />
190 <Tool
191 Name="VCManagedResourceCompilerTool"
192 />
193 <Tool
194 Name="VCResourceCompilerTool"
195 />
196 <Tool
197 Name="VCPreLinkEventTool"
198 />
199 <Tool
200 Name="VCLibrarianTool"
201 OutputFile="$(OutDir)/llui.lib"
202 />
203 <Tool
204 Name="VCALinkTool"
205 />
206 <Tool
207 Name="VCXDCMakeTool"
208 />
209 <Tool
210 Name="VCBscMakeTool"
211 />
212 <Tool
213 Name="VCFxCopTool"
214 />
215 <Tool
216 Name="VCPostBuildEventTool"
217 />
218 </Configuration>
219 </Configurations>
220 <References>
221 </References>
222 <Files>
223 <Filter
224 Name="Source Files"
225 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
226 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
227 >
228 <File
229 RelativePath=".\llalertdialog.cpp"
230 >
231 </File>
232 <File
233 RelativePath=".\llbutton.cpp"
234 >
235 </File>
236 <File
237 RelativePath=".\llcheckboxctrl.cpp"
238 >
239 </File>
240 <File
241 RelativePath=".\llclipboard.cpp"
242 >
243 </File>
244 <File
245 RelativePath=".\llcombobox.cpp"
246 >
247 </File>
248 <File
249 RelativePath=".\llctrlselectioninterface.cpp"
250 >
251 </File>
252 <File
253 RelativePath=".\lldraghandle.cpp"
254 >
255 </File>
256 <File
257 RelativePath=".\lleditmenuhandler.cpp"
258 >
259 </File>
260 <File
261 RelativePath=".\llfloater.cpp"
262 >
263 </File>
264 <File
265 RelativePath=".\llfocusmgr.cpp"
266 >
267 </File>
268 <File
269 RelativePath=".\lliconctrl.cpp"
270 >
271 </File>
272 <File
273 RelativePath=".\llkeywords.cpp"
274 >
275 </File>
276 <File
277 RelativePath=".\lllineeditor.cpp"
278 >
279 </File>
280 <File
281 RelativePath=".\llmenugl.cpp"
282 >
283 </File>
284 <File
285 RelativePath=".\llmodaldialog.cpp"
286 >
287 </File>
288 <File
289 RelativePath=".\llpanel.cpp"
290 >
291 </File>
292 <File
293 RelativePath=".\llradiogroup.cpp"
294 >
295 </File>
296 <File
297 RelativePath=".\llresizebar.cpp"
298 >
299 </File>
300 <File
301 RelativePath=".\llresizehandle.cpp"
302 >
303 </File>
304 <File
305 RelativePath=".\llresmgr.cpp"
306 >
307 </File>
308 <File
309 RelativePath=".\llrootview.cpp"
310 >
311 </File>
312 <File
313 RelativePath=".\llscrollbar.cpp"
314 >
315 </File>
316 <File
317 RelativePath=".\llscrollcontainer.cpp"
318 >
319 </File>
320 <File
321 RelativePath=".\llscrollingpanellist.cpp"
322 >
323 </File>
324 <File
325 RelativePath=".\llscrolllistctrl.cpp"
326 >
327 </File>
328 <File
329 RelativePath=".\llslider.cpp"
330 >
331 </File>
332 <File
333 RelativePath=".\llsliderctrl.cpp"
334 >
335 </File>
336 <File
337 RelativePath=".\llspinctrl.cpp"
338 >
339 </File>
340 <File
341 RelativePath=".\llstyle.cpp"
342 >
343 </File>
344 <File
345 RelativePath=".\lltabcontainer.cpp"
346 >
347 </File>
348 <File
349 RelativePath=".\lltabcontainervertical.cpp"
350 >
351 </File>
352 <File
353 RelativePath=".\lltextbox.cpp"
354 >
355 </File>
356 <File
357 RelativePath=".\lltexteditor.cpp"
358 >
359 </File>
360 <File
361 RelativePath=".\llui.cpp"
362 >
363 </File>
364 <File
365 RelativePath=".\lluictrl.cpp"
366 >
367 </File>
368 <File
369 RelativePath=".\lluictrlfactory.cpp"
370 >
371 </File>
372 <File
373 RelativePath=".\lluistring.cpp"
374 >
375 </File>
376 <File
377 RelativePath=".\llundo.cpp"
378 >
379 </File>
380 <File
381 RelativePath=".\llview.cpp"
382 >
383 </File>
384 <File
385 RelativePath=".\llviewborder.cpp"
386 >
387 </File>
388 <File
389 RelativePath=".\llviewquery.cpp"
390 >
391 </File>
392 </Filter>
393 <Filter
394 Name="Header Files"
395 Filter="h;hpp;hxx;hm;inl;inc;xsd"
396 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
397 >
398 <File
399 RelativePath=".\llalertdialog.h"
400 >
401 </File>
402 <File
403 RelativePath=".\llbutton.h"
404 >
405 </File>
406 <File
407 RelativePath=".\llcallbackmap.h"
408 >
409 </File>
410 <File
411 RelativePath=".\llcheckboxctrl.h"
412 >
413 </File>
414 <File
415 RelativePath=".\llclipboard.h"
416 >
417 </File>
418 <File
419 RelativePath=".\llcombobox.h"
420 >
421 </File>
422 <File
423 RelativePath=".\llctrlselectioninterface.h"
424 >
425 </File>
426 <File
427 RelativePath=".\lldraghandle.h"
428 >
429 </File>
430 <File
431 RelativePath=".\lleditmenuhandler.h"
432 >
433 </File>
434 <File
435 RelativePath=".\llfloater.h"
436 >
437 </File>
438 <File
439 RelativePath=".\llfocusmgr.h"
440 >
441 </File>
442 <File
443 RelativePath=".\lliconctrl.h"
444 >
445 </File>
446 <File
447 RelativePath=".\llkeywords.h"
448 >
449 </File>
450 <File
451 RelativePath=".\lllineeditor.h"
452 >
453 </File>
454 <File
455 RelativePath=".\llmemberlistener.h"
456 >
457 </File>
458 <File
459 RelativePath=".\llmenugl.h"
460 >
461 </File>
462 <File
463 RelativePath=".\llmodaldialog.h"
464 >
465 </File>
466 <File
467 RelativePath=".\llpanel.h"
468 >
469 </File>
470 <File
471 RelativePath=".\llradiogroup.h"
472 >
473 </File>
474 <File
475 RelativePath=".\llresizebar.h"
476 >
477 </File>
478 <File
479 RelativePath=".\llresizehandle.h"
480 >
481 </File>
482 <File
483 RelativePath=".\llresmgr.h"
484 >
485 </File>
486 <File
487 RelativePath=".\llrootview.h"
488 >
489 </File>
490 <File
491 RelativePath=".\llscrollbar.h"
492 >
493 </File>
494 <File
495 RelativePath=".\llscrollcontainer.h"
496 >
497 </File>
498 <File
499 RelativePath=".\llscrollingpanellist.h"
500 >
501 </File>
502 <File
503 RelativePath=".\llscrolllistctrl.h"
504 >
505 </File>
506 <File
507 RelativePath=".\llslider.h"
508 >
509 </File>
510 <File
511 RelativePath=".\llsliderctrl.h"
512 >
513 </File>
514 <File
515 RelativePath=".\llspinctrl.h"
516 >
517 </File>
518 <File
519 RelativePath=".\llstyle.h"
520 >
521 </File>
522 <File
523 RelativePath=".\lltabcontainer.h"
524 >
525 </File>
526 <File
527 RelativePath=".\lltabcontainervertical.h"
528 >
529 </File>
530 <File
531 RelativePath=".\lltextbox.h"
532 >
533 </File>
534 <File
535 RelativePath=".\lltexteditor.h"
536 >
537 </File>
538 <File
539 RelativePath=".\llui.h"
540 >
541 </File>
542 <File
543 RelativePath=".\lluiconstants.h"
544 >
545 </File>
546 <File
547 RelativePath=".\lluictrl.h"
548 >
549 </File>
550 <File
551 RelativePath=".\lluictrlfactory.h"
552 >
553 </File>
554 <File
555 RelativePath=".\lluistring.h"
556 >
557 </File>
558 <File
559 RelativePath=".\lluixmltags.h"
560 >
561 </File>
562 <File
563 RelativePath=".\llundo.h"
564 >
565 </File>
566 <File
567 RelativePath=".\llview.h"
568 >
569 </File>
570 <File
571 RelativePath=".\llviewborder.h"
572 >
573 </File>
574 <File
575 RelativePath=".\llviewquery.h"
576 >
577 </File>
578 </Filter>
579 <Filter
580 Name="Resource Files"
581 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
582 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
583 >
584 </Filter>
585 </Files>
586 <Globals>
587 </Globals>
588</VisualStudioProject>
diff --git a/linden/indra/llui/lluictrl.h b/linden/indra/llui/lluictrl.h
index 7f48378..47b5d66 100644
--- a/linden/indra/llui/lluictrl.h
+++ b/linden/indra/llui/lluictrl.h
@@ -36,7 +36,6 @@
36// 36//
37// Classes 37// Classes
38// 38//
39class LLViewerImage;
40class LLFontGL; 39class LLFontGL;
41class LLButton; 40class LLButton;
42class LLTextBox; 41class LLTextBox;
diff --git a/linden/indra/llui/lluictrlfactory.cpp b/linden/indra/llui/lluictrlfactory.cpp
index 5a35783..77ef749 100644
--- a/linden/indra/llui/lluictrlfactory.cpp
+++ b/linden/indra/llui/lluictrlfactory.cpp
@@ -210,12 +210,18 @@ LLUICtrlFactory::LLUICtrlFactory()
210 LLUICtrlCreator<LLMenuBarGL>::registerCreator(LL_MENU_BAR_GL_TAG, this); 210 LLUICtrlCreator<LLMenuBarGL>::registerCreator(LL_MENU_BAR_GL_TAG, this);
211 LLUICtrlCreator<LLScrollingPanelList>::registerCreator(LL_SCROLLING_PANEL_LIST_TAG, this); 211 LLUICtrlCreator<LLScrollingPanelList>::registerCreator(LL_SCROLLING_PANEL_LIST_TAG, this);
212 212
213 setupPaths();
213 214
215}
216
217void LLUICtrlFactory::setupPaths()
218{
214 LLString filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml"); 219 LLString filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml");
215 220
216 LLXMLNodePtr root; 221 LLXMLNodePtr root;
217 BOOL success = LLXMLNode::parseFile(filename, root, NULL); 222 BOOL success = LLXMLNode::parseFile(filename, root, NULL);
218 223 mXUIPaths.clear();
224
219 if (!success) 225 if (!success)
220 { 226 {
221 LLString slash = gDirUtilp->getDirDelimiter(); 227 LLString slash = gDirUtilp->getDirDelimiter();
@@ -239,7 +245,7 @@ LLUICtrlFactory::LLUICtrlFactory()
239 path_val_ui.setArg("[Language]", language); 245 path_val_ui.setArg("[Language]", language);
240 LLString fullpath = app_dir + path_val_ui.getString(); 246 LLString fullpath = app_dir + path_val_ui.getString();
241 247
242 if (mXUIPaths.empty() || (find(mXUIPaths.begin(), mXUIPaths.end(), fullpath) == mXUIPaths.end()) ) 248 if (std::find(mXUIPaths.begin(), mXUIPaths.end(), fullpath) == mXUIPaths.end())
243 { 249 {
244 mXUIPaths.push_back(app_dir + path_val_ui.getString()); 250 mXUIPaths.push_back(app_dir + path_val_ui.getString());
245 } 251 }
@@ -297,7 +303,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const LLString &filename, LLXMLNodePtr&
297// buildFloater() 303// buildFloater()
298//----------------------------------------------------------------------------- 304//-----------------------------------------------------------------------------
299void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename, 305void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename,
300 const LLCallbackMap::map_t* factory_map, BOOL open) 306 const LLCallbackMap::map_t* factory_map, BOOL open) /* Flawfinder: ignore */
301{ 307{
302 LLXMLNodePtr root; 308 LLXMLNodePtr root;
303 309
@@ -318,7 +324,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const LLString &filename
318 mFactoryStack.push_front(factory_map); 324 mFactoryStack.push_front(factory_map);
319 } 325 }
320 326
321 floaterp->initFloaterXML(root, NULL, this, open); 327 floaterp->initFloaterXML(root, NULL, this, open); /* Flawfinder: ignore */
322 328
323 if (LLUI::sShowXUINames) 329 if (LLUI::sShowXUINames)
324 { 330 {
diff --git a/linden/indra/llui/lluictrlfactory.h b/linden/indra/llui/lluictrlfactory.h
index ed2a396..b96dc5d 100644
--- a/linden/indra/llui/lluictrlfactory.h
+++ b/linden/indra/llui/lluictrlfactory.h
@@ -74,6 +74,8 @@ public:
74 // do not call! needs to be public so run-time can clean up the singleton 74 // do not call! needs to be public so run-time can clean up the singleton
75 virtual ~LLUICtrlFactory(); 75 virtual ~LLUICtrlFactory();
76 76
77 void setupPaths();
78
77 void buildFloater(LLFloater* floaterp, const LLString &filename, 79 void buildFloater(LLFloater* floaterp, const LLString &filename,
78 const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE); 80 const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
79 81
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp
index ab06c0f..13f1ddc 100644
--- a/linden/indra/llui/llview.cpp
+++ b/linden/indra/llui/llview.cpp
@@ -51,7 +51,6 @@
51BOOL LLView::sDebugRects = FALSE; 51BOOL LLView::sDebugRects = FALSE;
52BOOL LLView::sDebugKeys = FALSE; 52BOOL LLView::sDebugKeys = FALSE;
53S32 LLView::sDepth = 0; 53S32 LLView::sDepth = 0;
54LLView* LLView::sFastFrameView = NULL;
55BOOL LLView::sDebugMouseHandling = FALSE; 54BOOL LLView::sDebugMouseHandling = FALSE;
56LLString LLView::sMouseHandlerMessage; 55LLString LLView::sMouseHandlerMessage;
57S32 LLView::sSelectID = GL_NAME_UI_RESERVED; 56S32 LLView::sSelectID = GL_NAME_UI_RESERVED;
@@ -112,7 +111,6 @@ LLView::LLView() :
112 mSaveToXML(TRUE), 111 mSaveToXML(TRUE),
113 mIsFocusRoot(FALSE), 112 mIsFocusRoot(FALSE),
114 mLastVisible(TRUE), 113 mLastVisible(TRUE),
115 mRenderInFastFrame(TRUE),
116 mSpanChildren(FALSE), 114 mSpanChildren(FALSE),
117 mVisible(TRUE), 115 mVisible(TRUE),
118 mHidden(FALSE), 116 mHidden(FALSE),
@@ -133,7 +131,6 @@ LLView::LLView(const LLString& name, BOOL mouse_opaque) :
133 mSaveToXML(TRUE), 131 mSaveToXML(TRUE),
134 mIsFocusRoot(FALSE), 132 mIsFocusRoot(FALSE),
135 mLastVisible(TRUE), 133 mLastVisible(TRUE),
136 mRenderInFastFrame(TRUE),
137 mSpanChildren(FALSE), 134 mSpanChildren(FALSE),
138 mVisible(TRUE), 135 mVisible(TRUE),
139 mHidden(FALSE), 136 mHidden(FALSE),
@@ -157,7 +154,6 @@ LLView::LLView(
157 mSaveToXML(TRUE), 154 mSaveToXML(TRUE),
158 mIsFocusRoot(FALSE), 155 mIsFocusRoot(FALSE),
159 mLastVisible(TRUE), 156 mLastVisible(TRUE),
160 mRenderInFastFrame(TRUE),
161 mSpanChildren(FALSE), 157 mSpanChildren(FALSE),
162 mVisible(TRUE), 158 mVisible(TRUE),
163 mHidden(FALSE), 159 mHidden(FALSE),
@@ -199,11 +195,6 @@ LLView::~LLView()
199 mParentView->removeChild(this); 195 mParentView->removeChild(this);
200 } 196 }
201 197
202 if(LLView::sFastFrameView == this)
203 {
204 LLView::sFastFrameView = NULL;
205 }
206
207 dispatch_list_t::iterator itor; 198 dispatch_list_t::iterator itor;
208 for (itor = mDispatchList.begin(); itor != mDispatchList.end(); ++itor) 199 for (itor = mDispatchList.begin(); itor != mDispatchList.end(); ++itor)
209 { 200 {
@@ -1789,26 +1780,6 @@ void LLView::localRectToScreen(const LLRect& local, LLRect* screen) const
1789 } 1780 }
1790} 1781}
1791 1782
1792LLView* LLView::getRootMostFastFrameView()
1793{
1794 if (gFocusMgr.getTopView() == this)
1795 {
1796 return this;
1797 }
1798
1799 if (getParent())
1800 {
1801 LLView* rootmost_view = getParent()->getRootMostFastFrameView();
1802 if (rootmost_view)
1803 {
1804 return rootmost_view;
1805 }
1806 }
1807
1808 return mRenderInFastFrame ? this : NULL;
1809}
1810
1811
1812LLView* LLView::getRootView() 1783LLView* LLView::getRootView()
1813{ 1784{
1814 LLView* view = this; 1785 LLView* view = this;
diff --git a/linden/indra/llui/llview.h b/linden/indra/llui/llview.h
index 268f157..3885789 100644
--- a/linden/indra/llui/llview.h
+++ b/linden/indra/llui/llview.h
@@ -164,7 +164,6 @@ protected:
164public: 164public:
165 LLViewHandle mViewHandle; 165 LLViewHandle mViewHandle;
166 BOOL mLastVisible; 166 BOOL mLastVisible;
167 BOOL mRenderInFastFrame;
168 BOOL mSpanChildren; 167 BOOL mSpanChildren;
169 168
170private: 169private:
@@ -180,7 +179,6 @@ public:
180 static BOOL sDebugRects; // Draw debug rects behind everything. 179 static BOOL sDebugRects; // Draw debug rects behind everything.
181 static BOOL sDebugKeys; 180 static BOOL sDebugKeys;
182 static S32 sDepth; 181 static S32 sDepth;
183 static LLView* sFastFrameView;
184 static BOOL sDebugMouseHandling; 182 static BOOL sDebugMouseHandling;
185 static LLString sMouseHandlerMessage; 183 static LLString sMouseHandlerMessage;
186 static S32 sSelectID; 184 static S32 sSelectID;
@@ -338,8 +336,8 @@ public:
338 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); 336 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
339 337
340 virtual void translate( S32 x, S32 y ); 338 virtual void translate( S32 x, S32 y );
339 virtual void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
341 BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside ); 340 BOOL translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside );
342 void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
343 LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); 341 LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
344 LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); 342 LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
345 343
@@ -437,8 +435,6 @@ public:
437 virtual void localRectToScreen( const LLRect& local, LLRect* screen ) const; 435 virtual void localRectToScreen( const LLRect& local, LLRect* screen ) const;
438 virtual BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const; 436 virtual BOOL localRectToOtherView( const LLRect& local, LLRect* other, LLView* other_view ) const;
439 437
440 void setRenderInFastFrame(BOOL render) { mRenderInFastFrame = render; }
441 virtual LLView* getRootMostFastFrameView();
442 438
443 static LLWindow* getWindow(void); 439 static LLWindow* getWindow(void);
444 440
diff --git a/linden/indra/llui/llviewquery.cpp b/linden/indra/llui/llviewquery.cpp
index 4867116..89b2192 100644
--- a/linden/indra/llui/llviewquery.cpp
+++ b/linden/indra/llui/llviewquery.cpp
@@ -1,8 +1,8 @@
1/** 1/**
2 * @file llviewquery.cpp 2 * @file llviewquery.cpp
3 * @brief Implementation of view query class. 3 * @brief Implementation of view query class.
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab 7 * 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 8 * to you under the terms of the GNU General Public License, version 2.0
@@ -22,124 +22,124 @@
22 * 22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 25 * COMPLETENESS OR PERFORMANCE.
26 */ 26 */
27 27
28#include "llview.h" 28#include "llview.h"
29#include "lluictrl.h" 29#include "lluictrl.h"
30#include "llviewquery.h" 30#include "llviewquery.h"
31 31
32void LLQuerySorter::operator() (LLView * parent, viewList_t &children) const {} 32void LLQuerySorter::operator() (LLView * parent, viewList_t &children) const {}
33 33
34filterResult_t LLNoLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const 34filterResult_t LLNoLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const
35{ 35{
36 return filterResult_t(!(view->getChildList()->size() == 0), TRUE); 36 return filterResult_t(!(view->getChildList()->size() == 0), TRUE);
37} 37}
38 38
39filterResult_t LLVisibleFilter::operator() (const LLView* const view, const viewList_t & children) const 39filterResult_t LLVisibleFilter::operator() (const LLView* const view, const viewList_t & children) const
40{ 40{
41 return filterResult_t(view->getVisible(), view->getVisible()); 41 return filterResult_t(view->getVisible(), view->getVisible());
42} 42}
43filterResult_t LLEnabledFilter::operator() (const LLView* const view, const viewList_t & children) const 43filterResult_t LLEnabledFilter::operator() (const LLView* const view, const viewList_t & children) const
44{ 44{
45 return filterResult_t(view->getEnabled(), view->getEnabled()); 45 return filterResult_t(view->getEnabled(), view->getEnabled());
46} 46}
47filterResult_t LLTabStopFilter::operator() (const LLView* const view, const viewList_t & children) const 47filterResult_t LLTabStopFilter::operator() (const LLView* const view, const viewList_t & children) const
48{ 48{
49 return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl* const>(view)->hasTabStop(), 49 return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl* const>(view)->hasTabStop(),
50 view->canFocusChildren()); 50 view->canFocusChildren());
51} 51}
52 52
53// LLViewQuery 53// LLViewQuery
54 54
55LLViewQuery::LLViewQuery(): mPreFilters(), mPostFilters(), mSorterp() 55LLViewQuery::LLViewQuery(): mPreFilters(), mPostFilters(), mSorterp()
56{ 56{
57} 57}
58 58
59void LLViewQuery::addPreFilter(const LLQueryFilter* prefilter) { mPreFilters.push_back(prefilter); } 59void LLViewQuery::addPreFilter(const LLQueryFilter* prefilter) { mPreFilters.push_back(prefilter); }
60 60
61void LLViewQuery::addPostFilter(const LLQueryFilter* postfilter) { mPostFilters.push_back(postfilter); } 61void LLViewQuery::addPostFilter(const LLQueryFilter* postfilter) { mPostFilters.push_back(postfilter); }
62 62
63const LLViewQuery::filterList_t & LLViewQuery::getPreFilters() const { return mPreFilters; } 63const LLViewQuery::filterList_t & LLViewQuery::getPreFilters() const { return mPreFilters; }
64 64
65const LLViewQuery::filterList_t & LLViewQuery::getPostFilters() const { return mPostFilters; } 65const LLViewQuery::filterList_t & LLViewQuery::getPostFilters() const { return mPostFilters; }
66 66
67void LLViewQuery::setSorter(const LLQuerySorter* sorterp) { mSorterp = sorterp; } 67void LLViewQuery::setSorter(const LLQuerySorter* sorterp) { mSorterp = sorterp; }
68const LLQuerySorter* LLViewQuery::getSorter() const { return mSorterp; } 68const LLQuerySorter* LLViewQuery::getSorter() const { return mSorterp; }
69 69
70viewList_t LLViewQuery::run(LLView * view) const 70viewList_t LLViewQuery::run(LLView * view) const
71{ 71{
72 viewList_t result; 72 viewList_t result;
73 73
74 filterResult_t pre = runFilters(view, viewList_t(), mPreFilters); 74 filterResult_t pre = runFilters(view, viewList_t(), mPreFilters);
75 if(!pre.first && !pre.second) 75 if(!pre.first && !pre.second)
76 { 76 {
77 // skip post filters completely if we're not including ourselves or the children 77 // skip post filters completely if we're not including ourselves or the children
78 return result; 78 return result;
79 } 79 }
80 if(pre.second) 80 if(pre.second)
81 { 81 {
82 // run filters on children 82 // run filters on children
83 viewList_t filtered_children; 83 viewList_t filtered_children;
84 filterChildren(view, filtered_children); 84 filterChildren(view, filtered_children);
85 filterResult_t post = runFilters(view, filtered_children, mPostFilters); 85 filterResult_t post = runFilters(view, filtered_children, mPostFilters);
86 if(pre.first && post.first) 86 if(pre.first && post.first)
87 { 87 {
88 result.push_back(view); 88 result.push_back(view);
89 } 89 }
90 if(post.second) 90 if(post.second)
91 { 91 {
92 result.insert(result.end(), filtered_children.begin(), filtered_children.end()); 92 result.insert(result.end(), filtered_children.begin(), filtered_children.end());
93 } 93 }
94 } 94 }
95 else 95 else
96 { 96 {
97 if(pre.first) 97 if(pre.first)
98 { 98 {
99 result.push_back(view); 99 result.push_back(view);
100 } 100 }
101 } 101 }
102 return result; 102 return result;
103} 103}
104 104
105void LLViewQuery::filterChildren(LLView * view, viewList_t & filtered_children) const 105void LLViewQuery::filterChildren(LLView * view, viewList_t & filtered_children) const
106{ 106{
107 LLView::child_list_t views(*(view->getChildList())); 107 LLView::child_list_t views(*(view->getChildList()));
108 (*mSorterp)(view, views); // sort the children per the sorter 108 (*mSorterp)(view, views); // sort the children per the sorter
109 for(LLView::child_list_iter_t iter = views.begin(); 109 for(LLView::child_list_iter_t iter = views.begin();
110 iter != views.end(); 110 iter != views.end();
111 iter++) 111 iter++)
112 { 112 {
113 viewList_t indiv_children = this->run(*iter); 113 viewList_t indiv_children = this->run(*iter);
114 filtered_children.insert(filtered_children.end(), indiv_children.begin(), indiv_children.end()); 114 filtered_children.insert(filtered_children.end(), indiv_children.begin(), indiv_children.end());
115 } 115 }
116} 116}
117 117
118filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const 118filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const
119{ 119{
120 filterResult_t result = filterResult_t(TRUE, TRUE); 120 filterResult_t result = filterResult_t(TRUE, TRUE);
121 for(filterList_const_iter_t iter = filters.begin(); 121 for(filterList_const_iter_t iter = filters.begin();
122 iter != filters.end(); 122 iter != filters.end();
123 iter++) 123 iter++)
124 { 124 {
125 filterResult_t filtered = (**iter)(view, children); 125 filterResult_t filtered = (**iter)(view, children);
126 result.first = result.first && filtered.first; 126 result.first = result.first && filtered.first;
127 result.second = result.second && filtered.second; 127 result.second = result.second && filtered.second;
128 } 128 }
129 return result; 129 return result;
130} 130}
131 131
132class SortByTabOrder : public LLQuerySorter, public LLSingleton<SortByTabOrder> 132class SortByTabOrder : public LLQuerySorter, public LLSingleton<SortByTabOrder>
133{ 133{
134 /*virtual*/ void operator() (LLView * parent, LLView::child_list_t &children) const 134 /*virtual*/ void operator() (LLView * parent, LLView::child_list_t &children) const
135 { 135 {
136 children.sort(LLCompareByTabOrder(parent->getCtrlOrder())); 136 children.sort(LLCompareByTabOrder(parent->getCtrlOrder()));
137 } 137 }
138}; 138};
139 139
140LLCtrlQuery::LLCtrlQuery() : 140LLCtrlQuery::LLCtrlQuery() :
141 LLViewQuery() 141 LLViewQuery()
142{ 142{
143 setSorter(SortByTabOrder::getInstance()); 143 setSorter(SortByTabOrder::getInstance());
144} 144}
145 145
diff --git a/linden/indra/llui/llviewquery.h b/linden/indra/llui/llviewquery.h
index 3dc2861..7ab401a 100644
--- a/linden/indra/llui/llviewquery.h
+++ b/linden/indra/llui/llviewquery.h
@@ -1,8 +1,8 @@
1/** 1/**
2 * @file llviewquery.h 2 * @file llviewquery.h
3 * @brief Query algorithm for flattening and filtering the view hierarchy. 3 * @brief Query algorithm for flattening and filtering the view hierarchy.
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 * 6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab 7 * 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 8 * to you under the terms of the GNU General Public License, version 2.0
@@ -22,87 +22,87 @@
22 * 22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 25 * COMPLETENESS OR PERFORMANCE.
26 */ 26 */
27 27
28#ifndef LL_LLVIEWQUERY_H 28#ifndef LL_LLVIEWQUERY_H
29#define LL_LLVIEWQUERY_H 29#define LL_LLVIEWQUERY_H
30 30
31#include <list> 31#include <list>
32 32
33#include "llmemory.h" 33#include "llmemory.h"
34 34
35class LLView; 35class LLView;
36 36
37typedef std::list<LLView *> viewList_t; 37typedef std::list<LLView *> viewList_t;
38typedef std::pair<BOOL, BOOL> filterResult_t; 38typedef std::pair<BOOL, BOOL> filterResult_t;
39 39
40// Abstract base class for all filters. 40// Abstract base class for all filters.
41class LLQueryFilter : public LLRefCount 41class LLQueryFilter : public LLRefCount
42{ 42{
43public: 43public:
44 virtual filterResult_t operator() (const LLView* const view, const viewList_t & children) const =0; 44 virtual filterResult_t operator() (const LLView* const view, const viewList_t & children) const =0;
45}; 45};
46 46
47class LLQuerySorter : public LLRefCount 47class LLQuerySorter : public LLRefCount
48{ 48{
49public: 49public:
50 virtual void operator() (LLView * parent, viewList_t &children) const; 50 virtual void operator() (LLView * parent, viewList_t &children) const;
51}; 51};
52 52
53class LLNoLeavesFilter : public LLQueryFilter, public LLSingleton<LLNoLeavesFilter> 53class LLNoLeavesFilter : public LLQueryFilter, public LLSingleton<LLNoLeavesFilter>
54{ 54{
55 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; 55 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const;
56}; 56};
57class LLVisibleFilter : public LLQueryFilter, public LLSingleton<LLVisibleFilter> 57class LLVisibleFilter : public LLQueryFilter, public LLSingleton<LLVisibleFilter>
58{ 58{
59 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; 59 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const;
60}; 60};
61class LLEnabledFilter : public LLQueryFilter, public LLSingleton<LLEnabledFilter> 61class LLEnabledFilter : public LLQueryFilter, public LLSingleton<LLEnabledFilter>
62{ 62{
63 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; 63 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const;
64}; 64};
65class LLTabStopFilter : public LLQueryFilter, public LLSingleton<LLTabStopFilter> 65class LLTabStopFilter : public LLQueryFilter, public LLSingleton<LLTabStopFilter>
66{ 66{
67 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; 67 /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const;
68}; 68};
69 69
70// Algorithm for flattening 70// Algorithm for flattening
71class LLViewQuery 71class LLViewQuery
72{ 72{
73public: 73public:
74 typedef std::list<const LLQueryFilter*> filterList_t; 74 typedef std::list<const LLQueryFilter*> filterList_t;
75 typedef filterList_t::iterator filterList_iter_t; 75 typedef filterList_t::iterator filterList_iter_t;
76 typedef filterList_t::const_iterator filterList_const_iter_t; 76 typedef filterList_t::const_iterator filterList_const_iter_t;
77 77
78 LLViewQuery(); 78 LLViewQuery();
79 virtual ~LLViewQuery() {} 79 virtual ~LLViewQuery() {}
80 80
81 void addPreFilter(const LLQueryFilter* prefilter); 81 void addPreFilter(const LLQueryFilter* prefilter);
82 void addPostFilter(const LLQueryFilter* postfilter); 82 void addPostFilter(const LLQueryFilter* postfilter);
83 const filterList_t & getPreFilters() const; 83 const filterList_t & getPreFilters() const;
84 const filterList_t & getPostFilters() const; 84 const filterList_t & getPostFilters() const;
85 85
86 void setSorter(const LLQuerySorter* sorter); 86 void setSorter(const LLQuerySorter* sorter);
87 const LLQuerySorter* getSorter() const; 87 const LLQuerySorter* getSorter() const;
88 88
89 viewList_t run(LLView * view) const; 89 viewList_t run(LLView * view) const;
90 // syntactic sugar 90 // syntactic sugar
91 viewList_t operator () (LLView * view) const { return run(view); } 91 viewList_t operator () (LLView * view) const { return run(view); }
92protected: 92protected:
93 // override this method to provide iteration over other types of children 93 // override this method to provide iteration over other types of children
94 virtual void filterChildren(LLView * view, viewList_t & filtered_children) const; 94 virtual void filterChildren(LLView * view, viewList_t & filtered_children) const;
95 filterResult_t runFilters(LLView * view, const viewList_t children, const filterList_t filters) const; 95 filterResult_t runFilters(LLView * view, const viewList_t children, const filterList_t filters) const;
96protected: 96protected:
97 filterList_t mPreFilters; 97 filterList_t mPreFilters;
98 filterList_t mPostFilters; 98 filterList_t mPostFilters;
99 const LLQuerySorter* mSorterp; 99 const LLQuerySorter* mSorterp;
100}; 100};
101 101
102class LLCtrlQuery : public LLViewQuery 102class LLCtrlQuery : public LLViewQuery
103{ 103{
104public: 104public:
105 LLCtrlQuery(); 105 LLCtrlQuery();
106}; 106};
107 107
108#endif 108#endif