diff options
author | Kelly Washington <kelly@lindenlab.com> | 2007-06-21 22:40:22 +0000 |
---|---|---|
committer | Kelly Washington <kelly@lindenlab.com> | 2007-06-21 22:40:22 +0000 |
commit | e03bb0606a10f29c8b94909a713a5bb5c69e88b7 (patch) | |
tree | 6d8d07894579438c8cc70e08f5730c3c95dfe768 /indra/llui | |
parent | 2638f12f95eea692502836cf6548b4a0b234d009 (diff) |
merge -r62831:64079 branches/maintenance to release
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcombobox.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llctrlselectioninterface.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lleditmenuhandler.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 23 | ||||
-rw-r--r-- | indra/llui/llscrollcontainer.cpp | 19 | ||||
-rw-r--r-- | indra/llui/llscrollcontainer.h | 12 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 15 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.h | 2 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 81 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.h | 6 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 21 | ||||
-rw-r--r-- | indra/llui/llviewquery.cpp | 2 |
12 files changed, 130 insertions, 56 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index fae13dd700..d63a53fdff 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -46,8 +46,8 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString mAllowTextEntry(FALSE), mMaxChars(20), mTextEntryTentative(TRUE), - mPrearrangeCallback( NULL ), mListPosition(BELOW), + mPrearrangeCallback( NULL ), mTextEntryCallback( NULL ) { // For now, all comboboxes don't take keyboard focus when clicked. diff --git a/indra/llui/llctrlselectioninterface.cpp b/indra/llui/llctrlselectioninterface.cpp index 61044aa7da..917250e0dd 100644 --- a/indra/llui/llctrlselectioninterface.cpp +++ b/indra/llui/llctrlselectioninterface.cpp @@ -5,6 +5,7 @@ * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. * $License$ */ +#include "linden_common.h" #include "llctrlselectioninterface.h" diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp index 656eaff563..0981e818ab 100644 --- a/indra/llui/lleditmenuhandler.cpp +++ b/indra/llui/lleditmenuhandler.cpp @@ -6,7 +6,7 @@ * $License$ */ -#include "stdtypes.h" +#include "linden_common.h" #include "lleditmenuhandler.h" diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 7e7999c9f9..5e043ecea3 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -200,6 +200,9 @@ LLString LLLineEditor::getWidgetTag() const void LLLineEditor::onFocusLost() { + // Need to notify early when loosing focus. + getWindow()->allowLanguageTextInput(FALSE); + LLUICtrl::onFocusLost(); if( mCommitOnFocusLost && mText.getString() != mPrevText) @@ -1110,7 +1113,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle ctrl-uparrow if we have a history enabled line editor. case KEY_UP: - if( mHaveHistory && ( MASK_CONTROL & mask ) ) + if( mHaveHistory && ( MASK_CONTROL == mask ) ) { if( mCurrentHistoryLine > 0 ) { @@ -1127,7 +1130,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle ctrl-downarrow if we have a history enabled line editor case KEY_DOWN: - if( mHaveHistory && ( MASK_CONTROL & mask ) ) + if( mHaveHistory && ( MASK_CONTROL == mask ) ) { if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.size() - 1 ) { @@ -1626,6 +1629,12 @@ void LLLineEditor::setFocus( BOOL new_state ) { BOOL old_state = hasFocus(); + if (!new_state) + { + getWindow()->allowLanguageTextInput(FALSE); + } + + // getting focus when we didn't have it before, and we want to select all if (!old_state && new_state && mSelectAllonFocusReceived) { @@ -1656,6 +1665,16 @@ void LLLineEditor::setFocus( BOOL new_state ) } LLUICtrl::setFocus( new_state ); + + if (new_state) + { + // Allow Language Text Input only when this LineEditor has + // no prevalidate function attached. This criterion works + // fine on 1.15.0.2, since all prevalidate func reject any + // non-ASCII characters. I'm not sure on future versions, + // however. + getWindow()->allowLanguageTextInput(mPrevalidateFunc == NULL); + } } //virtual diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index e5e31e45a9..0e3c73f633 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -272,7 +272,26 @@ BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks ) // Opaque return TRUE; } +BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis) +{ + if(mScrollbar[axis]->getVisible()) + { + LLRect inner_rect_local( 0, mInnerRect.getHeight(), mInnerRect.getWidth(), 0 ); + const S32 AUTOSCROLL_SIZE = 10; + if(mScrollbar[axis]->getVisible()) + { + inner_rect_local.mRight -= SCROLLBAR_SIZE; + inner_rect_local.mTop += AUTOSCROLL_SIZE; + inner_rect_local.mBottom = inner_rect_local.mTop - AUTOSCROLL_SIZE; + } + if( inner_rect_local.pointInRect( x, y ) && (mScrollbar[axis]->getDocPos() > 0) ) + { + return TRUE; + } + } + return FALSE; +} BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index b63e3ffc07..6b69862f4f 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -15,6 +15,7 @@ #endif #include "stdenums.h" #include "llcoord.h" +#include "llscrollbar.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLScrollableContainerView @@ -27,7 +28,6 @@ // This class is a decorator class. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLScrollbar; class LLViewBorder; class LLUICtrlFactory; @@ -35,6 +35,10 @@ class LLUICtrlFactory; class LLScrollableContainerView : public LLUICtrl { public: + // Note: vertical comes before horizontal because vertical + // scrollbars have priority for mouse and keyboard events. + enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; + LLScrollableContainerView( const LLString& name, const LLRect& rect, LLView* scrolled_view, BOOL is_opaque = FALSE, const LLColor4& bg_color = LLColor4(0,0,0,0) ); @@ -68,6 +72,8 @@ public: void goToBottom(); S32 getBorderWidth(); + BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis); + // LLView functionality virtual void reshape(S32 width, S32 height, BOOL called_from_parent); virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); @@ -90,10 +96,6 @@ protected: virtual void scrollVertical( S32 new_pos ); void updateScroll(); - // Note: vertical comes before horizontal because vertical - // scrollbars have priority for mouse and keyboard events. - enum { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; - LLScrollbar* mScrollbar[SCROLLBAR_COUNT]; LLView* mScrolledView; S32 mSize; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 4c01387941..1d07d3f36b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -78,8 +78,10 @@ protected: // // LLScrollListIcon // -LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) : -mIcon(icon), mColor(LLColor4::white), mImageUUID(image_id.asString()) +LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) + : mIcon(icon), + mImageUUID(image_id.asString()), + mColor(LLColor4::white) { if (width) { @@ -411,21 +413,20 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect, mFgUnselectedColor( LLUI::sColorsGroup->getColor("ScrollUnselectedColor") ), mFgDisabledColor( LLUI::sColorsGroup->getColor("ScrollDisabledColor") ), mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ), - mHighlightedItem(-1), mBorderThickness( 2 ), mOnDoubleClickCallback( NULL ), mOnMaximumSelectCallback( NULL ), mOnSortChangedCallback( NULL ), - mDrewSelected(FALSE), + mHighlightedItem(-1), mBorder(NULL), - mSearchColumn(0), mDefaultColumn("SIMPLE"), - + mSearchColumn(0), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mSortColumn(-1), + mSortAscending(TRUE), mSorted(TRUE), - mSortAscending(TRUE) + mDrewSelected(FALSE) { mItemListRect.setOriginAndSize( mBorderThickness + LIST_BORDER_PAD, diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index dff522bc0b..711d3b0ce8 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -308,7 +308,7 @@ public: S32 getNumColumns() const { return mColumns.size(); } - LLScrollListCell *getColumn(const S32 i) const { if (i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } + LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } virtual BOOL handleClick(S32 x, S32 y, MASK mask); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 2844640291..ef527b32c2 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -31,6 +31,7 @@ #include "llglheaders.h" const F32 SCROLL_STEP_TIME = 0.4f; +const F32 SCROLL_DELAY_TIME = 0.5f; const S32 TAB_PADDING = 15; const S32 TABCNTR_TAB_MIN_WIDTH = 60; const S32 TABCNTR_TAB_MAX_WIDTH = 150; @@ -61,6 +62,7 @@ LLTabContainerCommon::LLTabContainerCommon( mLockedTabCount(0) { setMouseOpaque(FALSE); + mDragAndDropDelayTimer.stop(); } @@ -81,9 +83,11 @@ LLTabContainerCommon::LLTabContainerCommon( mCallbackUserdata( callback_userdata ), mTitleBox(NULL), mTopBorderHeight(LLPANEL_BORDER_WIDTH), - mTabPosition(pos) + mTabPosition(pos), + mLockedTabCount(0) { setMouseOpaque(FALSE); + mDragAndDropDelayTimer.stop(); } @@ -711,8 +715,8 @@ LLTabContainer::LLTabContainer( : LLTabContainerCommon(name, rect, pos, close_callback, callback_userdata, bordered), mLeftArrowBtn(NULL), - mRightArrowBtn(NULL), mJumpLeftArrowBtn(NULL), + mRightArrowBtn(NULL), mJumpRightArrowBtn(NULL), mRightTabBtnOffset(0), mMinTabWidth(TABCNTR_TAB_MIN_WIDTH), @@ -729,8 +733,8 @@ LLTabContainer::LLTabContainer( : LLTabContainerCommon(name, rect_control, pos, close_callback, callback_userdata, bordered), mLeftArrowBtn(NULL), - mRightArrowBtn(NULL), mJumpLeftArrowBtn(NULL), + mRightArrowBtn(NULL), mJumpRightArrowBtn(NULL), mRightTabBtnOffset(0), mMinTabWidth(TABCNTR_TAB_MIN_WIDTH), @@ -1556,43 +1560,48 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag { BOOL has_scroll_arrows = (mMaxScrollPos > 0); - if (has_scroll_arrows) + if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) { - if (mJumpLeftArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom; - mJumpLeftArrowBtn->handleHover(local_x, local_y, mask); - } - if (mJumpRightArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom; - mJumpRightArrowBtn->handleHover(local_x, local_y, mask); - } - if (mLeftArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mLeftArrowBtn->getRect().mLeft; - S32 local_y = y - mLeftArrowBtn->getRect().mBottom; - mLeftArrowBtn->handleHover(local_x, local_y, mask); - } - else if (mRightArrowBtn->getRect().pointInRect(x, y)) + + if (has_scroll_arrows) { - S32 local_x = x - mRightArrowBtn->getRect().mLeft; - S32 local_y = y - mRightArrowBtn->getRect().mBottom; - mRightArrowBtn->handleHover(local_x, local_y, mask); + if (mJumpLeftArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft; + S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom; + mJumpLeftArrowBtn->handleHover(local_x, local_y, mask); + } + if (mJumpRightArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft; + S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom; + mJumpRightArrowBtn->handleHover(local_x, local_y, mask); + } + if (mLeftArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mLeftArrowBtn->getRect().mLeft; + S32 local_y = y - mLeftArrowBtn->getRect().mBottom; + mLeftArrowBtn->handleHover(local_x, local_y, mask); + } + else if (mRightArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mRightArrowBtn->getRect().mLeft; + S32 local_y = y - mRightArrowBtn->getRect().mBottom; + mRightArrowBtn->handleHover(local_x, local_y, mask); + } } - } - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) - { - LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); - S32 local_x = x - tuple->mButton->getRect().mLeft; - S32 local_y = y - tuple->mButton->getRect().mBottom; - if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { - tuple->mButton->onCommit(); + LLTabTuple* tuple = *iter; + tuple->mButton->setVisible( TRUE ); + S32 local_x = x - tuple->mButton->getRect().mLeft; + S32 local_y = y - tuple->mButton->getRect().mBottom; + if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + { + tuple->mButton->onCommit(); + mDragAndDropDelayTimer.stop(); + } } } @@ -1621,4 +1630,4 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name) // tabs have changed size, might need to scroll to see current tab updateMaxScrollPos(); } -}
\ No newline at end of file +} diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index fbb73b951b..a395fd94af 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -97,7 +97,9 @@ public: virtual void setTabImage(LLPanel* child, std::string img_name); void setTitle( const LLString& title ); const LLString getPanelTitle(S32 index); - + + void setDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); } + virtual void setTopBorderHeight(S32 height); virtual void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool)); @@ -155,6 +157,8 @@ protected: S32 mScrollPosPixels; S32 mMaxScrollPos; + LLFrameTimer mDragAndDropDelayTimer; + void (*mCloseCallback)(void*); void* mCallbackUserdata; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index f8e1e33cad..7506559b98 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -26,6 +26,7 @@ #include "llclipboard.h" #include "llscrollbar.h" #include "llstl.h" +#include "llstring.h" #include "llkeyboard.h" #include "llkeywords.h" #include "llundo.h" @@ -494,8 +495,10 @@ void LLTextEditor::truncate() void LLTextEditor::setText(const LLString &utf8str) { - mUTF8Text = utf8str; - mWText = utf8str_to_wstring(utf8str); + // LLString::removeCRLF(utf8str); + mUTF8Text = utf8str_removeCRLF(utf8str); + // mUTF8Text = utf8str; + mWText = utf8str_to_wstring(mUTF8Text); mTextIsUpToDate = TRUE; truncate(); @@ -2471,6 +2474,8 @@ void LLTextEditor::redo() // virtual, from LLView void LLTextEditor::onFocusLost() { + getWindow()->allowLanguageTextInput(FALSE); + // Route menu back to the default if( gEditMenuHandler == this ) { @@ -3037,6 +3042,12 @@ void LLTextEditor::setFocus( BOOL new_state ) // Don't change anything if the focus state didn't change if (new_state == old_state) return; + // Notify early if we are loosing focus. + if (!new_state) + { + getWindow()->allowLanguageTextInput(FALSE); + } + LLUICtrl::setFocus( new_state ); if( new_state ) @@ -3057,6 +3068,12 @@ void LLTextEditor::setFocus( BOOL new_state ) endSelection(); } + + // Notify late if we are gaining focus. + if (new_state && !mReadOnly) + { + getWindow()->allowLanguageTextInput(TRUE); + } } BOOL LLTextEditor::acceptsTextInput() const diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index 650125d486..c7ae4245dd 100644 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp @@ -6,6 +6,8 @@ * $License$ */ +#include "linden_common.h" + #include "llview.h" #include "lluictrl.h" #include "llviewquery.h" |