diff options
author | Adam Moss <moss@lindenlab.com> | 2009-04-16 23:45:35 +0000 |
---|---|---|
committer | Adam Moss <moss@lindenlab.com> | 2009-04-16 23:45:35 +0000 |
commit | b01c75cb423f07a3d3354f8bd62f265f80062b3b (patch) | |
tree | dec1b220c24a60cc220d1cb07fd3545610644f0a /indra/llui | |
parent | 868250bdd74f348557102c0d8408d9bec30331f6 (diff) |
svn merge -r117314:117337
svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/mv13a-merge-1
QAR-1343 maint-viewer-13a+libcurlexploitfix-3-3 combo merge
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llclipboard.cpp | 41 | ||||
-rw-r--r-- | indra/llui/llclipboard.h | 11 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 2 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 97 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 13 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llresmgr.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 11 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 137 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 11 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 78 | ||||
-rw-r--r-- | indra/llui/llview.h | 4 |
13 files changed, 388 insertions, 34 deletions
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 8a7a214048..2cb8197a67 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -93,3 +93,44 @@ BOOL LLClipboard::canPasteString() const { return LLView::getWindow()->isClipboardTextAvailable(); } + + +void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) +{ + mSourceID = source_id; + mString = src.substr(pos, len); + LLView::getWindow()->copyTextToPrimary( mString ); +} + + +const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id ) +{ + if( mSourceID.notNull() ) + { + LLWString temp_string; + LLView::getWindow()->pasteTextFromPrimary(temp_string); + + if( temp_string != mString ) + { + mSourceID.setNull(); + mString = temp_string; + } + } + else + { + LLView::getWindow()->pasteTextFromPrimary(mString); + } + + if( source_id ) + { + *source_id = mSourceID; + } + + return mString; +} + + +BOOL LLClipboard::canPastePrimaryString() const +{ + return LLView::getWindow()->isPrimaryTextAvailable(); +} diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 37ed1ffe58..034a7a6aeb 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -44,10 +44,19 @@ public: LLClipboard(); ~LLClipboard(); + /* We support two flavors of clipboard. The default is the explicitly + copy-and-pasted clipboard. The second is the so-called 'primary' clipboard + which is implicitly copied upon selection on platforms which expect this + (i.e. X11/Linux). */ + void copyFromSubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); BOOL canPasteString() const; const LLWString& getPasteWString(LLUUID* source_id = NULL); - + + void copyFromPrimarySubstring(const LLWString ©_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null ); + BOOL canPastePrimaryString() const; + const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); + private: LLUUID mSourceID; LLWString mString; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 94af1868be..21f8f6e5f7 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1193,6 +1193,12 @@ BOOL LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); } +BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + bringToFront( x, y ); + return LLPanel::handleMiddleMouseDown( x, y, mask ); +} + // virtual BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) @@ -2188,7 +2194,7 @@ BOOL LLFloaterView::allChildrenClosed() LLView* viewp = *it; LLFloater* floaterp = (LLFloater*)viewp; - if (floaterp->getVisible() && !floaterp->isDead() && floaterp->canClose()) + if (floaterp->getVisible() && !floaterp->isDead() && floaterp->isCloseable()) { return false; } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index a8f7c211fb..0e3d148b09 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -195,7 +195,7 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); virtual void draw(); virtual void onOpen() {} diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 6aa2aac48c..964254d93f 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -489,6 +489,9 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing mKeystrokeTimer.reset(); + // take selection to 'primary' clipboard + updatePrimary(); + return TRUE; } @@ -571,6 +574,17 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + // llinfos << "MiddleMouseDown" << llendl; + setFocus( TRUE ); + if( canPastePrimary() ) + { + setCursorAtLocalPos(x); + pastePrimary(); + } + return TRUE; +} BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { @@ -665,6 +679,9 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) { // delay cursor flashing mKeystrokeTimer.reset(); + + // take selection to 'primary' clipboard + updatePrimary(); } return handled; @@ -868,7 +885,12 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } } - + if(handled) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } @@ -877,7 +899,7 @@ void LLLineEditor::deleteSelection() if( !mReadOnly && hasSelection() ) { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 selection_length = abs( mSelectionStart - mSelectionEnd ); + S32 selection_length = llabs( mSelectionStart - mSelectionEnd ); mText.erase(left_pos, selection_length); deselect(); @@ -900,7 +922,7 @@ void LLLineEditor::cut() S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring( mText.getWString(), left_pos, length ); deleteSelection(); @@ -931,7 +953,7 @@ void LLLineEditor::copy() if( canCopy() ) { S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring( mText.getWString(), left_pos, length ); } } @@ -941,20 +963,50 @@ BOOL LLLineEditor::canPaste() const return !mReadOnly && gClipboard.canPasteString(); } - -// paste from clipboard void LLLineEditor::paste() { - if (canPaste()) + bool is_primary = false; + pasteHelper(is_primary); +} + +void LLLineEditor::pastePrimary() +{ + bool is_primary = true; + pasteHelper(is_primary); +} + +// paste from primary (is_primary==true) or clipboard (is_primary==false) +void LLLineEditor::pasteHelper(bool is_primary) +{ + bool can_paste_it; + if (is_primary) + { + can_paste_it = canPastePrimary(); + } + else + { + can_paste_it = canPaste(); + } + + if (can_paste_it) { - LLWString paste = gClipboard.getPasteWString(); + LLWString paste; + if (is_primary) + { + paste = gClipboard.getPastePrimaryWString(); + } + else + { + paste = gClipboard.getPasteWString(); + } + if (!paste.empty()) { // Prepare for possible rollback LLLineEditorRollback rollback(this); // Delete any selected characters - if (hasSelection()) + if ((!is_primary) && hasSelection()) { deleteSelection(); } @@ -990,7 +1042,7 @@ void LLLineEditor::paste() clean_string = clean_string.substr(0, wchars_that_fit); reportBadKeystroke(); } - + mText.insert(getCursor(), clean_string); setCursor( getCursor() + (S32)clean_string.length() ); deselect(); @@ -1011,7 +1063,30 @@ void LLLineEditor::paste() } } - +// copy selection to primary +void LLLineEditor::copyPrimary() +{ + if( canCopy() ) + { + S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); + gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length ); + } +} + +BOOL LLLineEditor::canPastePrimary() const +{ + return !mReadOnly && gClipboard.canPastePrimaryString(); +} + +void LLLineEditor::updatePrimary() +{ + if(canCopy() ) + { + copyPrimary(); + } +} + BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { BOOL handled = FALSE; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 254ba19e59..fc5fcc5b90 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -90,6 +90,7 @@ public: /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); + /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); /*virtual*/ void onMouseCaptureLost(); @@ -97,13 +98,16 @@ public: // LLEditMenuHandler overrides virtual void cut(); virtual BOOL canCut() const; - virtual void copy(); virtual BOOL canCopy() const; - virtual void paste(); virtual BOOL canPaste() const; - + + virtual void updatePrimary(); + virtual void copyPrimary(); + virtual void pastePrimary(); + virtual BOOL canPastePrimary() const; + virtual void doDelete(); virtual BOOL canDoDelete() const; @@ -217,6 +221,9 @@ public: private: // private helper methods + + void pasteHelper(bool is_primary); + void removeChar(); void addChar(const llwchar c); void setCursorAtLocalPos(S32 local_mouse_x); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index f2f2aae382..5fb0e57c06 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -931,7 +931,8 @@ LLMenuItemCheckGL::LLMenuItemCheckGL ( const std::string& name, void* user_data, KEY key, MASK mask ) : LLMenuItemCallGL( name, label, clicked_cb, enabled_cb, user_data, key, mask ), - mCheckCallback( NULL ) + mCheckCallback( NULL ), + mChecked(FALSE) { setControlName(control_name, context); } diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 32d3d1f752..141b08c39d 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -257,6 +257,8 @@ std::string LLResMgr::getMonetaryString( S32 input ) const // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. // Fake up a conv structure with some reasonable values for the fields this function uses. struct lconv fakeconv; + char fake_neg[2] = "-"; + char fake_mon_group[4] = "\x03\x03\x00"; // commas every 3 digits if(conv->negative_sign[0] == 0) // Real locales all seem to have something here... { fakeconv = *conv; // start with what's there. @@ -265,8 +267,8 @@ std::string LLResMgr::getMonetaryString( S32 input ) const default: // Unknown -- use the US defaults. case LLLOCALE_USA: case LLLOCALE_UK: // UK ends up being the same as US for the items used here. - fakeconv.negative_sign = "-"; - fakeconv.mon_grouping = "\x03\x03\x00"; // commas every 3 digits + fakeconv.negative_sign = fake_neg; + fakeconv.mon_grouping = fake_mon_group; fakeconv.n_sign_posn = 1; // negative sign before the string break; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7b6c125eb1..5dd4e2d0ee 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -835,6 +835,12 @@ void LLScrollListCtrl::updateLayout() mItemListRect.mRight = getRect().getWidth() - mBorderThickness - SCROLLBAR_SIZE; } + // don't allow scrolling off bottom + if (mScrollLines + mPageLines > getItemCount()) + { + setScrollPos(llmax(0, getItemCount() - mPageLines)); + } + mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0)); mScrollbar->setPageSize( mPageLines ); mScrollbar->setDocSize( getItemCount() ); @@ -2663,6 +2669,11 @@ void LLScrollListCtrl::scrollToShowSelected() return; } + if (needsSorting() && !isSorted()) + { + sortItems(); + } + S32 index = getFirstSelectedIndex(); if (index < 0) { diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 7928887d4b..5e54c7a307 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -933,7 +933,7 @@ BOOL LLTextEditor::selectionContainsLineBreaks() if (hasSelection()) { S32 left = llmin(mSelectionStart, mSelectionEnd); - S32 right = left + abs(mSelectionStart - mSelectionEnd); + S32 right = left + llabs(mSelectionStart - mSelectionEnd); const LLWString &wtext = mWText; for( S32 i = left; i < right; i++ ) @@ -989,7 +989,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces ) { const LLWString &text = mWText; S32 left = llmin( mSelectionStart, mSelectionEnd ); - S32 right = left + abs( mSelectionStart - mSelectionEnd ); + S32 right = left + llabs( mSelectionStart - mSelectionEnd ); BOOL cursor_on_right = (mSelectionEnd > mSelectionStart); S32 cur = left; @@ -1203,6 +1203,18 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } +BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + setFocus( TRUE ); + if( canPastePrimary() ) + { + setCursorAtLocalPos( x, y, TRUE ); + pastePrimary(); + } + return TRUE; +} + + BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -1323,8 +1335,6 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) setCursorAtLocalPos( x, y, TRUE ); endSelection(); - - updateScrollFromCursor(); } if( !hasSelection() ) @@ -1332,6 +1342,9 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) handleMouseUpOverSegment( x, y, mask ); } + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } @@ -1394,8 +1407,12 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing resetKeystrokeTimer(); + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } + return handled; } @@ -1691,6 +1708,12 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) } } + if( handled ) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } @@ -1818,7 +1841,7 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op ) if( getEnabled() && hasSelection() ) { S32 pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); remove( pos, length, group_with_next_op ); @@ -1841,7 +1864,7 @@ void LLTextEditor::cut() return; } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID ); deleteSelection( FALSE ); @@ -1861,7 +1884,7 @@ void LLTextEditor::copy() return; } S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); - S32 length = abs( mSelectionStart - mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); gClipboard.copyFromSubstring(mWText, left_pos, length, mSourceID); } @@ -1870,22 +1893,56 @@ BOOL LLTextEditor::canPaste() const return !mReadOnly && gClipboard.canPasteString(); } - // paste from clipboard void LLTextEditor::paste() { - if (!canPaste()) + bool is_primary = false; + pasteHelper(is_primary); +} + +// paste from primary +void LLTextEditor::pastePrimary() +{ + bool is_primary = true; + pasteHelper(is_primary); +} + +// paste from primary (itsprimary==true) or clipboard (itsprimary==false) +void LLTextEditor::pasteHelper(bool is_primary) +{ + bool can_paste_it; + if (is_primary) + { + can_paste_it = canPastePrimary(); + } + else + { + can_paste_it = canPaste(); + } + + if (!can_paste_it) { return; } + LLUUID source_id; - LLWString paste = gClipboard.getPasteWString(&source_id); + LLWString paste; + if (is_primary) + { + paste = gClipboard.getPastePrimaryWString(&source_id); + } + else + { + paste = gClipboard.getPasteWString(&source_id); + } + if (paste.empty()) { return; } + // Delete any selected characters (the paste replaces them) - if( hasSelection() ) + if( (!is_primary) && hasSelection() ) { deleteSelection(TRUE); } @@ -1919,6 +1976,32 @@ void LLTextEditor::paste() } + +// copy selection to primary +void LLTextEditor::copyPrimary() +{ + if( !canCopy() ) + { + return; + } + S32 left_pos = llmin( mSelectionStart, mSelectionEnd ); + S32 length = llabs( mSelectionStart - mSelectionEnd ); + gClipboard.copyFromPrimarySubstring(mWText, left_pos, length, mSourceID); +} + +BOOL LLTextEditor::canPastePrimary() const +{ + return !mReadOnly && gClipboard.canPastePrimaryString(); +} + +void LLTextEditor::updatePrimary() +{ + if (canCopy()) + { + copyPrimary(); + } +} + BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) { BOOL handled = FALSE; @@ -1994,6 +2077,11 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) } } + if (handled) + { + updatePrimary(); + } + return handled; } @@ -4330,13 +4418,34 @@ S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse) } else { + // adjust the search slightly, to allow matching parenthesis inside the URL + S32 paren_count = 0; for (int index=pos; index<(S32)line.length(); index++) { char c = line[index]; - S32 m2 = closers.find(c); - if (m2 >= 0) + + if (c == '(') { - return index; + paren_count++; + } + else if (c == ')') + { + if (paren_count <= 0) + { + return index; + } + else + { + paren_count--; + } + } + else + { + S32 m2 = closers.find(c); + if (m2 >= 0) + { + return index; + } } } return line.length(); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 56825e7bfe..9291e1c436 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -84,6 +84,8 @@ public: virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); + virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + virtual BOOL handleKeyHere(KEY key, MASK mask ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); @@ -112,12 +114,19 @@ public: virtual BOOL canUndo() const; virtual void redo(); virtual BOOL canRedo() const; + virtual void cut(); virtual BOOL canCut() const; virtual void copy(); virtual BOOL canCopy() const; virtual void paste(); virtual BOOL canPaste() const; + + virtual void updatePrimary(); + virtual void copyPrimary(); + virtual void pastePrimary(); + virtual BOOL canPastePrimary() const; + virtual void doDelete(); virtual BOOL canDoDelete() const; virtual void selectAll(); @@ -430,6 +439,8 @@ private: // // Methods // + void pasteHelper(bool is_primary); + void updateSegments(); void pruneSegments(); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index a3db076b17..699c76a09d 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -987,6 +987,30 @@ BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) } return handled; } + +BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = childrenHandleMiddleMouseDown( x, y, mask ); + BOOL handled = (handled_view != NULL); + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + handled_view = this; + } + + return handled; +} + +BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + BOOL handled = childrenHandleMiddleMouseUp( x, y, mask ) != NULL; + if( !handled && blockMouseEvent(x, y) ) + { + handled = TRUE; + } + return handled; +} + LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { @@ -1148,6 +1172,34 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) return handled_view; } +LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = NULL; + + if (getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) && + viewp->getVisible() && + viewp->getEnabled() && + viewp->handleMiddleMouseDown( local_x, local_y, mask )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + handled_view = viewp; + break; + } + } + } + return handled_view; +} + LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) { LLView* handled_view = NULL; @@ -1233,6 +1285,32 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) return handled_view; } +LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + LLView* handled_view = NULL; + if( getVisible() && getEnabled() ) + { + for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + { + LLView* viewp = *child_it; + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if (viewp->pointInView(local_x, local_y) && + viewp->getVisible() && + viewp->getEnabled() && + viewp->handleMiddleMouseUp( local_x, local_y, mask )) + { + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("->") + viewp->mName + sMouseHandlerMessage; + } + handled_view = viewp; + break; + } + } + } + return handled_view; +} void LLView::draw() { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index b5a34bd4bd..e0e0f6ba47 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -465,6 +465,8 @@ public: /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); @@ -603,6 +605,8 @@ protected: LLView* childrenHandleHover(S32 x, S32 y, MASK mask); LLView* childrenHandleMouseUp(S32 x, S32 y, MASK mask); LLView* childrenHandleMouseDown(S32 x, S32 y, MASK mask); + LLView* childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask); + LLView* childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask); LLView* childrenHandleDoubleClick(S32 x, S32 y, MASK mask); LLView* childrenHandleScrollWheel(S32 x, S32 y, S32 clicks); LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask); |