summaryrefslogtreecommitdiff
path: root/indra/llui/lllineeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lllineeditor.cpp')
-rw-r--r--indra/llui/lllineeditor.cpp178
1 files changed, 89 insertions, 89 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 9b320fdf97..6664117bcd 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -74,7 +74,7 @@ static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor");
// Compiler optimization, generate extern template
template class LLLineEditor* LLView::getChild<class LLLineEditor>(
- const std::string& name, BOOL recurse) const;
+ const std::string& name, bool recurse) const;
//
// Member functions
@@ -127,10 +127,10 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mTextLeftEdge(0), // computed in updateTextPadding() below
mTextRightEdge(0), // computed in updateTextPadding() below
mCommitOnFocusLost( p.commit_on_focus_lost ),
- mKeystrokeOnEsc(FALSE),
+ mKeystrokeOnEsc(false),
mRevertOnEsc( p.revert_on_esc ),
mKeystrokeCallback( p.keystroke_callback() ),
- mIsSelecting( FALSE ),
+ mIsSelecting( false ),
mSelectionStart( 0 ),
mSelectionEnd( 0 ),
mLastSelectionX(-1),
@@ -138,23 +138,23 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mLastSelectionStart(-1),
mLastSelectionEnd(-1),
mBorderThickness( 0 ),
- mIgnoreArrowKeys( FALSE ),
+ mIgnoreArrowKeys( false ),
mIgnoreTab( p.ignore_tab ),
mDrawAsterixes( p.is_password ),
mSpellCheck( p.spellcheck ),
mSpellCheckStart(-1),
mSpellCheckEnd(-1),
mSelectAllonFocusReceived( p.select_on_focus ),
- mSelectAllonCommit( TRUE ),
- mPassDelete(FALSE),
- mReadOnly(FALSE),
+ mSelectAllonCommit( true ),
+ mPassDelete(false),
+ mReadOnly(false),
mBgImage( p.background_image ),
mBgImageDisabled( p.background_image_disabled ),
mBgImageFocused( p.background_image_focused ),
mShowImageFocused( p.bg_image_always_focused ),
mUseBgColor(p.use_bg_color),
- mHaveHistory(FALSE),
- mReplaceNewlinesWithSpaces( TRUE ),
+ mHaveHistory(false),
+ mReplaceNewlinesWithSpaces( true ),
mLabel(p.label),
mCursorColor(p.cursor_color()),
mBgColor(p.bg_color()),
@@ -169,7 +169,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
{
llassert( mMaxLengthBytes > 0 );
- LLUICtrl::setEnabled(TRUE);
+ LLUICtrl::setEnabled(true);
setEnabled(p.enabled);
mScrollTimer.reset();
@@ -214,7 +214,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
LLLineEditor::~LLLineEditor()
{
- mCommitOnFocusLost = FALSE;
+ mCommitOnFocusLost = false;
// Make sure no context menu linger around once the widget is deleted
LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
@@ -231,7 +231,7 @@ LLLineEditor::~LLLineEditor()
void LLLineEditor::initFromParams(const LLLineEditor::Params& params)
{
LLUICtrl::initFromParams(params);
- LLUICtrl::setEnabled(TRUE);
+ LLUICtrl::setEnabled(true);
setEnabled(params.enabled);
}
@@ -280,9 +280,9 @@ void LLLineEditor::onCommit()
if (mSelectAllonCommit) selectAll();
}
-// Returns TRUE if user changed value at all
+// Returns true if user changed value at all
// virtual
-BOOL LLLineEditor::isDirty() const
+bool LLLineEditor::isDirty() const
{
return mText.getString() != mPrevText;
}
@@ -343,14 +343,14 @@ void LLLineEditor::updateHistory()
}
}
-void LLLineEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
+void LLLineEditor::reshape(S32 width, S32 height, bool called_from_parent)
{
LLUICtrl::reshape(width, height, called_from_parent);
updateTextPadding(); // For clamping side-effect.
setCursor(mCursorPos); // For clamping side-effect.
}
-void LLLineEditor::setEnabled(BOOL enabled)
+void LLLineEditor::setEnabled(bool enabled)
{
mReadOnly = !enabled;
setTabStop(!mReadOnly);
@@ -405,7 +405,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text, bool use_size_limit
// Check to see if entire field is selected.
S32 len = mText.length();
- BOOL all_selected = (len > 0)
+ bool all_selected = (len > 0)
&& (( mSelectionStart == 0 && mSelectionEnd == len )
|| ( mSelectionStart == len && mSelectionEnd == 0 ));
@@ -517,7 +517,7 @@ void LLLineEditor::resetScrollPosition()
setCursor(getCursor());
}
-BOOL LLLineEditor::canDeselect() const
+bool LLLineEditor::canDeselect() const
{
return hasSelection();
}
@@ -526,13 +526,13 @@ void LLLineEditor::deselect()
{
mSelectionStart = 0;
mSelectionEnd = 0;
- mIsSelecting = FALSE;
+ mIsSelecting = false;
}
void LLLineEditor::startSelection()
{
- mIsSelecting = TRUE;
+ mIsSelecting = true;
mSelectionStart = getCursor();
mSelectionEnd = getCursor();
}
@@ -541,14 +541,14 @@ void LLLineEditor::endSelection()
{
if( mIsSelecting )
{
- mIsSelecting = FALSE;
+ mIsSelecting = false;
mSelectionEnd = getCursor();
}
}
-BOOL LLLineEditor::canSelectAll() const
+bool LLLineEditor::canSelectAll() const
{
- return TRUE;
+ return true;
}
void LLLineEditor::selectAll()
@@ -562,7 +562,7 @@ void LLLineEditor::selectAll()
mSelectionEnd = 0;
setCursor(mSelectionEnd);
//mScrollHPos = 0;
- mIsSelecting = TRUE;
+ mIsSelecting = true;
updatePrimary();
}
@@ -976,19 +976,19 @@ void LLLineEditor::addChar(const llwchar uni_char)
S32 new_bytes = wchar_utf8_length(new_c);
- BOOL allow_char = TRUE;
+ bool allow_char = true;
// Check byte length limit
if ((new_bytes + cur_bytes) > mMaxLengthBytes)
{
- allow_char = FALSE;
+ allow_char = false;
}
else if (mMaxLengthChars)
{
S32 wide_chars = mText.getWString().size();
if ((wide_chars + 1) > mMaxLengthChars)
{
- allow_char = FALSE;
+ allow_char = false;
}
}
@@ -1033,7 +1033,7 @@ void LLLineEditor::setSelection(S32 start, S32 end)
{
S32 len = mText.length();
- mIsSelecting = TRUE;
+ mIsSelecting = true;
// JC, yes, this seems odd, but I think you have to presume a
// selection dragged from the end towards the start.
@@ -1042,7 +1042,7 @@ void LLLineEditor::setSelection(S32 start, S32 end)
setCursor(start);
}
-void LLLineEditor::setDrawAsterixes(BOOL b)
+void LLLineEditor::setDrawAsterixes(bool b)
{
mDrawAsterixes = b;
updateAllowingLanguageInput();
@@ -1077,13 +1077,13 @@ S32 LLLineEditor::nextWordPos(S32 cursorPos) const
}
-BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
+bool LLLineEditor::handleSelectionKey(KEY key, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
if( mask & MASK_SHIFT )
{
- handled = TRUE;
+ handled = true;
switch( key )
{
@@ -1136,7 +1136,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1167,7 +1167,7 @@ void LLLineEditor::deleteSelection()
}
}
-BOOL LLLineEditor::canCut() const
+bool LLLineEditor::canCut() const
{
return !mReadOnly && !mDrawAsterixes && hasSelection();
}
@@ -1191,7 +1191,7 @@ void LLLineEditor::cut()
deleteSelection();
// Validate new string and rollback the if needed.
- BOOL need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
+ bool need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
if( need_to_rollback )
{
rollback.doRollback( this );
@@ -1204,7 +1204,7 @@ void LLLineEditor::cut()
}
}
-BOOL LLLineEditor::canCopy() const
+bool LLLineEditor::canCopy() const
{
return !mDrawAsterixes && hasSelection();
}
@@ -1221,7 +1221,7 @@ void LLLineEditor::copy()
}
}
-BOOL LLLineEditor::canPaste() const
+bool LLLineEditor::canPaste() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
@@ -1319,7 +1319,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
deselect();
// Validate new string and rollback the if needed.
- BOOL need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
+ bool need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
if( need_to_rollback )
{
rollback.doRollback( this );
@@ -1344,7 +1344,7 @@ void LLLineEditor::copyPrimary()
}
}
-BOOL LLLineEditor::canPastePrimary() const
+bool LLLineEditor::canPastePrimary() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
}
@@ -1357,9 +1357,9 @@ void LLLineEditor::updatePrimary()
}
}
-BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
+bool LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
switch( key )
{
@@ -1369,7 +1369,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
gKeyboard->toggleInsertMode();
}
- handled = TRUE;
+ handled = true;
break;
case KEY_BACKSPACE:
@@ -1390,7 +1390,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
LLUI::getInstance()->reportBadKeystroke();
}
}
- handled = TRUE;
+ handled = true;
break;
case KEY_PAGE_UP:
@@ -1398,7 +1398,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if (!mIgnoreArrowKeys)
{
setCursor(0);
- handled = TRUE;
+ handled = true;
}
break;
@@ -1411,7 +1411,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
setCursor(len);
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1438,7 +1438,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1465,7 +1465,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1482,7 +1482,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1499,7 +1499,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1528,10 +1528,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
-BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
+bool LLLineEditor::handleKeyHere(KEY key, MASK mask )
{
- BOOL handled = FALSE;
- BOOL selection_modified = FALSE;
+ bool handled = false;
+ bool selection_modified = false;
if ( gFocusMgr.getKeyboardFocus() == this )
{
@@ -1566,7 +1566,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
deselect();
}
- BOOL need_to_rollback = FALSE;
+ bool need_to_rollback = false;
// If read-only, don't allow changes
need_to_rollback |= (mReadOnly && (mText.getString() == rollback.getText()));
@@ -1625,7 +1625,7 @@ bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
deselect();
- BOOL need_to_rollback = FALSE;
+ bool need_to_rollback = false;
// Validate new string and rollback the keystroke if needed.
need_to_rollback |= ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
@@ -1651,7 +1651,7 @@ bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
}
-BOOL LLLineEditor::canDoDelete() const
+bool LLLineEditor::canDoDelete() const
{
return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
}
@@ -1681,7 +1681,7 @@ void LLLineEditor::doDelete()
}
// Validate new string and rollback the if needed.
- BOOL need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
+ bool need_to_rollback = ( mPrevalidateFunc && !mPrevalidateFunc( mText.getWString() ) );
if( need_to_rollback )
{
rollback.doRollback( this );
@@ -1702,7 +1702,7 @@ void LLLineEditor::drawBackground()
F32 alpha = getCurrentTransparency();
if (mUseBgColor)
{
- gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE);
+ gl_rect_2d(getLocalRect(), mBgColor % alpha, true);
}
else
{
@@ -1923,7 +1923,7 @@ void LLLineEditor::draw()
&rendered_pixels_right);
}
#if 1 // for when we're ready for image art.
- mBorder->setVisible(FALSE); // no more programmatic art.
+ mBorder->setVisible(false); // no more programmatic art.
#endif
if ( (getSpellCheck()) && (mText.length() > 2) )
@@ -2024,7 +2024,7 @@ void LLLineEditor::draw()
// If we're editing...
if( hasFocus())
{
- //mBorder->setVisible(TRUE); // ok, programmer art just this once.
+ //mBorder->setVisible(true); // ok, programmer art just this once.
// (Flash the cursor every half second)
if (!mReadOnly && gFocusMgr.getAppHasFocus())
{
@@ -2080,16 +2080,16 @@ void LLLineEditor::draw()
LLFontGL::NO_SHADOW,
S32_MAX,
mTextRightEdge - ll_round(rendered_pixels_right),
- &rendered_pixels_right, FALSE);
+ &rendered_pixels_right, false);
}
// Draw children (border)
- //mBorder->setVisible(TRUE);
- mBorder->setKeyboardFocusHighlight( TRUE );
+ //mBorder->setVisible(true);
+ mBorder->setKeyboardFocusHighlight( true );
LLView::draw();
- mBorder->setKeyboardFocusHighlight( FALSE );
- //mBorder->setVisible(FALSE);
+ mBorder->setKeyboardFocusHighlight( false );
+ //mBorder->setVisible(false);
}
else // does not have keyboard input
{
@@ -2105,7 +2105,7 @@ void LLLineEditor::draw()
LLFontGL::NO_SHADOW,
S32_MAX,
mTextRightEdge - ll_round(rendered_pixels_right),
- &rendered_pixels_right, FALSE);
+ &rendered_pixels_right, false);
}
// Draw children (border)
LLView::draw();
@@ -2162,19 +2162,19 @@ void LLLineEditor::onTabInto()
}
//virtual
-BOOL LLLineEditor::acceptsTextInput() const
+bool LLLineEditor::acceptsTextInput() const
{
- return TRUE;
+ return true;
}
// Start or stop the editor from accepting text-editing keystrokes
-void LLLineEditor::setFocus( BOOL new_state )
+void LLLineEditor::setFocus( bool new_state )
{
- BOOL old_state = hasFocus();
+ bool old_state = hasFocus();
if (!new_state)
{
- getWindow()->allowLanguageTextInput(this, FALSE);
+ getWindow()->allowLanguageTextInput(this, false);
}
@@ -2185,7 +2185,7 @@ void LLLineEditor::setFocus( BOOL new_state )
// 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;
+ mIsSelecting = false;
}
if( new_state )
@@ -2258,13 +2258,13 @@ bool LLLineEditor::prevalidateInput(const LLWString& wstr)
}
// static
-BOOL LLLineEditor::postvalidateFloat(const std::string &str)
+bool LLLineEditor::postvalidateFloat(const std::string &str)
{
LLLocale locale(LLLocale::USER_LOCALE);
- BOOL success = TRUE;
- BOOL has_decimal = FALSE;
- BOOL has_digit = FALSE;
+ bool success = true;
+ bool has_decimal = false;
+ bool has_digit = false;
LLWString trimmed = utf8str_to_wstring(str);
LLWStringUtil::trim(trimmed);
@@ -2289,22 +2289,22 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str)
if( has_decimal )
{
// can't have two
- success = FALSE;
+ success = false;
break;
}
else
{
- has_decimal = TRUE;
+ has_decimal = true;
}
}
else
if( LLStringOps::isDigit( trimmed[i] ) )
{
- has_digit = TRUE;
+ has_digit = true;
}
else
{
- success = FALSE;
+ success = false;
break;
}
}
@@ -2316,7 +2316,7 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str)
return success;
}
-BOOL LLLineEditor::evaluateFloat()
+bool LLLineEditor::evaluateFloat()
{
bool success;
F32 result = 0.f;
@@ -2348,7 +2348,7 @@ void LLLineEditor::onMouseCaptureLost()
}
-void LLLineEditor::setSelectAllonFocusReceived(BOOL b)
+void LLLineEditor::setSelectAllonFocusReceived(bool b)
{
mSelectAllonFocusReceived = b;
}
@@ -2369,16 +2369,16 @@ void LLLineEditor::setKeystrokeCallback(callback_t callback, void* user_data)
}
-BOOL LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text )
+bool LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text )
{
mText.setArg(key, text);
- return TRUE;
+ return true;
}
-BOOL LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text )
+bool LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text )
{
mLabel.setArg(key, text);
- return TRUE;
+ return true;
}
@@ -2398,15 +2398,15 @@ void LLLineEditor::updateAllowingLanguageInput()
}
if (hasFocus() && !mReadOnly && !mDrawAsterixes && mPrevalidateFunc == NULL)
{
- window->allowLanguageTextInput(this, TRUE);
+ window->allowLanguageTextInput(this, true);
}
else
{
- window->allowLanguageTextInput(this, FALSE);
+ window->allowLanguageTextInput(this, false);
}
}
-BOOL LLLineEditor::hasPreeditString() const
+bool LLLineEditor::hasPreeditString() const
{
return (mPreeditPositions.size() > 1);
}
@@ -2612,7 +2612,7 @@ S32 LLLineEditor::getPreeditFontSize() const
return ll_round(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
-void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace)
+void LLLineEditor::setReplaceNewlinesWithSpaces(bool replace)
{
mReplaceNewlinesWithSpaces = replace;
}