summaryrefslogtreecommitdiff
path: root/indra/llui/lllineeditor.cpp
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@lindenlab.com>2009-06-22 15:02:19 -0700
committerBryan O'Sullivan <bos@lindenlab.com>2009-06-22 15:02:19 -0700
commitbaa73fddd9287ddafd2d31551cb253b355ed910a (patch)
treee3f0986617fe6c0ee0a14df6aac13c6bb6f92507 /indra/llui/lllineeditor.cpp
parentdc3833f31b8a20220ddb1775e1625c016c397435 (diff)
parentfcaa1ad46fd1df4cfec9dee12caf6e7b5bf32136 (diff)
Merge with viewer-2.0.0-3 branch
Diffstat (limited to 'indra/llui/lllineeditor.cpp')
-rw-r--r--indra/llui/lllineeditor.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index c03ef7968f..5ea45e13cf 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -70,8 +70,9 @@ const F32 CURSOR_FLASH_DELAY = 1.0f; // in seconds
const S32 SCROLL_INCREMENT_ADD = 0; // make space for typing
const S32 SCROLL_INCREMENT_DEL = 4; // make space for baskspacing
const F32 AUTO_SCROLL_TIME = 0.05f;
+const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click. *TODO: make this equal to the double click interval?
-static LLRegisterWidget<LLLineEditor> r1("line_editor");
+static LLDefaultWidgetRegistry::Register<LLLineEditor> r1("line_editor");
template LLLineEditor* LLView::getChild<LLLineEditor>( const std::string& name, BOOL recurse, BOOL create_if_missing ) const;
@@ -161,6 +162,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
llassert( mMaxLengthBytes > 0 );
mScrollTimer.reset();
+ mTripleClickTimer.reset();
setText(p.default_text());
// line history support:
@@ -450,6 +452,7 @@ void LLLineEditor::selectAll()
BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
{
setFocus( TRUE );
+ mTripleClickTimer.setTimerExpirySec(TRIPLE_CLICK_INTERVAL);
if (mSelectionEnd == 0 && mSelectionStart == mText.length())
{
@@ -566,14 +569,25 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
}
else
{
- // Save selection for word/line selecting on double-click
- mLastSelectionStart = mSelectionStart;
- mLastSelectionEnd = mSelectionEnd;
+ if (mTripleClickTimer.hasExpired())
+ {
+ // Save selection for word/line selecting on double-click
+ mLastSelectionStart = mSelectionStart;
+ mLastSelectionEnd = mSelectionEnd;
- // Move cursor and deselect for regular click
- setCursorAtLocalPos( x );
- deselect();
- startSelection();
+ // Move cursor and deselect for regular click
+ setCursorAtLocalPos( x );
+ deselect();
+ startSelection();
+ }
+ else // handle triple click
+ {
+ selectAll();
+ // We don't want handleMouseUp() to "finish" the selection (and thereby
+ // set mSelectionEnd to where the mouse is), so we finish the selection
+ // here.
+ mIsSelecting = FALSE;
+ }
}
gFocusMgr.setMouseCapture( this );