From 41a30a59fb1b6dea2d531333d0429632f1fef2fe Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 2 Mar 2010 14:21:58 -0800 Subject: initial work changing topctrl to popup layer --- indra/llui/llcombobox.cpp | 7 ++----- indra/llui/llfloater.cpp | 15 +++----------- indra/llui/llfocusmgr.cpp | 47 +++----------------------------------------- indra/llui/llfocusmgr.h | 8 +------- indra/llui/llhandle.h | 7 +++++++ indra/llui/llmodaldialog.cpp | 6 +++--- indra/llui/llui.cpp | 29 +++++++++++++++++++++++++++ indra/llui/llui.h | 10 ++++++++++ indra/llui/llview.cpp | 5 ----- 9 files changed, 58 insertions(+), 76 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 9d23daf56d..de3bf719ee 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -615,7 +615,7 @@ void LLComboBox::showList() // register ourselves as a "top" control // effectively putting us into a special draw layer // and not affecting the bounding rectangle calculation - gFocusMgr.setTopCtrl(this); + LLUI::addPopup(this); // Show the list and push the button down mButton->setToggleState(TRUE); @@ -644,10 +644,7 @@ void LLComboBox::hideList() mList->mouseOverHighlightNthItem(-1); setUseBoundingRect(FALSE); - if( gFocusMgr.getTopCtrl() == this ) - { - gFocusMgr.setTopCtrl(NULL); - } + LLUI::removePopup(this); } } diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b6d73cda3c..b93b72abf6 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -527,10 +527,7 @@ void LLFloater::setVisible( BOOL visible ) if( !visible ) { - if( gFocusMgr.childIsTopCtrl( this ) ) - { - gFocusMgr.setTopCtrl(NULL); - } + LLUI::removePopup(this); if( gFocusMgr.childHasMouseCapture( this ) ) { @@ -704,10 +701,7 @@ void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent) void LLFloater::releaseFocus() { - if( gFocusMgr.childIsTopCtrl( this ) ) - { - gFocusMgr.setTopCtrl(NULL); - } + LLUI::removePopup(this); setFocus(FALSE); @@ -2503,10 +2497,7 @@ void LLFloaterView::syncFloaterTabOrder() if (modal_dialog) { // If we have a visible modal dialog, make sure that it has focus - if( gFocusMgr.getTopCtrl() != modal_dialog ) - { - gFocusMgr.setTopCtrl( modal_dialog ); - } + LLUI::addPopup(modal_dialog); if( !gFocusMgr.childHasKeyboardFocus( modal_dialog ) ) { diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 35fbc7b0a8..ad2940e685 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -38,8 +38,6 @@ const F32 FOCUS_FADE_TIME = 0.3f; -// NOTE: the LLFocusableElement implementation has been moved here from lluictrl.cpp. - LLFocusableElement::LLFocusableElement() : mFocusLostCallback(NULL), mFocusReceivedCallback(NULL), @@ -124,8 +122,7 @@ boost::signals2::connection LLFocusableElement::setTopLostCallback(const focus_s LLFocusMgr gFocusMgr; LLFocusMgr::LLFocusMgr() - : - mLockedView( NULL ), +: mLockedView( NULL ), mMouseCaptor( NULL ), mKeyboardFocus( NULL ), mLastKeyboardFocus( NULL ), @@ -133,16 +130,11 @@ LLFocusMgr::LLFocusMgr() mKeystrokesOnly(FALSE), mTopCtrl( NULL ), mAppHasFocus(TRUE) // Macs don't seem to notify us that we've gotten focus, so default to true - #ifdef _DEBUG - , mMouseCaptorName("none") - , mKeyboardFocusName("none") - , mTopCtrlName("none") - #endif { } -void LLFocusMgr::releaseFocusIfNeeded( const LLView* view ) +void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) { if( childHasMouseCapture( view ) ) { @@ -162,10 +154,7 @@ void LLFocusMgr::releaseFocusIfNeeded( const LLView* view ) } } - if( childIsTopCtrl( view ) ) - { - setTopCtrl( NULL ); - } + LLUI::removePopup(view); } @@ -248,11 +237,6 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL return; } - #ifdef _DEBUG - LLUICtrl* focus_ctrl = dynamic_cast(new_focus); - mKeyboardFocusName = focus_ctrl ? focus_ctrl->getName() : std::string("none"); - #endif - // If we've got a default keyboard focus, and the caller is // releasing keyboard focus, move to the default. if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL) @@ -334,20 +318,12 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f if( mKeyboardFocus == focus ) { mKeyboardFocus = NULL; - #ifdef _DEBUG - mKeyboardFocusName = std::string("none"); - #endif } } void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor ) { - //if (mFocusLocked) - //{ - // return; - //} - if( new_captor != mMouseCaptor ) { LLMouseHandler* old_captor = mMouseCaptor; @@ -370,24 +346,14 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor ) old_captor->onMouseCaptureLost(); } - #ifdef _DEBUG - mMouseCaptorName = new_captor ? new_captor->getName() : std::string("none"); - #endif } } void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor ) { - //if (mFocusLocked) - //{ - // return; - //} if( mMouseCaptor == captor ) { mMouseCaptor = NULL; - #ifdef _DEBUG - mMouseCaptorName = std::string("none"); - #endif } } @@ -416,10 +382,6 @@ void LLFocusMgr::setTopCtrl( LLUICtrl* new_top ) { mTopCtrl = new_top; - #ifdef _DEBUG - mTopCtrlName = new_top ? new_top->getName() : std::string("none"); - #endif - if (old_top) { old_top->onTopLost(); @@ -432,9 +394,6 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view ) if( mTopCtrl == top_view ) { mTopCtrl = NULL; - #ifdef _DEBUG - mTopCtrlName = std::string("none"); - #endif } } diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 83ecd1d301..5b08c628d4 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -119,7 +119,7 @@ public: BOOL childIsTopCtrl( const LLView* parent ) const; // All Three - void releaseFocusIfNeeded( const LLView* top_view ); + void releaseFocusIfNeeded( LLView* top_view ); void lockFocus(); void unlockFocus(); BOOL focusLocked() const { return mLockedView != NULL; } @@ -149,12 +149,6 @@ private: typedef std::map, LLHandle > focus_history_map_t; focus_history_map_t mFocusHistory; - - #ifdef _DEBUG - std::string mMouseCaptorName; - std::string mKeyboardFocusName; - std::string mTopCtrlName; - #endif }; extern LLFocusMgr gFocusMgr; diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index 899f6b9326..8ade327044 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -67,6 +67,13 @@ public: return *this; } + template + LLHandle& operator =(const LLHandle& other) + { + mTombStone = other.mTombStone; + return *this; + } + bool isDead() const { return mTombStone->getTarget() == NULL; diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 387af05935..6cff68c20b 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -111,7 +111,7 @@ void LLModalDialog::onOpen(const LLSD& key) // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( this ); - gFocusMgr.setTopCtrl( this ); + LLUI::addPopup(this); setFocus(TRUE); sModalStack.push_front( this ); @@ -153,7 +153,7 @@ void LLModalDialog::setVisible( BOOL visible ) gFocusMgr.setMouseCapture( this ); // The dialog view is a root view - gFocusMgr.setTopCtrl( this ); + LLUI::addPopup(this); setFocus( TRUE ); } else @@ -291,7 +291,7 @@ void LLModalDialog::onAppFocusGained() // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( instance ); instance->setFocus(TRUE); - gFocusMgr.setTopCtrl( instance ); + LLUI::addPopup(instance); instance->centerOnScreen(); } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index b348ec2d29..64df1dbc7a 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -86,6 +86,9 @@ std::list gUntranslated; /*static*/ LLHelp* LLUI::sHelpImpl = NULL; /*static*/ std::vector LLUI::sXUIPaths; /*static*/ LLFrameTimer LLUI::sMouseIdleTimer; +/*static*/ LLUI::add_popup_t LLUI::sAddPopupFunc; +/*static*/ LLUI::remove_popup_t LLUI::sRemovePopupFunc; +/*static*/ LLUI::clear_popups_t LLUI::sClearPopupsFunc; // register filtereditor here static LLDefaultChildRegistry::Register register_filter_editor("filter_editor"); @@ -1607,6 +1610,13 @@ void LLUI::cleanupClass() sImageProvider->cleanUp(); } +void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) +{ + sAddPopupFunc = add_popup; + sRemovePopupFunc = remove_popup; + sClearPopupsFunc = clear_popups; +} + //static void LLUI::dirtyRect(LLRect rect) { @@ -1877,6 +1887,25 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) return *sSettingGroups["config"]; // default group } +//static +void LLUI::addPopup(LLView* viewp) +{ + if (sAddPopupFunc) + { + sAddPopupFunc(viewp); + } +} + +//static +void LLUI::removePopup(LLView* viewp) +{ + if (sRemovePopupFunc) + { + sRemovePopupFunc(viewp); + } +} + + //static // spawn_x and spawn_y are top left corner of view in screen GL coordinates void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) diff --git a/indra/llui/llui.h b/indra/llui/llui.h index af8d4ea03b..824d76f526 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -160,12 +160,17 @@ public: // Methods // typedef std::map settings_map_t; + typedef boost::function add_popup_t; + typedef boost::function remove_popup_t; + typedef boost::function clear_popups_t; + static void initClass(const settings_map_t& settings, LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback = NULL, const LLVector2 *scale_factor = NULL, const std::string& language = LLStringUtil::null); static void cleanupClass(); + static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& ); static void pushMatrix(); static void popMatrix(); @@ -207,6 +212,8 @@ public: static F32 getMouseIdleTime() { return sMouseIdleTimer.getElapsedTimeF32(); } static void resetMouseIdleTimer() { sMouseIdleTimer.reset(); } static LLWindow* getWindow() { return sWindow; } + static void addPopup(LLView*); + static void removePopup(LLView*); // Ensures view does not overlap mouse cursor, but is inside // the view's parent rectangle. Used for tooltips, inspectors. @@ -227,6 +234,9 @@ private: static LLImageProviderInterface* sImageProvider; static std::vector sXUIPaths; static LLFrameTimer sMouseIdleTimer; + static add_popup_t sAddPopupFunc; + static remove_popup_t sRemovePopupFunc; + static clear_popups_t sClearPopupsFunc; }; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 63e627ceb5..db2c460eec 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -592,11 +592,6 @@ void LLView::setVisible(BOOL visible) { if ( mVisible != visible ) { - if( !visible && (gFocusMgr.getTopCtrl() == this) ) - { - gFocusMgr.setTopCtrl( NULL ); - } - mVisible = visible; // notify children of visibility change if root, or part of visible hierarchy -- cgit v1.2.3 From 69f9c0bcf9764a1b682bfdd5baa3f340922dcbaa Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 3 Mar 2010 19:37:41 -0800 Subject: WIP - replace top ctrl with LLPopupView --- indra/llui/llcombobox.cpp | 14 ++++++++------ indra/llui/llcombobox.h | 1 + indra/llui/llfloater.cpp | 2 +- indra/llui/llfocusmgr.cpp | 4 ++-- indra/llui/llfocusmgr.h | 2 +- indra/llui/llui.cpp | 9 +++++++++ indra/llui/llui.h | 2 ++ 7 files changed, 24 insertions(+), 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index de3bf719ee..c679717807 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -160,7 +160,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) createLineEditor(p); - setTopLostCallback(boost::bind(&LLComboBox::hideList, this)); + mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this)); } void LLComboBox::initFromParams(const LLComboBox::Params& p) @@ -187,6 +187,9 @@ BOOL LLComboBox::postBuild() LLComboBox::~LLComboBox() { // children automatically deleted, including mMenu, mButton + + // explicitly disconect this signal, since base class destructor might fire top lost + mTopLostSignalConnection.disconnect(); } @@ -612,16 +615,14 @@ void LLComboBox::showList() mList->setFocus(TRUE); - // register ourselves as a "top" control - // effectively putting us into a special draw layer - // and not affecting the bounding rectangle calculation - LLUI::addPopup(this); - // Show the list and push the button down mButton->setToggleState(TRUE); mList->setVisible(TRUE); + LLUI::addPopup(this); + setUseBoundingRect(TRUE); + updateBoundingRect(); } void LLComboBox::hideList() @@ -645,6 +646,7 @@ void LLComboBox::hideList() setUseBoundingRect(FALSE); LLUI::removePopup(this); + updateBoundingRect(); } } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 4f27588467..aa1e708bec 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -231,5 +231,6 @@ private: commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; S32 mLastSelectedIndex; + boost::signals2::connection mTopLostSignalConnection; }; #endif diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b93b72abf6..c45be34d43 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1354,7 +1354,7 @@ void LLFloater::bringToFront( S32 x, S32 y ) // virtual void LLFloater::setVisibleAndFrontmost(BOOL take_focus) { - gFocusMgr.setTopCtrl(NULL); + LLUI::clearPopups(); setVisible(TRUE); setFrontmost(take_focus); } diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index ad2940e685..b3af258456 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -437,9 +437,9 @@ void LLFocusMgr::setAppHasFocus(BOOL focus) } // release focus from "top ctrl"s, which generally hides them - if (!focus && mTopCtrl) + if (!focus) { - setTopCtrl(NULL); + LLUI::clearPopups(); } mAppHasFocus = focus; } diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 5b08c628d4..86d3ccf111 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -65,10 +65,10 @@ public: virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); + virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere protected: virtual void onFocusReceived(); virtual void onFocusLost(); - virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere focus_signal_t* mFocusLostCallback; focus_signal_t* mFocusReceivedCallback; focus_signal_t* mFocusChangedCallback; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 64df1dbc7a..5121ef5351 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1905,6 +1905,15 @@ void LLUI::removePopup(LLView* viewp) } } +//static +void LLUI::clearPopups() +{ + if (sClearPopupsFunc) + { + sClearPopupsFunc(); + } +} + //static // spawn_x and spawn_y are top left corner of view in screen GL coordinates diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 824d76f526..30f3623ded 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -212,8 +212,10 @@ public: static F32 getMouseIdleTime() { return sMouseIdleTimer.getElapsedTimeF32(); } static void resetMouseIdleTimer() { sMouseIdleTimer.reset(); } static LLWindow* getWindow() { return sWindow; } + static void addPopup(LLView*); static void removePopup(LLView*); + static void clearPopups(); // Ensures view does not overlap mouse cursor, but is inside // the view's parent rectangle. Used for tooltips, inspectors. -- cgit v1.2.3 From ce27036017eb4c3e7b51f620597e50330232f38c Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 4 Mar 2010 16:22:31 +0200 Subject: Backed out changeset: 0160afd678a5 Implemented solution fixed bug caused by changes made for EXT-3852 (07f21c92896f & 07f21c92896f). For now previous changes for EXT-3852 are reverted. So, changes for EXT-4572 (Click and hold the left mouse button doesn't let you browse tabbed IM floater) are unnecessary. --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 1dcfb4e296..30fc7babae 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -2061,12 +2061,5 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y) tuple->mButton->onCommit(); } } - /** - * EXT - 4572 (Click and hold the left mouse button doesn't let you browse tabbed IM floater) - * - * During hovering mouse(with left mouse button hold) over tabs, a newly just activated corresponding - * to the tab(that is hovered in the given instant of time) panel may caught mouse capture. - */ - gFocusMgr.setMouseCapture(this); } } -- cgit v1.2.3 From 485711e179e0ccf6351feb02318f41bbb5593662 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 4 Mar 2010 16:35:52 -0800 Subject: removed extraneous updateBoundingRect() calls remove the login progress panel as a popup only after it has finished fading out popupview manages it's own registering and unregistering of popup callbacks --- indra/llui/llcombobox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index c679717807..9ec1a9f7c4 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -622,7 +622,7 @@ void LLComboBox::showList() LLUI::addPopup(this); setUseBoundingRect(TRUE); - updateBoundingRect(); +// updateBoundingRect(); } void LLComboBox::hideList() @@ -646,7 +646,7 @@ void LLComboBox::hideList() setUseBoundingRect(FALSE); LLUI::removePopup(this); - updateBoundingRect(); +// updateBoundingRect(); } } -- cgit v1.2.3 From a8e1c2ed134b88b55b713ac53cd63cab4bb526b3 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Fri, 5 Mar 2010 15:41:25 +0200 Subject: Implemented (EXT-4705) Show maturity icon on Region/Estate tab. - Added LLIconsComboBox class - a combobox with icons for maturity ratings. - Fixed scroll list maximum width calculation. The width was calculated based on text value width for non-text columns. - Added image overlay alignment getter method to LLButton. --HG-- branch : product-engine --- indra/llui/llbutton.h | 1 + indra/llui/llcombobox.cpp | 45 +++++++++++++++++++++++++++++++---------- indra/llui/llcombobox.h | 33 +++++++++++++++++++++++++++++- indra/llui/llscrolllistctrl.cpp | 4 +++- 4 files changed, 70 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 6a0d8ef3d6..59b551a16d 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -216,6 +216,7 @@ public: void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); LLPointer getImageOverlay() { return mImageOverlay; } + LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; } void autoResize(); // resize with label of current btn state void resize(LLUIString label); // resize with label input diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 9d23daf56d..98c9217306 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -703,19 +703,12 @@ void LLComboBox::onListMouseUp() void LLComboBox::onItemSelected(const LLSD& data) { - const std::string name = mList->getSelectedItemLabel(); + setValue(data); - S32 cur_id = getCurrentIndex(); - mLastSelectedIndex = cur_id; - if (cur_id != -1) + if (mAllowTextEntry && mLastSelectedIndex != -1) { - setLabel(name); - - if (mAllowTextEntry) - { - gFocusMgr.setKeyboardFocus(mTextEntry); - mTextEntry->selectAll(); - } + gFocusMgr.setKeyboardFocus(mTextEntry); + mTextEntry->selectAll(); } // hiding the list reasserts the old value stored in the text editor/dropdown button @@ -1069,3 +1062,33 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last ) { return mList->selectItemRange(first, last); } + + +static LLDefaultChildRegistry::Register register_icons_combo_box("icons_combo_box"); + +LLIconsComboBox::Params::Params() +: icon_column("icon_column", ICON_COLUMN), + label_column("label_column", LABEL_COLUMN) +{} + +LLIconsComboBox::LLIconsComboBox(const LLIconsComboBox::Params& p) +: LLComboBox(p), + mIconColumnIndex(p.icon_column), + mLabelColumnIndex(p.label_column) +{} + +void LLIconsComboBox::setValue(const LLSD& value) +{ + BOOL found = mList->selectByValue(value); + if (found) + { + LLScrollListItem* item = mList->getFirstSelected(); + if (item) + { + mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); + + setLabel(mList->getSelectedItemLabel(mLabelColumnIndex)); + } + mLastSelectedIndex = mList->getFirstSelectedIndex(); + } +} diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 4f27588467..3cc2a8f5d1 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -221,6 +221,7 @@ protected: LLPointer mArrowImage; LLUIString mLabel; BOOL mHasAutocompletedText; + S32 mLastSelectedIndex; private: BOOL mAllowTextEntry; @@ -230,6 +231,36 @@ private: commit_callback_t mPrearrangeCallback; commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; - S32 mLastSelectedIndex; }; + +// A combo box with icons for the list of items. +class LLIconsComboBox +: public LLComboBox +{ +public: + struct Params + : public LLInitParam::Block + { + Optional icon_column, + label_column; + Params(); + }; + + /*virtual*/ void setValue(const LLSD& value); + +private: + enum EColumnIndex + { + ICON_COLUMN = 0, + LABEL_COLUMN + }; + + friend class LLUICtrlFactory; + LLIconsComboBox(const Params&); + virtual ~LLIconsComboBox() {}; + + S32 mIconColumnIndex; + S32 mLabelColumnIndex; +}; + #endif diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 77caaaa425..18ec5b51dd 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -630,7 +630,9 @@ void LLScrollListCtrl::calcColumnWidths() LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex); if (!cellp) continue; - column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth); + // get text value width only for text cells + column->mMaxContentWidth = cellp->isText() ? + llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth) : column->mMaxContentWidth; } max_item_width += column->mMaxContentWidth; -- cgit v1.2.3 From f499260782a0c94c4f164a743da9d2690240dad7 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Sat, 6 Mar 2010 01:17:34 +0200 Subject: Implemented (EXT-4715) Add maturity icons to Classifieds - create and details. --HG-- branch : product-engine --- indra/llui/llcombobox.cpp | 33 +++++++++++++++++++++++---------- indra/llui/llcombobox.h | 3 ++- 2 files changed, 25 insertions(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 98c9217306..e223e1c0bf 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -320,15 +320,19 @@ void LLComboBox::setValue(const LLSD& value) LLScrollListItem* item = mList->getFirstSelected(); if (item) { - setLabel( mList->getSelectedItemLabel() ); + setLabel(getSelectedItemLabel()); } mLastSelectedIndex = mList->getFirstSelectedIndex(); } + else + { + mLastSelectedIndex = -1; + } } const std::string LLComboBox::getSimple() const { - const std::string res = mList->getSelectedItemLabel(); + const std::string res = getSelectedItemLabel(); if (res.empty() && mAllowTextEntry) { return mTextEntry->getText(); @@ -407,7 +411,7 @@ BOOL LLComboBox::remove(S32 index) if (index < mList->getItemCount()) { mList->deleteSingleItem(index); - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); return TRUE; } return FALSE; @@ -448,7 +452,7 @@ BOOL LLComboBox::setCurrentByIndex( S32 index ) BOOL found = mList->selectNthItem( index ); if (found) { - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); mLastSelectedIndex = index; } return found; @@ -905,7 +909,7 @@ void LLComboBox::updateSelection() } else if (mList->selectItemByPrefix(left_wstring, FALSE)) { - LLWString selected_item = utf8str_to_wstring(mList->getSelectedItemLabel()); + LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); @@ -1007,7 +1011,7 @@ BOOL LLComboBox::setCurrentByID(const LLUUID& id) if (found) { - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); mLastSelectedIndex = mList->getFirstSelectedIndex(); } @@ -1023,7 +1027,7 @@ BOOL LLComboBox::setSelectedByValue(const LLSD& value, BOOL selected) BOOL found = mList->setSelectedByValue(value, selected); if (found) { - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); } return found; } @@ -1085,10 +1089,19 @@ void LLIconsComboBox::setValue(const LLSD& value) LLScrollListItem* item = mList->getFirstSelected(); if (item) { - mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); - - setLabel(mList->getSelectedItemLabel(mLabelColumnIndex)); + setLabel(getSelectedItemLabel()); } mLastSelectedIndex = mList->getFirstSelectedIndex(); } + else + { + mLastSelectedIndex = -1; + } +} + +const std::string LLIconsComboBox::getSelectedItemLabel(S32 column) const +{ + mButton->setImageOverlay(LLComboBox::getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); + + return LLComboBox::getSelectedItemLabel(mLabelColumnIndex); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 3cc2a8f5d1..62aab92abc 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -150,7 +150,7 @@ public: // Get name of current item. Returns an empty string if not found. const std::string getSimple() const; // Get contents of column x of selected row - const std::string getSelectedItemLabel(S32 column = 0) const; + virtual const std::string getSelectedItemLabel(S32 column = 0) const; // Sets the label, which doesn't have to exist in the label. // This is probably a UI abuse. @@ -247,6 +247,7 @@ public: }; /*virtual*/ void setValue(const LLSD& value); + /*virtual*/ const std::string getSelectedItemLabel(S32 column = 0) const; private: enum EColumnIndex -- cgit v1.2.3 From 7cea645ba2b77d5bbcba7a7189aa584ac95ff453 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 5 Mar 2010 17:38:21 -0800 Subject: added some logging to help track down crash in EXT-5849 --- indra/llui/llview.cpp | 8 ++++++-- indra/llui/llview.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index db2c460eec..b695731a02 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -73,9 +73,9 @@ S32 LLView::sLastBottomXML = S32_MIN; std::vector LLViewDrawContext::sDrawContextStack; -#if LL_DEBUG +//#if LL_DEBUG BOOL LLView::sIsDrawing = FALSE; -#endif +//#endif // Compiler optimization, generate extern template template class LLView* LLView::getChild( @@ -150,6 +150,10 @@ LLView::~LLView() { dirtyRect(); //llinfos << "Deleting view " << mName << ":" << (void*) this << llendl; + if (LLView::isDrawing) + { + llwarns << "Deleting view " << mName << " during UI draw() phase" << llendl; + } // llassert(LLView::sIsDrawing == FALSE); // llassert_always(sDepth == 0); // avoid deleting views while drawing! It can subtly break list iterators diff --git a/indra/llui/llview.h b/indra/llui/llview.h index c4d7313743..efae00f0e5 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -171,9 +171,9 @@ private: // widgets in general are not copyable LLView(const LLView& other) {}; public: -#if LL_DEBUG +//#if LL_DEBUG static BOOL sIsDrawing; -#endif +//#endif enum ESoundFlags { SILENT = 0, -- cgit v1.2.3 From 4ada9e7f15eed6a462f22a119a724f64799aba54 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 5 Mar 2010 18:19:29 -0800 Subject: fix --- indra/llui/llview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index b695731a02..d34083a384 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -150,7 +150,7 @@ LLView::~LLView() { dirtyRect(); //llinfos << "Deleting view " << mName << ":" << (void*) this << llendl; - if (LLView::isDrawing) + if (LLView::sIsDrawing) { llwarns << "Deleting view " << mName << " during UI draw() phase" << llendl; } -- cgit v1.2.3 From a4ebe8b9d5412d07bb80a1ab52288548610e9399 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 9 Mar 2010 15:34:09 +0200 Subject: possible defensive fix for EXT-6092 [crashhunters] Crash in LLFlatListView::selectItemPair, bug reason is unknown --HG-- branch : product-engine --- indra/llui/llflatlistview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 2481249f91..2e5aeec41d 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -492,6 +492,12 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) { if (!item_pair) return; + if (!item_pair->first) + { + llwarning("Attempt to selet an item pair containing null panel item", 0); + return; + } + setFocus(TRUE); bool select_item = !isSelected(item_pair); -- cgit v1.2.3