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.cpp272
1 files changed, 136 insertions, 136 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 05de46b852..fa71c7704d 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
@@ -131,10 +131,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),
@@ -142,7 +142,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mLastSelectionStart(-1),
mLastSelectionEnd(-1),
mBorderThickness( 0 ),
- mIgnoreArrowKeys( FALSE ),
+ mIgnoreArrowKeys( false ),
mIgnoreTab( p.ignore_tab ),
mDrawAsterixes( p.is_password ),
mAllowEmoji( p.allow_emoji ),
@@ -150,17 +150,17 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
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 ),
mShowLabelFocused( p.show_label_focused ),
mUseBgColor(p.use_bg_color),
- mHaveHistory(FALSE),
- mReplaceNewlinesWithSpaces( TRUE ),
+ mHaveHistory(false),
+ mReplaceNewlinesWithSpaces( true ),
mPrevalidator(p.prevalidator()),
mInputPrevalidator(p.input_prevalidator()),
mLabel(p.label),
@@ -177,7 +177,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
{
llassert( mMaxLengthBytes > 0 );
- LLUICtrl::setEnabled(TRUE);
+ LLUICtrl::setEnabled(true);
setEnabled(p.enabled);
mScrollTimer.reset();
@@ -221,7 +221,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());
@@ -238,7 +238,7 @@ LLLineEditor::~LLLineEditor()
void LLLineEditor::initFromParams(const LLLineEditor::Params& params)
{
LLUICtrl::initFromParams(params);
- LLUICtrl::setEnabled(TRUE);
+ LLUICtrl::setEnabled(true);
setEnabled(params.enabled);
}
@@ -287,9 +287,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;
}
@@ -350,14 +350,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);
@@ -412,7 +412,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 ));
@@ -529,7 +529,7 @@ void LLLineEditor::resetScrollPosition()
setCursor(getCursor());
}
-BOOL LLLineEditor::canDeselect() const
+bool LLLineEditor::canDeselect() const
{
return hasSelection();
}
@@ -538,13 +538,13 @@ void LLLineEditor::deselect()
{
mSelectionStart = 0;
mSelectionEnd = 0;
- mIsSelecting = FALSE;
+ mIsSelecting = false;
}
void LLLineEditor::startSelection()
{
- mIsSelecting = TRUE;
+ mIsSelecting = true;
mSelectionStart = getCursor();
mSelectionEnd = getCursor();
}
@@ -553,14 +553,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()
@@ -574,7 +574,7 @@ void LLLineEditor::selectAll()
mSelectionEnd = 0;
setCursor(mSelectionEnd);
//mScrollHPos = 0;
- mIsSelecting = TRUE;
+ mIsSelecting = true;
updatePrimary();
}
@@ -590,7 +590,7 @@ const std::string& LLLineEditor::getSuggestion(U32 index) const
U32 LLLineEditor::getSuggestionCount() const
{
- return mSuggestionList.size();
+ return static_cast<U32>(mSuggestionList.size());
}
void LLLineEditor::replaceWithSuggestion(U32 index)
@@ -680,9 +680,9 @@ void LLLineEditor::onSpellCheckSettingsChange()
mSpellCheckStart = mSpellCheckEnd = -1;
}
-BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
+bool LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- setFocus( TRUE );
+ setFocus( true );
mTripleClickTimer.setTimerExpirySec(TRIPLE_CLICK_INTERVAL);
if (mSelectionEnd == 0 && mSelectionStart == mText.length())
@@ -694,7 +694,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
{
const LLWString& wtext = mText.getWString();
- BOOL doSelectAll = TRUE;
+ bool doSelectAll = true;
// Select the word we're on
if( LLWStringUtil::isPartOfWord( wtext[mCursorPos] ) )
@@ -729,7 +729,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
// 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;
// delay cursor flashing
mKeystrokeTimer.reset();
@@ -737,15 +737,15 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
// take selection to 'primary' clipboard
updatePrimary();
- return TRUE;
+ return true;
}
-BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
// Check first whether the "clear search" button wants to deal with this.
if(childrenHandleMouseDown(x, y, mask) != NULL)
{
- return TRUE;
+ return true;
}
if (!mSelectAllonFocusReceived
@@ -757,7 +757,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
if (mask & MASK_SHIFT)
{
// assume we're starting a drag select
- mIsSelecting = TRUE;
+ mIsSelecting = true;
// Handle selection extension
S32 old_cursor_pos = getCursor();
@@ -813,14 +813,14 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
// 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;
}
}
gFocusMgr.setMouseCapture( this );
}
- setFocus(TRUE);
+ setFocus(true);
// delay cursor flashing
mKeystrokeTimer.reset();
@@ -828,40 +828,40 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
if (mMouseDownSignal)
(*mMouseDownSignal)(this,x,y,mask);
- return TRUE;
+ return true;
}
-BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
+bool LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
{
// LL_INFOS() << "MiddleMouseDown" << LL_ENDL;
- setFocus( TRUE );
+ setFocus( true );
if( canPastePrimary() )
{
setCursorAtLocalPos(x);
pastePrimary();
}
- return TRUE;
+ return true;
}
-BOOL LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
+bool LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- setFocus(TRUE);
+ setFocus(true);
if (!LLUICtrl::handleRightMouseDown(x, y, mask) && getShowContextMenu())
{
showContextMenu(x, y);
}
- return TRUE;
+ return true;
}
-BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
+bool LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
// Check first whether the "clear search" button wants to deal with this.
if(!hasMouseCapture())
{
if(childrenHandleHover(x, y, mask) != NULL)
{
- return TRUE;
+ return true;
}
}
@@ -904,34 +904,34 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask)
getWindow()->setCursor(UI_CURSOR_IBEAM);
LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL;
- handled = TRUE;
+ handled = true;
}
if( !handled )
{
getWindow()->setCursor(UI_CURSOR_IBEAM);
LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL;
- handled = TRUE;
+ handled = true;
}
return handled;
}
-BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
if( hasMouseCapture() )
{
gFocusMgr.setMouseCapture( NULL );
- handled = TRUE;
+ handled = true;
}
// Check first whether the "clear search" button wants to deal with this.
if(!handled && childrenHandleMouseUp(x, y, mask) != NULL)
{
- return TRUE;
+ return true;
}
if( mIsSelecting )
@@ -939,7 +939,7 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
setCursorAtLocalPos( x );
mSelectionEnd = getCursor();
- handled = TRUE;
+ handled = true;
}
if( handled )
@@ -994,23 +994,23 @@ void LLLineEditor::addChar(const llwchar uni_char)
mText.erase(getCursor(), 1);
}
- S32 cur_bytes = mText.getString().size();
+ S32 cur_bytes = static_cast<S32>(mText.getString().size());
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();
+ auto wide_chars = mText.getWString().size();
if ((wide_chars + 1) > mMaxLengthChars)
{
- allow_char = FALSE;
+ allow_char = false;
}
}
@@ -1074,7 +1074,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.
@@ -1083,7 +1083,7 @@ void LLLineEditor::setSelection(S32 start, S32 end)
setCursor(start);
}
-void LLLineEditor::setDrawAsterixes(BOOL b)
+void LLLineEditor::setDrawAsterixes(bool b)
{
mDrawAsterixes = b;
updateAllowingLanguageInput();
@@ -1118,13 +1118,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 )
{
@@ -1177,7 +1177,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1208,7 +1208,7 @@ void LLLineEditor::deleteSelection()
}
}
-BOOL LLLineEditor::canCut() const
+bool LLLineEditor::canCut() const
{
return !mReadOnly && !mDrawAsterixes && hasSelection();
}
@@ -1232,7 +1232,7 @@ void LLLineEditor::cut()
deleteSelection();
// Validate new string and rollback the if needed.
- BOOL need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString());
+ bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString());
if (need_to_rollback)
{
rollback.doRollback( this );
@@ -1246,7 +1246,7 @@ void LLLineEditor::cut()
}
}
-BOOL LLLineEditor::canCopy() const
+bool LLLineEditor::canCopy() const
{
return !mDrawAsterixes && hasSelection();
}
@@ -1263,7 +1263,7 @@ void LLLineEditor::copy()
}
}
-BOOL LLLineEditor::canPaste() const
+bool LLLineEditor::canPaste() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
@@ -1351,7 +1351,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
if (mMaxLengthChars)
{
- U32 available_chars = mMaxLengthChars - mText.getWString().size();
+ auto available_chars = mMaxLengthChars - mText.getWString().size();
if (available_chars < clean_string.size())
{
@@ -1366,7 +1366,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
deselect();
// Validate new string and rollback the if needed.
- BOOL need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString());
+ bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString());
if (need_to_rollback)
{
rollback.doRollback( this );
@@ -1392,7 +1392,7 @@ void LLLineEditor::copyPrimary()
}
}
-BOOL LLLineEditor::canPastePrimary() const
+bool LLLineEditor::canPastePrimary() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
}
@@ -1405,9 +1405,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 )
{
@@ -1417,7 +1417,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
gKeyboard->toggleInsertMode();
}
- handled = TRUE;
+ handled = true;
break;
case KEY_BACKSPACE:
@@ -1438,7 +1438,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
LLUI::getInstance()->reportBadKeystroke();
}
}
- handled = TRUE;
+ handled = true;
break;
case KEY_PAGE_UP:
@@ -1446,7 +1446,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if (!mIgnoreArrowKeys)
{
setCursor(0);
- handled = TRUE;
+ handled = true;
}
break;
@@ -1459,7 +1459,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
setCursor(len);
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1486,7 +1486,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1513,32 +1513,32 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
// handle ctrl-uparrow if we have a history enabled line editor.
case KEY_UP:
- if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) )
+ if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask)))
{
- if( mCurrentHistoryLine > mLineHistory.begin() )
+ if (mCurrentHistoryLine > mLineHistory.begin())
{
- mText.assign( *(--mCurrentHistoryLine) );
+ mText.assign(*(--mCurrentHistoryLine));
setCursorToEnd();
}
else
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
// handle [ctrl]-downarrow if we have a history enabled line editor
case KEY_DOWN:
- if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) )
+ if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask)))
{
- if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 )
+ if (!mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1)
{
mText.assign( *(++mCurrentHistoryLine) );
setCursorToEnd();
@@ -1547,7 +1547,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1576,10 +1576,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 )
{
@@ -1653,18 +1653,18 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
}
-BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
+bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
{
if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL
{
- return FALSE;
+ return false;
}
- BOOL handled = FALSE;
+ bool handled = false;
if ( (gFocusMgr.getKeyboardFocus() == this) && getVisible() && !mReadOnly)
{
- handled = TRUE;
+ handled = true;
LLLineEditorRollback rollback( this );
@@ -1704,7 +1704,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
return handled;
}
-BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing)
+bool LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing)
{
auto handled = FALSE;
@@ -1735,7 +1735,7 @@ BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing)
return handled;
}
-BOOL LLLineEditor::canDoDelete() const
+bool LLLineEditor::canDoDelete() const
{
return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
}
@@ -1787,7 +1787,7 @@ void LLLineEditor::drawBackground()
F32 alpha = getCurrentTransparency();
if (mUseBgColor)
{
- gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE);
+ gl_rect_2d(getLocalRect(), mBgColor % alpha, true);
}
else
{
@@ -2009,7 +2009,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) )
@@ -2110,7 +2110,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())
{
@@ -2166,16 +2166,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
{
@@ -2248,19 +2248,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);
}
@@ -2271,7 +2271,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 )
@@ -2339,20 +2339,20 @@ 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);
- S32 len = trimmed.length();
+ auto len = trimmed.length();
if( 0 < len )
{
- S32 i = 0;
+ size_t i = 0;
// First character can be a negative sign
if( '-' == trimmed[0] )
@@ -2370,22 +2370,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;
}
}
@@ -2397,7 +2397,7 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str)
return success;
}
-BOOL LLLineEditor::evaluateFloat()
+bool LLLineEditor::evaluateFloat()
{
bool success;
F32 result = 0.f;
@@ -2409,7 +2409,7 @@ BOOL LLLineEditor::evaluateFloat()
if (!success)
{
// Move the cursor to near the error on failure
- setCursor(LLCalc::getInstance()->getLastErrorPos());
+ setCursor(static_cast<S32>(LLCalc::getInstance()->getLastErrorPos()));
// *TODO: Translated error message indicating the type of error? Select error text?
}
else
@@ -2429,7 +2429,7 @@ void LLLineEditor::onMouseCaptureLost()
}
-void LLLineEditor::setSelectAllonFocusReceived(BOOL b)
+void LLLineEditor::setSelectAllonFocusReceived(bool b)
{
mSelectAllonFocusReceived = b;
}
@@ -2450,16 +2450,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;
}
@@ -2479,15 +2479,15 @@ void LLLineEditor::updateAllowingLanguageInput()
}
if (hasFocus() && !mReadOnly && !mDrawAsterixes && !mPrevalidator)
{
- 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);
}
@@ -2550,7 +2550,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string,
if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
{
mPreeditOverwrittenWString.assign( LLWString( mText, insert_preedit_at, mPreeditWString.length() ) );
- mText.erase(insert_preedit_at, mPreeditWString.length());
+ mText.erase(insert_preedit_at, static_cast<S32>(mPreeditWString.length()));
}
else
{
@@ -2570,7 +2570,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string,
mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY);
}
-BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const
+bool LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const
{
if (control)
{
@@ -2592,13 +2592,13 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
if (preedit_right_column < mScrollHPos)
{
// This should not occure...
- return FALSE;
+ return false;
}
const S32 query = (query_offset >= 0 ? preedit_left_column + query_offset : getCursor());
if (query < mScrollHPos || query < preedit_left_column || query > preedit_right_column)
{
- return FALSE;
+ return false;
}
if (coord)
@@ -2625,7 +2625,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds);
}
- return TRUE;
+ return true;
}
void LLLineEditor::getPreeditRange(S32 *position, S32 *length) const
@@ -2671,7 +2671,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length)
mPreeditPositions[0] = position;
mPreeditPositions[1] = position + length;
mPreeditStandouts.resize(1);
- mPreeditStandouts[0] = FALSE;
+ mPreeditStandouts[0] = false;
}
else
{
@@ -2693,7 +2693,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;
}
@@ -2749,7 +2749,7 @@ void LLLineEditor::showContextMenu(S32 x, S32 y)
// If the cursor is on a misspelled word, retrieve suggestions for it
std::string misspelled_word = getMisspelledWord(mCursorPos);
- if ((is_misspelled = !misspelled_word.empty()) == true)
+ if ((is_misspelled = !misspelled_word.empty()))
{
LLSpellChecker::instance().getSuggestions(misspelled_word, mSuggestionList);
}