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 3d2a426913..2250ed5cb3 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -70,7 +70,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
@@ -83,12 +83,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);
@@ -114,29 +114,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;
@@ -161,7 +161,7 @@ public:
private:
LLWString mWString;
- BOOL mBlockExtensions;
+ bool mBlockExtensions;
};
@@ -170,15 +170,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 )
{
@@ -201,12 +201,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 );
@@ -246,7 +246,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() ),
@@ -259,7 +259,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mPrevalidateFunc(p.prevalidate_callback()),
mShowContextMenu(p.show_context_menu),
mEnableTooltipPaste(p.enable_tooltip_paste),
- mPassDelete(FALSE),
+ mPassDelete(false),
mKeepSelectionOnReturn(false)
{
mSourceID.generate();
@@ -275,7 +275,7 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
addChild( mBorder );
setText(p.default_text());
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
}
void LLTextEditor::initFromParams( const LLTextEditor::Params& p)
@@ -329,14 +329,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())
{
@@ -373,7 +373,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;
@@ -381,15 +381,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())
{
@@ -411,7 +411,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;
}
}
@@ -419,15 +419,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);
}
}
@@ -505,7 +505,7 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out,
}
}
-BOOL LLTextEditor::selectionContainsLineBreaks()
+bool LLTextEditor::selectionContainsLineBreaks()
{
if (hasSelection())
{
@@ -517,11 +517,11 @@ BOOL LLTextEditor::selectionContainsLineBreaks()
{
if (wtext[i] == '\n')
{
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
@@ -552,7 +552,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 );
}
}
}
@@ -567,7 +567,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
@@ -596,7 +596,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
@@ -623,7 +623,7 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
}
while( cur < right );
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
if( (right < getLength()) && (text[right] == '\n') )
{
@@ -646,9 +646,9 @@ void LLTextEditor::indentSelectedLines( S32 spaces )
}
//virtual
-BOOL LLTextEditor::canSelectAll() const
+bool LLTextEditor::canSelectAll() const
{
- return TRUE;
+ return true;
}
// virtual
@@ -668,15 +668,15 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p
endSelection();
}
-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
@@ -689,7 +689,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
@@ -708,7 +708,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
mSelectionEnd = mCursorPos;
}
// assume we're starting a drag select
- mIsSelecting = TRUE;
+ mIsSelecting = true;
}
else
{
@@ -717,7 +717,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
}
}
- handled = TRUE;
+ handled = true;
}
// Delay cursor flashing
@@ -730,11 +730,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;
@@ -742,7 +742,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;
@@ -760,16 +760,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))
@@ -781,13 +781,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() )
{
@@ -804,7 +804,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 )
@@ -822,16 +822,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()))
@@ -857,7 +857,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
// take selection to 'primary' clipboard
updatePrimary();
- handled = TRUE;
+ handled = true;
}
// Delay cursor flashing
@@ -867,16 +867,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);
@@ -914,7 +914,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();
@@ -922,7 +922,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
// take selection to 'primary' clipboard
updatePrimary();
- handled = TRUE;
+ handled = true;
}
return handled;
@@ -977,7 +977,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
@@ -999,7 +999,7 @@ S32 LLTextEditor::overwriteChar(S32 pos, llwchar wc)
}
else
{
- return execute(new TextCmdOverwriteChar(pos, FALSE, wc));
+ return execute(new TextCmdOverwriteChar(pos, false, wc));
}
}
@@ -1044,7 +1044,7 @@ void LLTextEditor::removeCharOrTab()
for (S32 i = 0; i < chars_to_remove; i++)
{
setCursorPos(mCursorPos - 1);
- remove( mCursorPos, 1, FALSE );
+ remove( mCursorPos, 1, false );
}
}
else
@@ -1056,7 +1056,7 @@ void LLTextEditor::removeCharOrTab()
// Remove a single character from the text
S32 LLTextEditor::removeChar(S32 pos)
{
- return remove( pos, 1, FALSE );
+ return remove( pos, 1, false );
}
void LLTextEditor::removeChar()
@@ -1107,7 +1107,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()));
}
}
@@ -1119,7 +1119,7 @@ void LLTextEditor::addChar(llwchar wc)
}
if( hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
{
@@ -1146,7 +1146,7 @@ void LLTextEditor::addChar(llwchar wc)
}
}
-void LLTextEditor::addLineBreakChar(BOOL group_together)
+void LLTextEditor::addLineBreakChar(bool group_together)
{
if( !getEnabled() )
{
@@ -1154,7 +1154,7 @@ void LLTextEditor::addLineBreakChar(BOOL group_together)
}
if( hasSelection() )
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode())
{
@@ -1170,13 +1170,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 )
{
@@ -1257,7 +1257,7 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1271,14 +1271,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:
@@ -1343,7 +1343,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1356,7 +1356,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() )
{
@@ -1371,7 +1371,7 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op )
}
// virtual
-BOOL LLTextEditor::canCut() const
+bool LLTextEditor::canCut() const
{
return !mReadOnly && hasSelection();
}
@@ -1386,12 +1386,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();
}
@@ -1408,7 +1408,7 @@ void LLTextEditor::copy()
LLClipboard::instance().copyToClipboard(getWText(), left_pos, length);
}
-BOOL LLTextEditor::canPaste() const
+bool LLTextEditor::canPaste() const
{
return !mReadOnly && LLClipboard::instance().isTextAvailable();
}
@@ -1430,7 +1430,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)
{
@@ -1457,7 +1457,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).
@@ -1472,7 +1472,7 @@ void LLTextEditor::pasteHelper(bool is_primary)
deselect();
onKeyStroke();
- mParseOnTheFly = TRUE;
+ mParseOnTheFly = true;
}
@@ -1514,9 +1514,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);
@@ -1525,11 +1525,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.
}
}
@@ -1545,7 +1545,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);
}
@@ -1558,13 +1558,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 )
{
@@ -1628,7 +1628,7 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
}
@@ -1642,11 +1642,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 )
{
@@ -1660,7 +1660,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
case KEY_BACKSPACE:
if( hasSelection() )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
else
if( 0 < mCursorPos )
@@ -1679,7 +1679,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
{
if( hasSelection() && !mKeepSelectionOnReturn )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
if (mAutoIndent)
{
@@ -1688,7 +1688,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- handled = FALSE;
+ handled = false;
break;
}
break;
@@ -1696,7 +1696,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() )
@@ -1707,7 +1707,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
{
if( hasSelection() )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
S32 offset = getLineOffsetFromDocIndex(mCursorPos);
@@ -1721,7 +1721,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
break;
default:
- handled = FALSE;
+ handled = false;
break;
}
@@ -1759,15 +1759,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)
@@ -1791,7 +1791,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);
@@ -1803,7 +1803,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
// Add the text
cleanStringForPaste(tool_tip_text);
pasteTextWithLinebreaks(tool_tip_text);
- handled = TRUE;
+ handled = true;
}
}
else
@@ -1825,14 +1825,14 @@ 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 )
@@ -1848,7 +1848,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
// Keys that add characters temporarily hide the cursor
getWindow()->hideCursorUntilMouseMove();
- handled = TRUE;
+ handled = true;
}
if( handled )
@@ -1866,7 +1866,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
// virtual
-BOOL LLTextEditor::canDoDelete() const
+bool LLTextEditor::canDoDelete() const
{
return !mReadOnly && ( !mPassDelete || ( hasSelection() || (mCursorPos < getLength())) );
}
@@ -1879,7 +1879,7 @@ void LLTextEditor::doDelete()
}
if( hasSelection() )
{
- deleteSelection(FALSE);
+ deleteSelection(false);
}
else
if( mCursorPos < getLength() )
@@ -1923,14 +1923,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;
}
@@ -1961,7 +1961,7 @@ void LLTextEditor::undo()
onKeyStroke();
}
-BOOL LLTextEditor::canRedo() const
+bool LLTextEditor::canRedo() const
{
return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front());
}
@@ -2040,7 +2040,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;
@@ -2073,7 +2073,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;
@@ -2251,9 +2251,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;
@@ -2261,7 +2261,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 );
@@ -2293,7 +2293,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);
@@ -2335,32 +2335,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 );
}
@@ -2370,10 +2370,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();
@@ -2382,7 +2382,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 )
@@ -2412,7 +2412,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));
@@ -2428,7 +2428,7 @@ void LLTextEditor::onSpellCheckPerformed()
{
if (isPristine())
{
- mBaseDocIsPristine = FALSE;
+ mBaseDocIsPristine = false;
}
}
@@ -2445,7 +2445,7 @@ void LLTextEditor::makePristine()
}
}
-BOOL LLTextEditor::isPristine() const
+bool LLTextEditor::isPristine() const
{
if( mPristineCmd )
{
@@ -2458,7 +2458,7 @@ BOOL LLTextEditor::isPristine() const
}
}
-BOOL LLTextEditor::tryToRevertToPristineState()
+bool LLTextEditor::tryToRevertToPristineState()
{
if( !isPristine() )
{
@@ -2487,7 +2487,7 @@ BOOL LLTextEditor::tryToRevertToPristineState()
}
}
- return isPristine(); // TRUE => success
+ return isPristine(); // true => success
}
void LLTextEditor::updateLinkSegments()
@@ -2546,7 +2546,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);
@@ -2565,20 +2565,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;
@@ -2586,36 +2586,36 @@ 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)
{
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 )
@@ -2632,7 +2632,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);
@@ -2643,7 +2643,7 @@ BOOL LLTextEditor::exportBuffer(std::string &buffer )
outstream << getText();
outstream << "}\n";
- return TRUE;
+ return true;
}
void LLTextEditor::updateAllowingLanguageInput()
@@ -2656,17 +2656,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);
}
@@ -2682,7 +2682,7 @@ void LLTextEditor::resetPreedit()
}
else
{
- deleteSelection(TRUE);
+ deleteSelection(true);
}
}
if (hasPreeditString())
@@ -2755,7 +2755,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)
{
@@ -2778,13 +2778,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;
@@ -2845,7 +2845,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
@@ -2891,7 +2891,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
{
@@ -2913,11 +2913,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 )