From c285f59ce2a05703e3a1232fcaf3ee3aea714b3f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 18 Feb 2024 12:52:19 +0100 Subject: Replace BOOL with bool in llwindow and dependent classes --- indra/llui/lltextbox.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llui/lltextbox.cpp') diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 521dabf9d4..739b46bb07 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -52,9 +52,9 @@ LLTextBox::LLTextBox(const LLTextBox::Params& p) LLTextBox::~LLTextBox() {} -BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextBase::handleMouseDown(x, y, mask); + bool handled = LLTextBase::handleMouseDown(x, y, mask); if (getSoundFlags() & MOUSE_DOWN) { @@ -63,7 +63,7 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) if (!handled && mClickedCallback) { - handled = TRUE; + handled = true; } if (handled) @@ -75,9 +75,9 @@ BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) return handled; } -BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextBase::handleMouseUp(x, y, mask); + bool handled = LLTextBase::handleMouseUp(x, y, mask); if (getSoundFlags() & MOUSE_UP) { @@ -96,21 +96,21 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) if (mClickedCallback && !handled) { mClickedCallback(); - handled = TRUE; + handled = true; } } return handled; } -BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) +bool LLTextBox::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = LLTextBase::handleHover(x, y, mask); + bool handled = LLTextBase::handleHover(x, y, mask); if (!handled && mClickedCallback && mShowCursorHand) { // Clickable text boxes change the cursor to a hand LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } return handled; } -- cgit v1.2.3 From a5261a5fa8fad810ecb5c260d92c3e771822bf58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 23:46:23 +0100 Subject: Convert BOOL to bool in llui --- indra/llui/lltextbox.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llui/lltextbox.cpp') diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 739b46bb07..f143d619c5 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -39,7 +39,7 @@ static LLDefaultChildRegistry::Register r("text"); // Compiler optimization, generate extern template template class LLTextBox* LLView::getChild( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), @@ -115,7 +115,7 @@ bool LLTextBox::handleHover(S32 x, S32 y, MASK mask) return handled; } -void LLTextBox::setEnabled(BOOL enabled) +void LLTextBox::setEnabled(bool enabled) { // just treat enabled as read-only flag bool read_only = !enabled; @@ -156,16 +156,16 @@ LLSD LLTextBox::getValue() const return getViewModel()->getValue(); } -BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); LLTextBase::setText(mText.getString()); - return TRUE; + return true; } -void LLTextBox::reshapeToFitText(BOOL called_from_parent) +void LLTextBox::reshapeToFitText(bool called_from_parent) { reflow(); -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/llui/lltextbox.cpp | 366 +++++++++++++++++++++++------------------------ 1 file changed, 183 insertions(+), 183 deletions(-) (limited to 'indra/llui/lltextbox.cpp') diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index b3b97c00b4..92551b682c 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -1,183 +1,183 @@ -/** - * @file lltextbox.cpp - * @brief A text display widget - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#define LLTEXTBOX_CPP -#include "lltextbox.h" - -#include "lluictrlfactory.h" -#include "llfocusmgr.h" -#include "llwindow.h" -#include "llurlregistry.h" -#include "llstyle.h" - -static LLDefaultChildRegistry::Register r("text"); - -// Compiler optimization, generate extern template -template class LLTextBox* LLView::getChild( - const std::string& name, bool recurse) const; - -LLTextBox::LLTextBox(const LLTextBox::Params& p) -: LLTextBase(p), - mClickedCallback(NULL), - mShowCursorHand(true) -{ - mSkipTripleClick = true; -} - -LLTextBox::~LLTextBox() -{} - -bool LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) -{ - bool handled = LLTextBase::handleMouseDown(x, y, mask); - - if (getSoundFlags() & MOUSE_DOWN) - { - make_ui_sound("UISndClick"); - } - - if (!handled && mClickedCallback) - { - handled = true; - } - - if (handled) - { - // Route future Mouse messages here preemptively. (Release on mouse up.) - gFocusMgr.setMouseCapture( this ); - } - - return handled; -} - -bool LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) -{ - bool handled = LLTextBase::handleMouseUp(x, y, mask); - - if (getSoundFlags() & MOUSE_UP) - { - make_ui_sound("UISndClickRelease"); - } - - // We only handle the click if the click both started and ended within us - if (hasMouseCapture()) - { - // Release the mouse - gFocusMgr.setMouseCapture( NULL ); - - // DO THIS AT THE VERY END to allow the button to be destroyed - // as a result of being clicked. If mouseup in the widget, - // it's been clicked - if (mClickedCallback && !handled) - { - mClickedCallback(); - handled = true; - } - } - - return handled; -} - -bool LLTextBox::handleHover(S32 x, S32 y, MASK mask) -{ - bool handled = LLTextBase::handleHover(x, y, mask); - if (!handled && mClickedCallback && mShowCursorHand) - { - // Clickable text boxes change the cursor to a hand - LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return true; - } - return handled; -} - -void LLTextBox::setEnabled(bool enabled) -{ - // just treat enabled as read-only flag - bool read_only = !enabled; - if (read_only != mReadOnly) - { - LLTextBase::setReadOnly(read_only); - updateSegments(); - } - LLTextBase::setEnabled(enabled); -} - -void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params ) -{ - // does string argument insertion - mText.assign(text); - - LLTextBase::setText(mText.getString(), input_params ); -} - -void LLTextBox::setClickedCallback( boost::function cb, void* userdata /*= NULL */ ) -{ - mClickedCallback = boost::bind(cb, userdata); -} - -S32 LLTextBox::getTextPixelWidth() -{ - return getTextBoundingRect().getWidth(); -} - -S32 LLTextBox::getTextPixelHeight() -{ - return getTextBoundingRect().getHeight(); -} - - -LLSD LLTextBox::getValue() const -{ - return getViewModel()->getValue(); -} - -bool LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) -{ - mText.setArg(key, text); - LLTextBase::setText(mText.getString()); - - return true; -} - - -void LLTextBox::reshapeToFitText(bool called_from_parent) -{ - reflow(); - - S32 width = getTextPixelWidth(); - S32 height = getTextPixelHeight(); - //consider investigating reflow() to find missing width pixel (see SL-17045 changes) - reshape( width + 2 * mHPad + 1, height + 2 * mVPad, called_from_parent ); -} - - -void LLTextBox::onUrlLabelUpdated(const std::string &url, const std::string &label) -{ - needsReflow(); -} - +/** + * @file lltextbox.cpp + * @brief A text display widget + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#define LLTEXTBOX_CPP +#include "lltextbox.h" + +#include "lluictrlfactory.h" +#include "llfocusmgr.h" +#include "llwindow.h" +#include "llurlregistry.h" +#include "llstyle.h" + +static LLDefaultChildRegistry::Register r("text"); + +// Compiler optimization, generate extern template +template class LLTextBox* LLView::getChild( + const std::string& name, bool recurse) const; + +LLTextBox::LLTextBox(const LLTextBox::Params& p) +: LLTextBase(p), + mClickedCallback(NULL), + mShowCursorHand(true) +{ + mSkipTripleClick = true; +} + +LLTextBox::~LLTextBox() +{} + +bool LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) +{ + bool handled = LLTextBase::handleMouseDown(x, y, mask); + + if (getSoundFlags() & MOUSE_DOWN) + { + make_ui_sound("UISndClick"); + } + + if (!handled && mClickedCallback) + { + handled = true; + } + + if (handled) + { + // Route future Mouse messages here preemptively. (Release on mouse up.) + gFocusMgr.setMouseCapture( this ); + } + + return handled; +} + +bool LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) +{ + bool handled = LLTextBase::handleMouseUp(x, y, mask); + + if (getSoundFlags() & MOUSE_UP) + { + make_ui_sound("UISndClickRelease"); + } + + // We only handle the click if the click both started and ended within us + if (hasMouseCapture()) + { + // Release the mouse + gFocusMgr.setMouseCapture( NULL ); + + // DO THIS AT THE VERY END to allow the button to be destroyed + // as a result of being clicked. If mouseup in the widget, + // it's been clicked + if (mClickedCallback && !handled) + { + mClickedCallback(); + handled = true; + } + } + + return handled; +} + +bool LLTextBox::handleHover(S32 x, S32 y, MASK mask) +{ + bool handled = LLTextBase::handleHover(x, y, mask); + if (!handled && mClickedCallback && mShowCursorHand) + { + // Clickable text boxes change the cursor to a hand + LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); + return true; + } + return handled; +} + +void LLTextBox::setEnabled(bool enabled) +{ + // just treat enabled as read-only flag + bool read_only = !enabled; + if (read_only != mReadOnly) + { + LLTextBase::setReadOnly(read_only); + updateSegments(); + } + LLTextBase::setEnabled(enabled); +} + +void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params ) +{ + // does string argument insertion + mText.assign(text); + + LLTextBase::setText(mText.getString(), input_params ); +} + +void LLTextBox::setClickedCallback( boost::function cb, void* userdata /*= NULL */ ) +{ + mClickedCallback = boost::bind(cb, userdata); +} + +S32 LLTextBox::getTextPixelWidth() +{ + return getTextBoundingRect().getWidth(); +} + +S32 LLTextBox::getTextPixelHeight() +{ + return getTextBoundingRect().getHeight(); +} + + +LLSD LLTextBox::getValue() const +{ + return getViewModel()->getValue(); +} + +bool LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) +{ + mText.setArg(key, text); + LLTextBase::setText(mText.getString()); + + return true; +} + + +void LLTextBox::reshapeToFitText(bool called_from_parent) +{ + reflow(); + + S32 width = getTextPixelWidth(); + S32 height = getTextPixelHeight(); + //consider investigating reflow() to find missing width pixel (see SL-17045 changes) + reshape( width + 2 * mHPad + 1, height + 2 * mVPad, called_from_parent ); +} + + +void LLTextBox::onUrlLabelUpdated(const std::string &url, const std::string &label) +{ + needsReflow(); +} + -- cgit v1.2.3