summaryrefslogtreecommitdiff
path: root/indra/llui/lltexteditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lltexteditor.cpp')
-rw-r--r--indra/llui/lltexteditor.cpp334
1 files changed, 167 insertions, 167 deletions
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 7150052b65..81eaec620c 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -71,7 +71,7 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor");
// Compiler optimization, generate extern template
template class LLTextEditor* LLView::getChild<class LLTextEditor>(
- const std::string& name, BOOL recurse) const;
+ const std::string& name, bool recurse) const;
//
// Constants
@@ -84,12 +84,12 @@ const F32 SPELLCHECK_DELAY = 0.5f; // delay between the last keypress and spell
class LLTextEditor::TextCmdInsert : public LLTextBase::TextCmd
{
public:
- TextCmdInsert(S32 pos, BOOL group_with_next, const LLWString &ws, LLTextSegmentPtr segment)
+ TextCmdInsert(S32 pos, bool group_with_next, const LLWString &ws, LLTextSegmentPtr segment)
: TextCmd(pos, group_with_next, segment), mWString(ws)
{
}
virtual ~TextCmdInsert() {}
- virtual BOOL execute( LLTextBase* editor, S32* delta )
+ virtual bool execute( LLTextBase* editor, S32* delta )
{
*delta = insert(editor, getPosition(), mWString );
LLWStringUtil::truncate(mWString, *delta);
@@ -115,29 +115,29 @@ private:
class LLTextEditor::TextCmdAddChar : public LLTextBase::TextCmd
{
public:
- TextCmdAddChar( S32 pos, BOOL group_with_next, llwchar wc, LLTextSegmentPtr segment)
- : TextCmd(pos, group_with_next, segment), mWString(1, wc), mBlockExtensions(FALSE)
+ TextCmdAddChar( S32 pos, bool group_with_next, llwchar wc, LLTextSegmentPtr segment)
+ : TextCmd(pos, group_with_next, segment), mWString(1, wc), mBlockExtensions(false)
{
}
virtual void blockExtensions()
{
- mBlockExtensions = TRUE;
+ mBlockExtensions = true;
}
- virtual BOOL canExtend(S32 pos) const
+ virtual bool canExtend(S32 pos) const
{
// cannot extend text with custom segments
- if (!mSegments.empty()) return FALSE;
+ if (!mSegments.empty()) return false;
return !mBlockExtensions && (pos == getPosition() + (S32)mWString.length());
}
- virtual BOOL execute( LLTextBase* editor, S32* delta )
+ virtual bool execute( LLTextBase* editor, S32* delta )
{
*delta = insert(editor, getPosition(), mWString);
LLWStringUtil::truncate(mWString, *delta);
//mWString = wstring_truncate(mWString, *delta);
return (*delta != 0);
}
- virtual BOOL extendAndExecute( LLTextBase* editor, S32 pos, llwchar wc, S32* delta )
+ virtual bool extendAndExecute( LLTextBase* editor, S32 pos, llwchar wc, S32* delta )
{
LLWString ws;
ws += wc;
@@ -162,7 +162,7 @@ public:
private:
LLWString mWString;
- BOOL mBlockExtensions;
+ bool mBlockExtensions;
};
@@ -171,15 +171,15 @@ private:
class LLTextEditor::TextCmdOverwriteChar : public LLTextBase::TextCmd
{
public:
- TextCmdOverwriteChar( S32 pos, BOOL group_with_next, llwchar wc)
+ TextCmdOverwriteChar( S32 pos, bool group_with_next, llwchar wc)
: TextCmd(pos, group_with_next), mChar(wc), mOldChar(0) {}
- virtual BOOL execute( LLTextBase* editor, S32* delta )
+ virtual bool execute( LLTextBase* editor, S32* delta )
{
mOldChar = editor->getWText()[getPosition()];
overwrite(editor, getPosition(), mChar);
*delta = 0;
- return TRUE;
+ return true;
}
virtual S32 undo( LLTextBase* editor )
{
@@ -202,12 +202,12 @@ private:
class LLTextEditor::TextCmdRemove : public LLTextBase::TextCmd
{
public:
- TextCmdRemove( S32 pos, BOOL group_with_next, S32 len, segment_vec_t& segments ) :
+ TextCmdRemove( S32 pos, bool group_with_next, S32 len, segment_vec_t& segments ) :
TextCmd(pos, group_with_next), mLen(len)
{
std::swap(mSegments, segments);
}
- virtual BOOL execute( LLTextBase* editor, S32* delta )
+ virtual bool execute( LLTextBase* editor, S32* delta )
{
mWString = editor->getWText().substr(getPosition(), mLen);
*delta = remove(editor, getPosition(), mLen );
@@ -248,7 +248,7 @@ LLTextEditor::Params::Params()
LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
LLTextBase(p),
mAutoreplaceCallback(),
- mBaseDocIsPristine(TRUE),
+ mBaseDocIsPristine(true),
mPristineCmd( NULL ),
mLastCmd( NULL ),
mDefaultColor( p.default_color() ),
@@ -262,7 +262,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mShowContextMenu(p.show_context_menu),
mShowEmojiHelper(p.show_emoji_helper),
mEnableTooltipPaste(p.enable_tooltip_paste),
- mPassDelete(FALSE),
+ mPassDelete(false),
mKeepSelectionOnReturn(false)
{
mSourceID.generate();
@@ -278,7 +278,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
addChild( mBorder );
setText(p.default_text());
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
}
void LLTextEditor::initFromParams( const LLTextEditor::Params& p)
@@ -332,14 +332,14 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Param
blockUndo();
deselect();
- mParseOnTheFly = FALSE;
+ mParseOnTheFly = false;
LLTextBase::setText(utf8str, input_params);
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
resetDirty();
}
-void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap)
+void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insensitive, bool wrap)
{
if (search_text_in.empty())
{
@@ -376,7 +376,7 @@ void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insen
// If still -1, then search_text just isn't found.
if (-1 == loc)
{
- mIsSelecting = FALSE;
+ mIsSelecting = false;
mSelectionEnd = 0;
mSelectionStart = 0;
return;
@@ -384,15 +384,15 @@ void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insen
setCursorPos(loc);
- mIsSelecting = TRUE;
+ mIsSelecting = true;
mSelectionEnd = mCursorPos;
mSelectionStart = llmin((S32)getLength(), (S32)(mCursorPos + search_text.size()));
}
-BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::string& replace_text,
- BOOL case_insensitive, BOOL wrap)
+bool LLTextEditor::replaceText(const std::string& search_text_in, const std::string& replace_text,
+ bool case_insensitive, bool wrap)
{
- BOOL replaced = FALSE;
+ bool replaced = false;
if (search_text_in.empty())
{
@@ -414,7 +414,7 @@ BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::str
if (selected_text == search_text)
{
insertText(replace_text);
- replaced = TRUE;
+ replaced = true;
}
}
@@ -422,15 +422,15 @@ BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::str
return replaced;
}
-void LLTextEditor::replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive)
+void LLTextEditor::replaceTextAll(const std::string& search_text, const std::string& replace_text, bool case_insensitive)
{
startOfDoc();
- selectNext(search_text, case_insensitive, FALSE);
+ selectNext(search_text, case_insensitive, false);
- BOOL replaced = TRUE;
+ bool replaced = true;
while ( replaced )
{
- replaced = replaceText(search_text,replace_text, case_insensitive, FALSE);
+ replaced = replaceText(search_text,replace_text, case_insensitive, false);
}
}
@@ -518,7 +518,7 @@ void LLTextEditor::setShowEmojiHelper(bool show)
mShowEmojiHelper = show;
}
-BOOL LLTextEditor::selectionContainsLineBreaks()
+bool LLTextEditor::selectionContainsLineBreaks()
{
if (hasSelection())
{
@@ -530,11 +530,11 @@ BOOL LLTextEditor::selectionContainsLineBreaks()
{
if (wtext[i] == '\n')
{
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
@@ -565,7 +565,7 @@ S32 LLTextEditor::indentLine( S32 pos, S32 spaces )
LLWString wtext = getWText();
if (wtext[pos] == ' ')
{
- delta_spaces += remove( pos, 1, FALSE );
+ delta_spaces += remove( pos, 1, false );
}
}
}
@@ -580,7 +580,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
LLWString text = getWText();
S32 left = llmin( mSelectionStart, mSelectionEnd );
S32 right = left + llabs( mSelectionStart - mSelectionEnd );
- BOOL cursor_on_right = (mSelectionEnd > mSelectionStart);
+ bool cursor_on_right = (mSelectionEnd > mSelectionStart);
S32 cur = left;
// Expand left to start of line
@@ -609,7 +609,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
// Disabling parsing on the fly to avoid updating text segments
// until all indentation commands are executed.
- mParseOnTheFly = FALSE;
+ mParseOnTheFly = false;
// Find each start-of-line and indent it
do
@@ -636,7 +636,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
}
while( cur < right );
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
if( (right < getLength()) && (text[right] == '\n') )
{
@@ -659,9 +659,9 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
}
//virtual
-BOOL LLTextEditor::canSelectAll() const
+bool LLTextEditor::canSelectAll() const
{
- return TRUE;
+ return true;
}
// virtual
@@ -703,15 +703,15 @@ void LLTextEditor::handleEmojiCommit(llwchar emoji)
}
}
-BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
// set focus first, in case click callbacks want to change it
// RN: do we really need to have a tab stop?
if (hasTabStop())
{
- setFocus( TRUE );
+ setFocus( true );
}
// Let scrollbar have first dibs
@@ -724,7 +724,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
deselect();
}
- BOOL start_select = TRUE;
+ bool start_select = true;
if( start_select )
{
// If we're not scrolling (handled by child), then we're selecting
@@ -743,7 +743,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
mSelectionEnd = mCursorPos;
}
// assume we're starting a drag select
- mIsSelecting = TRUE;
+ mIsSelecting = true;
}
else
{
@@ -752,7 +752,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
}
}
- handled = TRUE;
+ handled = true;
}
// Delay cursor flashing
@@ -765,11 +765,11 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
return handled;
}
-BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
+bool LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
if (hasTabStop())
{
- setFocus(TRUE);
+ setFocus(true);
}
bool show_menu = false;
@@ -777,7 +777,7 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
// Prefer editor menu if it has selection. See EXT-6806.
if (hasSelection())
{
- S32 click_pos = getDocIndexFromLocalCoord(x, y, FALSE);
+ S32 click_pos = getDocIndexFromLocalCoord(x, y, false);
if (click_pos > mSelectionStart && click_pos < mSelectionEnd)
{
show_menu = true;
@@ -795,16 +795,16 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
showContextMenu(x, y);
}
- return TRUE;
+ return true;
}
-BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
+bool LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
{
if (hasTabStop())
{
- setFocus(TRUE);
+ setFocus(true);
}
if (!LLTextBase::handleMouseDown(x, y, mask))
@@ -816,13 +816,13 @@ BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
pastePrimary();
}
}
- return TRUE;
+ return true;
}
-BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
+bool LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
if(hasMouseCapture() )
{
@@ -839,7 +839,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
}
LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL;
getWindow()->setCursor(UI_CURSOR_IBEAM);
- handled = TRUE;
+ handled = true;
}
if( !handled )
@@ -857,16 +857,16 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
if( !handled )
{
getWindow()->setCursor(UI_CURSOR_IBEAM);
- handled = TRUE;
+ handled = true;
}
return handled;
}
-BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
// if I'm not currently selecting text
if (!(mIsSelecting && hasMouseCapture()))
@@ -892,7 +892,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
// take selection to 'primary' clipboard
updatePrimary();
- handled = TRUE;
+ handled = true;
}
// Delay cursor flashing
@@ -902,16 +902,16 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
gFocusMgr.setMouseCapture( NULL );
- handled = TRUE;
+ handled = true;
}
return handled;
}
-BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
+bool LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
// let scrollbar and text segments have first dibs
handled = LLTextBase::handleDoubleClick(x, y, mask);
@@ -949,7 +949,7 @@ BOOL LLTextEditor::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
resetCursorBlink();
@@ -957,7 +957,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
// take selection to 'primary' clipboard
updatePrimary();
- handled = TRUE;
+ handled = true;
}
return handled;
@@ -1018,7 +1018,7 @@ S32 LLTextEditor::insert(S32 pos, const LLWString &wstr, bool group_with_next_op
S32 LLTextEditor::remove(S32 pos, S32 length, bool group_with_next_op)
{
S32 end_pos = getEditableIndex(pos + length, true);
- BOOL removedChar = FALSE;
+ bool removedChar = false;
segment_vec_t segments_to_remove;
// store text segments
@@ -1040,7 +1040,7 @@ S32 LLTextEditor::overwriteChar(S32 pos, llwchar wc)
}
else
{
- return execute(new TextCmdOverwriteChar(pos, FALSE, wc));
+ return execute(new TextCmdOverwriteChar(pos, false, wc));
}
}
@@ -1153,7 +1153,7 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc)
}
else
{
- return execute(new TextCmdAddChar(pos, FALSE, wc, LLTextSegmentPtr()));
+ return execute(new TextCmdAddChar(pos, false, wc, LLTextSegmentPtr()));
}
}
@@ -1165,7 +1165,7 @@ void LLTextEditor::addChar(llwchar wc)
}
if( hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
{
@@ -1224,7 +1224,7 @@ void LLTextEditor::tryToShowEmojiHelper()
}
}
-void LLTextEditor::addLineBreakChar(BOOL group_together)
+void LLTextEditor::addLineBreakChar(bool group_together)
{
if( !getEnabled() )
{
@@ -1232,7 +1232,7 @@ void LLTextEditor::addLineBreakChar(BOOL group_together)
}
if( hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
{
@@ -1248,13 +1248,13 @@ void LLTextEditor::addLineBreakChar(BOOL group_together)
}
-BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
+bool LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
if( mask & MASK_SHIFT )
{
- handled = TRUE;
+ handled = true;
switch( key )
{
@@ -1335,7 +1335,7 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1349,14 +1349,14 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
return handled;
}
-BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
+bool LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
// Ignore capslock key
if( MASK_NONE == mask )
{
- handled = TRUE;
+ handled = true;
switch( key )
{
case KEY_UP:
@@ -1421,7 +1421,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1434,7 +1434,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
return handled;
}
-void LLTextEditor::deleteSelection(BOOL group_with_next_op )
+void LLTextEditor::deleteSelection(bool group_with_next_op )
{
if( getEnabled() && hasSelection() )
{
@@ -1449,7 +1449,7 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op )
}
// virtual
-BOOL LLTextEditor::canCut() const
+bool LLTextEditor::canCut() const
{
return !mReadOnly && hasSelection();
}
@@ -1464,12 +1464,12 @@ void LLTextEditor::cut()
S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
S32 length = llabs( mSelectionStart - mSelectionEnd );
LLClipboard::instance().copyToClipboard( getWText(), left_pos, length);
- deleteSelection( FALSE );
+ deleteSelection( false );
onKeyStroke();
}
-BOOL LLTextEditor::canCopy() const
+bool LLTextEditor::canCopy() const
{
return hasSelection();
}
@@ -1486,7 +1486,7 @@ void LLTextEditor::copy()
LLClipboard::instance().copyToClipboard(getWText(), left_pos, length);
}
-BOOL LLTextEditor::canPaste() const
+bool LLTextEditor::canPaste() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
@@ -1508,7 +1508,7 @@ void LLTextEditor::pastePrimary()
// paste from primary (itsprimary==true) or clipboard (itsprimary==false)
void LLTextEditor::pasteHelper(bool is_primary)
{
- mParseOnTheFly = FALSE;
+ mParseOnTheFly = false;
bool can_paste_it;
if (is_primary)
{
@@ -1535,7 +1535,7 @@ void LLTextEditor::pasteHelper(bool is_primary)
// Delete any selected characters (the paste replaces them)
if( (!is_primary) && hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
// Clean up string (replace tabs and remove characters that our fonts don't support).
@@ -1550,7 +1550,7 @@ void LLTextEditor::pasteHelper(bool is_primary)
deselect();
onKeyStroke();
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
}
@@ -1592,9 +1592,9 @@ void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string)
if(pos!=start)
{
std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,pos-start);
- setCursorPos(mCursorPos + insert(mCursorPos, str, TRUE, LLTextSegmentPtr()));
+ setCursorPos(mCursorPos + insert(mCursorPos, str, true, LLTextSegmentPtr()));
}
- addLineBreakChar(TRUE); // Add a line break and group with the next addition.
+ addLineBreakChar(true); // Add a line break and group with the next addition.
start = pos+1;
pos = clean_string.find('\n',start);
@@ -1603,11 +1603,11 @@ void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string)
if (pos != start)
{
std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,clean_string.length()-start);
- setCursorPos(mCursorPos + insert(mCursorPos, str, FALSE, LLTextSegmentPtr()));
+ setCursorPos(mCursorPos + insert(mCursorPos, str, false, LLTextSegmentPtr()));
}
else
{
- addLineBreakChar(FALSE); // Add a line break and end the grouping.
+ addLineBreakChar(false); // Add a line break and end the grouping.
}
}
@@ -1623,7 +1623,7 @@ void LLTextEditor::copyPrimary()
LLClipboard::instance().copyToClipboard(getWText(), left_pos, length, true);
}
-BOOL LLTextEditor::canPastePrimary() const
+bool LLTextEditor::canPastePrimary() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
}
@@ -1636,13 +1636,13 @@ void LLTextEditor::updatePrimary()
}
}
-BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
+bool LLTextEditor::handleControlKey(const KEY key, const MASK mask)
{
- BOOL handled = FALSE;
+ bool handled = false;
if( mask & MASK_CONTROL )
{
- handled = TRUE;
+ handled = true;
switch( key )
{
@@ -1706,7 +1706,7 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1720,11 +1720,11 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
}
-BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
+bool LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
{
- BOOL handled = TRUE;
+ bool handled = true;
- if (mReadOnly) return FALSE;
+ if (mReadOnly) return false;
switch( key )
{
@@ -1738,7 +1738,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
case KEY_BACKSPACE:
if( hasSelection() )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
else
if( 0 < mCursorPos )
@@ -1757,7 +1757,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
{
if( hasSelection() && !mKeepSelectionOnReturn )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
if (mAutoIndent)
{
@@ -1766,7 +1766,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- handled = FALSE;
+ handled = false;
break;
}
break;
@@ -1774,7 +1774,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
case KEY_TAB:
if (mask & MASK_CONTROL)
{
- handled = FALSE;
+ handled = false;
break;
}
if( hasSelection() && selectionContainsLineBreaks() )
@@ -1785,7 +1785,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
{
if( hasSelection() )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
S32 offset = getLineOffsetFromDocIndex(mCursorPos);
@@ -1799,7 +1799,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
@@ -1837,15 +1837,15 @@ void LLTextEditor::unindentLineBeforeCloseBrace()
}
-BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
+bool LLTextEditor::handleKeyHere(KEY key, MASK mask )
{
- BOOL handled = FALSE;
+ bool handled = false;
// Special case for TAB. If want to move to next field, report
// not handled and let the parent take care of field movement.
if (KEY_TAB == key && mTabsToNextField)
{
- return FALSE;
+ return false;
}
if (mReadOnly && mScroller)
@@ -1858,7 +1858,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
{
if (!mReadOnly && mShowEmojiHelper && LLEmojiHelper::instance().handleKey(this, key, mask))
{
- return TRUE;
+ return true;
}
if (mEnableTooltipPaste &&
@@ -1875,7 +1875,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
// Delete any selected characters (the tooltip text replaces them)
if(hasSelection())
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
std::basic_string<llwchar>::size_type pos = tool_tip_text.find('\n',0);
@@ -1887,7 +1887,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
// Add the text
cleanStringForPaste(tool_tip_text);
pasteTextWithLinebreaks(tool_tip_text);
- handled = TRUE;
+ handled = true;
}
}
else
@@ -1915,21 +1915,21 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
}
-BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
+bool LLTextEditor::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;
// Handle most keys only if the text editor is writeable.
if( !mReadOnly )
{
if (mShowEmojiHelper && uni_char < 0x80 && LLEmojiHelper::instance().handleKey(this, (KEY)uni_char, MASK_NONE))
{
- return TRUE;
+ return true;
}
if( mAutoIndent && '}' == uni_char )
@@ -1943,7 +1943,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
// Keys that add characters temporarily hide the cursor
getWindow()->hideCursorUntilMouseMove();
- handled = TRUE;
+ handled = true;
}
if( handled )
@@ -1961,7 +1961,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
// virtual
-BOOL LLTextEditor::canDoDelete() const
+bool LLTextEditor::canDoDelete() const
{
return !mReadOnly && ( !mPassDelete || ( hasSelection() || (mCursorPos < getLength())) );
}
@@ -1974,7 +1974,7 @@ void LLTextEditor::doDelete()
}
if( hasSelection() )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
else
if( mCursorPos < getLength() )
@@ -2018,14 +2018,14 @@ void LLTextEditor::doDelete()
void LLTextEditor::blockUndo()
{
- mBaseDocIsPristine = FALSE;
+ mBaseDocIsPristine = false;
mLastCmd = NULL;
std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
mUndoStack.clear();
}
// virtual
-BOOL LLTextEditor::canUndo() const
+bool LLTextEditor::canUndo() const
{
return !mReadOnly && mLastCmd != NULL;
}
@@ -2056,7 +2056,7 @@ void LLTextEditor::undo()
onKeyStroke();
}
-BOOL LLTextEditor::canRedo() const
+bool LLTextEditor::canRedo() const
{
return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front());
}
@@ -2135,7 +2135,7 @@ void LLTextEditor::onCommit()
LLTextBase::onCommit();
}
-void LLTextEditor::setEnabled(BOOL enabled)
+void LLTextEditor::setEnabled(bool enabled)
{
// just treat enabled as read-only flag
bool read_only = !enabled;
@@ -2168,7 +2168,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y)
// Route menu to this class
// previously this was done in ::handleRightMoseDown:
//if(hasTabStop())
- // setFocus(TRUE) - why? weird...
+ // setFocus(true) - why? weird...
// and then inside setFocus
// ....
// gEditMenuHandler = this;
@@ -2346,9 +2346,9 @@ void LLTextEditor::draw()
// Start or stop the editor from accepting text-editing keystrokes
// see also LLLineEditor
-void LLTextEditor::setFocus( BOOL new_state )
+void LLTextEditor::setFocus( bool new_state )
{
- BOOL old_state = hasFocus();
+ bool old_state = hasFocus();
// Don't change anything if the focus state didn't change
if (new_state == old_state) return;
@@ -2356,7 +2356,7 @@ void LLTextEditor::setFocus( BOOL new_state )
// Notify early if we are losing focus.
if (!new_state)
{
- getWindow()->allowLanguageTextInput(this, FALSE);
+ getWindow()->allowLanguageTextInput(this, false);
}
LLTextBase::setFocus( new_state );
@@ -2388,7 +2388,7 @@ void LLTextEditor::setCursorAndScrollToEnd()
endOfDoc();
}
-void LLTextEditor::getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap )
+void LLTextEditor::getCurrentLineAndColumn( S32* line, S32* col, bool include_wordwrap )
{
*line = getLineNumFromDocIndex(mCursorPos, include_wordwrap);
*col = getLineOffsetFromDocIndex(mCursorPos, include_wordwrap);
@@ -2430,32 +2430,32 @@ void LLTextEditor::autoIndent()
// Inserts new text at the cursor position
void LLTextEditor::insertText(const std::string &new_text)
{
- BOOL enabled = getEnabled();
- setEnabled( TRUE );
+ bool enabled = getEnabled();
+ setEnabled( true );
// Delete any selected characters (the insertion replaces them)
if( hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
- setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), FALSE, LLTextSegmentPtr() ));
+ setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), false, LLTextSegmentPtr() ));
setEnabled( enabled );
}
void LLTextEditor::insertText(LLWString &new_text)
{
- BOOL enabled = getEnabled();
- setEnabled( TRUE );
+ bool enabled = getEnabled();
+ setEnabled( true );
// Delete any selected characters (the insertion replaces them)
if( hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
- setCursorPos(mCursorPos + insert( mCursorPos, new_text, FALSE, LLTextSegmentPtr() ));
+ setCursorPos(mCursorPos + insert( mCursorPos, new_text, false, LLTextSegmentPtr() ));
setEnabled( enabled );
}
@@ -2465,10 +2465,10 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const
// Save old state
S32 selection_start = mSelectionStart;
S32 selection_end = mSelectionEnd;
- BOOL was_selecting = mIsSelecting;
+ bool was_selecting = mIsSelecting;
S32 cursor_pos = mCursorPos;
S32 old_length = getLength();
- BOOL cursor_was_at_end = (mCursorPos == old_length);
+ bool cursor_was_at_end = (mCursorPos == old_length);
deselect();
@@ -2477,7 +2477,7 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const
LLWString widget_wide_text = utf8str_to_wstring(text);
LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + widget_wide_text.size());
- insert(getLength(), widget_wide_text, FALSE, segment);
+ insert(getLength(), widget_wide_text, false, segment);
// Set the cursor and scroll position
if( selection_start != selection_end )
@@ -2507,7 +2507,7 @@ void LLTextEditor::removeTextFromEnd(S32 num_chars)
{
if (num_chars <= 0) return;
- remove(getLength() - num_chars, num_chars, FALSE);
+ remove(getLength() - num_chars, num_chars, false);
S32 len = getLength();
setCursorPos (llclamp(mCursorPos, 0, len));
@@ -2523,7 +2523,7 @@ void LLTextEditor::onSpellCheckPerformed()
{
if (isPristine())
{
- mBaseDocIsPristine = FALSE;
+ mBaseDocIsPristine = false;
}
}
@@ -2540,7 +2540,7 @@ void LLTextEditor::makePristine()
}
}
-BOOL LLTextEditor::isPristine() const
+bool LLTextEditor::isPristine() const
{
if( mPristineCmd )
{
@@ -2553,7 +2553,7 @@ BOOL LLTextEditor::isPristine() const
}
}
-BOOL LLTextEditor::tryToRevertToPristineState()
+bool LLTextEditor::tryToRevertToPristineState()
{
if( !isPristine() )
{
@@ -2582,7 +2582,7 @@ BOOL LLTextEditor::tryToRevertToPristineState()
}
}
- return isPristine(); // TRUE => success
+ return isPristine(); // true => success
}
void LLTextEditor::updateLinkSegments()
@@ -2641,7 +2641,7 @@ void LLTextEditor::onMouseCaptureLost()
///////////////////////////////////////////////////////////////////
// Hack for Notecards
-BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
+bool LLTextEditor::importBuffer(const char* buffer, S32 length )
{
std::istringstream instream(buffer);
@@ -2660,20 +2660,20 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
if( 1 != sscanf(tbuf, "Linden text version %d", &version) )
{
LL_WARNS() << "Invalid Linden text file header " << LL_ENDL;
- return FALSE;
+ return false;
}
if( 1 != version )
{
LL_WARNS() << "Invalid Linden text file version: " << version << LL_ENDL;
- return FALSE;
+ return false;
}
instream.getline(tbuf, MAX_STRING);
if( 0 != sscanf(tbuf, "{") )
{
LL_WARNS() << "Invalid Linden text file format" << LL_ENDL;
- return FALSE;
+ return false;
}
S32 text_len = 0;
@@ -2681,37 +2681,37 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
if( 1 != sscanf(tbuf, "Text length %d", &text_len) )
{
LL_WARNS() << "Invalid Linden text length field" << LL_ENDL;
- return FALSE;
+ return false;
}
if( text_len > mMaxTextByteLength )
{
LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL;
- return FALSE;
+ return false;
}
- BOOL success = TRUE;
+ bool success = true;
char* text = new char[ text_len + 1];
if (text == NULL)
{
LLError::LLUserWarningMsg::showOutOfMemory();
LL_ERRS() << "Memory allocation failure." << LL_ENDL;
- return FALSE;
+ return false;
}
instream.get(text, text_len + 1, '\0');
text[text_len] = '\0';
if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */
{
LL_WARNS() << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << LL_ENDL;/* Flawfinder: ignore */
- success = FALSE;
+ success = false;
}
instream.getline(tbuf, MAX_STRING);
if( success && (0 != sscanf(tbuf, "}")) )
{
LL_WARNS() << "Invalid Linden text file format: missing terminal }" << LL_ENDL;
- success = FALSE;
+ success = false;
}
if( success )
@@ -2728,7 +2728,7 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
return success;
}
-BOOL LLTextEditor::exportBuffer(std::string &buffer )
+bool LLTextEditor::exportBuffer(std::string &buffer )
{
std::ostringstream outstream(buffer);
@@ -2739,7 +2739,7 @@ BOOL LLTextEditor::exportBuffer(std::string &buffer )
outstream << getText();
outstream << "}\n";
- return TRUE;
+ return true;
}
void LLTextEditor::updateAllowingLanguageInput()
@@ -2752,17 +2752,17 @@ void LLTextEditor::updateAllowingLanguageInput()
}
if (hasFocus() && !mReadOnly)
{
- window->allowLanguageTextInput(this, TRUE);
+ window->allowLanguageTextInput(this, true);
}
else
{
- window->allowLanguageTextInput(this, FALSE);
+ window->allowLanguageTextInput(this, false);
}
}
// Preedit is managed off the undo/redo command stack.
-BOOL LLTextEditor::hasPreeditString() const
+bool LLTextEditor::hasPreeditString() const
{
return (mPreeditPositions.size() > 1);
}
@@ -2778,7 +2778,7 @@ void LLTextEditor::resetPreedit()
}
else
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
}
if (hasPreeditString())
@@ -2851,7 +2851,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string,
onKeyStroke();
}
-BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const
+bool LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const
{
if (control)
{
@@ -2874,13 +2874,13 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
const S32 query = (query_offset >= 0 ? preedit_left_position + query_offset : mCursorPos);
if (query < preedit_left_position || query > preedit_right_position)
{
- return FALSE;
+ return false;
}
const S32 first_visible_line = getFirstVisibleLine();
if (query < getLineStart(first_visible_line))
{
- return FALSE;
+ return false;
}
S32 current_line = first_visible_line;
@@ -2941,7 +2941,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds);
}
- return TRUE;
+ return true;
}
void LLTextEditor::getSelectionRange(S32 *position, S32 *length) const
@@ -2987,7 +2987,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
mPreeditPositions[0] = position;
mPreeditPositions[1] = position + length;
mPreeditStandouts.resize(1);
- mPreeditStandouts[0] = FALSE;
+ mPreeditStandouts[0] = false;
}
else
{
@@ -3009,11 +3009,11 @@ S32 LLTextEditor::getPreeditFontSize() const
return ll_round((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
-BOOL LLTextEditor::isDirty() const
+bool LLTextEditor::isDirty() const
{
if(mReadOnly)
{
- return FALSE;
+ return false;
}
if( mPristineCmd )