summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-04-17 11:24:08 -0700
committerGraham Linden <graham@lindenlab.com>2019-04-17 11:24:08 -0700
commit5f8cca95f8890d22496932827626f6c437d2b188 (patch)
tree716675dbd41416fd383568dfb47c5d3246f03423 /indra/llui
parenta7e7d4a8185cd63c2f6f87fea992667912999426 (diff)
parent81dbd3663bdaff741e68de0ec4d4d35bedf6649d (diff)
Merge 6.2.1
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lllineeditor.cpp60
-rw-r--r--indra/llui/lllineeditor.h3
-rw-r--r--indra/llui/llspinctrl.cpp6
3 files changed, 39 insertions, 30 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index ee8c445afb..f1914ee9c5 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -503,6 +503,13 @@ void LLLineEditor::setCursorToEnd()
deselect();
}
+void LLLineEditor::resetScrollPosition()
+{
+ mScrollHPos = 0;
+ // make sure cursor says in visible range
+ setCursor(getCursor());
+}
+
BOOL LLLineEditor::canDeselect() const
{
return hasSelection();
@@ -1685,42 +1692,37 @@ void LLLineEditor::doDelete()
void LLLineEditor::drawBackground()
{
- F32 alpha = getCurrentTransparency();
- if (mUseBgColor)
+ bool has_focus = hasFocus();
+ LLUIImage* image;
+ if ( mReadOnly )
+ {
+ image = mBgImageDisabled;
+ }
+ else if ( has_focus || mShowImageFocused)
{
- gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE);
+ image = mBgImageFocused;
}
else
{
- bool has_focus = hasFocus();
- LLUIImage* image;
- if (mReadOnly)
- {
- image = mBgImageDisabled;
- }
- else if (has_focus || mShowImageFocused)
- {
- image = mBgImageFocused;
- }
- else
- {
- image = mBgImage;
- }
+ image = mBgImage;
+ }
- if (!image) return;
- // optionally draw programmatic border
- if (has_focus)
- {
- LLColor4 tmp_color = gFocusMgr.getFocusColor();
- tmp_color.setAlpha(alpha);
- image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(),
- tmp_color,
- gFocusMgr.getFocusFlashWidth());
- }
- LLColor4 tmp_color = UI_VERTEX_COLOR;
+ if (!image) return;
+
+ F32 alpha = getCurrentTransparency();
+
+ // optionally draw programmatic border
+ if (has_focus)
+ {
+ LLColor4 tmp_color = gFocusMgr.getFocusColor();
tmp_color.setAlpha(alpha);
- image->draw(getLocalRect(), tmp_color);
+ image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(),
+ tmp_color,
+ gFocusMgr.getFocusFlashWidth());
}
+ LLColor4 tmp_color = UI_VERTEX_COLOR;
+ tmp_color.setAlpha(alpha);
+ image->draw(getLocalRect(), tmp_color);
}
void LLLineEditor::draw()
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index a711ccefab..aa5779d45f 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -210,6 +210,9 @@ public:
void setCursor( S32 pos );
void setCursorToEnd();
+ // set scroll to earliest position it can reasonable set
+ void resetScrollPosition();
+
// Selects characters 'start' to 'end'.
void setSelection(S32 start, S32 end);
virtual void getSelectionRange(S32 *position, S32 *length) const;
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index f6831c6d5e..ce3fc29d32 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -290,6 +290,7 @@ void LLSpinCtrl::forceSetValue(const LLSD& value )
LLF32UICtrl::setValue(value);
updateEditor();
+ mEditor->resetScrollPosition();
}
}
@@ -355,7 +356,9 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data )
if( success )
{
- updateEditor();
+ // We commited and clamped value
+ // try to display as much as possible
+ mEditor->resetScrollPosition();
}
else
{
@@ -475,6 +478,7 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask)
// text editors don't support revert normally (due to user confusion)
// but not allowing revert on a spinner seems dangerous
updateEditor();
+ mEditor->resetScrollPosition();
mEditor->setFocus(FALSE);
return TRUE;
}