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.cpp274
1 files changed, 137 insertions, 137 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 6dc68b4de2..60b6115b34 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;
+ std::string_view 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;
}
}
@@ -1055,7 +1055,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.
@@ -1064,7 +1064,7 @@ void LLLineEditor::setSelection(S32 start, S32 end)
setCursor(start);
}
-void LLLineEditor::setDrawAsterixes(BOOL b)
+void LLLineEditor::setDrawAsterixes(bool b)
{
mDrawAsterixes = b;
updateAllowingLanguageInput();
@@ -1099,13 +1099,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 )
{
@@ -1158,7 +1158,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1189,7 +1189,7 @@ void LLLineEditor::deleteSelection()
}
}
-BOOL LLLineEditor::canCut() const
+bool LLLineEditor::canCut() const
{
return !mReadOnly && !mDrawAsterixes && hasSelection();
}
@@ -1213,7 +1213,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 );
@@ -1227,7 +1227,7 @@ void LLLineEditor::cut()
}
}
-BOOL LLLineEditor::canCopy() const
+bool LLLineEditor::canCopy() const
{
return !mDrawAsterixes && hasSelection();
}
@@ -1244,7 +1244,7 @@ void LLLineEditor::copy()
}
}
-BOOL LLLineEditor::canPaste() const
+bool LLLineEditor::canPaste() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
@@ -1332,7 +1332,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())
{
@@ -1347,7 +1347,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 );
@@ -1373,7 +1373,7 @@ void LLLineEditor::copyPrimary()
}
}
-BOOL LLLineEditor::canPastePrimary() const
+bool LLLineEditor::canPastePrimary() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
}
@@ -1386,9 +1386,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 )
{
@@ -1398,7 +1398,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
gKeyboard->toggleInsertMode();
}
- handled = TRUE;
+ handled = true;
break;
case KEY_BACKSPACE:
@@ -1419,7 +1419,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
LLUI::getInstance()->reportBadKeystroke();
}
}
- handled = TRUE;
+ handled = true;
break;
case KEY_PAGE_UP:
@@ -1427,7 +1427,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
if (!mIgnoreArrowKeys)
{
setCursor(0);
- handled = TRUE;
+ handled = true;
}
break;
@@ -1440,7 +1440,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
setCursor(len);
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1467,7 +1467,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1494,32 +1494,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();
@@ -1528,7 +1528,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
{
LLUI::getInstance()->reportBadKeystroke();
}
- handled = TRUE;
+ handled = true;
}
break;
@@ -1557,10 +1557,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 )
{
@@ -1634,18 +1634,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 );
@@ -1686,7 +1686,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
}
-BOOL LLLineEditor::canDoDelete() const
+bool LLLineEditor::canDoDelete() const
{
return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );
}
@@ -1738,7 +1738,7 @@ void LLLineEditor::drawBackground()
F32 alpha = getCurrentTransparency();
if (mUseBgColor)
{
- gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE);
+ gl_rect_2d(getLocalRect(), mBgColor % alpha, true);
}
else
{
@@ -1960,7 +1960,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) )
@@ -2061,7 +2061,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())
{
@@ -2109,7 +2109,7 @@ void LLLineEditor::draw()
if (0 == mText.length() && (mReadOnly || mShowLabelFocused))
{
mGLFont->render(mLabel.getWString(), 0,
- mTextLeftEdge, (F32)text_bottom,
+ (F32)mTextLeftEdge, (F32)text_bottom,
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
@@ -2117,16 +2117,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
{
@@ -2134,7 +2134,7 @@ void LLLineEditor::draw()
if (0 == mText.length())
{
mGLFont->render(mLabel.getWString(), 0,
- mTextLeftEdge, (F32)text_bottom,
+ (F32)mTextLeftEdge, (F32)text_bottom,
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
@@ -2199,19 +2199,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);
}
@@ -2222,7 +2222,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 )
@@ -2290,20 +2290,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] )
@@ -2321,22 +2321,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;
}
}
@@ -2348,7 +2348,7 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str)
return success;
}
-BOOL LLLineEditor::evaluateFloat()
+bool LLLineEditor::evaluateFloat()
{
bool success;
F32 result = 0.f;
@@ -2360,7 +2360,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
@@ -2380,7 +2380,7 @@ void LLLineEditor::onMouseCaptureLost()
}
-void LLLineEditor::setSelectAllonFocusReceived(BOOL b)
+void LLLineEditor::setSelectAllonFocusReceived(bool b)
{
mSelectAllonFocusReceived = b;
}
@@ -2401,16 +2401,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;
}
@@ -2430,15 +2430,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);
}
@@ -2501,7 +2501,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
{
@@ -2521,7 +2521,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)
{
@@ -2543,13 +2543,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)
@@ -2576,7 +2576,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
@@ -2622,7 +2622,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
{
@@ -2644,7 +2644,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;
}
@@ -2700,7 +2700,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);
}