diff options
Diffstat (limited to 'indra/llui')
156 files changed, 3683 insertions, 3702 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 3feb989ed5..4682044d6e 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -103,7 +103,7 @@ void LLAccordionCtrl::draw() } //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::postBuild() +bool LLAccordionCtrl::postBuild() { static LLUICachedControl<S32> scrollbar_size("UIScrollbarSize", 0); @@ -127,7 +127,7 @@ BOOL LLAccordionCtrl::postBuild() mScrollbar = LLUICtrlFactory::create<LLScrollbar>(sbparams); LLView::addChild(mScrollbar); - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); mScrollbar->setFollowsRight(); mScrollbar->setFollowsTop(); mScrollbar->setFollowsBottom(); @@ -167,7 +167,7 @@ BOOL LLAccordionCtrl::postBuild() updateNoTabsHelpTextVisibility(); - return TRUE; + return true; } @@ -179,7 +179,7 @@ LLAccordionCtrl::~LLAccordionCtrl() //--------------------------------------------------------------------------------- -void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLAccordionCtrl::reshape(S32 width, S32 height, bool called_from_parent) { // adjust our rectangle LLRect rcLocal = getRect(); @@ -199,7 +199,7 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) } //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLAccordionCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { return LLPanel::handleRightMouseDown(x, y, mask); } @@ -243,7 +243,7 @@ void LLAccordionCtrl::showScrollbar(S32 width, S32 height) { bool was_visible = mScrollbar->getVisible(); - mScrollbar->setVisible(TRUE); + mScrollbar->setVisible(true); static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -265,9 +265,9 @@ void LLAccordionCtrl::showScrollbar(S32 width, S32 height) void LLAccordionCtrl::hideScrollbar(S32 width, S32 height) { - if (mScrollbar->getVisible() == FALSE) + if (!mScrollbar->getVisible()) return; - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -391,7 +391,7 @@ void LLAccordionCtrl::updateNoTabsHelpTextVisibility() } } - mNoVisibleTabsHelpText->setVisible(visible_exists ? FALSE : TRUE); + mNoVisibleTabsHelpText->setVisible(!visible_exists); } void LLAccordionCtrl::arrangeSingle() @@ -407,7 +407,7 @@ void LLAccordionCtrl::arrangeSingle() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { @@ -421,7 +421,7 @@ void LLAccordionCtrl::arrangeSingle() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { @@ -469,7 +469,7 @@ void LLAccordionCtrl::arrangeMultiple() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == FALSE) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) @@ -484,7 +484,7 @@ void LLAccordionCtrl::arrangeMultiple() if (mFitParent) { // All expanded tabs will have equal height - panel_height = calcExpandedTabHeight(i, panel_top); + panel_height = calcExpandedTabHeight(static_cast<S32>(i), panel_top); ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); // Try to make accordion tab fit accordion view height. @@ -552,24 +552,24 @@ void LLAccordionCtrl::arrange() //--------------------------------------------------------------------------------- -BOOL LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (LLPanel::handleScrollWheel(x, y, clicks)) - return TRUE; + return true; if (mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks)) - return TRUE; - return FALSE; + return true; + return false; } -BOOL LLAccordionCtrl::handleKeyHere(KEY key, MASK mask) +bool LLAccordionCtrl::handleKeyHere(KEY key, MASK mask) { if (mScrollbar->getVisible() && mScrollbar->handleKeyHere(key, mask)) - return TRUE; + return true; return LLPanel::handleKeyHere(key, mask); } -BOOL LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -577,17 +577,17 @@ BOOL LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, { // Scroll folder view if needed. Never accepts a drag or drop. *accept = ACCEPT_NO; - BOOL handled = autoScroll(x, y); + bool handled = autoScroll(x, y); if (!handled) { handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL; } - return TRUE; + return true; } -BOOL LLAccordionCtrl::autoScroll(S32 x, S32 y) +bool LLAccordionCtrl::autoScroll(S32 x, S32 y) { static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -624,7 +624,7 @@ BOOL LLAccordionCtrl::autoScroll(S32 x, S32 y) } } - return scrolling ? TRUE : FALSE; + return scrolling; } void LLAccordionCtrl::updateLayout(S32 width, S32 height) @@ -819,11 +819,11 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) } else if (info.has("child_visibility_change")) { - BOOL new_visibility = info["child_visibility_change"]; + bool new_visibility = info["child_visibility_change"]; if (new_visibility) { // there is at least one visible tab - mNoVisibleTabsHelpText->setVisible(FALSE); + mNoVisibleTabsHelpText->setVisible(false); } else { diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 2741db24e8..1dfa9100f6 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -88,12 +88,12 @@ public: LLAccordionCtrl(); virtual ~LLAccordionCtrl(); - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual BOOL handleRightMouseDown ( S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel ( S32 x, S32 y, S32 clicks ); - virtual BOOL handleKeyHere (KEY key, MASK mask); - virtual BOOL handleDragAndDrop (S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleRightMouseDown ( S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel ( S32 x, S32 y, S32 clicks ); + virtual bool handleKeyHere (KEY key, MASK mask); + virtual bool handleDragAndDrop (S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -101,7 +101,7 @@ public: // // Call reshape after changing splitter's size - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); void addCollapsibleCtrl(LLView* view); void removeCollapsibleCtrl(LLView* view); @@ -161,7 +161,7 @@ private: void showScrollbar (S32 width, S32 height); void hideScrollbar (S32 width, S32 height); - BOOL autoScroll (S32 x, S32 y); + bool autoScroll (S32 x, S32 y); /** * An adaptor for LLTabComparator diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 52893e530f..6d58a2545c 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -64,9 +64,9 @@ public: virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); - virtual BOOL postBuild(); + virtual bool postBuild(); std::string getTitle(); void setTitle(const std::string& title, const std::string& hl); @@ -79,8 +79,8 @@ public: virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -150,9 +150,9 @@ LLAccordionCtrlTab::LLAccordionCtrlTabHeader::~LLAccordionCtrlTabHeader() { } -BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() +bool LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() { - return TRUE; + return true; } std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle() @@ -202,7 +202,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() S32 height = getRect().getHeight(); F32 alpha = getCurrentTransparency(); - gl_rect_2d(0, 0, width - 1, height - 1, mHeaderBGColor.get() % alpha, TRUE); + gl_rect_2d(0, 0, width - 1, height - 1, mHeaderBGColor.get() % alpha, true); LLAccordionCtrlTab* parent = dynamic_cast<LLAccordionCtrlTab*>(getParent()); bool collapsible = parent && parent->getCollapsible(); @@ -245,7 +245,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() LLUICtrl::draw(); } -void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { S32 header_height = mHeaderTextbox->getTextPixelHeight(); @@ -276,7 +276,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseLeave(S32 x, S32 y, MA mAutoOpenTimer.stop(); } -BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, bool called_from_parent) { if ((key == KEY_LEFT || key == KEY_RIGHT) && mask == MASK_NONE) { @@ -286,8 +286,8 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleKey(KEY key, MASK mask, return LLUICtrl::handleKey(key, mask, called_from_parent); } -BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -303,7 +303,7 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 { parent->changeOpenClose(false); mAutoOpenTimer.stop(); - return TRUE; + return true; } } else @@ -380,7 +380,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) LLFocusableElement::setFocusLostCallback(boost::bind(&LLAccordionCtrlTab::deselectOnFocusLost, this)); } - reshape(100, 200,FALSE); + reshape(100, 200,false); } LLAccordionCtrlTab::~LLAccordionCtrlTab() @@ -407,11 +407,11 @@ void LLAccordionCtrlTab::setDisplayChildren(bool display) else { if (mScrollbar) - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); } } -void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLAccordionCtrlTab::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { LLRect headerRect; @@ -439,14 +439,14 @@ void LLAccordionCtrlTab::changeOpenClose(bool is_open) mExpandedHeight = getRect().getHeight(); setDisplayChildren(!is_open); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + reshape(getRect().getWidth(), getRect().getHeight(), false); if (mCommitSignal) { (*mCommitSignal)(this, getDisplayChildren()); } } -void LLAccordionCtrlTab::onVisibilityChange(BOOL new_visibility) +void LLAccordionCtrlTab::onVisibilityChange(bool new_visibility) { LLUICtrl::onVisibilityChange(new_visibility); @@ -482,7 +482,7 @@ void LLAccordionCtrlTab::onUpdateScrollToChild(const LLUICtrl *cntrl) LLUICtrl::onUpdateScrollToChild(cntrl); } -BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) { if (mCollapsible && mHeaderVisible && mCanOpenClose) { @@ -493,13 +493,13 @@ BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) // Reset stored state mWasStateStored = false; - return TRUE; + return true; } } return LLUICtrl::handleMouseDown(x,y,mask); } -BOOL LLAccordionCtrlTab::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLAccordionCtrlTab::handleMouseUp(S32 x, S32 y, MASK mask) { return LLUICtrl::handleMouseUp(x,y,mask); } @@ -643,14 +643,14 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value) if (mHeader) { - mHeader->setVisible(value ? TRUE : FALSE); + mHeader->setVisible(value); } - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + reshape(getRect().getWidth(), getRect().getHeight(), false); }; //virtual -BOOL LLAccordionCtrlTab::postBuild() +bool LLAccordionCtrlTab::postBuild() { if (mHeader) { @@ -812,7 +812,7 @@ S32 LLAccordionCtrlTab::notify(const LLSD& info) return 0; } -BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLAccordionCtrlTab::handleKey(KEY key, MASK mask, bool called_from_parent) { if (!mHeader->hasFocus()) return LLUICtrl::handleKey(key, mask, called_from_parent); @@ -820,7 +820,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) if ((key == KEY_RETURN) && mask == MASK_NONE) { changeOpenClose(getDisplayChildren()); - return TRUE; + return true; } if ((key == KEY_ADD || key == KEY_RIGHT) && mask == MASK_NONE) @@ -828,7 +828,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) if (!getDisplayChildren()) { changeOpenClose(getDisplayChildren()); - return TRUE; + return true; } } @@ -837,7 +837,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) if (getDisplayChildren()) { changeOpenClose(getDisplayChildren()); - return TRUE; + return true; } } @@ -853,7 +853,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) { getAccordionView()->notify(LLSD().with("action", "select_first")); } - return TRUE; + return true; } if (key == KEY_UP && mask == MASK_NONE) @@ -862,7 +862,7 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) // we're processing notifyParent so let call parent directly getParent()->notifyParent(LLSD().with("action", "select_prev")); - return TRUE; + return true; } return LLUICtrl::handleKey(key, mask, called_from_parent); @@ -992,10 +992,10 @@ void LLAccordionCtrlTab::hideScrollbar(const LLRect& child_rect) if (!mContainerPanel || !mScrollbar) return; - if (mScrollbar->getVisible() == FALSE) + if (!mScrollbar->getVisible()) return; - mScrollbar->setVisible(FALSE); + mScrollbar->setVisible(false); mScrollbar->setDocPos(0); //shrink child panel @@ -1097,7 +1097,7 @@ void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, panel->setRect(panel_rect); } -BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) +bool LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) { //header may be not the first child but we need to process it first if (y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT / 2)) @@ -1105,22 +1105,22 @@ BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) //inside tab header //fix for EXT-6619 mHeader->handleToolTip(x, y, mask); - return TRUE; + return true; } return LLUICtrl::handleToolTip(x, y, mask); } -BOOL LLAccordionCtrlTab::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLAccordionCtrlTab::handleScrollWheel(S32 x, S32 y, S32 clicks) { if (LLUICtrl::handleScrollWheel(x, y, clicks)) { - return TRUE; + return true; } if (mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks)) { - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index f01fff2519..cf3569683e 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -134,7 +134,7 @@ public: void canOpenClose(bool can_open_close) { mCanOpenClose = can_open_close; }; bool canOpenClose() const { return mCanOpenClose; }; - virtual BOOL postBuild(); + virtual bool postBuild(); S32 notifyParent(const LLSD& info); S32 notify(const LLSD& info); @@ -153,22 +153,22 @@ protected: public: // Call reshape after changing size - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); /** * Raises notifyParent event with "child_visibility_change" = new_visibility */ - void onVisibilityChange(BOOL new_visibility); + void onVisibilityChange(bool new_visibility); virtual void onUpdateScrollToChild(const LLUICtrl * cntrl); // Changes expand/collapse state and triggers expand/collapse callbacks - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual bool addChild(LLView* child, S32 tab_group = 0 ); diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 847aefafb3..55fbd72165 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -36,7 +36,7 @@ static LLDefaultChildRegistry::Register<LLBadge> r("badge"); static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF; // Compiler optimization, generate extern template -template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const; +template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const; LLBadge::Params::Params() @@ -239,7 +239,7 @@ void LLBadge::draw() S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; F32 *right_position_out = NULL; - BOOL do_not_use_ellipses = false; + bool do_not_use_ellipses = false; F32 badge_width = (2.0f * mPaddingHoriz) + mGLFont->getWidthF32(badge_label_wstring.c_str(), badge_label_begin_offset, badge_char_length); diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 59296ffe86..a6d584c6d7 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -171,7 +171,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLBADGE_CPP -extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const; +extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const; #endif #endif // LL_LLBADGE_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 16b58dcc5b..e6c045250e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -56,7 +56,7 @@ static LLDefaultChildRegistry::Register<LLButton> r("button"); // Compiler optimization, generate extern template template class LLButton* LLView::getChild<class LLButton>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; // globals S32 LLBUTTON_H_PAD = 4; @@ -124,10 +124,10 @@ LLButton::LLButton(const LLButton::Params& p) LLBadgeOwner(getHandle()), mMouseDownFrame(0), mMouseHeldDownCount(0), - mBorderEnabled( FALSE ), - mFlashing( FALSE ), + mBorderEnabled( false ), + mFlashing( false ), mCurGlowStrength(0.f), - mNeedsHighlight(FALSE), + mNeedsHighlight(false), mUnselectedLabel(p.label()), mSelectedLabel(p.label_selected()), mGLFont(p.font), @@ -170,7 +170,7 @@ LLButton::LLButton(const LLButton::Params& p) mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mCommitOnCaptureLost(p.commit_on_capture_lost), - mFadeWhenDisabled(FALSE), + mFadeWhenDisabled(false), mForcePressedState(false), mDisplayPressedState(p.display_pressed_state), mLastDrawCharsCount(0), @@ -223,7 +223,7 @@ LLButton::LLButton(const LLButton::Params& p) if (p.image_disabled() == default_params.image_disabled() ) { mImageDisabled = p.image_unselected; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } if (p.image_pressed_selected == default_params.image_pressed_selected) @@ -239,7 +239,7 @@ LLButton::LLButton(const LLButton::Params& p) if (p.image_disabled_selected() == default_params.image_disabled_selected()) { mImageDisabledSelected = p.image_selected; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } if (p.image_pressed == default_params.image_pressed) @@ -387,7 +387,7 @@ boost::signals2::connection LLButton::setHeldDownCallback( button_callback_t cb, return setHeldDownCallback(boost::bind(cb, data)); } -BOOL LLButton::postBuild() +bool LLButton::postBuild() { autoResize(); @@ -396,9 +396,9 @@ BOOL LLButton::postBuild() return LLUICtrl::postBuild(); } -BOOL LLButton::handleUnicodeCharHere(llwchar uni_char) +bool LLButton::handleUnicodeCharHere(llwchar uni_char) { - BOOL handled = FALSE; + bool handled = false; if(' ' == uni_char && !gKeyboard->getKeyRepeated(' ')) { @@ -409,14 +409,14 @@ BOOL LLButton::handleUnicodeCharHere(llwchar uni_char) LLUICtrl::onCommit(); - handled = TRUE; + handled = true; } return handled; } -BOOL LLButton::handleKeyHere(KEY key, MASK mask ) +bool LLButton::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( mCommitOnReturn && KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key)) { if (mIsToggle) @@ -424,7 +424,7 @@ BOOL LLButton::handleKeyHere(KEY key, MASK mask ) toggleState(); } - handled = TRUE; + handled = true; LLUICtrl::onCommit(); } @@ -432,7 +432,7 @@ BOOL LLButton::handleKeyHere(KEY key, MASK mask ) } -BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLButton::handleMouseDown(S32 x, S32 y, MASK mask) { if (!childrenHandleMouseDown(x, y, mask)) { @@ -441,7 +441,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) if (hasTabStop() && !getIsChrome()) { - setFocus(TRUE); + setFocus(true); } if (!mFunctionName.empty()) @@ -472,11 +472,11 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) make_ui_sound("UISndClick"); } } - return TRUE; + return true; } -BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLButton::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -521,10 +521,10 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) childrenHandleMouseUp(x, y, mask); } - return TRUE; + return true; } -BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mHandleRightMouse && !childrenHandleRightMouseDown(x, y, mask)) { @@ -533,7 +533,7 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) if (hasTabStop() && !getIsChrome()) { - setFocus(TRUE); + setFocus(true); } // if (pointInView(x, y)) @@ -546,10 +546,10 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) // if they are not mouse opaque. } - return TRUE; + return true; } -BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) { if (mHandleRightMouse) { @@ -575,14 +575,14 @@ BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) // but this might change the mouse handling of existing buttons in a bad way. // if they are not mouse opaque. } - return TRUE; + return true; } void LLButton::onMouseLeave(S32 x, S32 y, MASK mask) { LLUICtrl::onMouseLeave(x, y, mask); - mNeedsHighlight = FALSE; + mNeedsHighlight = false; } void LLButton::setHighlight(bool b) @@ -590,11 +590,11 @@ void LLButton::setHighlight(bool b) mNeedsHighlight = b; } -BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) +bool LLButton::handleHover(S32 x, S32 y, MASK mask) { if (isInEnabledChain() && (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this)) - mNeedsHighlight = TRUE; + mNeedsHighlight = true; if (!childrenHandleHover(x, y, mask)) { @@ -613,7 +613,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << LL_ENDL; } - return TRUE; + return true; } void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) @@ -633,7 +633,7 @@ void LLButton::draw() static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::getInstance()->mSettingGroups["config"], "EnableButtonFlashing", true); F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); - bool pressed_by_keyboard = FALSE; + bool pressed_by_keyboard = false; if (hasFocus()) { pressed_by_keyboard = gKeyboard->getKeyDown(' ') || (mCommitOnReturn && gKeyboard->getKeyDown(KEY_RETURN)); @@ -655,7 +655,7 @@ void LLButton::draw() || mForcePressedState; bool selected = getToggleState(); - bool use_glow_effect = FALSE; + bool use_glow_effect = false; LLColor4 highlighting_color = LLColor4::white; LLColor4 glow_color = LLColor4::white; LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; @@ -687,7 +687,7 @@ void LLButton::draw() else { imagep = mImageSelected; - use_glow_effect = TRUE; + use_glow_effect = true; } } else @@ -699,7 +699,7 @@ void LLButton::draw() else { imagep = mImageUnselected; - use_glow_effect = TRUE; + use_glow_effect = true; } } } @@ -741,7 +741,7 @@ void LLButton::draw() if (mFlashingTimer) { LLColor4 flash_color = mFlashBgColor.get(); - use_glow_effect = TRUE; + use_glow_effect = true; glow_type = LLRender::BT_ALPHA; // blend the glow if (mFlashingTimer->isCurrentlyHighlighted() || !mFlashingTimer->isFlashingInProgress()) @@ -762,7 +762,7 @@ void LLButton::draw() if (mNeedsHighlight && !imagep) { - use_glow_effect = TRUE; + use_glow_effect = true; } // Figure out appropriate color for the text @@ -850,7 +850,7 @@ void LLButton::draw() // no image LL_DEBUGS() << "No image for button " << getName() << LL_ENDL; // draw it in pink so we can find it - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1 % alpha, FALSE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1 % alpha, false); } // let overlay image and text play well together @@ -984,12 +984,12 @@ void LLButton::drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size) } } -BOOL LLButton::getToggleState() const +bool LLButton::getToggleState() const { return getValue().asBoolean(); } -void LLButton::setToggleState(BOOL b) +void LLButton::setToggleState(bool b) { if( b != getToggleState() ) { @@ -1016,7 +1016,7 @@ void LLButton::setFlashing(bool b, bool force_flashing/* = false */) } } -BOOL LLButton::toggleState() +bool LLButton::toggleState() { bool flipped = ! getToggleState(); setToggleState(flipped); @@ -1041,11 +1041,11 @@ void LLButton::setLabel( const LLStringExplicit& label ) } //virtual -BOOL LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mUnselectedLabel.setArg(key, text); mSelectedLabel.setArg(key, text); - return TRUE; + return true; } void LLButton::setLabelUnselected( const LLStringExplicit& label ) @@ -1143,14 +1143,14 @@ void LLButton::setImageDisabled(LLPointer<LLUIImage> image) { mImageDisabled = image; mDisabledImageColor = mImageColor; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } void LLButton::setImageDisabledSelected(LLPointer<LLUIImage> image) { mImageDisabledSelected = image; mDisabledImageColor = mImageColor; - mFadeWhenDisabled = TRUE; + mFadeWhenDisabled = true; } void LLButton::setImagePressed(LLPointer<LLUIImage> image) @@ -1243,11 +1243,11 @@ void LLButton::addImageAttributeToXML(LLXMLNodePtr node, { if( !image_name.empty() ) { - node->createChild(xml_tag_name.c_str(), TRUE)->setStringValue(image_name); + node->createChild(xml_tag_name.c_str(), true)->setStringValue(image_name); } else if( image_id != LLUUID::null ) { - node->createChild((xml_tag_name + "_id").c_str(), TRUE)->setUUIDValue(image_id); + node->createChild((xml_tag_name + "_id").c_str(), true)->setUUIDValue(image_id); } } @@ -1314,7 +1314,7 @@ void LLButton::resetMouseDownTimer() mMouseDownTimer.reset(); } -BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLButton::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 8ac42596e4..fed5cdcc50 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -156,16 +156,16 @@ public: void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName, const LLUUID& imageID,const std::string& xmlTagName) const; - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); virtual void draw(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void onMouseCaptureLost(); @@ -174,8 +174,8 @@ public: void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; } void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; } - void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } - void setUseFontColor( BOOL use_font_color) { mUseFontColor = use_font_color; } + void setUseEllipses( bool use_ellipses ) { mUseEllipses = use_ellipses; } + void setUseFontColor( bool use_font_color) { mUseFontColor = use_font_color; } boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb); @@ -200,13 +200,13 @@ public: F32 getHeldDownTime() const { return mMouseDownTimer.getElapsedTimeF32(); } - BOOL toggleState(); - BOOL getToggleState() const; - void setToggleState(BOOL b); + bool toggleState(); + bool getToggleState() const; + void setToggleState(bool b); void setHighlight(bool b); void setFlashing( bool b, bool force_flashing = false ); - BOOL getFlashing() const { return mFlashing; } + bool getFlashing() const { return mFlashing; } LLFlashTimer* getFlashTimer() {return mFlashingTimer;} void setFlashColor(const LLUIColor &color) { mFlashBgColor = color; }; @@ -243,7 +243,7 @@ public: void setLabel(const std::string& label); void setLabel(const LLUIString& label); void setLabel( const LLStringExplicit& label); - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); void setLabelUnselected(const LLStringExplicit& label); void setLabelSelected(const LLStringExplicit& label); void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; } @@ -257,12 +257,12 @@ public: bool labelIsTruncated() const; const LLUIString& getCurrentLabel() const; - void setScaleImage(BOOL scale) { mScaleImage = scale; } - BOOL getScaleImage() const { return mScaleImage; } + void setScaleImage(bool scale) { mScaleImage = scale; } + bool getScaleImage() const { return mScaleImage; } - void setDropShadowedText(BOOL b) { mDropShadowedText = b; } + void setDropShadowedText(bool b) { mDropShadowedText = b; } - void setBorderEnabled(BOOL b) { mBorderEnabled = b; } + void setBorderEnabled(bool b) { mBorderEnabled = b; } void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; } @@ -275,8 +275,8 @@ public: void setImageFlash(LLPointer<LLUIImage> image); void setImagePressed(LLPointer<LLUIImage> image); - void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } - BOOL getCommitOnReturn() const { return mCommitOnReturn; } + void setCommitOnReturn(bool commit) { mCommitOnReturn = commit; } + bool getCommitOnReturn() const { return mCommitOnReturn; } static void onHeldDown(void *userdata); // to be called by gIdleCallbacks static void toggleFloaterAndSetToggleState(LLUICtrl* ctrl, const LLSD& sdname); @@ -400,7 +400,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLBUTTON_CPP extern template class LLButton* LLView::getChild<class LLButton>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LLBUTTON_H diff --git a/indra/llui/llchat.h b/indra/llui/llchat.h index 56105add7e..5f75ed2f8d 100644 --- a/indra/llui/llchat.h +++ b/indra/llui/llchat.h @@ -83,7 +83,7 @@ public: mSourceType(CHAT_SOURCE_AGENT), mChatType(CHAT_TYPE_NORMAL), mAudible(CHAT_AUDIBLE_FULLY), - mMuted(FALSE), + mMuted(false), mTime(0.0), mTimeStr(), mPosAgent(), @@ -100,7 +100,7 @@ public: EChatSourceType mSourceType; EChatType mChatType; EChatAudible mAudible; - BOOL mMuted; // pass muted chat to maintain list of chatters + bool mMuted; // pass muted chat to maintain list of chatters F64 mTime; // viewer only, seconds from viewer start std::string mTimeStr; LLVector3 mPosAgent; diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index 8a8b9e7461..da5afd0386 100644 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -176,9 +176,9 @@ void LLChatEntry::onFocusLost() LLUICtrl::onFocusLost(); } -BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) +bool LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { - BOOL handled = FALSE; + bool handled = false; LLTextEditor::handleSpecialKey(key, mask); @@ -203,7 +203,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; @@ -227,7 +227,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; diff --git a/indra/llui/llchatentry.h b/indra/llui/llchatentry.h index f7473b320d..5621ede1e7 100644 --- a/indra/llui/llchatentry.h +++ b/indra/llui/llchatentry.h @@ -84,7 +84,7 @@ private: */ void updateHistory(); - BOOL handleSpecialKey(const KEY key, const MASK mask); + bool handleSpecialKey(const KEY key, const MASK mask); // Fired when text height expanded to mExpandLinesCount diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 8ba37a8075..3bcf0a6517 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -45,7 +45,7 @@ static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box"); // Compiler optimization, generate extern template template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; void LLCheckBoxCtrl::WordWrap::declareValues() { @@ -77,7 +77,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p) static LLUICachedControl<S32> llcheckboxctrl_vpad ("UICheckboxctrlVPad", 0); // must be big enough to hold all children - setUseBoundingRect(TRUE); + setUseBoundingRect(true); // *HACK Get rid of this with SL-55508... // this allows blank check boxes and radio boxes for now @@ -160,13 +160,13 @@ void LLCheckBoxCtrl::onCommit() { if( getEnabled() ) { - setTentative(FALSE); + setTentative(false); setControlValue(getValue()); LLUICtrl::onCommit(); } } -void LLCheckBoxCtrl::setEnabled(BOOL b) +void LLCheckBoxCtrl::setEnabled(bool b) { LLView::setEnabled(b); @@ -182,10 +182,10 @@ void LLCheckBoxCtrl::setEnabled(BOOL b) void LLCheckBoxCtrl::clear() { - setValue( FALSE ); + setValue( false ); } -void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLCheckBoxCtrl::reshape(S32 width, S32 height, bool called_from_parent) { LLRect rect = getRect(); S32 delta_width = width - rect.getWidth(); @@ -205,10 +205,10 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) LLRect label_rect = mLabel->getRect(); S32 new_width = rect.getWidth() - label_rect.mLeft; - mLabel->reshape(new_width, label_rect.getHeight(), TRUE); + mLabel->reshape(new_width, label_rect.getHeight(), true); S32 label_top = label_rect.mTop; - mLabel->reshapeToFitText(TRUE); + mLabel->reshapeToFitText(true); label_rect = mLabel->getRect(); if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN) @@ -247,13 +247,13 @@ LLSD LLCheckBoxCtrl::getValue() const } //virtual -void LLCheckBoxCtrl::setTentative(BOOL b) +void LLCheckBoxCtrl::setTentative(bool b) { mButton->setTentative(b); } //virtual -BOOL LLCheckBoxCtrl::getTentative() const +bool LLCheckBoxCtrl::getTentative() const { return mButton->getTentative(); } @@ -261,7 +261,7 @@ BOOL LLCheckBoxCtrl::getTentative() const void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label ) { mLabel->setText( label ); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + reshape(getRect().getWidth(), getRect().getHeight(), false); } std::string LLCheckBoxCtrl::getLabel() const @@ -269,10 +269,10 @@ std::string LLCheckBoxCtrl::getLabel() const return mLabel->getText(); } -BOOL LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - BOOL res = mLabel->setTextArg(key, text); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); + bool res = mLabel->setTextArg(key, text); + reshape(getRect().getWidth(), getRect().getHeight(), false); return res; } @@ -283,14 +283,14 @@ void LLCheckBoxCtrl::setControlName(const std::string& control_name, LLView* con } -// virtual Returns TRUE if the user has modified this control. -BOOL LLCheckBoxCtrl::isDirty() const +// virtual Returns true if the user has modified this control. +bool LLCheckBoxCtrl::isDirty() const { if ( mButton ) { return mButton->isDirty(); } - return FALSE; // Shouldn't get here + return false; // Shouldn't get here } diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index f2b61db308..3058e946c3 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -36,8 +36,8 @@ // Constants // -const BOOL RADIO_STYLE = TRUE; -const BOOL CHECK_STYLE = FALSE; +const bool RADIO_STYLE = true; +const bool CHECK_STYLE = false; // // Classes @@ -87,28 +87,28 @@ protected: public: // LLView interface - virtual void setEnabled( BOOL b ); + virtual void setEnabled( bool b ); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); // LLUICtrl interface virtual void setValue(const LLSD& value ); virtual LLSD getValue() const; - BOOL get() { return (BOOL)getValue().asBoolean(); } - void set(BOOL value) { setValue(value); } + bool get() { return (bool)getValue().asBoolean(); } + void set(bool value) { setValue(value); } - virtual void setTentative(BOOL b); - virtual BOOL getTentative() const; + virtual void setTentative(bool b); + virtual bool getTentative() const; - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void clear(); virtual void onCommit(); // LLCheckBoxCtrl interface - virtual BOOL toggle() { return mButton->toggleState(); } // returns new state + virtual bool toggle() { return mButton->toggleState(); } // returns new state - void setBtnFocus() { mButton->setFocus(TRUE); } + void setBtnFocus() { mButton->setFocus(true); } void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; } void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; } @@ -121,7 +121,7 @@ public: virtual void setControlName(const std::string& control_name, LLView* context); - virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. + virtual bool isDirty() const; // Returns true if the user has modified this control. virtual void resetDirty(); // Clear dirty state protected: @@ -151,7 +151,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLCHECKBOXCTRL_CPP extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LLCHECKBOXCTRL_H diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 5132d33bbf..64896ccfcb 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -73,7 +73,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ if (LLAssetType::lookupIsAssetIDKnowable(type)) { LLWString source = utf8str_to_wstring(src.asString()); - res = addToClipboard(source, 0, source.size()); + res = addToClipboard(source, 0, static_cast<S32>(source.size())); } if (res) { @@ -87,13 +87,13 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const { bool res = false; - S32 count = mObjects.size(); + auto count = mObjects.size(); inv_objects.reserve(inv_objects.size() + count); if (count > 0) { res = true; inv_objects.clear(); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { inv_objects.push_back(mObjects[i]); } diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 71dd93d07d..79dce1c714 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -171,13 +171,13 @@ void LLComboBox::initFromParams(const LLComboBox::Params& p) } // virtual -BOOL LLComboBox::postBuild() +bool LLComboBox::postBuild() { if (mControlVariable) { setValue(mControlVariable->getValue()); // selects the appropriate item } - return TRUE; + return true; } @@ -212,16 +212,16 @@ void LLComboBox::onCommit() // we have selected an existing item, blitz the manual text entry with // the properly capitalized item mTextEntry->setValue(getSimple()); - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); } setControlValue(getValue()); LLUICtrl::onCommit(); } // virtual -BOOL LLComboBox::isDirty() const +bool LLComboBox::isDirty() const { - BOOL grubby = FALSE; + bool grubby = false; if ( mList ) { grubby = mList->isDirty(); @@ -244,7 +244,7 @@ bool LLComboBox::itemExists(const std::string& name) } // add item "name" to menu -LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOOL enabled) +LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, bool enabled) { LLScrollListItem* item = mList->addSimpleElement(name, pos); item->setEnabled(enabled); @@ -263,7 +263,7 @@ LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOO } // add item "name" with a unique id to menu -LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAddPosition pos, bool enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos, id); item->setEnabled(enabled); @@ -282,7 +282,7 @@ LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAd } // add item "name" with attached userdata -LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddPosition pos, bool enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos); item->setEnabled(enabled); @@ -302,7 +302,7 @@ LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddP } // add item "name" with attached generic data -LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosition pos, BOOL enabled ) +LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosition pos, bool enabled ) { LLScrollListItem* item = mList->addSimpleElement(name, pos, value); item->setEnabled(enabled); @@ -325,17 +325,17 @@ LLScrollListItem* LLComboBox::addSeparator(EAddPosition pos) return mList->addSeparator(pos); } -void LLComboBox::sortByName(BOOL ascending) +void LLComboBox::sortByName(bool ascending) { mList->sortOnce(0, ascending); } // Choose an item with a given name in the menu. -// Returns TRUE if the item was found. -BOOL LLComboBox::setSimple(const LLStringExplicit& name) +// Returns true if the item was found. +bool LLComboBox::setSimple(const LLStringExplicit& name) { - BOOL found = mList->selectItemByLabel(name, FALSE); + bool found = mList->selectItemByLabel(name, false); if (found) { @@ -349,7 +349,7 @@ BOOL LLComboBox::setSimple(const LLStringExplicit& name) // virtual void LLComboBox::setValue(const LLSD& value) { - BOOL found = mList->selectByValue(value); + bool found = mList->selectByValue(value); if (found) { LLScrollListItem* item = mList->getFirstSelected(); @@ -406,9 +406,9 @@ void LLComboBox::setLabel(const LLStringExplicit& name) if ( mTextEntry ) { mTextEntry->setText(name); - if (mList->selectItemByLabel(name, FALSE)) + if (mList->selectItemByLabel(name, false)) { - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); mLastSelectedIndex = mList->getFirstSelectedIndex(); } else @@ -430,7 +430,7 @@ void LLComboBox::updateLabel() if (mTextEntry) { mTextEntry->setText(getSelectedItemLabel()); - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); } // If combo box doesn't allow text entry update @@ -441,9 +441,9 @@ void LLComboBox::updateLabel() } } -BOOL LLComboBox::remove(const std::string& name) +bool LLComboBox::remove(const std::string& name) { - BOOL found = mList->selectItemByLabel(name); + bool found = mList->selectItemByLabel(name); if (found) { @@ -458,15 +458,15 @@ BOOL LLComboBox::remove(const std::string& name) return found; } -BOOL LLComboBox::remove(S32 index) +bool LLComboBox::remove(S32 index) { if (index < mList->getItemCount()) { mList->deleteSingleItem(index); setLabel(getSelectedItemLabel()); - return TRUE; + return true; } - return FALSE; + return false; } // Keyboard focus lost. @@ -482,7 +482,7 @@ void LLComboBox::onFocusLost() LLUICtrl::onFocusLost(); } -void LLComboBox::setButtonVisible(BOOL visible) +void LLComboBox::setButtonVisible(bool visible) { mButton->setVisible(visible); if (mTextEntry) @@ -494,13 +494,13 @@ void LLComboBox::setButtonVisible(BOOL visible) text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * BTN_DROP_SHADOW; } //mTextEntry->setRect(text_entry_rect); - mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); + mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), true); } } -BOOL LLComboBox::setCurrentByIndex( S32 index ) +bool LLComboBox::setCurrentByIndex( S32 index ) { - BOOL found = mList->selectNthItem( index ); + bool found = mList->selectNthItem( index ); if (found) { setLabel(getSelectedItemLabel()); @@ -519,7 +519,7 @@ S32 LLComboBox::getCurrentIndex() const return -1; } -void LLComboBox::setEnabledByValue(const LLSD& value, BOOL enabled) +void LLComboBox::setEnabledByValue(const LLSD& value, bool enabled) { LLScrollListItem *found = mList->getItem(value); if (found) @@ -537,7 +537,7 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) S32 shadow_size = BTN_DROP_SHADOW; mButton->setRect(LLRect( getRect().getWidth() - llmax(8,arrow_width) - 2 * shadow_size, rect.mTop, rect.mRight, rect.mBottom)); - mButton->setTabStop(FALSE); + mButton->setTabStop(false); mButton->setHAlign(LLFontGL::HCENTER); LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); @@ -555,7 +555,7 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) params.label(mLabel); mTextEntry = LLUICtrlFactory::create<LLLineEditor> (params); mTextEntry->setText(cur_label); - mTextEntry->setIgnoreTab(TRUE); + mTextEntry->setIgnoreTab(true); addChild(mTextEntry); // clear label on button @@ -570,7 +570,7 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) if (mTextEntry) { - mTextEntry->setVisible(FALSE); + mTextEntry->setVisible(false); } } } @@ -674,15 +674,15 @@ void LLComboBox::showList() // NB: this call will trigger the focuslost callback which will hide the list, so do it first // before finally showing the list - mList->setFocus(TRUE); + mList->setFocus(true); // Show the list and push the button down - mButton->setToggleState(TRUE); - mList->setVisible(TRUE); + mButton->setToggleState(true); + mList->setVisible(true); LLUI::getInstance()->addPopup(this); - setUseBoundingRect(TRUE); + setUseBoundingRect(true); // updateBoundingRect(); } @@ -701,11 +701,11 @@ void LLComboBox::hideList() else if(mLastSelectedIndex >= 0) mList->selectNthItem(mLastSelectedIndex); - mButton->setToggleState(FALSE); - mList->setVisible(FALSE); + mButton->setToggleState(false); + mList->setVisible(false); mList->mouseOverHighlightNthItem(-1); - setUseBoundingRect(FALSE); + setUseBoundingRect(false); LLUI::getInstance()->removePopup(this); // updateBoundingRect(); } @@ -731,7 +731,7 @@ void LLComboBox::onButtonMouseDown() showList(); } - setFocus( TRUE ); + setFocus( true ); // pass mouse capture on to list if button is depressed if (mButton->hasMouseCapture()) @@ -781,13 +781,13 @@ void LLComboBox::onItemSelected(const LLSD& data) onCommit(); } -BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) +bool LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) { std::string tool_tip; if(LLUICtrl::handleToolTip(x, y, mask)) { - return TRUE; + return true; } tool_tip = getToolTip(); @@ -802,19 +802,19 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) .message(tool_tip) .sticky_rect(calcScreenRect())); } - return TRUE; + return true; } -BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) +bool LLComboBox::handleKeyHere(KEY key, MASK mask) { - BOOL result = FALSE; + bool result = false; if (hasFocus()) { if (mList->getVisible() && key == KEY_ESCAPE && mask == MASK_NONE) { hideList(); - return TRUE; + return true; } //give list a chance to pop up and handle key LLScrollListItem* last_selected_item = mList->getLastSelectedItem(); @@ -837,7 +837,7 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) // don't show list and don't eat key input when committing // free-form text entry with RETURN since user already knows // what they are trying to select - return FALSE; + return false; } // if selection has changed, pop open list else if (mList->getLastSelectedItem() != last_selected_item @@ -851,9 +851,9 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) return result; } -BOOL LLComboBox::handleUnicodeCharHere(llwchar uni_char) +bool LLComboBox::handleUnicodeCharHere(llwchar uni_char) { - BOOL result = FALSE; + bool result = false; if (gFocusMgr.childHasKeyboardFocus(this)) { // space bar just shows the list @@ -880,12 +880,12 @@ void LLComboBox::setTextEntry(const LLStringExplicit& text) if (mTextEntry) { mTextEntry->setText(text); - mHasAutocompletedText = FALSE; + mHasAutocompletedText = false; updateSelection(); } } -void LLComboBox::setKeystrokeOnEsc(BOOL enable) +void LLComboBox::setKeystrokeOnEsc(bool enable) { if (mTextEntry) { @@ -904,9 +904,9 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) if (key == KEY_BACKSPACE || key == KEY_DELETE) { - if (mList->selectItemByLabel(line_editor->getText(), FALSE)) + if (mList->selectItemByLabel(line_editor->getText(), false)) { - line_editor->setTentative(FALSE); + line_editor->setTentative(false); mLastSelectedIndex = mList->getFirstSelectedIndex(); } else @@ -941,7 +941,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) } } line_editor->selectAll(); - line_editor->setTentative(FALSE); + line_editor->setTentative(false); } else if (key == KEY_UP) { @@ -956,7 +956,7 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor) } } line_editor->selectAll(); - line_editor->setTentative(FALSE); + line_editor->setTentative(false); } else { @@ -985,20 +985,20 @@ void LLComboBox::updateSelection() prearrangeList(mTextEntry->getText()); } - if (mList->selectItemByLabel(full_string, FALSE)) + if (mList->selectItemByLabel(full_string, false)) { - mTextEntry->setTentative(FALSE); + mTextEntry->setTentative(false); mLastSelectedIndex = mList->getFirstSelectedIndex(); } - else if (mList->selectItemByPrefix(left_wstring, FALSE)) + else if (mList->selectItemByPrefix(left_wstring, false)) { LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); - mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); + mTextEntry->setSelection(static_cast<S32>(left_wstring.size()), static_cast<S32>(mTextEntry->getWText().size())); mTextEntry->endSelection(); - mTextEntry->setTentative(FALSE); - mHasAutocompletedText = TRUE; + mTextEntry->setTentative(false); + mHasAutocompletedText = true; mLastSelectedIndex = mList->getFirstSelectedIndex(); } else // no matching items found @@ -1006,7 +1006,7 @@ void LLComboBox::updateSelection() mList->deselectAllItems(); mTextEntry->setText(wstring_to_utf8str(user_wstring)); // removes text added by autocompletion mTextEntry->setTentative(mTextEntryTentative); - mHasAutocompletedText = FALSE; + mHasAutocompletedText = false; mLastSelectedIndex = -1; } } @@ -1019,7 +1019,7 @@ void LLComboBox::onTextCommit(const LLSD& data) mTextEntry->selectAll(); } -void LLComboBox::setFocus(BOOL b) +void LLComboBox::setFocus(bool b) { LLUICtrl::setFocus(b); @@ -1028,7 +1028,7 @@ void LLComboBox::setFocus(BOOL b) mList->clearSearchString(); if (mList->getVisible()) { - mList->setFocus(TRUE); + mList->setFocus(true); } } } @@ -1094,7 +1094,7 @@ void LLComboBox::imageLoaded() { LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); text_entry_rect.mRight -= llmax(8, arrow_width) + 2 * BTN_DROP_SHADOW; - mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); + mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), true); } } } @@ -1139,7 +1139,7 @@ void LLComboBox::clearRows() mList->clearRows(); } -void LLComboBox::sortByColumn(const std::string& name, BOOL ascending) +void LLComboBox::sortByColumn(const std::string& name, bool ascending) { mList->sortByColumn(name, ascending); } @@ -1147,9 +1147,9 @@ void LLComboBox::sortByColumn(const std::string& name, BOOL ascending) //============================================================================ //LLCtrlSelectionInterface functions -BOOL LLComboBox::setCurrentByID(const LLUUID& id) +bool LLComboBox::setCurrentByID(const LLUUID& id) { - BOOL found = mList->selectByID( id ); + bool found = mList->selectByID( id ); if (found) { @@ -1164,9 +1164,9 @@ LLUUID LLComboBox::getCurrentID() const { return mList->getStringUUIDSelectedItem(); } -BOOL LLComboBox::setSelectedByValue(const LLSD& value, BOOL selected) +bool LLComboBox::setSelectedByValue(const LLSD& value, bool selected) { - BOOL found = mList->setSelectedByValue(value, selected); + bool found = mList->setSelectedByValue(value, selected); if (found) { setLabel(getSelectedItemLabel()); @@ -1179,32 +1179,32 @@ LLSD LLComboBox::getSelectedValue() return mList->getSelectedValue(); } -BOOL LLComboBox::isSelected(const LLSD& value) const +bool LLComboBox::isSelected(const LLSD& value) const { return mList->isSelected(value); } -BOOL LLComboBox::operateOnSelection(EOperation op) +bool LLComboBox::operateOnSelection(EOperation op) { if (op == OP_DELETE) { mList->deleteSelectedItems(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLComboBox::operateOnAll(EOperation op) +bool LLComboBox::operateOnAll(EOperation op) { if (op == OP_DELETE) { clearRows(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLComboBox::selectItemRange( S32 first, S32 last ) +bool LLComboBox::selectItemRange( S32 first, S32 last ) { return mList->selectItemRange(first, last); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 93382a1022..cc1c2885fc 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -94,7 +94,7 @@ public: virtual ~LLComboBox(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); protected: friend class LLUICtrlFactory; @@ -111,18 +111,18 @@ public: // LLView interface virtual void onFocusLost(); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); // LLUICtrl interface virtual void clear(); // select nothing virtual void onCommit(); - virtual BOOL acceptsTextInput() const { return mAllowTextEntry; } - virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. + virtual bool acceptsTextInput() const { return mAllowTextEntry; } + virtual bool isDirty() const; // Returns true if the user has modified this control. virtual void resetDirty(); // Clear dirty state - virtual void setFocus(BOOL b); + virtual void setFocus(bool b); // Selects item by underlying LLSD value, using LLSD::asString() matching. // For simple items, this is just the name of the label. @@ -133,21 +133,21 @@ public: virtual LLSD getValue() const; void setTextEntry(const LLStringExplicit& text); - void setKeystrokeOnEsc(BOOL enable); + void setKeystrokeOnEsc(bool enable); - LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu - LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - LLScrollListItem* add(const std::string& name, void* userdata, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - LLScrollListItem* add(const std::string& name, LLSD value, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, bool enabled = true); // add item "name" to menu + LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, bool enabled = true); + LLScrollListItem* add(const std::string& name, void* userdata, EAddPosition pos = ADD_BOTTOM, bool enabled = true); + LLScrollListItem* add(const std::string& name, LLSD value, EAddPosition pos = ADD_BOTTOM, bool enabled = true); LLScrollListItem* addSeparator(EAddPosition pos = ADD_BOTTOM); - BOOL remove( S32 index ); // remove item by index, return TRUE if found and removed + bool remove( S32 index ); // remove item by index, return true if found and removed void removeall() { clearRows(); } bool itemExists(const std::string& name); - void sortByName(BOOL ascending = TRUE); // Sort the entries in the combobox by name + void sortByName(bool ascending = true); // Sort the entries in the combobox by name - // Select current item by name using selectItemByLabel. Returns FALSE if not found. - BOOL setSimple(const LLStringExplicit& name); + // Select current item by name using selectItemByLabel. Returns false if not found. + bool setSimple(const LLStringExplicit& name); // Get name of current item. Returns an empty string if not found. const std::string getSimple() const; // Get contents of column x of selected row @@ -160,12 +160,12 @@ public: // Updates the combobox label to match the selected list item. void updateLabel(); - BOOL remove(const std::string& name); // remove item "name", return TRUE if found and removed + bool remove(const std::string& name); // remove item "name", return true if found and removed - BOOL setCurrentByIndex( S32 index ); + bool setCurrentByIndex( S32 index ); S32 getCurrentIndex() const; - void setEnabledByValue(const LLSD& value, BOOL enabled); + void setEnabledByValue(const LLSD& value, bool enabled); void createLineEditor(const Params&); @@ -183,21 +183,21 @@ public: virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); virtual void clearRows(); - virtual void sortByColumn(const std::string& name, BOOL ascending); + virtual void sortByColumn(const std::string& name, bool ascending); // LLCtrlSelectionInterface functions - virtual BOOL getCanSelect() const { return TRUE; } - virtual BOOL selectFirstItem() { return setCurrentByIndex(0); } - virtual BOOL selectNthItem( S32 index ) { return setCurrentByIndex(index); } - virtual BOOL selectItemRange( S32 first, S32 last ); + virtual bool getCanSelect() const { return true; } + virtual bool selectFirstItem() { return setCurrentByIndex(0); } + virtual bool selectNthItem( S32 index ) { return setCurrentByIndex(index); } + virtual bool selectItemRange( S32 first, S32 last ); virtual S32 getFirstSelectedIndex() const { return getCurrentIndex(); } - virtual BOOL setCurrentByID( const LLUUID& id ); + virtual bool setCurrentByID( const LLUUID& id ); virtual LLUUID getCurrentID() const; // LLUUID::null if no items in menu - virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected); + virtual bool setSelectedByValue(const LLSD& value, bool selected); virtual LLSD getSelectedValue(); - virtual BOOL isSelected(const LLSD& value) const; - virtual BOOL operateOnSelection(EOperation op); - virtual BOOL operateOnAll(EOperation op); + virtual bool isSelected(const LLSD& value) const; + virtual bool operateOnSelection(EOperation op); + virtual bool operateOnAll(EOperation op); //======================================================================== @@ -214,7 +214,7 @@ public: */ boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); } - void setButtonVisible(BOOL visible); + void setButtonVisible(bool visible); void onButtonMouseDown(); void onListMouseUp(); @@ -234,13 +234,13 @@ protected: EPreferredPosition mListPosition; LLPointer<LLUIImage> mArrowImage; LLUIString mLabel; - BOOL mHasAutocompletedText; + bool mHasAutocompletedText; private: - BOOL mAllowTextEntry; - BOOL mAllowNewValues; + bool mAllowTextEntry; + bool mAllowNewValues; S32 mMaxChars; - BOOL mTextEntryTentative; + bool mTextEntryTentative; commit_callback_t mPrearrangeCallback; commit_callback_t mTextEntryCallback; commit_callback_t mTextChangedCallback; diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 270ec86e01..03717da80b 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -107,7 +107,7 @@ LLCommandManager::~LLCommandManager() U32 LLCommandManager::commandCount() const { - return mCommands.size(); + return static_cast<U32>(mCommands.size()); } LLCommand * LLCommandManager::getCommand(U32 commandIndex) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 3b2586a5a1..e6df0d3a4b 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -198,7 +198,7 @@ protected: void addCommand(LLCommand * command); private: - typedef std::map<LLUUID, U32> CommandIndexMap; + typedef std::map<LLUUID, size_t> CommandIndexMap; typedef std::vector<LLCommand *> CommandVector; CommandVector mCommands; diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 795bf1070a..9fbfb3e5fa 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -77,7 +77,7 @@ void LLConsole::setLinePersistTime(F32 seconds) mFadeTime = mLinePersistTime - FADE_DURATION; } -void LLConsole::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLConsole::reshape(S32 width, S32 height, bool called_from_parent) { S32 new_width = llmax(50, llmin(getRect().getWidth(), width)); S32 new_height = llmax(llfloor(mFont->getLineHeight()) + 15, llmin(getRect().getHeight(), height)); @@ -147,11 +147,11 @@ void LLConsole::draw() return; } - U32 num_lines=0; + size_t num_lines{ 0 }; paragraph_t::reverse_iterator paragraph_it; paragraph_it = mParagraphs.rbegin(); - U32 paragraph_num=mParagraphs.size(); + auto paragraph_num=mParagraphs.size(); while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend()) { @@ -159,7 +159,7 @@ void LLConsole::draw() if(num_lines > mMaxLines || ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f)) { //All lines above here are done. Lose them. - for (U32 i=0;i<paragraph_num;i++) + for (size_t i = 0; i < paragraph_num; i++) { if (!mParagraphs.empty()) mParagraphs.pop_front(); @@ -258,7 +258,7 @@ void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) ParagraphColorSegment color_segment; color_segment.mColor.setValue(color_llsd); - color_segment.mNumChars = color_str.length(); + color_segment.mNumChars = static_cast<S32>(color_str.length()); mParagraphColorSegments.push_back(color_segment); } @@ -310,7 +310,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b skip_chars = 0; } - U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, static_cast<S32>(line_end) - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (drawable != 0) { @@ -380,7 +380,7 @@ void LLConsole::updateClass() void LLConsole::update() { { - LLMutexLock lock(&mMutex); + LLCoros::LockType lock(mMutex); while (!mLines.empty()) { diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h index d3dc1bbfde..cc9fd71d84 100644 --- a/indra/llui/llconsole.h +++ b/indra/llui/llconsole.h @@ -132,7 +132,7 @@ public: // each line lasts this long after being added void setLinePersistTime(F32 seconds); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + void reshape(S32 width, S32 height, bool called_from_parent = true); // -1 = monospace, 0 means small, font size = 1 means big void setFontSize(S32 size_index); diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index f01d66382c..4c2912cde6 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -57,11 +57,11 @@ LLContainerView::~LLContainerView() // Children all cleaned up by default view destructor. } -BOOL LLContainerView::postBuild() +bool LLContainerView::postBuild() { setDisplayChildren(mDisplayChildren); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); - return TRUE; + reshape(getRect().getWidth(), getRect().getHeight(), false); + return true; } bool LLContainerView::addChild(LLView* child, S32 tab_group) @@ -74,14 +74,14 @@ bool LLContainerView::addChild(LLView* child, S32 tab_group) return res; } -BOOL LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask) { return handleMouseDown(x, y, mask); } -BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (mDisplayChildren) { handled = (LLView::childrenHandleMouseDown(x, y, mask) != NULL); @@ -91,16 +91,16 @@ BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) if( mShowLabel && (y >= getRect().getHeight() - 10) ) { setDisplayChildren(!mDisplayChildren); - reshape(getRect().getWidth(), getRect().getHeight(), FALSE); - handled = TRUE; + reshape(getRect().getWidth(), getRect().getHeight(), false); + handled = true; } } return handled; } -BOOL LLContainerView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLContainerView::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (mDisplayChildren) { handled = (LLView::childrenHandleMouseUp(x, y, mask) != NULL); @@ -128,7 +128,7 @@ void LLContainerView::draw() } -void LLContainerView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLContainerView::reshape(S32 width, S32 height, bool called_from_parent) { LLRect scroller_rect; scroller_rect.setOriginAndSize(0, 0, width, height); @@ -159,7 +159,7 @@ void LLContainerView::reshape(S32 width, S32 height, BOOL called_from_parent) } } -void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) +void LLContainerView::arrange(S32 width, S32 height, bool called_from_parent) { // Determine the sizes and locations of all contained views S32 total_height = 0; @@ -242,7 +242,7 @@ void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) { if (getParent()) { - getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), FALSE); + getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), false); } } @@ -288,7 +288,7 @@ void LLContainerView::setLabel(const std::string& label) mLabel = label; } -void LLContainerView::setDisplayChildren(BOOL displayChildren) +void LLContainerView::setDisplayChildren(bool displayChildren) { mDisplayChildren = displayChildren; for (child_list_const_iter_t child_iter = getChildList()->begin(); diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 118d3a967c..319fb7d5e9 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -49,8 +49,8 @@ public: Optional<bool> display_children; Params() : label("label"), - show_label("show_label", FALSE), - display_children("display_children", TRUE) + show_label("show_label", false), + display_children("display_children", true) { changeDefault(mouse_opaque, false); } @@ -65,30 +65,30 @@ protected: public: ~LLContainerView(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. void setLabel(const std::string& label); - void showLabel(BOOL show) { mShowLabel = show; } - void setDisplayChildren(BOOL displayChildren); - BOOL getDisplayChildren() { return mDisplayChildren; } + void showLabel(bool show) { mShowLabel = show; } + void setDisplayChildren(bool displayChildren); + bool getDisplayChildren() { return mDisplayChildren; } void setScrollContainer(LLScrollContainer* scroll) {mScrollContainer = scroll;} private: LLScrollContainer* mScrollContainer; - void arrange(S32 width, S32 height, BOOL called_from_parent = TRUE); - BOOL mShowLabel; + void arrange(S32 width, S32 height, bool called_from_parent = true); + bool mShowLabel; protected: - BOOL mDisplayChildren; + bool mDisplayChildren; std::string mLabel; }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/llctrlselectioninterface.cpp b/indra/llui/llctrlselectioninterface.cpp index 10e5a75bff..0a5512afa1 100644 --- a/indra/llui/llctrlselectioninterface.cpp +++ b/indra/llui/llctrlselectioninterface.cpp @@ -33,14 +33,14 @@ LLCtrlSelectionInterface::~LLCtrlSelectionInterface() { } -BOOL LLCtrlSelectionInterface::selectByValue(LLSD value) +bool LLCtrlSelectionInterface::selectByValue(LLSD value) { - return setSelectedByValue(value, TRUE); + return setSelectedByValue(value, true); } -BOOL LLCtrlSelectionInterface::deselectByValue(LLSD value) +bool LLCtrlSelectionInterface::deselectByValue(LLSD value) { - return setSelectedByValue(value, FALSE); + return setSelectedByValue(value, false); } diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index 56dd7a7415..c845f7027d 100644 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h @@ -47,29 +47,29 @@ public: OP_DESELECT, }; - virtual BOOL getCanSelect() const = 0; + virtual bool getCanSelect() const = 0; virtual S32 getItemCount() const = 0; - virtual BOOL selectFirstItem() = 0; - virtual BOOL selectNthItem( S32 index ) = 0; - virtual BOOL selectItemRange( S32 first, S32 last ) = 0; + virtual bool selectFirstItem() = 0; + virtual bool selectNthItem( S32 index ) = 0; + virtual bool selectItemRange( S32 first, S32 last ) = 0; virtual S32 getFirstSelectedIndex() const = 0; // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function - virtual BOOL setCurrentByID( const LLUUID& id ) = 0; + virtual bool setCurrentByID( const LLUUID& id ) = 0; virtual LLUUID getCurrentID() const = 0; - BOOL selectByValue(const LLSD value); - BOOL deselectByValue(const LLSD value); - virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected) = 0; + bool selectByValue(const LLSD value); + bool deselectByValue(const LLSD value); + virtual bool setSelectedByValue(const LLSD& value, bool selected) = 0; virtual LLSD getSelectedValue() = 0; - virtual BOOL isSelected(const LLSD& value) const = 0; + virtual bool isSelected(const LLSD& value) const = 0; - virtual BOOL operateOnSelection(EOperation op) = 0; - virtual BOOL operateOnAll(EOperation op) = 0; + virtual bool operateOnSelection(EOperation op) = 0; + virtual bool operateOnAll(EOperation op) = 0; }; class LLCtrlListInterface : public LLCtrlSelectionInterface @@ -88,7 +88,7 @@ public: virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) = 0; virtual void clearRows() = 0; - virtual void sortByColumn(const std::string& name, BOOL ascending) = 0; + virtual void sortByColumn(const std::string& name, bool ascending) = 0; }; class LLCtrlScrollInterface diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 22e1ac4334..19ae03cdf9 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -40,9 +40,9 @@ void LLDockableFloater::init(LLDockableFloater* thiz) thiz->resetInstance(); // all dockable floaters should have close, dock and minimize buttons - thiz->setCanClose(TRUE); + thiz->setCanClose(true); thiz->setCanDock(true); - thiz->setCanMinimize(TRUE); + thiz->setCanMinimize(true); thiz->setOverlapsScreenChannel(false); thiz->mForceDocking = false; } @@ -74,7 +74,7 @@ LLDockableFloater::~LLDockableFloater() { } -BOOL LLDockableFloater::postBuild() +bool LLDockableFloater::postBuild() { // Remember we should force docking when the floater is opened for the first time if (mIsDockedStateForcedCallback != NULL && mIsDockedStateForcedCallback()) @@ -108,14 +108,14 @@ void LLDockableFloater::toggleInstance(const LLSD& sdname) // if floater undocked else if (instance != NULL) { - instance->setMinimized(FALSE); + instance->setMinimized(false); if (instance->getVisible()) { - instance->setVisible(FALSE); + instance->setVisible(false); } else { - instance->setVisible(TRUE); + instance->setVisible(true); gFloaterView->bringToFront(instance); } } @@ -127,13 +127,13 @@ void LLDockableFloater::resetInstance() { if (sInstanceHandle.get() != NULL && sInstanceHandle.get()->isDocked()) { - sInstanceHandle.get()->setVisible(FALSE); + sInstanceHandle.get()->setVisible(false); } sInstanceHandle = getHandle(); } } -void LLDockableFloater::setVisible(BOOL visible) +void LLDockableFloater::setVisible(bool visible) { // Force docking if requested if (visible && mForceDocking) @@ -160,12 +160,12 @@ void LLDockableFloater::setVisible(BOOL visible) LLFloater::setVisible(visible); } -void LLDockableFloater::setMinimized(BOOL minimize) +void LLDockableFloater::setMinimized(bool minimize) { if(minimize && isDocked()) { // minimizing a docked floater just hides it - setVisible(FALSE); + setVisible(false); } else { @@ -185,14 +185,14 @@ LLView * LLDockableFloater::getDockWidget() void LLDockableFloater::onDockHidden() { - setCanDock(FALSE); + setCanDock(false); } void LLDockableFloater::onDockShown() { if (!isMinimized()) { - setCanDock(TRUE); + setCanDock(true); } } diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index e7ceb235a7..3effc977db 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -81,7 +81,7 @@ public: * If descendant class overrides postBuild() in order to perform specific * construction then it must still invoke its superclass' implementation. */ - /* virtula */BOOL postBuild(); + /* virtula */bool postBuild(); /* virtual */void setDocked(bool docked, bool pop_on_undock = true); /* virtual */void draw(); @@ -89,13 +89,13 @@ public: * If descendant class overrides setVisible() then it must still invoke its * superclass' implementation. */ - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); /** * If descendant class overrides setMinimized() then it must still invoke its * superclass' implementation. */ - /*virtual*/ void setMinimized(BOOL minimize); + /*virtual*/ void setMinimized(bool minimize); LLView * getDockWidget(); @@ -129,7 +129,7 @@ protected: // Checks if docking should be forced. // It may be useful e.g. if floater created in mouselook mode (see EXT-5609) - boost::function<BOOL ()> mIsDockedStateForcedCallback; + boost::function<bool ()> mIsDockedStateForcedCallback; private: std::unique_ptr<LLDockControl> mDockControl; diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index dbec1d5d80..15536178ab 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -57,7 +57,7 @@ LLDragHandle::LLDragHandle(const LLDragHandle::Params& p) mLastMouseScreenY( 0 ), mTitleBox( NULL ), mMaxTitleWidth( 0 ), - mForeground( TRUE ), + mForeground( true ), mDragHighlightColor(p.drag_highlight_color()), mDragShadowColor(p.drag_shadow_color()) @@ -79,7 +79,7 @@ void LLDragHandle::initFromParams(const LLDragHandle::Params& p) setTitle( p.label ); } -void LLDragHandle::setTitleVisible(BOOL visible) +void LLDragHandle::setTitleVisible(bool visible) { if(mTitleBox) { @@ -160,7 +160,7 @@ void LLDragHandleTop::draw() LLRect title_rect = mTitleBox->getRect(); S32 title_right = title_rect.mLeft + mTitleWidth; - BOOL show_right_side = title_right < getRect().getWidth(); + bool show_right_side = title_right < getRect().getWidth(); for( S32 i=0; i<4; i++ ) { @@ -211,7 +211,7 @@ void LLDragHandleLeft::draw() // no titles yet //LLRect title_rect = mTitleBox->getRect(); //S32 title_right = title_rect.mLeft + mTitleWidth; - //BOOL show_right_side = title_right < getRect().getWidth(); + //bool show_right_side = title_right < getRect().getWidth(); S32 line = left; for( S32 i=0; i<4; i++ ) @@ -256,13 +256,13 @@ void LLDragHandleTop::reshapeTitleBox() mTitleBox->setShape( title_rect ); } -void LLDragHandleTop::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLDragHandleTop::reshape(S32 width, S32 height, bool called_from_parent) { LLView::reshape(width, height, called_from_parent); reshapeTitleBox(); } -void LLDragHandleLeft::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLDragHandleLeft::reshape(S32 width, S32 height, bool called_from_parent) { LLView::reshape(width, height, called_from_parent); } @@ -271,7 +271,7 @@ void LLDragHandleLeft::reshape(S32 width, S32 height, BOOL called_from_parent) // UI event handling //------------------------------------------------------------- -BOOL LLDragHandle::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLDragHandle::handleMouseDown(S32 x, S32 y, MASK mask) { // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. @@ -282,11 +282,11 @@ BOOL LLDragHandle::handleMouseDown(S32 x, S32 y, MASK mask) mLastMouseScreenY = mDragLastScreenY; // Note: don't pass on to children - return TRUE; + return true; } -BOOL LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -295,13 +295,13 @@ BOOL LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) } // Note: don't pass on to children - return TRUE; + return true; } -BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) +bool LLDragHandle::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -324,11 +324,11 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) delta_y >= SLOP) { parent->setDocked(false, false); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -367,13 +367,13 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" <<LL_ENDL; - handled = TRUE; + handled = true; } else { getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } // Note: don't pass on to children diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index f61dae8dc3..a522e63243 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -61,20 +61,20 @@ public: virtual void setValue(const LLSD& value); - void setForeground(BOOL b) { mForeground = b; } - BOOL getForeground() const { return mForeground; } + void setForeground(bool b) { mForeground = b; } + bool getForeground() const { return mForeground; } void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } LLRect getButtonsRect() { return mButtonsRect; } - void setTitleVisible(BOOL visible); + void setTitleVisible(bool visible); virtual void setTitle( const std::string& title ) = 0; virtual std::string getTitle() const = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); protected: LLDragHandle(const Params&); @@ -93,7 +93,7 @@ private: LLUIColor mDragHighlightColor; LLUIColor mDragShadowColor; S32 mMaxTitleWidth; - BOOL mForeground; + bool mForeground; // Pixels near the edge to snap floaters. static S32 sSnapMargin; @@ -111,7 +111,7 @@ public: virtual void setTitle( const std::string& title ); virtual std::string getTitle() const; virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); private: void reshapeTitleBox(); @@ -129,7 +129,7 @@ public: virtual void setTitle( const std::string& title ); virtual std::string getTitle() const; virtual void draw(); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); }; diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h index f516b0f2e2..ff111c16a7 100644 --- a/indra/llui/lleditmenuhandler.h +++ b/indra/llui/lleditmenuhandler.h @@ -35,29 +35,29 @@ public: virtual ~LLEditMenuHandler(); virtual void undo() {}; - virtual BOOL canUndo() const { return FALSE; } + virtual bool canUndo() const { return false; } virtual void redo() {}; - virtual BOOL canRedo() const { return FALSE; } + virtual bool canRedo() const { return false; } virtual void cut() {}; - virtual BOOL canCut() const { return FALSE; } + virtual bool canCut() const { return false; } virtual void copy() {}; - virtual BOOL canCopy() const { return FALSE; } + virtual bool canCopy() const { return false; } virtual void paste() {}; - virtual BOOL canPaste() const { return FALSE; } + virtual bool canPaste() const { return false; } // "delete" is a keyword virtual void doDelete() {}; - virtual BOOL canDoDelete() const { return FALSE; } + virtual bool canDoDelete() const { return false; } virtual void selectAll() {}; - virtual BOOL canSelectAll() const { return FALSE; } + virtual bool canSelectAll() const { return false; } virtual void deselect() {}; - virtual BOOL canDeselect() const { return FALSE; } + virtual bool canDeselect() const { return false; } // TODO: Instead of being a public data member, it would be better to hide it altogether // and have a "set" method and then a bunch of static versions of the cut, copy, paste diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp index f16c38a11a..925608e47e 100644 --- a/indra/llui/llemojidictionary.cpp +++ b/indra/llui/llemojidictionary.cpp @@ -210,7 +210,7 @@ void LLEmojiDictionary::findByShortCode( std::size_t begin, end; if (searchInShortCode(begin, end, shortCode, needle)) { - results[begin].emplace_back(d.Character, shortCode, begin, end); + results[static_cast<llwchar>(begin)].emplace_back(d.Character, shortCode, begin, end); } } } diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp index 7a5f342cd5..f7b3a1e9a6 100644 --- a/indra/llui/llfiltereditor.cpp +++ b/indra/llui/llfiltereditor.cpp @@ -33,7 +33,7 @@ LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p) : LLSearchEditor(p) { - setCommitOnFocusLost(FALSE); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!) + setCommitOnFocusLost(false); // we'll commit on every keystroke, don't re-commit when we take focus away (i.e. we go to interact with the actual results!) } diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index 2de05f04c5..c3db24c987 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -53,7 +53,7 @@ void LLFlashTimer::unset() mCallback = NULL; } -BOOL LLFlashTimer::tick() +bool LLFlashTimer::tick() { mIsCurrentlyHighlighted = !mIsCurrentlyHighlighted; diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index 037e32ac50..b55ce53fc0 100644 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -46,7 +46,7 @@ public: LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0); ~LLFlashTimer() {}; - /*virtual*/ BOOL tick(); + /*virtual*/ bool tick(); void startFlashing(); void stopFlashing(); diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index cd866f1625..1799968afb 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -48,7 +48,7 @@ LLFlatListView::Params::Params() no_items_text("no_items_text") {}; -void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +void LLFlatListView::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { S32 delta = height - getRect().getHeight(); LLScrollContainer::reshape(width, height, called_from_parent); @@ -390,7 +390,7 @@ U32 LLFlatListView::size(const bool only_visible_items) const } else { - return mItemPairs.size(); + return static_cast<U32>(mItemPairs.size()); } } @@ -528,7 +528,7 @@ void LLFlatListView::draw() } // virtual -BOOL LLFlatListView::postBuild() +bool LLFlatListView::postBuild() { setTabStop(true); return LLScrollContainer::postBuild(); @@ -563,7 +563,7 @@ void LLFlatListView::rearrangeItems() } // add paddings between items, excluding invisible ones - height += mItemPad * (mItemPairs.size() - invisible_children_count - 1); + height += mItemPad * (static_cast<S32>(mItemPairs.size()) - invisible_children_count - 1); LLRect rc = mItemsPanel->getRect(); S32 width = mItemsNoScrollWidth; @@ -610,7 +610,7 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) return; } - setFocus(TRUE); + setFocus(true); bool select_item = !isSelected(item_pair); @@ -714,10 +714,10 @@ void LLFlatListView::onItemRightMouseClick(item_pair_t* item_pair, MASK mask) onItemMouseClick(item_pair, mask); } -BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) +bool LLFlatListView::handleKeyHere(KEY key, MASK mask) { - BOOL reset_selection = (mask != MASK_SHIFT); - BOOL handled = FALSE; + bool reset_selection = (mask != MASK_SHIFT); + bool handled = false; switch (key) { case KEY_RETURN: @@ -725,7 +725,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) if (mSelectedItemPairs.size() && mask == MASK_NONE) { mOnReturnSignal(this, getValue()); - handled = TRUE; + handled = true; } break; } @@ -753,7 +753,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) { if (mask == MASK_NONE) { - setFocus(FALSE); // pass focus to the game area (EXT-8357) + setFocus(false); // pass focus to the game area (EXT-8357) } break; } @@ -779,7 +779,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) localRectToScreen(selected_rc, &screen_rc); notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));*/ - handled = TRUE; + handled = true; } return handled ? handled : LLScrollContainer::handleKeyHere(key, mask); @@ -1040,7 +1040,7 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti return false; } -BOOL LLFlatListView::canSelectAll() const +bool LLFlatListView::canSelectAll() const { return 0 != size() && mAllowSelection && mMultipleSelection; } @@ -1198,14 +1198,14 @@ void LLFlatListView::onFocusReceived() { if (size()) { - mSelectedItemsBorder->setVisible(TRUE); + mSelectedItemsBorder->setVisible(true); } gEditMenuHandler = this; } // virtual void LLFlatListView::onFocusLost() { - mSelectedItemsBorder->setVisible(FALSE); + mSelectedItemsBorder->setVisible(false); // Route menu back to the default if (gEditMenuHandler == this) { @@ -1376,7 +1376,7 @@ bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) if (!item) return false; - BOOL visible = TRUE; + bool visible = true; // 0 signifies that filter is matched, // i.e. we don't hide items that don't support 'match_filter' action, separators etc. @@ -1390,7 +1390,7 @@ bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) if (!mForceShowingUnmatchedItems) { selectItem(item, false); - visible = FALSE; + visible = false; } } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index ba269a7d78..6d75e9f282 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -113,7 +113,7 @@ public: }; // disable traversal when finding widget to hand focus off to - /*virtual*/ BOOL canFocusChildren() const { return FALSE; } + /*virtual*/ bool canFocusChildren() const { return false; } /** * Connects callback to signal called when Return key is pressed. @@ -121,7 +121,7 @@ public: boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); } /** Overridden LLPanel's reshape, height is ignored, the list sets its height to accommodate all items */ - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); /** Returns full rect of child panel */ const LLRect& getItemsRect() const; @@ -264,7 +264,7 @@ public: void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } /** Get number of selected items in the list */ - U32 numSelected() const {return mSelectedItemPairs.size(); } + U32 numSelected() const {return static_cast<U32>(mSelectedItemPairs.size()); } /** Get number of (visible) items in the list */ U32 size(const bool only_visible_items = true) const; @@ -346,7 +346,7 @@ protected: virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection); - virtual BOOL canSelectAll() const; + virtual bool canSelectAll() const; virtual void selectAll(); virtual bool isSelected(item_pair_t* item_pair) const; @@ -364,9 +364,9 @@ protected: */ void notifyParentItemsRectChanged(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - virtual BOOL postBuild(); + virtual bool postBuild(); virtual void onFocusReceived(); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 75254f80d8..f29f9286c9 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -116,7 +116,7 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = }; LLMultiFloater* LLFloater::sHostp = NULL; -BOOL LLFloater::sQuitting = FALSE; // Flag to prevent storing visibility controls while quitting +bool LLFloater::sQuitting = false; // Flag to prevent storing visibility controls while quitting LLFloaterView* gFloaterView = NULL; @@ -261,15 +261,15 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mHeaderHeight(p.header_height), mLegacyHeaderHeight(p.legacy_header_height), mDefaultRectForGroup(true), - mMinimized(FALSE), - mForeground(FALSE), - mFirstLook(TRUE), + mMinimized(false), + mForeground(false), + mFirstLook(true), mButtonScale(1.0f), - mAutoFocus(TRUE), // automatically take focus when opened + mAutoFocus(true), // automatically take focus when opened mCanDock(false), mDocked(false), mTornOff(false), - mHasBeenDraggedWhileMinimized(FALSE), + mHasBeenDraggedWhileMinimized(false), mPreviousMinimizedBottom(0), mPreviousMinimizedLeft(0), mDefaultRelativeX(p.rel_x), @@ -281,10 +281,10 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) // mNotificationContext = new LLFloaterNotificationContext(getHandle()); // Clicks stop here. - setMouseOpaque(TRUE); + setMouseOpaque(true); // Floaters always draw their background, unlike every other panel. - setBackgroundVisible(TRUE); + setBackgroundVisible(true); // Floaters start not minimized. When minimized, they save their // prior rectangle to be used on restore. @@ -307,28 +307,28 @@ void LLFloater::initFloater(const Params& p) // Close button. if (mCanClose) { - mButtonsEnabled[BUTTON_CLOSE] = TRUE; + mButtonsEnabled[BUTTON_CLOSE] = true; } // Help button: '?' //SL-14050 Disable all Help question marks - mButtonsEnabled[BUTTON_HELP] = FALSE; + mButtonsEnabled[BUTTON_HELP] = false; // Minimize button only for top draggers if ( !mDragOnLeft && mCanMinimize ) { - mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; + mButtonsEnabled[BUTTON_MINIMIZE] = true; } if(mCanDock) { - mButtonsEnabled[BUTTON_DOCK] = TRUE; + mButtonsEnabled[BUTTON_DOCK] = true; } buildButtons(p); // Floaters are created in the invisible state - setVisible(FALSE); + setVisible(false); if (!getParent()) { @@ -530,7 +530,7 @@ LLFloater::~LLFloater() // This is important so that floaters with persistent rects (i.e., those // created with rect control rather than an LLRect) are restored in their // correct, non-minimized positions. - setMinimized( FALSE ); + setMinimized( false ); delete mDragHandle; for (S32 i = 0; i < 4; i++) @@ -598,12 +598,12 @@ LLControlGroup* LLFloater::getControlGroup() return LLUI::getInstance()->mSettingGroups["account"]; } -void LLFloater::setVisible( BOOL visible ) +void LLFloater::setVisible( bool visible ) { LLPanel::setVisible(visible); // calls onVisibilityChange() if( visible && mFirstLook ) { - mFirstLook = FALSE; + mFirstLook = false; } if( !visible ) @@ -632,7 +632,7 @@ void LLFloater::setVisible( BOOL visible ) } -void LLFloater::setIsSingleInstance(BOOL is_single_instance) +void LLFloater::setIsSingleInstance(bool is_single_instance) { mSingleInstance = is_single_instance; if (!mIsReuseInitialized) @@ -643,12 +643,12 @@ void LLFloater::setIsSingleInstance(BOOL is_single_instance) // virtual -void LLFloater::onVisibilityChange ( BOOL new_visibility ) +void LLFloater::onVisibilityChange ( bool new_visibility ) { if (new_visibility) { if (getHost()) - getHost()->setFloaterFlashing(this, FALSE); + getHost()->setFloaterFlashing(this, false); } LLPanel::onVisibilityChange ( new_visibility ); } @@ -681,7 +681,7 @@ void LLFloater::openFloater(const LLSD& key) if (getHost() != NULL) { - getHost()->setMinimized(FALSE); + getHost()->setMinimized(false); getHost()->setVisibleAndFrontmost(mAutoFocus && !getIsChrome()); getHost()->showFloater(this); } @@ -693,7 +693,7 @@ void LLFloater::openFloater(const LLSD& key) floater_to_stack = LLFloaterReg::getLastFloaterCascading(); } applyControlsAndPosition(floater_to_stack); - setMinimized(FALSE); + setMinimized(false); setVisibleAndFrontmost(mAutoFocus && !getIsChrome()); } @@ -714,7 +714,7 @@ void LLFloater::closeFloater(bool app_quitting) // Always unminimize before trying to close. // Most of the time the user will never see this state. - setMinimized(FALSE); + setMinimized(false); if (canClose()) { @@ -746,7 +746,7 @@ void LLFloater::closeFloater(bool app_quitting) LLFloater* dependee = mDependeeHandle.get(); if (dependee && !dependee->isDead()) { - dependee->setFocus(TRUE); + dependee->setFocus(true); } } } @@ -788,11 +788,11 @@ void LLFloater::closeFloater(bool app_quitting) // Hide the instance if (getHost()) { - getHost()->setVisible(FALSE); + getHost()->setVisible(false); } else { - setVisible(FALSE); + setVisible(false); if (!mReuseInstance) { destroy(); @@ -801,7 +801,7 @@ void LLFloater::closeFloater(bool app_quitting) } else { - setVisible(FALSE); // hide before destroying (so onVisibilityChange() gets called) + setVisible(false); // hide before destroying (so onVisibilityChange() gets called) if (!mReuseInstance) { destroy(); @@ -825,7 +825,7 @@ void LLFloater::closeHostedFloater() } /*virtual*/ -void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloater::reshape(S32 width, S32 height, bool called_from_parent) { LLPanel::reshape(width, height, called_from_parent); } @@ -852,7 +852,7 @@ void LLFloater::releaseFocus() { LLUI::getInstance()->removePopup(this); - setFocus(FALSE); + setFocus(false); if( gFocusMgr.childHasMouseCapture( this ) ) { @@ -1126,12 +1126,12 @@ std::string LLFloater::getShortTitle() const } } -BOOL LLFloater::canSnapTo(const LLView* other_view) +bool LLFloater::canSnapTo(const LLView* other_view) { if (NULL == other_view) { LL_WARNS() << "other_view is NULL" << LL_ENDL; - return FALSE; + return false; } if (other_view != getParent()) @@ -1142,7 +1142,7 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) && mDependents.find(other_floaterp->getHandle()) != mDependents.end()) { // this is a dependent that is already snapped to us, so don't snap back to it - return FALSE; + return false; } } @@ -1232,16 +1232,16 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) else { // If minimized, and origin has changed, set - // mHasBeenDraggedWhileMinimized to TRUE + // mHasBeenDraggedWhileMinimized to true if ((new_rect.mLeft != old_rect.mLeft) || (new_rect.mBottom != old_rect.mBottom)) { - mHasBeenDraggedWhileMinimized = TRUE; + mHasBeenDraggedWhileMinimized = true; } } } -void LLFloater::setMinimized(BOOL minimize) +void LLFloater::setMinimized(bool minimize) { const LLFloater::Params& default_params = LLFloater::getDefaultParams(); S32 floater_header_size = default_params.header_height; @@ -1257,7 +1257,7 @@ void LLFloater::setMinimized(BOOL minimize) if (minimize) { // minimized flag should be turned on before release focus - mMinimized = TRUE; + mMinimized = true; mExpandedRect = getRect(); // If the floater has been dragged while minimized in the @@ -1276,11 +1276,11 @@ void LLFloater::setMinimized(BOOL minimize) if (mButtonsEnabled[BUTTON_MINIMIZE]) { - mButtonsEnabled[BUTTON_MINIMIZE] = FALSE; - mButtonsEnabled[BUTTON_RESTORE] = TRUE; + mButtonsEnabled[BUTTON_MINIMIZE] = false; + mButtonsEnabled[BUTTON_RESTORE] = true; } - setBorderVisible(TRUE); + setBorderVisible(true); for(handle_set_iter_t dependent_it = mDependents.begin(); dependent_it != mDependents.end(); @@ -1291,11 +1291,11 @@ void LLFloater::setMinimized(BOOL minimize) { if (floaterp->isMinimizeable()) { - floaterp->setMinimized(TRUE); + floaterp->setMinimized(true); } else if (!floaterp->isMinimized()) { - floaterp->setVisible(FALSE); + floaterp->setVisible(false); } } } @@ -1307,16 +1307,16 @@ void LLFloater::setMinimized(BOOL minimize) { if (mResizeBar[i] != NULL) { - mResizeBar[i]->setEnabled(FALSE); + mResizeBar[i]->setEnabled(false); } if (mResizeHandle[i] != NULL) { - mResizeHandle[i]->setEnabled(FALSE); + mResizeHandle[i]->setEnabled(false); } } // Reshape *after* setting mMinimized - reshape( minimized_width, floater_header_size, TRUE); + reshape( minimized_width, floater_header_size, true); } else { @@ -1332,8 +1332,8 @@ void LLFloater::setMinimized(BOOL minimize) setOrigin( mExpandedRect.mLeft, mExpandedRect.mBottom ); if (mButtonsEnabled[BUTTON_RESTORE]) { - mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; - mButtonsEnabled[BUTTON_RESTORE] = FALSE; + mButtonsEnabled[BUTTON_MINIMIZE] = true; + mButtonsEnabled[BUTTON_RESTORE] = false; } // show dependent floater @@ -1344,8 +1344,8 @@ void LLFloater::setMinimized(BOOL minimize) LLFloater* floaterp = dependent_it->get(); if (floaterp) { - floaterp->setMinimized(FALSE); - floaterp->setVisible(TRUE); + floaterp->setMinimized(false); + floaterp->setVisible(true); } } @@ -1361,10 +1361,10 @@ void LLFloater::setMinimized(BOOL minimize) } } - mMinimized = FALSE; + mMinimized = false; setFrontmost(); // Reshape *after* setting mMinimized - reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); + reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), true ); } make_ui_sound("UISndWindowClose"); @@ -1372,7 +1372,7 @@ void LLFloater::setMinimized(BOOL minimize) applyTitle (); } -void LLFloater::setFocus( BOOL b ) +void LLFloater::setFocus( bool b ) { if (b && getIsChrome()) { @@ -1380,7 +1380,7 @@ void LLFloater::setFocus( BOOL b ) } LLView* last_focus = gFocusMgr.getLastFocusForGroup(this); // a descendent already has focus - BOOL child_had_focus = hasFocus(); + bool child_had_focus = hasFocus(); // give focus to first valid descendent LLPanel::setFocus(b); @@ -1403,7 +1403,7 @@ void LLFloater::setFocus( BOOL b ) last_focus->isInVisibleChain()) { // *FIX: should handle case where focus doesn't stick - last_focus->setFocus(TRUE); + last_focus->setFocus(true); } } updateTransparency(b ? TT_ACTIVE : TT_INACTIVE); @@ -1418,15 +1418,15 @@ void LLFloater::setRect(const LLRect &rect) } // virtual -void LLFloater::setIsChrome(BOOL is_chrome) +void LLFloater::setIsChrome(bool is_chrome) { // chrome floaters don't take focus at all if (is_chrome) { // remove focus if we're changing to chrome - setFocus(FALSE); + setFocus(false); // can't Ctrl-Tab to "chrome" floaters - setFocusRoot(FALSE); + setFocusRoot(false); mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome))); } @@ -1434,7 +1434,7 @@ void LLFloater::setIsChrome(BOOL is_chrome) } // Change the draw style to account for the foreground state. -void LLFloater::setForeground(BOOL front) +void LLFloater::setForeground(bool front) { if (front != mForeground) { @@ -1479,13 +1479,13 @@ void LLFloater::setHost(LLMultiFloater* host) // add tear off button if (mCanTearOff) { - mButtonsEnabled[BUTTON_TEAR_OFF] = TRUE; + mButtonsEnabled[BUTTON_TEAR_OFF] = true; } } else if (!mHostHandle.isDead() && !host) { mButtonScale = 1.f; - //mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE; + //mButtonsEnabled[BUTTON_TEAR_OFF] = false; } if (host) { @@ -1520,7 +1520,7 @@ void LLFloater::moveResizeHandlesToFront() } /*virtual*/ -BOOL LLFloater::isFrontmost() +bool LLFloater::isFrontmost() { LLFloaterView* floater_view = getParentByType<LLFloaterView>(); return getVisible() @@ -1528,7 +1528,7 @@ BOOL LLFloater::isFrontmost() && floater_view->getFrontmost() == this); } -void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL resize) +void LLFloater::addDependentFloater(LLFloater* floaterp, bool reposition, bool resize) { mDependents.insert(floaterp->getHandle()); floaterp->mDependeeHandle = getHandle(); @@ -1543,12 +1543,12 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL r rect.mBottom = base.mBottom; else if (rect.mLeft == base.mLeft) rect.mRight = base.mRight; - floaterp->reshape(rect.getWidth(), rect.getHeight(), FALSE); + floaterp->reshape(rect.getWidth(), rect.getHeight(), false); } floaterp->setRect(rect); floaterp->setSnapTarget(getHandle()); } - gFloaterView->adjustToFitScreen(floaterp, FALSE, TRUE); + gFloaterView->adjustToFitScreen(floaterp, false, true); if (floaterp->isFrontmost()) { // make sure to bring self and sibling floaters to front @@ -1556,7 +1556,7 @@ void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition, BOOL r } } -void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, BOOL reposition, BOOL resize) +void LLFloater::addDependentFloater(LLHandle<LLFloater> dependent, bool reposition, bool resize) { LLFloater* dependent_floaterp = dependent.get(); if(dependent_floaterp) @@ -1609,7 +1609,7 @@ void LLFloater::fitWithDependentsOnScreen(const LLRect& left, const LLRect& bott mTranslateWithDependents = false; } -BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index) +bool LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index) { if( mButtonsEnabled[index] ) { @@ -1622,23 +1622,23 @@ BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index my_butt->handleMouseDown(local_x, local_y, mask)) { // the button handled it - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLFloater::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLFloater::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLPanel::handleScrollWheel(x,y,clicks); - return TRUE;//always + return true;//always } // virtual -BOOL LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) { LL_DEBUGS() << "LLFloater::handleMouseUp calling LLPanel (really LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; - BOOL handled = LLPanel::handleMouseUp(x,y,mask); // Not implemented in LLPanel so this actually calls LLView + bool handled = LLPanel::handleMouseUp(x,y,mask); // Not implemented in LLPanel so this actually calls LLView if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); } @@ -1646,7 +1646,7 @@ BOOL LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) } // virtual -BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) { if( mMinimized ) { @@ -1654,19 +1654,19 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) // Note: this block and the offerClickToButton helper method can be removed // because the parent container will handle it for us but we'll keep it here // for safety until after reworking the panel code to manage hidden children. - if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return TRUE; - if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return TRUE; - if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return TRUE; - if(offerClickToButton(x, y, mask, BUTTON_DOCK)) return TRUE; + if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return true; + if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return true; + if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return true; + if(offerClickToButton(x, y, mask, BUTTON_DOCK)) return true; - setFrontmost(TRUE, FALSE); + setFrontmost(true, false); // Otherwise pass to drag handle for movement return mDragHandle->handleMouseDown(x, y, mask); } else { bringToFront( x, y ); - BOOL handled = LLPanel::handleMouseDown( x, y, mask ); + bool handled = LLPanel::handleMouseDown( x, y, mask ); if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); } @@ -1675,14 +1675,14 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) } // virtual -BOOL LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLFloater::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL was_minimized = mMinimized; + bool was_minimized = mMinimized; bringToFront( x, y ); return was_minimized || LLPanel::handleRightMouseDown( x, y, mask ); } -BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { bringToFront( x, y ); return LLPanel::handleMiddleMouseDown( x, y, mask ); @@ -1690,10 +1690,10 @@ BOOL LLFloater::handleMiddleMouseDown(S32 x, S32 y, MASK mask) // virtual -BOOL LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLFloater::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL was_minimized = mMinimized; - setMinimized(FALSE); + bool was_minimized = mMinimized; + setMinimized(false); return was_minimized || LLPanel::handleDoubleClick(x, y, mask); } @@ -1728,23 +1728,23 @@ void LLFloater::goneFromFront() } // virtual -void LLFloater::setVisibleAndFrontmost(BOOL take_focus,const LLSD& key) +void LLFloater::setVisibleAndFrontmost(bool take_focus,const LLSD& key) { LLUIUsage::instance().logFloater(getInstanceName()); LLMultiFloater* hostp = getHost(); if (hostp) { - hostp->setVisible(TRUE); + hostp->setVisible(true); hostp->setFrontmost(take_focus); } else { - setVisible(TRUE); + setVisible(true); setFrontmost(take_focus); } } -void LLFloater::setFrontmost(BOOL take_focus, BOOL restore) +void LLFloater::setFrontmost(bool take_focus, bool restore) { LLMultiFloater* hostp = getHost(); if (hostp) @@ -1779,7 +1779,7 @@ void LLFloater::setCanDock(bool b) } else { - mButtonsEnabled[BUTTON_DOCK] = FALSE; + mButtonsEnabled[BUTTON_DOCK] = false; } } updateTitleButtons(); @@ -1794,7 +1794,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) if (mDocked) { - setMinimized(FALSE); + setMinimized(false); mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; } @@ -1836,9 +1836,9 @@ void LLFloater::onClickTearOff(LLFloater* self) new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight()); self->setRect(new_rect); } - gFloaterView->adjustToFitScreen(self, FALSE); + gFloaterView->adjustToFitScreen(self, false); // give focus to new window to keep continuity for the user - self->setFocus(TRUE); + self->setFocus(true); self->setTornOff(true); } else //Attach to parent. @@ -1852,7 +1852,7 @@ void LLFloater::onClickTearOff(LLFloater* self) self->mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); self->storeRectControl(); } - self->setMinimized(FALSE); // to reenable minimize button if it was minimized + self->setMinimized(false); // to reenable minimize button if it was minimized new_host->showFloater(self); // make sure host is visible new_host->openFloater(new_host->getKey()); @@ -1926,6 +1926,14 @@ void LLFloater::onClickClose( LLFloater* self ) self->onClickCloseBtn(); } +// static +void LLFloater::onClickClose(LLFloater* self, bool app_quitting) +{ + if (!self) + return; + self->onClickCloseBtn(app_quitting); +} + void LLFloater::onClickCloseBtn(bool app_quitting) { closeFloater(false); @@ -1984,7 +1992,7 @@ void LLFloater::draw() const LLFontGL* font = LLFontGL::getFontSansSerif(); LLRect r = getRect(); gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - font->getLineHeight() - 1, - titlebar_focus_color % alpha, 0, TRUE); + titlebar_focus_color % alpha, 0, true); } } } @@ -1997,13 +2005,13 @@ void LLFloater::draw() { LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); // is this button a direct descendent and not a nested widget (e.g. checkbox)? - BOOL focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && dynamic_cast<LLButton*>(focus_ctrl)->getParent() == this; + bool focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && dynamic_cast<LLButton*>(focus_ctrl)->getParent() == this; // only enable default button when current focus is not a button getDefaultButton()->setBorderEnabled(!focus_is_child_button); } else { - getDefaultButton()->setBorderEnabled(FALSE); + getDefaultButton()->setBorderEnabled(false); } } if (isMinimized()) @@ -2012,7 +2020,7 @@ void LLFloater::draw() { drawChild(mButtons[i]); } - drawChild(mDragHandle, 0, 0, TRUE); + drawChild(mDragHandle, 0, 0, true); } else { @@ -2027,7 +2035,7 @@ void LLFloater::draw() LLFloater* old_host = mLastHostHandle.get(); if (!old_host) { - setCanTearOff(FALSE); + setCanTearOff(false); } } } @@ -2076,14 +2084,14 @@ void LLFloater::updateTransparency(ETypeTransparency transparency_type) updateTransparency(this, transparency_type); } -void LLFloater::setCanMinimize(BOOL can_minimize) +void LLFloater::setCanMinimize(bool can_minimize) { // if removing minimize/restore button programmatically, // go ahead and unminimize floater mCanMinimize = can_minimize; if (!can_minimize) { - setMinimized(FALSE); + setMinimized(false); } mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); @@ -2092,7 +2100,7 @@ void LLFloater::setCanMinimize(BOOL can_minimize) updateTitleButtons(); } -void LLFloater::setCanClose(BOOL can_close) +void LLFloater::setCanClose(bool can_close) { mCanClose = can_close; mButtonsEnabled[BUTTON_CLOSE] = can_close; @@ -2100,7 +2108,7 @@ void LLFloater::setCanClose(BOOL can_close) updateTitleButtons(); } -void LLFloater::setCanTearOff(BOOL can_tear_off) +void LLFloater::setCanTearOff(bool can_tear_off) { mCanTearOff = can_tear_off; mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead(); @@ -2109,23 +2117,23 @@ void LLFloater::setCanTearOff(BOOL can_tear_off) } -void LLFloater::setCanResize(BOOL can_resize) +void LLFloater::setCanResize(bool can_resize) { mResizable = can_resize; enableResizeCtrls(can_resize); } -void LLFloater::setCanDrag(BOOL can_drag) +void LLFloater::setCanDrag(bool can_drag) { // if we delete drag handle, we no longer have access to the floater's title // so just enable/disable it if (!can_drag && mDragHandle->getEnabled()) { - mDragHandle->setEnabled(FALSE); + mDragHandle->setEnabled(false); } else if (can_drag && !mDragHandle->getEnabled()) { - mDragHandle->setEnabled(TRUE); + mDragHandle->setEnabled(true); } } @@ -2203,13 +2211,13 @@ void LLFloater::updateTitleButtons() buttons_rect.mLeft = btn_rect.mLeft; } mButtons[i]->setRect(btn_rect); - mButtons[i]->setVisible(TRUE); + mButtons[i]->setVisible(true); // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater mButtons[i]->setTabStop(i == BUTTON_RESTORE); } else { - mButtons[i]->setVisible(FALSE); + mButtons[i]->setVisible(false); } } if (mDragHandle) @@ -2403,7 +2411,7 @@ static LLDefaultChildRegistry::Register<LLFloaterView> r("floater_view"); LLFloaterView::LLFloaterView (const Params& p) : LLUICtrl (p), - mFocusCycleMode(FALSE), + mFocusCycleMode(false), mMinimizePositionVOffset(0), mSnapOffsetBottom(0), mSnapOffsetRight(0) @@ -2412,7 +2420,7 @@ LLFloaterView::LLFloaterView (const Params& p) } // By default, adjust vertical. -void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFloaterView::reshape(S32 width, S32 height, bool called_from_parent) { LLView::reshape(width, height, called_from_parent); @@ -2482,7 +2490,7 @@ void LLFloaterView::restoreAll() LLFloater* floaterp = dynamic_cast<LLFloater*>(child); if (floaterp) { - floaterp->setMinimized(FALSE); + floaterp->setMinimized(false); } } @@ -2557,7 +2565,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF } -void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore) +void LLFloaterView::bringToFront(LLFloater* child, bool give_focus, bool restore) { if (!child) return; @@ -2567,7 +2575,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore { if (give_focus && child->canFocusStealFrontmost() && !gFocusMgr.childHasKeyboardFocus(child)) { - child->setFocus(TRUE); + child->setFocus(true); } return; } @@ -2625,7 +2633,7 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore // always unminimize dependee, but allow dependents to stay minimized if (!floaterp->isDependent()) { - floaterp->setMinimized(FALSE); + floaterp->setMinimized(false); } } floaters_to_move.clear(); @@ -2650,12 +2658,12 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus, BOOL restore if(restore) { - child->setMinimized(FALSE); + child->setMinimized(false); } if (give_focus && !gFocusMgr.childHasKeyboardFocus(child)) { - child->setFocus(TRUE); + child->setFocus(true); // floater did not take focus, so relinquish focus to world if (!child->hasFocus()) { @@ -2676,7 +2684,7 @@ void LLFloaterView::highlightFocusedFloater() continue; } - BOOL floater_or_dependent_has_focus = gFocusMgr.childHasKeyboardFocus(floater); + bool floater_or_dependent_has_focus = gFocusMgr.childHasKeyboardFocus(floater); for(LLFloater::handle_set_iter_t dependent_it = floater->mDependents.begin(); dependent_it != floater->mDependents.end(); ++dependent_it) @@ -2684,7 +2692,7 @@ void LLFloaterView::highlightFocusedFloater() LLFloater* dependent_floaterp = dependent_it->get(); if (dependent_floaterp && gFocusMgr.childHasKeyboardFocus(dependent_floaterp)) { - floater_or_dependent_has_focus = TRUE; + floater_or_dependent_has_focus = true; } } @@ -2730,7 +2738,7 @@ void LLFloaterView::unhighlightFocusedFloater() { LLFloater *floater = (LLFloater *)(*child_it); - floater->setForeground(FALSE); + floater->setForeground(false); } } @@ -2739,7 +2747,7 @@ void LLFloaterView::focusFrontFloater() LLFloater* floaterp = getFrontmost(); if (floaterp) { - floaterp->setFocus(TRUE); + floaterp->setFocus(true); } } @@ -2759,7 +2767,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) row -= floater_header_size ) //loop rows { - bool foundGap = TRUE; + bool foundGap = true; for(child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) //loop floaters @@ -2776,7 +2784,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) { // needs the check for off grid. can't drag, // but window resize makes them off - foundGap = FALSE; + foundGap = false; break; } } @@ -2878,7 +2886,7 @@ void LLFloaterView::showHiddenFloaters() mHiddenFloaters.clear(); } -BOOL LLFloaterView::allChildrenClosed() +bool LLFloaterView::allChildrenClosed() { // see if there are any visible floaters (some floaters "close" // by setting themselves invisible) @@ -2912,7 +2920,7 @@ void LLFloaterView::refresh() LLRect snap_rect = getSnapRect(); if (snap_rect != mLastSnapRect) { - reshape(getRect().getWidth(), getRect().getHeight(), TRUE); + reshape(getRect().getWidth(), getRect().getHeight(), true); } // Constrain children to be entirely on the screen @@ -2927,7 +2935,7 @@ void LLFloaterView::refresh() } } -void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars/* = false*/) +void LLFloaterView::adjustToFitScreen(LLFloater* floater, bool allow_partial_outside, bool snap_in_toolbars/* = false*/) { if (floater->getParent() != this) { @@ -3099,7 +3107,7 @@ void LLFloaterView::syncFloaterTabOrder() if( !gFocusMgr.childHasKeyboardFocus( modal_dialog ) ) { - modal_dialog->setFocus(TRUE); + modal_dialog->setFocus(true); } if( !gFocusMgr.childHasMouseCapture( modal_dialog ) ) @@ -3131,7 +3139,7 @@ void LLFloaterView::syncFloaterTabOrder() } } - bringToFront(floaterp, FALSE); + bringToFront(floaterp, false); // Restore top floaters if (!listTop.empty()) @@ -3183,7 +3191,7 @@ S32 LLFloaterView::getZOrder(LLFloater* child) return rv; } -void LLFloaterView::pushVisibleAll(BOOL visible, const skip_list_t& skip_list) +void LLFloaterView::pushVisibleAll(bool visible, const skip_list_t& skip_list) { for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) @@ -3397,7 +3405,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); - return TRUE; + return true; } LLUICtrlFactory::instance().pushFileName(xml_filename); @@ -3406,7 +3414,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str { LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; - return FALSE; + return false; } Params referenced_params; @@ -3476,7 +3484,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str setRect(rect); } - BOOL result; + bool result; result = postBuild(); if (!result) @@ -3485,7 +3493,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str } applyRectControl(); // If we have a saved rect control, apply it - gFloaterView->adjustToFitScreen(this, FALSE); // Floaters loaded from XML should all fit on screen + gFloaterView->adjustToFitScreen(this, false); // Floaters loaded from XML should all fit on screen moveResizeHandlesToFront(); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index dcc9af4c6e..9be2240f6f 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -46,20 +46,20 @@ class LLMultiFloater; class LLFloater; -const BOOL RESIZE_YES = TRUE; -const BOOL RESIZE_NO = FALSE; +const bool RESIZE_YES = true; +const bool RESIZE_NO = false; -const BOOL DRAG_ON_TOP = FALSE; -const BOOL DRAG_ON_LEFT = TRUE; +const bool DRAG_ON_TOP = false; +const bool DRAG_ON_LEFT = true; -const BOOL MINIMIZE_YES = TRUE; -const BOOL MINIMIZE_NO = FALSE; +const bool MINIMIZE_YES = true; +const bool MINIMIZE_NO = false; -const BOOL CLOSE_YES = TRUE; -const BOOL CLOSE_NO = FALSE; +const bool CLOSE_YES = true; +const bool CLOSE_NO = false; -const BOOL ADJUST_VERTICAL_YES = TRUE; -const BOOL ADJUST_VERTICAL_NO = FALSE; +const bool ADJUST_VERTICAL_YES = true; +const bool ADJUST_VERTICAL_NO = false; const F32 CONTEXT_CONE_IN_ALPHA = 0.f; const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; @@ -222,13 +222,13 @@ public: bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); - /*virtual*/ BOOL canSnapTo(const LLView* other_view); + /*virtual*/ bool canSnapTo(const LLView* other_view); /*virtual*/ void setSnappedTo(const LLView* snap_view); - /*virtual*/ void setFocus( BOOL b ); - /*virtual*/ void setIsChrome(BOOL is_chrome); + /*virtual*/ void setFocus( bool b ); + /*virtual*/ void setIsChrome(bool is_chrome); /*virtual*/ void setRect(const LLRect &rect); - void setIsSingleInstance(BOOL is_single_instance); - BOOL getIsSingleInstance() { return mSingleInstance; } + void setIsSingleInstance(bool is_single_instance); + bool getIsSingleInstance() { return mSingleInstance; } void initFloater(const Params& p); @@ -240,7 +240,7 @@ public: // Close the floater or its host. Use when hidding or toggling a floater instance. virtual void closeHostedFloater(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void translate(S32 x, S32 y); // Release keyboard and mouse focus @@ -258,14 +258,14 @@ public: std::string getTitle() const; void setShortTitle( const std::string& short_title ); std::string getShortTitle() const; - virtual void setMinimized(BOOL b); + virtual void setMinimized(bool b); void moveResizeHandlesToFront(); - void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE, BOOL resize = FALSE); - void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE, BOOL resize = FALSE); + void addDependentFloater(LLFloater* dependent, bool reposition = true, bool resize = false); + void addDependentFloater(LLHandle<LLFloater> dependent_handle, bool reposition = true, bool resize = false); LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } void removeDependentFloater(LLFloater* dependent); void fitWithDependentsOnScreen(const LLRect& left, const LLRect& bottom, const LLRect& right, const LLRect& constraint, S32 min_overlap_pixels); - BOOL isMinimized() const { return mMinimized; } + bool isMinimized() const { return mMinimized; } /// isShown() differs from getVisible() in that isShown() also considers /// isMinimized(). isShown() is true only if visible and not minimized. bool isShown() const; @@ -274,17 +274,17 @@ public: static bool isShown(const LLFloater* floater); static bool isVisible(const LLFloater* floater); static bool isMinimized(const LLFloater* floater); - BOOL isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts - virtual BOOL isFrontmost(); - BOOL isDependent() { return !mDependeeHandle.isDead(); } - void setCanMinimize(BOOL can_minimize); - void setCanClose(BOOL can_close); - void setCanTearOff(BOOL can_tear_off); - virtual void setCanResize(BOOL can_resize); - void setCanDrag(BOOL can_drag); + bool isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts + virtual bool isFrontmost(); + bool isDependent() { return !mDependeeHandle.isDead(); } + void setCanMinimize(bool can_minimize); + void setCanClose(bool can_close); + void setCanTearOff(bool can_tear_off); + virtual void setCanResize(bool can_resize); + void setCanDrag(bool can_drag); bool getCanDrag(); void setHost(LLMultiFloater* host); - BOOL isResizable() const { return mResizable; } + bool isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; } @@ -298,13 +298,13 @@ public: S32 getMinHeight() const{ return mMinHeight; } S32 getHeaderHeight() const { return mHeaderHeight; } - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 mask); virtual void draw(); virtual void drawShadow(LLPanel* panel); @@ -314,19 +314,19 @@ public: // This cannot be "const" until all derived floater canClose() // methods are const as well. JC - virtual BOOL canClose() { return TRUE; } + virtual bool canClose() { return true; } - /*virtual*/ void setVisible(BOOL visible); // do not override - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); // do not override + /*virtual*/ void setVisible(bool visible); // do not override + /*virtual*/ void onVisibilityChange ( bool new_visibility ); // do not override bool canFocusStealFrontmost() const { return mFocusStealsFrontmost; } void setFocusStealsFrontmost(bool wants_frontmost) { mFocusStealsFrontmost = wants_frontmost; } - void setFrontmost(BOOL take_focus = TRUE, BOOL restore = TRUE); - virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); + void setFrontmost(bool take_focus = true, bool restore = true); + virtual void setVisibleAndFrontmost(bool take_focus = true, const LLSD& key = LLSD()); // Defaults to false. - virtual BOOL canSaveAs() const { return FALSE; } + virtual bool canSaveAs() const { return false; } virtual void saveAs() {} @@ -363,6 +363,7 @@ public: // } static void onClickClose(LLFloater* floater); + static void onClickClose(LLFloater* floater, bool app_quitting); static void onClickMinimize(LLFloater* floater); static void onClickTearOff(LLFloater* floater); static void onClickDock(LLFloater* floater); @@ -400,8 +401,8 @@ protected: void setExpandedRect(const LLRect& rect) { mExpandedRect = rect; } // size when not minimized const LLRect& getExpandedRect() const { return mExpandedRect; } - void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened - BOOL getAutoFocus() const { return mAutoFocus; } + void setAutoFocus(bool focus) { mAutoFocus = focus; } // whether to automatically take focus when opened + bool getAutoFocus() const { return mAutoFocus; } LLDragHandle* getDragHandle() const { return mDragHandle; } void destroy(); // Don't call this directly. You probably want to call closeFloater() @@ -420,7 +421,7 @@ protected: F32 contex_cone_out_alpha = CONTEXT_CONE_OUT_ALPHA); private: - void setForeground(BOOL b); // called only by floaterview + void setForeground(bool b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters void createMinimizeButton(); void buildButtons(const Params& p); @@ -437,7 +438,7 @@ private: */ static std::string getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome); - BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); + bool offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); void addDragHandle(); @@ -483,18 +484,18 @@ private: LLUIString mTitle; LLUIString mShortTitle; - BOOL mSingleInstance; // TRUE if there is only ever one instance of the floater + bool mSingleInstance; // true if there is only ever one instance of the floater bool mReuseInstance; // true if we want to hide the floater when we close it instead of destroying it bool mIsReuseInitialized; // true if mReuseInstance already set from parameters std::string mInstanceName; // Store the instance name so we can remove ourselves from the list - BOOL mCanTearOff; - BOOL mCanMinimize; - BOOL mCanClose; - bool mFocusStealsFrontmost = true; // FALSE if we don't want the currently focused floater to cover this floater without user interaction - BOOL mDragOnLeft; - BOOL mResizable; - BOOL mAutoClose; + bool mCanTearOff; + bool mCanMinimize; + bool mCanClose; + bool mFocusStealsFrontmost = true; // false if we don't want the currently focused floater to cover this floater without user interaction + bool mDragOnLeft; + bool mResizable; + bool mAutoClose; LLFloaterEnums::EOpenPositioning mPositioning; LLCoordFloater mPosition; @@ -504,12 +505,12 @@ private: S32 mHeaderHeight; // height in pixels of header for title, drag bar S32 mLegacyHeaderHeight;// HACK see initFloaterXML() - BOOL mMinimized; - BOOL mForeground; + bool mMinimized; + bool mForeground; LLHandle<LLFloater> mDependeeHandle; - BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible. + bool mFirstLook; // true if the _next_ time this floater is visible will be the first time in the session that it is visible. typedef std::set<LLHandle<LLFloater> > handle_set_t; typedef std::set<LLHandle<LLFloater> >::iterator handle_set_iter_t; @@ -518,7 +519,7 @@ private: bool mButtonsEnabled[BUTTON_COUNT]; F32 mButtonScale; - BOOL mAutoFocus; + bool mAutoFocus; LLHandle<LLFloater> mSnappedTo; LLHandle<LLFloater> mHostHandle; @@ -529,7 +530,7 @@ private: bool mTornOff; static LLMultiFloater* sHostp; - static BOOL sQuitting; + static bool sQuitting; static std::string sButtonNames[BUTTON_COUNT]; static std::string sButtonToolTips[BUTTON_COUNT]; static std::string sButtonToolTipsIndex[BUTTON_COUNT]; @@ -537,7 +538,7 @@ private: typedef void(*click_callback)(LLFloater*); static click_callback sButtonCallbacks[BUTTON_COUNT]; - BOOL mHasBeenDraggedWhileMinimized; + bool mHasBeenDraggedWhileMinimized; S32 mPreviousMinimizedBottom; S32 mPreviousMinimizedLeft; @@ -563,7 +564,7 @@ protected: public: - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void draw(); /*virtual*/ LLRect getSnapRect() const; /*virtual*/ void refresh(); @@ -571,25 +572,25 @@ public: LLRect findNeighboringPosition( LLFloater* reference_floater, LLFloater* neighbor ); // Given a child of gFloaterView, make sure this view can fit entirely onscreen. - void adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside, BOOL snap_in_toolbars = false); + void adjustToFitScreen(LLFloater* floater, bool allow_partial_outside, bool snap_in_toolbars = false); void setMinimizePositionVerticalOffset(S32 offset) { mMinimizePositionVOffset = offset; } void getMinimizePosition( S32 *left, S32 *bottom); void restoreAll(); // un-minimize all floaters typedef std::set<LLView*> skip_list_t; - void pushVisibleAll(BOOL visible, const skip_list_t& skip_list = skip_list_t()); + void pushVisibleAll(bool visible, const skip_list_t& skip_list = skip_list_t()); void popVisibleAll(const skip_list_t& skip_list = skip_list_t()); - void setCycleMode(BOOL mode) { mFocusCycleMode = mode; } - BOOL getCycleMode() const { return mFocusCycleMode; } - void bringToFront( LLFloater* child, BOOL give_focus = TRUE, BOOL restore = TRUE ); + void setCycleMode(bool mode) { mFocusCycleMode = mode; } + bool getCycleMode() const { return mFocusCycleMode; } + void bringToFront( LLFloater* child, bool give_focus = true, bool restore = true ); void highlightFocusedFloater(); void unhighlightFocusedFloater(); void focusFrontFloater(); void destroyAllChildren(); // attempt to close all floaters void closeAllChildren(bool app_quitting); - BOOL allChildrenClosed(); + bool allChildrenClosed(); void shiftFloaters(S32 x_offset, S32 y_offset); void hideAllFloaters(); @@ -620,7 +621,7 @@ private: LLRect mToolbarBottomRect; LLRect mToolbarRightRect; LLHandle<LLView> mSnapView; - BOOL mFocusCycleMode; + bool mFocusCycleMode; S32 mSnapOffsetBottom; S32 mSnapOffsetRight; S32 mMinimizePositionVOffset; diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 989ce12d09..fd5a370bc3 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -248,7 +248,7 @@ LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::str // Visibility Management //static -LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) +LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus) { if( sBlockShowFloaters // see EXT-7090 @@ -259,7 +259,7 @@ LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, { instance->openFloater(key); if (focus) - instance->setFocus(TRUE); + instance->setFocus(true); } return instance; } @@ -281,15 +281,15 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key) bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); - if (LLFloater::isShown(instance)) + if (instance && instance->isShown()) { instance->closeHostedFloater(); return false; } - else - { - return showInstance(name, key, TRUE) ? true : false; - } + + instance = showInstance(name, key, true); + + return instance != nullptr; } //static @@ -310,7 +310,7 @@ void LLFloaterReg::showInitialVisibleInstances() std::string controlname = getVisibilityControlName(name); if (LLFloater::getControlGroup()->controlExists(controlname)) { - BOOL isvis = LLFloater::getControlGroup()->getBOOL(controlname); + bool isvis = LLFloater::getControlGroup()->getBOOL(controlname); if (isvis) { showInstance(name, LLSD()); // keyed floaters shouldn't set save_vis to true @@ -332,7 +332,7 @@ void LLFloaterReg::hideVisibleInstances(const std::set<std::string>& exceptions) for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter) { LLFloater* floater = *iter; - floater->pushVisible(FALSE); + floater->pushVisible(false); } } } @@ -409,7 +409,7 @@ std::string LLFloaterReg::getBaseControlName(const std::string& name) std::string LLFloaterReg::declareVisibilityControl(const std::string& name) { std::string controlname = getVisibilityControlName(name); - LLFloater::getControlGroup()->declareBOOL(controlname, FALSE, + LLFloater::getControlGroup()->declareBOOL(controlname, false, llformat("Window Visibility for %s", name.c_str()), LLControlVariable::PERSIST_NONDFT); return controlname; @@ -419,7 +419,7 @@ std::string LLFloaterReg::declareVisibilityControl(const std::string& name) std::string LLFloaterReg::declareDockStateControl(const std::string& name) { std::string controlname = getDockStateControlName(name); - LLFloater::getControlGroup()->declareBOOL(controlname, TRUE, + LLFloater::getControlGroup()->declareBOOL(controlname, true, llformat("Window Docking state for %s", name.c_str()), LLControlVariable::PERSIST_NONDFT); return controlname; @@ -492,7 +492,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& { if (host->isMinimized() || !host->isShown() || !host->isFrontmost()) { - host->setMinimized(FALSE); + host->setMinimized(false); instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); } @@ -500,7 +500,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& { instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); - instance->setFocus(TRUE); + instance->setFocus(true); } else { @@ -511,7 +511,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& { if (instance->isMinimized()) { - instance->setMinimized(FALSE); + instance->setMinimized(false); instance->setVisibleAndFrontmost(true, key); } else if (!instance->isShown()) @@ -552,7 +552,7 @@ void LLFloaterReg::showInstanceOrBringToFront(const LLSD& sdname, const LLSD& ke { if (host->isMinimized() || !host->isShown() || !host->isFrontmost()) { - host->setMinimized(FALSE); + host->setMinimized(false); instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); } @@ -560,14 +560,14 @@ void LLFloaterReg::showInstanceOrBringToFront(const LLSD& sdname, const LLSD& ke { instance->openFloater(key); instance->setVisibleAndFrontmost(true, key); - instance->setFocus(TRUE); + instance->setFocus(true); } } else { if (instance->isMinimized()) { - instance->setMinimized(FALSE); + instance->setMinimized(false); instance->setVisibleAndFrontmost(true, key); } else if (!instance->isShown()) diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 43f3f7b170..6a642cbb27 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -102,7 +102,7 @@ public: // Visibility Management // return NULL if instance not found or can't create instance (no builder) - static LLFloater* showInstance(const std::string& name, const LLSD& key = LLSD(), BOOL focus = FALSE); + static LLFloater* showInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false); // Close a floater (may destroy or set invisible) // return false if can't find instance static bool hideInstance(const std::string& name, const LLSD& key = LLSD()); @@ -145,7 +145,7 @@ public: } template <class T> - static T* showTypedInstance(const std::string& name, const LLSD& key = LLSD(), BOOL focus = FALSE) + static T* showTypedInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false) { return dynamic_cast<T*>(showInstance(name, key, focus)); } diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index 1d529d09d3..2e198e8dbc 100644 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp @@ -35,7 +35,7 @@ const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24; LLFlyoutButton::LLFlyoutButton(const Params& p) : LLComboBox(p), - mToggleState(FALSE), + mToggleState(false), mActionButton(NULL) { // Always use text box @@ -69,7 +69,7 @@ void LLFlyoutButton::draw() LLComboBox::draw(); } -void LLFlyoutButton::setToggleState(BOOL state) +void LLFlyoutButton::setToggleState(bool state) { mToggleState = state; } diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index c217d14ff1..7a49501318 100644 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h @@ -56,13 +56,13 @@ protected: public: virtual void draw(); - void setToggleState(BOOL state); + void setToggleState(bool state); void onActionButtonClick(const LLSD& data); protected: LLButton* mActionButton; - BOOL mToggleState; + bool mToggleState; }; #endif // LL_LLFLYOUTBUTTON_H diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 5b7525daac..e0e789f730 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -41,25 +41,25 @@ LLFocusableElement::LLFocusableElement() } // virtual -BOOL LLFocusableElement::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLFocusableElement::handleKey(KEY key, MASK mask, bool called_from_parent) { - return FALSE; + return false; } // virtual -BOOL LLFocusableElement::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +bool LLFocusableElement::handleKeyUp(KEY key, MASK mask, bool called_from_parent) { - return FALSE; + return false; } // virtual -BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLFocusableElement::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { - return FALSE; + return false; } // virtual -BOOL LLFocusableElement::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent) +bool LLFocusableElement::handleUnicodeString(char *uni_str, bool editing, bool called_from_parent) { return FALSE; } @@ -102,12 +102,12 @@ void LLFocusableElement::onTopLost() if (mTopLostCallback) (*mTopLostCallback)(this); } -BOOL LLFocusableElement::hasFocus() const +bool LLFocusableElement::hasFocus() const { return gFocusMgr.getKeyboardFocus() == this; } -void LLFocusableElement::setFocus(BOOL b) +void LLFocusableElement::setFocus(bool b) { } @@ -155,9 +155,9 @@ LLFocusMgr::LLFocusMgr() mKeyboardFocus( NULL ), mLastKeyboardFocus( NULL ), mDefaultKeyboardFocus( NULL ), - mKeystrokesOnly(FALSE), + mKeystrokesOnly(false), mTopCtrl( NULL ), - mAppHasFocus(TRUE), // Macs don't seem to notify us that we've gotten focus, so default to true + mAppHasFocus(true), // Macs don't seem to notify us that we've gotten focus, so default to true mImpl(new LLFocusMgr::Impl) { } @@ -192,7 +192,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) LLUI::getInstance()->removePopup(view); } -void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL keystrokes_only) +void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only) { // notes if keyboard focus is changed again (by onFocusLost/onFocusReceived) // making the rest of our processing unnecessary since it will already be @@ -275,7 +275,7 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL // releasing keyboard focus, move to the default. if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL) { - mDefaultKeyboardFocus->setFocus(TRUE); + mDefaultKeyboardFocus->setFocus(true); } LLView* focus_subtree = dynamic_cast<LLView*>(mKeyboardFocus); @@ -307,23 +307,23 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL } -// Returns TRUE is parent or any descedent of parent has keyboard focus. -BOOL LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const +// Returns true is parent or any descedent of parent has keyboard focus. +bool LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const { LLView* focus_view = dynamic_cast<LLView*>(mKeyboardFocus); while( focus_view ) { if( focus_view == parent ) { - return TRUE; + return true; } focus_view = focus_view->getParent(); } - return FALSE; + return false; } -// Returns TRUE is parent or any descedent of parent is the mouse captor. -BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const +// Returns true is parent or any descedent of parent is the mouse captor. +bool LLFocusMgr::childHasMouseCapture( const LLView* parent ) const { if( mMouseCaptor && dynamic_cast<LLView*>(mMouseCaptor) != NULL ) { @@ -332,12 +332,12 @@ BOOL LLFocusMgr::childHasMouseCapture( const LLView* parent ) const { if( captor_view == parent ) { - return TRUE; + return true; } captor_view = captor_view->getParent(); } } - return FALSE; + return false; } void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus ) @@ -406,18 +406,18 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor } -BOOL LLFocusMgr::childIsTopCtrl( const LLView* parent ) const +bool LLFocusMgr::childIsTopCtrl( const LLView* parent ) const { LLView* top_view = (LLView*)mTopCtrl; while( top_view ) { if( top_view == parent ) { - return TRUE; + return true; } top_view = top_view->getParent(); } - return FALSE; + return false; } @@ -477,7 +477,7 @@ void LLFocusMgr::triggerFocusFlash() mFocusFlashTimer.reset(); } -void LLFocusMgr::setAppHasFocus(BOOL focus) +void LLFocusMgr::setAppHasFocus(bool focus) { if (!mAppHasFocus && focus) { diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index c12d52d121..1ca6f50354 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -45,8 +45,8 @@ public: LLFocusableElement(); virtual ~LLFocusableElement(); - virtual void setFocus( BOOL b ); - virtual BOOL hasFocus() const; + virtual void setFocus( bool b ); + virtual bool hasFocus() const; typedef boost::signals2::signal<void(LLFocusableElement*)> focus_signal_t; @@ -56,10 +56,10 @@ public: boost::signals2::connection setTopLostCallback(const focus_signal_t::slot_type& cb); // These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus. - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - virtual BOOL handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); + virtual bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); + virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); + virtual bool handleUnicodeString(char *uni_str, bool editing, bool called_from_parent); /** * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages @@ -90,23 +90,23 @@ public: void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse. LLMouseHandler* getMouseCapture() const { return mMouseCaptor; } void removeMouseCaptureWithoutCallback( const LLMouseHandler* captor ); - BOOL childHasMouseCapture( const LLView* parent ) const; + bool childHasMouseCapture( const LLView* parent ) const; // Keyboard Focus - void setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock = FALSE, BOOL keystrokes_only = FALSE); // new_focus = NULL to release the focus. + void setKeyboardFocus(LLFocusableElement* new_focus, bool lock = false, bool keystrokes_only = false); // new_focus = NULL to release the focus. LLFocusableElement* getKeyboardFocus() const { return mKeyboardFocus; } LLFocusableElement* getLastKeyboardFocus() const { return mLastKeyboardFocus; } - BOOL childHasKeyboardFocus( const LLView* parent ) const; + bool childHasKeyboardFocus( const LLView* parent ) const; void removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus ); - BOOL getKeystrokesOnly() { return mKeystrokesOnly; } - void setKeystrokesOnly(BOOL keystrokes_only) { mKeystrokesOnly = keystrokes_only; } + bool getKeystrokesOnly() { return mKeystrokesOnly; } + void setKeystrokesOnly(bool keystrokes_only) { mKeystrokesOnly = keystrokes_only; } F32 getFocusFlashAmt() const; S32 getFocusFlashWidth() const { return ll_round(lerp(1.f, 3.f, getFocusFlashAmt())); } LLColor4 getFocusColor() const; void triggerFocusFlash(); - BOOL getAppHasFocus() const { return mAppHasFocus; } - void setAppHasFocus(BOOL focus); + bool getAppHasFocus() const { return mAppHasFocus; } + void setAppHasFocus(bool focus); LLView* getLastFocusForGroup(LLView* subtree_root) const; void clearLastFocusForGroup(LLView* subtree_root); @@ -120,13 +120,13 @@ public: void setTopCtrl(LLUICtrl* new_top); LLUICtrl* getTopCtrl() const { return mTopCtrl; } void removeTopCtrlWithoutCallback( const LLUICtrl* top_view ); - BOOL childIsTopCtrl( const LLView* parent ) const; + bool childIsTopCtrl( const LLView* parent ) const; // All Three void releaseFocusIfNeeded( LLView* top_view ); void lockFocus(); void unlockFocus(); - BOOL focusLocked() const { return mLockedView != NULL; } + bool focusLocked() const { return mLockedView != NULL; } bool keyboardFocusHasAccelerators() const; @@ -142,14 +142,14 @@ private: LLFocusableElement* mKeyboardFocus; // Keyboard events are preemptively routed to this object LLFocusableElement* mLastKeyboardFocus; // who last had focus LLFocusableElement* mDefaultKeyboardFocus; - BOOL mKeystrokesOnly; + bool mKeystrokesOnly; // Top View LLUICtrl* mTopCtrl; LLFrameTimer mFocusFlashTimer; - BOOL mAppHasFocus; + bool mAppHasFocus; Impl * mImpl; }; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 33921cf4f0..1d4ecbe9c9 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -84,12 +84,12 @@ F32 LLFolderView::sAutoOpenTime = 1.f; class LLCloseAllFoldersFunctor : public LLFolderViewFunctor { public: - LLCloseAllFoldersFunctor(BOOL close) { mOpen = !close; } + LLCloseAllFoldersFunctor(bool close) { mOpen = !close; } virtual ~LLCloseAllFoldersFunctor() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item); - BOOL mOpen; + bool mOpen; }; @@ -167,21 +167,21 @@ LLFolderView::LLFolderView(const Params& p) mAllowMultiSelect(p.allow_multiselect), mAllowDrag(p.allow_drag), mShowEmptyMessage(p.show_empty_message), - mShowFolderHierarchy(FALSE), + mShowFolderHierarchy(false), mRenameItem( NULL ), - mNeedsScroll( FALSE ), + mNeedsScroll( false ), mUseLabelSuffix(p.use_label_suffix), mSuppressFolderMenu(p.suppress_folder_menu), - mPinningSelectedItem(FALSE), - mNeedsAutoSelect( FALSE ), - mAutoSelectOverride(FALSE), - mNeedsAutoRename(FALSE), - mShowSelectionContext(FALSE), - mShowSingleSelection(FALSE), + mPinningSelectedItem(false), + mNeedsAutoSelect( false ), + mAutoSelectOverride(false), + mNeedsAutoRename(false), + mShowSelectionContext(false), + mShowSingleSelection(false), mArrangeGeneration(0), mSignalSelectCallback(0), mMinWidth(0), - mDragAndDropThisFrame(FALSE), + mDragAndDropThisFrame(false), mCallbackRegistrar(NULL), mEnableRegistrar(NULL), mUseEllipses(p.use_ellipses), @@ -205,7 +205,7 @@ LLFolderView::LLFolderView(const Params& p) mAutoOpenItems.setDepth(AUTO_OPEN_STACK_DEPTH); mAutoOpenCandidate = NULL; mAutoOpenTimer.stop(); - mKeyboardSelection = FALSE; + mKeyboardSelection = false; mIndentation = getParentFolder() ? getParentFolder()->getIndentation() + mLocalIndentation : 0; //clear label @@ -286,9 +286,9 @@ LLFolderView::~LLFolderView( void ) mViewModel = NULL; } -BOOL LLFolderView::canFocusChildren() const +bool LLFolderView::canFocusChildren() const { - return FALSE; + return false; } void LLFolderView::addFolder( LLFolderViewFolder* folder) @@ -299,7 +299,7 @@ void LLFolderView::addFolder( LLFolderViewFolder* folder) void LLFolderView::closeAllFolders() { // Close all the folders - setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_DOWN); arrangeAll(); } @@ -309,7 +309,7 @@ void LLFolderView::openTopLevelFolders() iter != mFolders.end();) { folders_t::iterator fit = iter++; - (*fit)->setOpen(TRUE); + (*fit)->setOpen(true); } } @@ -349,7 +349,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) getViewModelItem()->filter(filter); } -void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLFolderView::reshape(S32 width, S32 height, bool called_from_parent) { LLRect scroll_rect; if (mScrollContainer) @@ -366,7 +366,7 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) width = scroll_rect.getWidth(); } LLView::reshape(width, height, called_from_parent); - mReshapeSignal(mSelectedItems, FALSE); + mReshapeSignal(mSelectedItems, false); } void LLFolderView::addToSelectionList(LLFolderViewItem* item) @@ -377,9 +377,9 @@ void LLFolderView::addToSelectionList(LLFolderViewItem* item) } if (mSelectedItems.size()) { - mSelectedItems.back()->setIsCurSelection(FALSE); + mSelectedItems.back()->setIsCurSelection(false); } - item->setIsCurSelection(TRUE); + item->setIsCurSelection(true); mSelectedItems.push_back(item); } @@ -387,7 +387,7 @@ void LLFolderView::removeFromSelectionList(LLFolderViewItem* item) { if (mSelectedItems.size()) { - mSelectedItems.back()->setIsCurSelection(FALSE); + mSelectedItems.back()->setIsCurSelection(false); } selected_items_t::iterator item_iter; @@ -404,7 +404,7 @@ void LLFolderView::removeFromSelectionList(LLFolderViewItem* item) } if (mSelectedItems.size()) { - mSelectedItems.back()->setIsCurSelection(TRUE); + mSelectedItems.back()->setIsCurSelection(true); } } @@ -425,19 +425,19 @@ LLFolderView::selected_items_t& LLFolderView::getSelectedItems( void ) } // Record the selected item and pass it down the hierachy. -BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus) +bool LLFolderView::setSelection(LLFolderViewItem* selection, bool openitem, + bool take_keyboard_focus) { mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS; if( selection == this ) { - return FALSE; + return false; } if( selection && take_keyboard_focus) { - mParentPanel.get()->setFocus(TRUE); + mParentPanel.get()->setFocus(true); } // clear selection down here because change of keyboard focus can potentially @@ -449,7 +449,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, addToSelectionList(selection); } - BOOL rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus); + bool rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus); if(openitem && selection) { selection->getParentFolder()->requestArrange(); @@ -460,14 +460,14 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, return rv; } -BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) +bool LLFolderView::changeSelection(LLFolderViewItem* selection, bool selected) { - BOOL rv = FALSE; + bool rv = false; // can't select root folder if(!selection || selection == this) { - return FALSE; + return false; } if (!mAllowMultiSelect) @@ -484,7 +484,7 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) } } - BOOL on_list = (item_iter != mSelectedItems.end()); + bool on_list = (item_iter != mSelectedItems.end()); if(selected && !on_list) { @@ -516,7 +516,7 @@ void LLFolderView::sanitizeSelection() LLFolderViewItem* item = *item_iter; // ensure that each ancestor is open and potentially passes filtering - BOOL visible = false; + bool visible = false; if(item->getViewModelItem() != NULL) { visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item @@ -564,7 +564,7 @@ void LLFolderView::sanitizeSelection() std::vector<LLFolderViewItem*>::iterator item_it; for (item_it = items_to_remove.begin(); item_it != items_to_remove.end(); ++item_it ) { - changeSelection(*item_it, FALSE); // toggle selection (also removes from list) + changeSelection(*item_it, false); // toggle selection (also removes from list) } // if nothing selected after prior constraints... @@ -602,7 +602,7 @@ void LLFolderView::sanitizeSelection() if (new_selection) { - setSelection(new_selection, FALSE, FALSE); + setSelection(new_selection, false, false); } } } @@ -670,12 +670,12 @@ void LLFolderView::draw() if (hasVisibleChildren()) { - mStatusTextBox->setVisible( FALSE ); + mStatusTextBox->setVisible( false ); } else if (mShowEmptyMessage) { mStatusTextBox->setValue(getFolderViewModel()->getStatusText(mItems.empty() && mFolders.empty())); - mStatusTextBox->setVisible( TRUE ); + mStatusTextBox->setVisible( true ); // firstly reshape message textbox with current size. This is necessary to // LLTextBox::getTextPixelHeight works properly @@ -717,7 +717,7 @@ void LLFolderView::draw() // and arrow for the root folder LLView::draw(); - mDragAndDropThisFrame = FALSE; + mDragAndDropThisFrame = false; } void LLFolderView::finishRenamingItem( void ) @@ -758,7 +758,7 @@ void LLFolderView::removeSelectedItems() // items, since the removal will futz with internal data // structures. std::vector<LLFolderViewItem*> items; - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(count <= 0) return; LLFolderViewItem* item = NULL; selected_items_t::iterator item_it; @@ -803,7 +803,7 @@ void LLFolderView::removeSelectedItems() setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); listeners.reserve(count); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { listener = items[i]->getViewModelItem(); if(listener && (std::find(listeners.begin(), listeners.end(), listener) == listeners.end())) @@ -836,7 +836,7 @@ void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) while (close_item && close_item != item->getParentFolder()) { mAutoOpenItems.pop(); - close_item->setOpenArrangeRecursively(FALSE); + close_item->setOpenArrangeRecursively(false); close_item = mAutoOpenItems.check(); } @@ -844,7 +844,7 @@ void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) mAutoOpenItems.push(item); - item->setOpen(TRUE); + item->setOpen(true); if(!item->isSingleFolderMode()) { LLRect content_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); @@ -858,7 +858,7 @@ void LLFolderView::closeAutoOpenedFolders() while (mAutoOpenItems.check()) { LLFolderViewFolder* close_item = mAutoOpenItems.pop(); - close_item->setOpen(FALSE); + close_item->setOpen(false); } if (mAutoOpenCandidate) @@ -869,7 +869,7 @@ void LLFolderView::closeAutoOpenedFolders() mAutoOpenTimer.stop(); } -BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) +bool LLFolderView::autoOpenTest(LLFolderViewFolder* folder) { if (folder && mAutoOpenCandidate == folder) { @@ -883,10 +883,10 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) { autoOpenItem(folder); mAutoOpenTimer.stop(); - return TRUE; + return true; } } - return FALSE; + return false; } // otherwise new candidate, restart timer @@ -896,14 +896,14 @@ BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) } mAutoOpenCandidate = folder; mAutoOpenTimer.start(); - return FALSE; + return false; } -BOOL LLFolderView::canCopy() const +bool LLFolderView::canCopy() const { if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) { - return FALSE; + return false; } for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) @@ -911,10 +911,10 @@ BOOL LLFolderView::canCopy() const const LLFolderViewItem* item = *selected_it; if (!item->getViewModelItem()->isItemCopyable()) { - return FALSE; + return false; } } - return TRUE; + return true; } // copy selected item @@ -922,7 +922,7 @@ void LLFolderView::copy() { // *NOTE: total hack to clear the inventory clipboard LLClipboard::instance().reset(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { LLFolderViewModelItem* listener = NULL; @@ -939,11 +939,11 @@ void LLFolderView::copy() mSearchString.clear(); } -BOOL LLFolderView::canCut() const +bool LLFolderView::canCut() const { if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) { - return FALSE; + return false; } for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) @@ -953,10 +953,10 @@ BOOL LLFolderView::canCut() const if (!listener || !listener->isItemRemovable()) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLFolderView::cut() @@ -988,11 +988,11 @@ void LLFolderView::cut() mSearchString.clear(); } -BOOL LLFolderView::canPaste() const +bool LLFolderView::canPaste() const { if (mSelectedItems.empty()) { - return FALSE; + return false; } if(getVisible() && getEnabled()) @@ -1009,13 +1009,13 @@ BOOL LLFolderView::canPaste() const listener = folderp->getViewModelItem(); if (!listener || !listener->isClipboardPasteable()) { - return FALSE; + return false; } } } - return TRUE; + return true; } - return FALSE; + return false; } // paste selected item @@ -1059,7 +1059,7 @@ void LLFolderView::startRenamingSelectedItem( void ) // make sure selection is visible scrollToShowSelection(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLFolderViewItem* item = NULL; if(count > 0) { @@ -1075,9 +1075,9 @@ void LLFolderView::startRenamingSelectedItem( void ) mRenamer->setText(item->getName()); mRenamer->selectAll(); - mRenamer->setVisible( TRUE ); + mRenamer->setVisible( true ); // set focus will fail unless item is visible - mRenamer->setFocus( TRUE ); + mRenamer->setFocus( true ); if (!mRenamerTopLostSignalConnection.connected()) { mRenamerTopLostSignalConnection = mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this)); @@ -1086,9 +1086,9 @@ void LLFolderView::startRenamingSelectedItem( void ) } } -BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) +bool LLFolderView::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. @@ -1103,7 +1103,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) case KEY_F2: mSearchString.clear(); startRenamingSelectedItem(); - handled = TRUE; + handled = true; break; case KEY_RETURN: @@ -1113,7 +1113,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { finishRenamingItem(); mSearchString.clear(); - handled = TRUE; + handled = true; } } break; @@ -1122,7 +1122,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if( mRenameItem && mRenamer->getVisible() ) { closeRenamer(); - handled = TRUE; + handled = true; } mSearchString.clear(); break; @@ -1133,7 +1133,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mScrollContainer->pageUp(30); } - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -1142,7 +1142,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mScrollContainer->pageDown(30); } - handled = TRUE; + handled = true; break; case KEY_HOME: @@ -1151,7 +1151,7 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) { mScrollContainer->goToTop(); } - handled = TRUE; + handled = true; break; case KEY_END: @@ -1166,14 +1166,14 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if((mSelectedItems.size() > 0) && mScrollContainer) { LLFolderViewItem* last_selected = getCurSelectedItem(); - BOOL shift_select = mask & MASK_SHIFT; + bool shift_select = mask & MASK_SHIFT; // don't shift select down to children of folders (they are implicitly selected through parent) LLFolderViewItem* next = last_selected->getNextOpenNode(!shift_select); if (!mKeyboardSelection || (!shift_select && (!next || next == last_selected))) { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; + setSelection(last_selected, false, true); + mKeyboardSelection = true; } if (shift_select) @@ -1183,12 +1183,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (next->isSelected()) { // shrink selection - changeSelection(last_selected, FALSE); + changeSelection(last_selected, false); } else if (last_selected->getParentFolder() == next->getParentFolder()) { // grow selection - changeSelection(next, TRUE); + changeSelection(next, true); } } } @@ -1202,11 +1202,11 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed { clearSelection(); - return TRUE; + return true; } - return FALSE; + return false; } - setSelection( next, FALSE, TRUE ); + setSelection( next, false, true ); } else { @@ -1214,14 +1214,14 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed { clearSelection(); - return TRUE; + return true; } - return FALSE; + return false; } } scrollToShowSelection(); mSearchString.clear(); - handled = TRUE; + handled = true; } break; @@ -1229,14 +1229,14 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if((mSelectedItems.size() > 0) && mScrollContainer) { LLFolderViewItem* last_selected = mSelectedItems.back(); - BOOL shift_select = mask & MASK_SHIFT; + bool shift_select = mask & MASK_SHIFT; // don't shift select down to children of folders (they are implicitly selected through parent) LLFolderViewItem* prev = last_selected->getPreviousOpenNode(!shift_select); if (!mKeyboardSelection || (!shift_select && prev == this)) { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; + setSelection(last_selected, false, true); + mKeyboardSelection = true; } if (shift_select) @@ -1246,12 +1246,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (prev->isSelected()) { // shrink selection - changeSelection(last_selected, FALSE); + changeSelection(last_selected, false); } else if (last_selected->getParentFolder() == prev->getParentFolder()) { // grow selection - changeSelection(prev, TRUE); + changeSelection(prev, true); } } } @@ -1265,18 +1265,18 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed { clearSelection(); - return TRUE; + return true; } - return FALSE; + return false; } - setSelection( prev, FALSE, TRUE ); + setSelection( prev, false, true ); } } scrollToShowSelection(); mSearchString.clear(); - handled = TRUE; + handled = true; } break; @@ -1284,9 +1284,9 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if(mSelectedItems.size()) { LLFolderViewItem* last_selected = getCurSelectedItem(); - last_selected->setOpen( TRUE ); + last_selected->setOpen( true ); mSearchString.clear(); - handled = TRUE; + handled = true; } break; @@ -1296,21 +1296,21 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) LLFolderViewItem* last_selected = getCurSelectedItem(); if(last_selected && last_selected->isSingleFolderMode()) { - handled = FALSE; + handled = false; break; } LLFolderViewItem* parent_folder = last_selected->getParentFolder(); if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder()) { - setSelection(parent_folder, FALSE, TRUE); + setSelection(parent_folder, false, true); } else { - last_selected->setOpen( FALSE ); + last_selected->setOpen( false ); } mSearchString.clear(); scrollToShowSelection(); - handled = TRUE; + handled = true; } break; } @@ -1319,20 +1319,20 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) } -BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) +bool LLFolderView::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } if (uni_char > 0x7f) { LL_WARNS() << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << LL_ENDL; - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; if (mParentPanel.get()->hasFocus()) { // SL-51858: Key presses are not being passed to the Popup menu. @@ -1353,28 +1353,28 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) { mSearchString += uni_char; } - search(getCurSelectedItem(), mSearchString, FALSE); + search(getCurSelectedItem(), mSearchString, false); - handled = TRUE; + handled = true; } return handled; } -BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) { - mKeyboardSelection = FALSE; + mKeyboardSelection = false; mSearchString.clear(); - mParentPanel.get()->setFocus(TRUE); + mParentPanel.get()->setFocus(true); LLEditMenuHandler::gEditMenuHandler = this; return LLView::handleMouseDown( x, y, mask ); } -BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward) +bool LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, bool backward) { // get first selected item LLFolderViewItem* search_item = first_item; @@ -1391,7 +1391,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc } // search over all open nodes for first substring match (with wrapping) - BOOL found = FALSE; + bool found = false; LLFolderViewItem* original_search_item = search_item; do { @@ -1414,10 +1414,10 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); LLStringUtil::toUpper(current_item_label); - S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); + auto search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { - found = TRUE; + found = true; break; } if (backward) @@ -1434,27 +1434,27 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc if (found) { - setSelection(search_item, FALSE, TRUE); + setSelection(search_item, false, true); scrollToShowSelection(); } return found; } -BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) { // skip LLFolderViewFolder::handleDoubleClick() return LLView::handleDoubleClick( x, y, mask ); } -BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { // all user operations move keyboard focus to inventory // this way, we know when to stop auto-updating a search - mParentPanel.get()->setFocus(TRUE); + mParentPanel.get()->setFocus(true); - BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; - S32 count = mSelectedItems.size(); + bool handled = childrenHandleRightMouseDown(x, y, mask) != NULL; + auto count = mSelectedItems.size(); LLMenuGL* menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); if (!menu) @@ -1485,10 +1485,10 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) } } - BOOL item_clicked = FALSE; - for (selected_items_t::iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + bool item_clicked{ false }; + for (const auto item : mSelectedItems) { - item_clicked |= (*item_it)->getRect().pointInRect(x, y); + item_clicked |= item->getRect().pointInRect(x, y); } if(!item_clicked && mSingleFolderMode) { @@ -1525,15 +1525,15 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { if (menu && menu->getVisible()) { - menu->setVisible(FALSE); + menu->setVisible(false); } - setSelection(NULL, FALSE, TRUE); + setSelection(NULL, false, true); } return handled; } // Add "--no options--" if the menu is completely blank. -BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const +bool LLFolderView::addNoOptions(LLMenuGL* menu) const { const std::string nooptions_str = "--no options--"; LLView *nooptions_item = NULL; @@ -1546,7 +1546,7 @@ BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const LLView *menu_item = (*itor); if (menu_item->getVisible()) { - return FALSE; + return false; } std::string name = menu_item->getName(); if (menu_item->getName() == nooptions_str) @@ -1556,14 +1556,14 @@ BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const } if (nooptions_item) { - nooptions_item->setVisible(TRUE); - nooptions_item->setEnabled(FALSE); - return TRUE; + nooptions_item->setVisible(true); + nooptions_item->setEnabled(false); + return true; } - return FALSE; + return false; } -BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask ) +bool LLFolderView::handleHover( S32 x, S32 y, MASK mask ) { return LLView::handleHover( x, y, mask ); } @@ -1584,15 +1584,15 @@ void LLFolderView::setHoveredItem(LLFolderViewItem* itemp) } } -BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - mDragAndDropThisFrame = TRUE; + mDragAndDropThisFrame = true; // have children handle it first - BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, + bool handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); // when drop is not handled by child, it should be handled @@ -1627,7 +1627,7 @@ void LLFolderView::scrollToShowSelection() { if ( mSelectedItems.size() ) { - mNeedsScroll = TRUE; + mNeedsScroll = true; } } @@ -1640,7 +1640,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr // don't scroll to items when mouse is being used to scroll/drag and drop if (gFocusMgr.childHasMouseCapture(mScrollContainer)) { - mNeedsScroll = FALSE; + mNeedsScroll = false; return; } @@ -1678,18 +1678,18 @@ LLRect LLFolderView::getVisibleRect() return visible_rect; } -BOOL LLFolderView::getShowSelectionContext() +bool LLFolderView::getShowSelectionContext() { if (mShowSelectionContext) { - return TRUE; + return true; } LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu && menu->getVisible()) { - return TRUE; + return true; } - return FALSE; + return false; } void LLFolderView::setShowSingleSelection(bool show) @@ -1720,7 +1720,7 @@ void LLFolderView::update() if (filter_object.isModified() && filter_object.isNotDefault() && mParentPanel.get()->getVisible()) { - mNeedsAutoSelect = TRUE; + mNeedsAutoSelect = true; } // Filter to determine visibility before arranging @@ -1747,7 +1747,7 @@ void LLFolderView::update() applyFunctorRecursively(functor); } - // Open filtered folders for folder views with mAutoSelectOverride=TRUE. + // Open filtered folders for folder views with mAutoSelectOverride=true. // Used by LLPlacesFolderView. if (filter_object.showAllResults()) { @@ -1760,7 +1760,7 @@ void LLFolderView::update() scrollToShowSelection(); } - BOOL filter_finished = mViewModel->contentsReady() + bool filter_finished = mViewModel->contentsReady() && (getViewModelItem()->passedFilter() || ( getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration() && !filter_modified)); @@ -1769,10 +1769,10 @@ void LLFolderView::update() || gFocusMgr.childHasMouseCapture(mParentPanel.get())) { // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process - mNeedsAutoSelect = FALSE; + mNeedsAutoSelect = false; } - BOOL is_visible = isInVisibleChain() || mForceArrange; + bool is_visible = isInVisibleChain() || mForceArrange; //Puts folders/items in proper positions // arrange() takes the model filter flag into account and call sort() if necessary (CHUI-849) @@ -1797,7 +1797,7 @@ void LLFolderView::update() if (!mPinningSelectedItem && !mSelectedItems.empty()) { // lets pin it! - mPinningSelectedItem = TRUE; + mPinningSelectedItem = true; //Computes visible area const LLRect visible_content_rect = (mScrollContainer ? mScrollContainer->getVisibleContentRect() : LLRect()); @@ -1832,7 +1832,7 @@ void LLFolderView::update() // stop pinning selected item after folders stop rearranging if (!needsArrange()) { - mPinningSelectedItem = FALSE; + mPinningSelectedItem = false; } } @@ -1868,7 +1868,7 @@ void LLFolderView::update() } if (!needs_arrange || !is_visible) { - mNeedsScroll = FALSE; + mNeedsScroll = false; } } } @@ -1885,15 +1885,15 @@ void LLFolderView::update() if (mSignalSelectCallback) { //RN: we use keyboard focus as a proxy for user-explicit actions - BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); + bool take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); mSelectSignal(mSelectedItems, take_keyboard_focus); } - mSignalSelectCallback = FALSE; + mSignalSelectCallback = false; } } else { - mSignalSelectCallback = FALSE; + mSignalSelectCallback = false; } } @@ -1928,7 +1928,7 @@ void LLFolderView::updateRenamerPosition() S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_rect.getWidth() - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); S32 height = mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD; - mRenamer->reshape( width, height, TRUE ); + mRenamer->reshape( width, height, true ); } } @@ -1940,9 +1940,9 @@ void LLFolderView::updateMenuOptions(LLMenuGL* menu) LLView::child_list_t::const_iterator menu_itor; for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) { - (*menu_itor)->setVisible(FALSE); - (*menu_itor)->pushVisible(TRUE); - (*menu_itor)->setEnabled(TRUE); + (*menu_itor)->setVisible(false); + (*menu_itor)->pushVisible(true); + (*menu_itor)->setEnabled(true); } // Successively filter out invalid options @@ -2008,7 +2008,7 @@ bool LLFolderView::selectFirstItem() { LLFolderViewItem* itemp = folder->getNextFromChild(0,true); if(itemp) - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } @@ -2019,7 +2019,7 @@ bool LLFolderView::selectFirstItem() LLFolderViewItem* itemp = (*iit); if (itemp->getVisible()) { - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } } @@ -2033,7 +2033,7 @@ bool LLFolderView::selectLastItem() LLFolderViewItem* itemp = (*iit); if (itemp->getVisible()) { - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } } @@ -2045,7 +2045,7 @@ bool LLFolderView::selectLastItem() { LLFolderViewItem* itemp = folder->getPreviousFromChild(0,true); if(itemp) - setSelection(itemp,FALSE,TRUE); + setSelection(itemp,false,true); return true; } } @@ -2086,15 +2086,15 @@ void LLFolderView::onRenamerLost() { if (mRenamer && mRenamer->getVisible()) { - mRenamer->setVisible(FALSE); + mRenamer->setVisible(false); // will commit current name (which could be same as original name) - mRenamer->setFocus(FALSE); + mRenamer->setFocus(false); } if( mRenameItem ) { - setSelection( mRenameItem, TRUE ); + setSelection( mRenameItem, true ); mRenameItem = NULL; } } @@ -2102,17 +2102,17 @@ void LLFolderView::onRenamerLost() LLFolderViewItem* LLFolderView::getNextUnselectedItem() { LLFolderViewItem* last_item = *mSelectedItems.rbegin(); - LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); + LLFolderViewItem* new_selection = last_item->getNextOpenNode(false); while(new_selection && new_selection->isSelected()) { - new_selection = new_selection->getNextOpenNode(FALSE); + new_selection = new_selection->getNextOpenNode(false); } if (!new_selection) { - new_selection = last_item->getPreviousOpenNode(FALSE); + new_selection = last_item->getPreviousOpenNode(false); while (new_selection && (new_selection->isInSelection())) { - new_selection = new_selection->getPreviousOpenNode(FALSE); + new_selection = new_selection->getPreviousOpenNode(false); } } return new_selection; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index ca78bd3072..62ef2a0626 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -109,7 +109,7 @@ public: LLFolderView(const Params&); virtual ~LLFolderView( void ); - virtual BOOL canFocusChildren() const; + virtual bool canFocusChildren() const; virtual const LLFolderView* getRoot() const { return this; } virtual LLFolderView* getRoot() { return this; } @@ -120,7 +120,7 @@ public: LLFolderViewGroupedItemModel* getFolderViewGroupedItemModel() { return mGroupedItemModel; } const LLFolderViewGroupedItemModel* getFolderViewGroupedItemModel() const { return mGroupedItemModel; } - typedef boost::signals2::signal<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)> signal_t; + typedef boost::signals2::signal<void (const std::deque<LLFolderViewItem*>& items, bool user_action)> signal_t; void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } @@ -156,12 +156,12 @@ public: selected_items_t& getSelectedItems( void ); // Record the selected item and pass it down the hierarchy. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus = TRUE); + virtual bool setSelection(LLFolderViewItem* selection, bool openitem, + bool take_keyboard_focus = true); // This method is used to toggle the selection of an item. Walks // children, and keeps track of selected objects. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + virtual bool changeSelection(LLFolderViewItem* selection, bool selected); virtual std::set<LLFolderViewItem*> getSelectionList() const; @@ -172,7 +172,7 @@ public: void removeFromSelectionList(LLFolderViewItem* item); bool startDrag(); - void setDragAndDropThisFrame() { mDragAndDropThisFrame = TRUE; } + void setDragAndDropThisFrame() { mDragAndDropThisFrame = true; } void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; } LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; } @@ -181,17 +181,17 @@ public: void autoOpenItem(LLFolderViewFolder* item); void closeAutoOpenedFolders(); - BOOL autoOpenTest(LLFolderViewFolder* item); - BOOL isOpen() const { return TRUE; } // root folder always open + bool autoOpenTest(LLFolderViewFolder* item); + bool isOpen() const { return true; } // root folder always open // Copy & paste - virtual BOOL canCopy() const; + virtual bool canCopy() const; virtual void copy(); - virtual BOOL canCut() const; + virtual bool canCut() const; virtual void cut(); - virtual BOOL canPaste() const; + virtual bool canPaste() const; virtual void paste(); LLFolderViewItem* getNextUnselectedItem(); @@ -200,20 +200,20 @@ public: void startRenamingSelectedItem( void ); // LLView functionality - ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + ///*virtual*/ bool handleKey( KEY key, MASK mask, bool called_from_parent ); + /*virtual*/ bool handleKeyHere( KEY key, MASK mask ); + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleDoubleClick( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(FALSE); } + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(false); } virtual void draw(); virtual void deleteAllChildren(); @@ -223,22 +223,22 @@ public: void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; } LLRect getVisibleRect(); - BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); + bool search(LLFolderViewItem* first_item, const std::string &search_string, bool backward); void setShowSelectionContext(bool show) { mShowSelectionContext = show; } - BOOL getShowSelectionContext(); + bool getShowSelectionContext(); void setShowSingleSelection(bool show); - BOOL getShowSingleSelection() { return mShowSingleSelection; } + bool getShowSingleSelection() { return mShowSingleSelection; } F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } bool getUseEllipses() { return mUseEllipses; } S32 getSelectedCount() { return (S32)mSelectedItems.size(); } void update(); // needs to be called periodically (e.g. once per frame) - BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } - BOOL needsAutoRename() { return mNeedsAutoRename; } - void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; } - void setPinningSelectedItem(BOOL val) { mPinningSelectedItem = val; } - void setAutoSelectOverride(BOOL val) { mAutoSelectOverride = val; } + bool needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } + bool needsAutoRename() { return mNeedsAutoRename; } + void setNeedsAutoRename(bool val) { mNeedsAutoRename = val; } + void setPinningSelectedItem(bool val) { mPinningSelectedItem = val; } + void setAutoSelectOverride(bool val) { mAutoSelectOverride = val; } bool showItemLinkOverlays() { return mShowItemLinkOverlays; } @@ -280,7 +280,7 @@ protected: bool selectFirstItem(); bool selectLastItem(); - BOOL addNoOptions(LLMenuGL* menu) const; + bool addNoOptions(LLMenuGL* menu) const; protected: @@ -386,14 +386,14 @@ public: class LLSelectFirstFilteredItem : public LLFolderViewFunctor { public: - LLSelectFirstFilteredItem() : mItemSelected(FALSE), mFolderSelected(FALSE) {} + LLSelectFirstFilteredItem() : mItemSelected(false), mFolderSelected(false) {} virtual ~LLSelectFirstFilteredItem() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item); - BOOL wasItemSelected() { return mItemSelected || mFolderSelected; } + bool wasItemSelected() { return mItemSelected || mFolderSelected; } protected: - BOOL mItemSelected; - BOOL mFolderSelected; + bool mItemSelected; + bool mFolderSelected; }; class LLOpenFilteredFolders : public LLFolderViewFunctor @@ -408,15 +408,15 @@ public: class LLSaveFolderState : public LLFolderViewFunctor { public: - LLSaveFolderState() : mApply(FALSE) {} + LLSaveFolderState() : mApply(false) {} virtual ~LLSaveFolderState() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item) {} - void setApply(BOOL apply); + void setApply(bool apply); void clearOpenFolders() { mOpenFolders.clear(); } protected: std::set<LLUUID> mOpenFolders; - BOOL mApply; + bool mApply; }; class LLOpenFoldersWithSelection : public LLFolderViewFunctor diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index a9e1171444..82cd2483e8 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -128,18 +128,18 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mSuffixNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), mParentFolder( NULL ), - mIsSelected( FALSE ), - mIsCurSelection( FALSE ), - mSelectPending(FALSE), + mIsSelected( false ), + mIsCurSelection( false ), + mSelectPending(false), mIsItemCut(false), mCutGeneration(0), mLabelStyle( LLFontGL::NORMAL ), - mHasVisibleChildren(FALSE), + mHasVisibleChildren(false), mLocalIndentation(p.folder_indentation), mIndentation(0), mItemHeight(p.item_height), mControlLabelRotation(0.f), - mDragAndDropTarget(FALSE), + mDragAndDropTarget(false), mLabel(p.name), mRoot(p.root), mViewModelItem(p.listener), @@ -185,7 +185,7 @@ LLFolderViewItem::~LLFolderViewItem() gFocusMgr.removeKeyboardFocusWithoutCallback(this); } -BOOL LLFolderViewItem::postBuild() +bool LLFolderViewItem::postBuild() { LLFolderViewModelItem* vmi = getViewModelItem(); llassert(vmi); // not supposed to happen, if happens, find out why and fix @@ -207,7 +207,7 @@ BOOL LLFolderViewItem::postBuild() // while LLFolderViewItem::arrange() updates visual part mSuffixNeedsRefresh = true; mLabelWidthDirty = true; - return TRUE; + return true; } LLFolderView* LLFolderViewItem::getRoot() @@ -220,21 +220,21 @@ const LLFolderView* LLFolderViewItem::getRoot() const return mRoot; } // Returns true if this object is a child (or grandchild, etc.) of potential_ancestor. -BOOL LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) +bool LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) { LLFolderViewItem* root = this; while( root->mParentFolder ) { if( root->mParentFolder == potential_ancestor ) { - return TRUE; + return true; } root = root->mParentFolder; } - return FALSE; + return false; } -LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children) +LLFolderViewItem* LLFolderViewItem::getNextOpenNode(bool include_children) { if (!mParentFolder) { @@ -256,7 +256,7 @@ LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children) return itemp; } -LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) +LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(bool include_children) { if (!mParentFolder) { @@ -280,19 +280,19 @@ LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) return itemp; } -BOOL LLFolderViewItem::passedFilter(S32 filter_generation) +bool LLFolderViewItem::passedFilter(S32 filter_generation) { return getViewModelItem()->passedFilter(filter_generation); } -BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) +bool LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) { if (filter_generation < 0) { filter_generation = getFolderViewModel()->getFilter().getFirstSuccessGeneration(); } LLFolderViewModelItem* model = getViewModelItem(); - BOOL visible = model->passedFilter(filter_generation); + bool visible = model->passedFilter(filter_generation); if (model->getMarkedDirtyGeneration() >= filter_generation) { // unsure visibility state @@ -352,8 +352,8 @@ void LLFolderViewItem::refreshSuffix() } // Utility function for LLFolderView -void LLFolderViewItem::arrangeAndSet(BOOL set_selection, - BOOL take_keyboard_focus) +void LLFolderViewItem::arrangeAndSet(bool set_selection, + bool take_keyboard_focus) { LLFolderView* root = getRoot(); if (getParentFolder()) @@ -362,7 +362,7 @@ void LLFolderViewItem::arrangeAndSet(BOOL set_selection, } if(set_selection) { - getRoot()->setSelection(this, TRUE, take_keyboard_focus); + getRoot()->setSelection(this, true, take_keyboard_focus); if(root) { root->scrollToShowSelection(); @@ -377,7 +377,7 @@ std::set<LLFolderViewItem*> LLFolderViewItem::getSelectionList() const return selection; } -// addToFolder() returns TRUE if it succeeds. FALSE otherwise +// addToFolder() returns true if it succeeds. false otherwise void LLFolderViewItem::addToFolder(LLFolderViewFolder* folder) { folder->addItem(this); @@ -447,7 +447,7 @@ S32 LLFolderViewItem::getTextPad() // means 'deselect' for a leaf item. Do this optimization after // multiple selection is implemented to make sure it all plays nice // together. -BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus) +bool LLFolderViewItem::setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus) { if (selection == this && !mIsSelected) { @@ -460,7 +460,7 @@ BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, return mIsSelected; } -BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected) +bool LLFolderViewItem::changeSelection(LLFolderViewItem* selection, bool selected) { if (selection == this) { @@ -472,31 +472,31 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte { selectItem(); } - return TRUE; + return true; } - return FALSE; + return false; } void LLFolderViewItem::deselectItem(void) { - mIsSelected = FALSE; + mIsSelected = false; } void LLFolderViewItem::selectItem(void) { - if (mIsSelected == FALSE) + if (!mIsSelected) { - mIsSelected = TRUE; + mIsSelected = true; getViewModelItem()->selectItem(); } } -BOOL LLFolderViewItem::isMovable() +bool LLFolderViewItem::isMovable() { return getViewModelItem()->isItemMovable(); } -BOOL LLFolderViewItem::isRemovable() +bool LLFolderViewItem::isRemovable() { return getViewModelItem()->isItemRemovable(); } @@ -515,12 +515,12 @@ void LLFolderViewItem::destroyView() // Call through to the viewed object and return true if it can be // removed. -//BOOL LLFolderViewItem::removeRecursively(BOOL single_item) -BOOL LLFolderViewItem::remove() +//bool LLFolderViewItem::removeRecursively(bool single_item) +bool LLFolderViewItem::remove() { if(!isRemovable()) { - return FALSE; + return false; } return getViewModelItem()->removeItem(); } @@ -554,21 +554,21 @@ const std::string& LLFolderViewItem::getName( void ) const } // LLView functionality -BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) { if(!mIsSelected) { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) { if (LLView::childrenHandleMouseDown(x, y, mask)) { - return TRUE; + return true; } // No handler needed for focus lost since this class has no @@ -587,7 +587,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) } else { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); } make_ui_sound("UISndClick"); } @@ -595,15 +595,15 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) { // If selected, we reserve the decision of deselecting/reselecting to the mouse up moment. // This is necessary so we maintain selection consistent when starting a drag. - mSelectPending = TRUE; + mSelectPending = true; } mDragStartX = x; mDragStartY = y; - return TRUE; + return true; } -BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); @@ -618,7 +618,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { // RN: when starting drag and drop, clear out last auto-open root->autoOpenTest(NULL); - root->setShowSelectionContext(TRUE); + root->setShowSelectionContext(true); // Release keyboard focus, so that if stuff is dropped into the // world, pressing the delete key won't blow away the inventory @@ -633,31 +633,31 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) } root->clearHoveredItem(); - return TRUE; + return true; } else { LLFolderView* pRoot = getRoot(); pRoot->setHoveredItem(this); - pRoot->setShowSelectionContext(FALSE); + pRoot->setShowSelectionContext(false); getWindow()->setCursor(UI_CURSOR_ARROW); // let parent handle this then... - return FALSE; + return false; } } -BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) { openItem(); - return TRUE; + return true; } -BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) { if (LLView::childrenHandleMouseUp(x, y, mask)) { - return TRUE; + return true; } // if mouse hasn't moved since mouse down... @@ -674,21 +674,21 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) } else { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); } } - mSelectPending = FALSE; + mSelectPending = false; if( hasMouseCapture() ) { if (getRoot()) { - getRoot()->setShowSelectionContext(FALSE); + getRoot()->setShowSelectionContext(false); } gFocusMgr.setMouseCapture( NULL ); } - return TRUE; + return true; } void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask) @@ -703,18 +703,18 @@ void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask) } } -BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; - BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + bool handled = false; + bool accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); handled = accepted; if (accepted) { - mDragAndDropTarget = TRUE; + mDragAndDropTarget = true; *accept = ACCEPT_YES_MULTI; } else @@ -775,7 +775,7 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L return mIsItemCut; } -void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, +void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor) { const S32 focus_top = getRect().getHeight(); @@ -789,7 +789,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo //--------------------------------------------------------------------------------// // Draw highlight for selected items // Note: Always render "current" item or flashing item, only render other selected - // items if mShowSingleSelection is FALSE. + // items if mShowSingleSelection is false. // if (isHighlightAllowed()) @@ -833,7 +833,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_top, getRect().getWidth() - 2, focus_bottom, - focusOutlineColor, FALSE); + focusOutlineColor, false); } if (folder_open) @@ -842,14 +842,14 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_bottom + 1, // overlap with bottom edge of above rect getRect().getWidth() - 2, 0, - focusOutlineColor, FALSE); + focusOutlineColor, false); if (showContent && !isFlashing()) { gl_rect_2d(FOCUS_LEFT, focus_bottom + 1, getRect().getWidth() - 2, 0, - bgColor, TRUE); + bgColor, true); } } } @@ -859,7 +859,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_top, getRect().getWidth() - 2, focus_bottom, - mouseOverColor, FALSE); + mouseOverColor, false); } //--------------------------------------------------------------------------------// @@ -872,16 +872,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo focus_top, getRect().getWidth() - 2, focus_bottom, - bgColor, FALSE); + bgColor, false); if (folder_open) { gl_rect_2d(FOCUS_LEFT, focus_bottom + 1, // overlap with bottom edge of above rect getRect().getWidth() - 2, 0, - bgColor, FALSE); + bgColor, false); } - mDragAndDropTarget = FALSE; + mDragAndDropTarget = false; } } @@ -892,13 +892,13 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y // font->renderUTF8(mLabel, 0, x, y, color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/TRUE); + S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true); } void LLFolderViewItem::draw() { - const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); - const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled + const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false); + const bool filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : false); // If we have keyboard focus, draw selection filled const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>(); const S32 TOP_PAD = default_params.item_top_pad; @@ -940,22 +940,22 @@ void LLFolderViewItem::draw() return; } - std::string::size_type filter_string_length = mViewModelItem->hasFilterStringMatch() ? mViewModelItem->getFilterStringSize() : 0; + auto filter_string_length = mViewModelItem->hasFilterStringMatch() ? static_cast<S32>(mViewModelItem->getFilterStringSize()) : 0; F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); std::string combined_string = mLabel + mLabelSuffix; const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL); - S32 filter_offset = mViewModelItem->getFilterStringOffset(); + S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset()); if (filter_string_length > 0) { S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); S32 top = getRect().getHeight() - TOP_PAD; if(mLabelSuffix.empty() || (font == suffix_font)) { - S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2; - S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2; + S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; + S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -976,7 +976,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; + S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -1033,7 +1033,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, @@ -1071,8 +1071,8 @@ bool LLFolderViewItem::isInSelection() const LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): LLFolderViewItem( p ), - mIsOpen(FALSE), - mExpanderHighlighted(FALSE), + mIsOpen(false), + mExpanderHighlighted(false), mCurHeight(0.f), mTargetHeight(0.f), mAutoOpenCountdown(0.f), @@ -1107,7 +1107,7 @@ LLFolderViewFolder::~LLFolderViewFolder( void ) gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() } -// addToFolder() returns TRUE if it succeeds. FALSE otherwise +// addToFolder() returns true if it succeeds. false otherwise void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) { folder->addFolder(this); @@ -1267,7 +1267,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) > ll_round(mCurHeight) + mMaxFolderItemOverlap) { // hide if beyond current folder height - (*fit)->setVisible(FALSE); + (*fit)->setVisible(false); } } @@ -1279,7 +1279,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) if (getRect().getHeight() - (*iit)->getRect().mBottom > ll_round(mCurHeight) + mMaxFolderItemOverlap) { - (*iit)->setVisible(FALSE); + (*iit)->setVisible(false); } } } @@ -1297,7 +1297,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) return ll_round(mTargetHeight); } -BOOL LLFolderViewFolder::needsArrange() +bool LLFolderViewFolder::needsArrange() { return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); } @@ -1309,17 +1309,17 @@ bool LLFolderViewFolder::descendantsPassedFilter(S32 filter_generation) // Passes selection information on to children and record selection // information if necessary. -BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus) +bool LLFolderViewFolder::setSelection(LLFolderViewItem* selection, bool openitem, + bool take_keyboard_focus) { - BOOL rv = FALSE; + bool rv = false; if (selection == this) { if (!isSelected()) { selectItem(); } - rv = TRUE; + rv = true; } else { @@ -1327,9 +1327,9 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem { deselectItem(); } - rv = FALSE; + rv = false; } - BOOL child_selected = FALSE; + bool child_selected = false; for (folders_t::iterator iter = mFolders.begin(); iter != mFolders.end();) @@ -1337,8 +1337,8 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem folders_t::iterator fit = iter++; if((*fit)->setSelection(selection, openitem, take_keyboard_focus)) { - rv = TRUE; - child_selected = TRUE; + rv = true; + child_selected = true; } } for (items_t::iterator iter = mItems.begin(); @@ -1347,13 +1347,13 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem items_t::iterator iit = iter++; if((*iit)->setSelection(selection, openitem, take_keyboard_focus)) { - rv = TRUE; - child_selected = TRUE; + rv = true; + child_selected = true; } } if(openitem && child_selected && !mSingleFolderMode) { - setOpenArrangeRecursively(TRUE); + setOpenArrangeRecursively(true); } return rv; } @@ -1361,15 +1361,15 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem // This method is used to change the selection of an item. // Recursively traverse all children; if 'selection' is 'this' then change // the select status if necessary. -// Returns TRUE if the selection state of this folder, or of a child, was changed. -BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected) +// Returns true if the selection state of this folder, or of a child, was changed. +bool LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, bool selected) { - BOOL rv = FALSE; + bool rv = false; if(selection == this) { if (isSelected() != selected) { - rv = TRUE; + rv = true; if (selected) { selectItem(); @@ -1387,7 +1387,7 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec folders_t::iterator fit = iter++; if((*fit)->changeSelection(selection, selected)) { - rv = TRUE; + rv = true; } } for (items_t::iterator iter = mItems.begin(); @@ -1396,7 +1396,7 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selec items_t::iterator iit = iter++; if((*iit)->changeSelection(selection, selected)) { - rv = TRUE; + rv = true; } } return rv; @@ -1580,7 +1580,8 @@ void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFo void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) { - if (getRoot()->getAllowMultiSelect() == FALSE) return; + if (!getRoot()->getAllowMultiSelect()) + return; LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem(); if (cur_selected_item == NULL) @@ -1591,14 +1592,15 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) bool reverse = false; LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse); - if (!common_ancestor) return; + if (!common_ancestor) + return; LLFolderViewItem* last_selected_item_from_cur = cur_selected_item; LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder(); std::vector<LLFolderViewItem*> items_to_select_forward; - while(cur_folder != common_ancestor) + while (cur_folder != common_ancestor) { cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward); @@ -1610,7 +1612,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) LLFolderViewItem* last_selected_item_from_new = new_selection; cur_folder = new_selection->getParentFolder(); - while(cur_folder != common_ancestor) + while (cur_folder != common_ancestor) { cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse); @@ -1629,7 +1631,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) LLFolderView* root = getRoot(); - BOOL selection_reverse = new_selection->isSelected(); //indication that some elements are being deselected + bool selection_reverse = new_selection->isSelected(); //indication that some elements are being deselected // array always go from 'will be selected' to ' will be unselected', iterate // in opposite direction to simplify identification of 'point of origin' in @@ -1639,12 +1641,12 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) ++it) { LLFolderViewItem* item = *it; - BOOL selected = item->isSelected(); + bool selected = item->isSelected(); if (!selection_reverse && selected) { // it is our 'point of origin' where we shift/expand from // don't deselect it - selection_reverse = TRUE; + selection_reverse = true; } else { @@ -1655,11 +1657,11 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) if (selection_reverse) { // at some point we reversed selection, first element should be deselected - root->changeSelection(last_selected_item_from_cur, FALSE); + root->changeSelection(last_selected_item_from_cur, false); } // element we expand to should always be selected - root->changeSelection(new_selection, TRUE); + root->changeSelection(new_selection, true); } @@ -1717,11 +1719,11 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item, bool deparent_mode removeChild(item); } -BOOL LLFolderViewFolder::isMovable() +bool LLFolderViewFolder::isMovable() { if( !(getViewModelItem()->isItemMovable()) ) { - return FALSE; + return false; } for (items_t::iterator iter = mItems.begin(); @@ -1730,7 +1732,7 @@ BOOL LLFolderViewFolder::isMovable() items_t::iterator iit = iter++; if(!(*iit)->isMovable()) { - return FALSE; + return false; } } @@ -1740,18 +1742,18 @@ BOOL LLFolderViewFolder::isMovable() folders_t::iterator fit = iter++; if(!(*fit)->isMovable()) { - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLFolderViewFolder::isRemovable() +bool LLFolderViewFolder::isRemovable() { if( !(getViewModelItem()->isItemRemovable()) ) { - return FALSE; + return false; } for (items_t::iterator iter = mItems.begin(); @@ -1760,7 +1762,7 @@ BOOL LLFolderViewFolder::isRemovable() items_t::iterator iit = iter++; if(!(*iit)->isRemovable()) { - return FALSE; + return false; } } @@ -1770,10 +1772,10 @@ BOOL LLFolderViewFolder::isRemovable() folders_t::iterator fit = iter++; if(!(*fit)->isRemovable()) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLFolderViewFolder::destroyRoot() @@ -1793,7 +1795,7 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item) mItems.push_back(item); item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); - item->setVisible(FALSE); + item->setVisible(false); addChild(item); @@ -1816,7 +1818,7 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) mFolders.push_back(folder); folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); - folder->setVisible(FALSE); + folder->setVisible(false); // rearrange all descendants too, as our indentation level might have changed //folder->requestArrange(); //requestSort(); @@ -1847,7 +1849,7 @@ void LLFolderViewFolder::toggleOpen() } // Force a folder open or closed -void LLFolderViewFolder::setOpen(BOOL openitem) +void LLFolderViewFolder::setOpen(bool openitem) { if(mSingleFolderMode) { @@ -1864,9 +1866,9 @@ void LLFolderViewFolder::setOpen(BOOL openitem) } } -void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse) +void LLFolderViewFolder::setOpenArrangeRecursively(bool openitem, ERecurseType recurse) { - BOOL was_open = isOpen(); + bool was_open = isOpen(); mIsOpen = openitem; if(!was_open && openitem) { @@ -1901,17 +1903,17 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType r } } -BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, - BOOL drop, +bool LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, + bool drop, EDragAndDropType c_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); + bool accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); if (accepted) { - mDragAndDropTarget = TRUE; + mDragAndDropTarget = true; *accept = ACCEPT_YES_MULTI; } else @@ -1922,7 +1924,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, // drag and drop to child item, so clear pending auto-opens getRoot()->autoOpenTest(NULL); - return TRUE; + return true; } void LLFolderViewFolder::openItem( void ) @@ -1965,14 +1967,14 @@ void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor) } // LLView functionality -BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; if (isOpen()) { @@ -1986,11 +1988,11 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewFolder" << LL_ENDL; } - return TRUE; + return true; } -BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, - BOOL drop, +bool LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -2000,14 +2002,14 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, { *accept = ACCEPT_NO; tooltip_msg = LLTrans::getString("TooltipOutboxCannotDropOnRoot"); - return TRUE; + return true; } - BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + bool accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); if (accepted) { - mDragAndDropTarget = TRUE; + mDragAndDropTarget = true; *accept = ACCEPT_YES_MULTI; } else @@ -2020,13 +2022,13 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, getRoot()->autoOpenTest(this); } - return TRUE; + return true; } -BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( isOpen() ) { @@ -2040,11 +2042,11 @@ BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) } -BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) +bool LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) { mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); - BOOL handled = LLView::handleHover(x, y, mask); + bool handled = LLView::handleHover(x, y, mask); if (!handled) { @@ -2055,9 +2057,9 @@ BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) return handled; } -BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if( isOpen() ) { handled = childrenHandleMouseDown(x,y,mask) != NULL; @@ -2068,7 +2070,7 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) && !mSingleFolderMode) { toggleOpen(); - handled = TRUE; + handled = true; } else { @@ -2080,9 +2082,9 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) return handled; } -BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) +bool LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; if(mSingleFolderMode) { static LLUICachedControl<bool> double_click_new_window("SingleModeDoubleClickOpenWindow", false); @@ -2099,7 +2101,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) getViewModelItem()->navigateToFolder(false); }); } - return TRUE; + return true; } if( isOpen() ) @@ -2114,12 +2116,12 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) if (double_click_action == 1) { getViewModelItem()->navigateToFolder(true); - return TRUE; + return true; } if (double_click_action == 2) { getViewModelItem()->navigateToFolder(false, true); - return TRUE; + return true; } } if(mIndentation < x && x < mIndentation + (isCollapsed() ? 0 : mArrowSize) + mTextPad) @@ -2130,10 +2132,10 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) } else { - getRoot()->setSelection(this, FALSE); + getRoot()->setSelection(this, false); toggleOpen(); } - handled = TRUE; + handled = true; } return handled; } @@ -2150,19 +2152,19 @@ void LLFolderViewFolder::draw() LLView::draw(); } - mExpanderHighlighted = FALSE; + mExpanderHighlighted = false; } // this does prefix traversal, as folders are listed above their contents -LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, BOOL include_children ) +LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, bool include_children ) { - BOOL found_item = FALSE; + bool found_item = false; LLFolderViewItem* result = NULL; // when not starting from a given item, start at beginning if(item == NULL) { - found_item = TRUE; + found_item = true; } // find current item among children @@ -2180,16 +2182,16 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { if(item == (*fit)) { - found_item = TRUE; + found_item = true; // if we are on downwards traversal if (include_children && (*fit)->isOpen()) { // look for first descendant - return (*fit)->getNextFromChild(NULL, TRUE); + return (*fit)->getNextFromChild(NULL, true); } // otherwise advance to next folder ++fit; - include_children = TRUE; + include_children = true; break; } } @@ -2201,7 +2203,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { if(item == (*iit)) { - found_item = TRUE; + found_item = true; // point to next item ++iit; break; @@ -2214,7 +2216,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { // you should never call this method with an item that isn't a child // so we should always find something - llassert(FALSE); + llassert(false); return NULL; } @@ -2252,22 +2254,22 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { // If there are no siblings or children to go to, recurse up one level in the tree // and skip children for this folder, as we've already discounted them - result = mParentFolder->getNextFromChild(this, FALSE); + result = mParentFolder->getNextFromChild(this, false); } return result; } // this does postfix traversal, as folders are listed above their contents -LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, BOOL include_children ) +LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, bool include_children ) { - BOOL found_item = FALSE; + bool found_item = false; LLFolderViewItem* result = NULL; // when not starting from a given item, start at end if(item == NULL) { - found_item = TRUE; + found_item = true; } // find current item among children @@ -2285,7 +2287,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { if(item == (*iit)) { - found_item = TRUE; + found_item = true; // point to next item ++iit; break; @@ -2299,7 +2301,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { if(item == (*fit)) { - found_item = TRUE; + found_item = true; // point to next folder ++fit; break; @@ -2312,7 +2314,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { // you should never call this method with an item that isn't a child // so we should always find something - llassert(FALSE); + llassert(false); return NULL; } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 351613e387..f7ced81274 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -158,21 +158,21 @@ protected: static LLFontGL* getLabelFontForStyle(U8 style); - BOOL mIsSelected; + bool mIsSelected; public: static void initClass(); static void cleanupClass(); - BOOL postBuild(); + bool postBuild(); virtual void openItem( void ); - void arrangeAndSet(BOOL set_selection, BOOL take_keyboard_focus); + void arrangeAndSet(bool set_selection, bool take_keyboard_focus); virtual ~LLFolderViewItem( void ); - // addToFolder() returns TRUE if it succeeds. FALSE otherwise + // addToFolder() returns true if it succeeds. false otherwise virtual void addToFolder(LLFolderViewFolder* folder); // Finds width and height of this object and it's children. Also @@ -184,13 +184,13 @@ public: S32 getTextPad(); // If 'selection' is 'this' then note that otherwise ignore. - // Returns TRUE if this item ends up being selected. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + // Returns true if this item ends up being selected. + virtual bool setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus); // This method is used to set the selection state of an item. // If 'selection' is 'this' then note selection. - // Returns TRUE if the selection state of this item was changed. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + // Returns true if the selection state of this item was changed. + virtual bool changeSelection(LLFolderViewItem* selection, bool selected); // this method is used to deselect this element void deselectItem(); @@ -202,24 +202,24 @@ public: virtual std::set<LLFolderViewItem*> getSelectionList() const; // Returns true is this object and all of its children can be removed (deleted by user) - virtual BOOL isRemovable(); + virtual bool isRemovable(); // Returns true is this object and all of its children can be moved - virtual BOOL isMovable(); + virtual bool isMovable(); // destroys this item recursively virtual void destroyView(); - BOOL isSelected() const { return mIsSelected; } + bool isSelected() const { return mIsSelected; } bool isInSelection() const; - void setUnselected() { mIsSelected = FALSE; } + void setUnselected() { mIsSelected = false; } - void setIsCurSelection(BOOL select) { mIsCurSelection = select; } + void setIsCurSelection(bool select) { mIsCurSelection = select; } - BOOL getIsCurSelection() const { return mIsCurSelection; } + bool getIsCurSelection() const { return mIsCurSelection; } - BOOL hasVisibleChildren() const { return mHasVisibleChildren; } + bool hasVisibleChildren() const { return mHasVisibleChildren; } // true if object can't have children virtual bool isFolderComplete() { return true; } @@ -229,8 +229,8 @@ public: // Call through to the viewed object and return true if it can be // removed. Returns true if it's removed. - //virtual BOOL removeRecursively(BOOL single_item); - BOOL remove(); + //virtual bool removeRecursively(bool single_item); + bool remove(); // Build an appropriate context menu for the item. Flags unused. void buildContextMenu(class LLMenuGL& menu, U32 flags); @@ -249,8 +249,8 @@ public: void setParentFolder(LLFolderViewFolder* parent) { mParentFolder = parent; } - LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); - LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); + LLFolderViewItem* getNextOpenNode( bool include_children = true ); + LLFolderViewItem* getPreviousOpenNode( bool include_children = true ); const LLFolderViewModelItem* getViewModelItem( void ) const { return mViewModelItem; } LLFolderViewModelItem* getViewModelItem( void ) { return mViewModelItem; } @@ -262,16 +262,16 @@ public: void rename(const std::string& new_name); // Show children - virtual void setOpen(BOOL open = TRUE) {}; - virtual BOOL isOpen() const { return FALSE; } + virtual void setOpen(bool open = true) {}; + virtual bool isOpen() const { return false; } virtual LLFolderView* getRoot(); virtual const LLFolderView* getRoot() const; - BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor ); + bool isDescendantOf( const LLFolderViewFolder* potential_ancestor ); S32 getIndentation() const { return mIndentation; } - virtual BOOL passedFilter(S32 filter_generation = -1); - virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); + virtual bool passedFilter(S32 filter_generation = -1); + virtual bool isPotentiallyVisible(S32 filter_generation = -1); // refresh information from the object being viewed. // refreshes label, suffixes and sets icons. Expensive! @@ -284,22 +284,22 @@ public: bool isSingleFolderMode() { return mSingleFolderMode; } // LLView functionality - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleDoubleClick( S32 x, S32 y, MASK mask ); virtual void onMouseLeave(S32 x, S32 y, MASK mask); - //virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return LLView::findChildView(name, recurse); } + //virtual LLView* findChildView(const std::string& name, bool recurse) const { return LLView::findChildView(name, recurse); } // virtual void handleDropped(); virtual void draw(); void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color); - void drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); + void drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); void drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -324,7 +324,7 @@ protected: friend class LLUICtrlFactory; void updateLabelRotation(); - virtual bool isCollapsed() { return FALSE; } + virtual bool isCollapsed() { return false; } public: typedef std::list<LLFolderViewItem*> items_t; @@ -334,8 +334,8 @@ protected: items_t mItems; folders_t mFolders; - BOOL mIsOpen; - BOOL mExpanderHighlighted; + bool mIsOpen; + bool mExpanderHighlighted; F32 mCurHeight; F32 mTargetHeight; F32 mAutoOpenCountdown; @@ -356,40 +356,40 @@ public: virtual ~LLFolderViewFolder( void ); - LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); - LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); + LLFolderViewItem* getNextFromChild( LLFolderViewItem*, bool include_children = true ); + LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, bool include_children = true ); - // addToFolder() returns TRUE if it succeeds. FALSE otherwise + // addToFolder() returns true if it succeeds. false otherwise virtual void addToFolder(LLFolderViewFolder* folder); // Finds width and height of this object and it's children. Also // makes sure that this view and it's children are the right size. virtual S32 arrange( S32* width, S32* height ); - BOOL needsArrange(); + bool needsArrange(); bool descendantsPassedFilter(S32 filter_generation = -1); // Passes selection information on to children and record // selection information if necessary. - // Returns TRUE if this object (or a child) ends up being selected. - // If 'openitem' is TRUE then folders are opened up along the way to the selection. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus = TRUE); + // Returns true if this object (or a child) ends up being selected. + // If 'openitem' is true then folders are opened up along the way to the selection. + virtual bool setSelection(LLFolderViewItem* selection, bool openitem, bool take_keyboard_focus = true); // This method is used to change the selection of an item. // Recursively traverse all children; if 'selection' is 'this' then change // the select status if necessary. - // Returns TRUE if the selection state of this folder, or of a child, was changed. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + // Returns true if the selection state of this folder, or of a child, was changed. + virtual bool changeSelection(LLFolderViewItem* selection, bool selected); // this method is used to group select items void extendSelectionTo(LLFolderViewItem* selection); // Returns true is this object and all of its children can be removed. - virtual BOOL isRemovable(); + virtual bool isRemovable(); // Returns true is this object and all of its children can be moved - virtual BOOL isMovable(); + virtual bool isMovable(); // destroys this folder, and all children virtual void destroyView(); @@ -416,7 +416,7 @@ public: virtual void toggleOpen(); // Force a folder open or closed - virtual void setOpen(BOOL openitem = TRUE); + virtual void setOpen(bool openitem = true); // Called when a child is refreshed. virtual void requestArrange(); @@ -425,14 +425,14 @@ public: // method was written because the list iterators destroy the state // of other iterations, thus, we can't arrange while iterating // through the children (such as when setting which is selected. - virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse = RECURSE_NO); + virtual void setOpenArrangeRecursively(bool openitem, ERecurseType recurse = RECURSE_NO); // Get the current state of the folder. - virtual BOOL isOpen() const { return mIsOpen; } + virtual bool isOpen() const { return mIsOpen; } // special case if an object is dropped on the child. - BOOL handleDragAndDropFromChild(MASK mask, - BOOL drop, + bool handleDragAndDropFromChild(MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -447,18 +447,18 @@ public: virtual void openItem( void ); // LLView functionality - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - BOOL handleDragAndDropToThisFolder(MASK mask, - BOOL drop, + bool handleDragAndDropToThisFolder(MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index f02c1e3883..b8d6d89971 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -162,24 +162,24 @@ public: virtual void navigateToFolder(bool new_window = false, bool change_mode = false) = 0; - virtual BOOL isItemWearable() const { return FALSE; } + virtual bool isItemWearable() const { return false; } - virtual BOOL isItemRenameable() const = 0; - virtual BOOL renameItem(const std::string& new_name) = 0; + virtual bool isItemRenameable() const = 0; + virtual bool renameItem(const std::string& new_name) = 0; - virtual BOOL isItemMovable( void ) const = 0; // Can be moved to another folder + virtual bool isItemMovable( void ) const = 0; // Can be moved to another folder virtual void move( LLFolderViewModelItem* parent_listener ) = 0; - virtual BOOL isItemRemovable( bool check_worn = true ) const = 0; // Can be destroyed - virtual BOOL removeItem() = 0; + virtual bool isItemRemovable( bool check_worn = true ) const = 0; // Can be destroyed + virtual bool removeItem() = 0; virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) = 0; virtual bool isItemCopyable(bool can_copy_as_link = true) const = 0; - virtual BOOL copyToClipboard() const = 0; - virtual BOOL cutToClipboard() = 0; + virtual bool copyToClipboard() const = 0; + virtual bool cutToClipboard() = 0; virtual bool isCutToClipboard() { return false; }; - virtual BOOL isClipboardPasteable() const = 0; + virtual bool isClipboardPasteable() const = 0; virtual void pasteFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0; @@ -207,10 +207,10 @@ public: virtual void clearChildren() = 0; // This method will be called to determine if a drop can be - // performed, and will set drop to TRUE if a drop is - // requested. Returns TRUE if a drop is possible/happened, - // otherwise FALSE. - virtual BOOL dragOrDrop(MASK mask, BOOL drop, + // performed, and will set drop to true if a drop is + // requested. Returns true if a drop is possible/happened, + // otherwise false. + virtual bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) = 0; diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 38c869cd59..83379dd0a9 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -86,17 +86,17 @@ void LLIconCtrl::draw() LLUICtrl::draw(); } -BOOL LLIconCtrl::handleHover(S32 x, S32 y, MASK mask) +bool LLIconCtrl::handleHover(S32 x, S32 y, MASK mask) { if (mInteractable && getEnabled()) { getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } return LLUICtrl::handleHover(x, y, mask); } -void LLIconCtrl::onVisibilityChange(BOOL new_visibility) +void LLIconCtrl::onVisibilityChange(bool new_visibility) { LLUICtrl::onVisibilityChange(new_visibility); if (mPriority == LLGLTexture::BOOST_ICON) diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index 240fe3a74c..aae1d1d572 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -71,10 +71,10 @@ public: virtual void draw(); // llview overrides - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); // lluictrl overrides - void onVisibilityChange(BOOL new_visibility); + void onVisibilityChange(bool new_visibility); virtual void setValue(const LLSD& value ); std::string getImageName() const; diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 1ac1e41727..5e184b5ddb 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -39,7 +39,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const // strncmp is much faster than string compare bool res = true; const llwchar* t = mToken.c_str(); - S32 len = mToken.size(); + auto len = mToken.size(); for (S32 i=0; i<len; i++) { if (s[i] != t[i]) @@ -55,7 +55,7 @@ inline bool LLKeywordToken::isTail(const llwchar* s) const { bool res = true; const llwchar* t = mDelimiter.c_str(); - S32 len = mDelimiter.size(); + auto len = mDelimiter.size(); for (S32 i=0; i<len; i++) { if (s[i] != t[i]) @@ -134,7 +134,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) if (arguments.isArray()) { - U32 argsCount = arguments.size(); + auto argsCount = arguments.size(); LLSD::array_iterator arrayIt = arguments.beginArray(); for ( ; arrayIt != arguments.endArray(); ++arrayIt) { @@ -489,7 +489,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW return; } - S32 text_len = wtext.size() + 1; + S32 text_len = static_cast<S32>(wtext.size()) + 1; seg_list->push_back( new LLNormalTextSegment( style, 0, text_len, editor ) ); @@ -525,7 +525,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW // Line start tokens { - BOOL line_done = FALSE; + bool line_done = false; for (token_list_t::iterator iter = mLineTokenList.begin(); iter != mLineTokenList.end(); ++iter) { @@ -542,7 +542,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW //create segments from seg_start to seg_end insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, style, editor); - line_done = TRUE; // to break out of second loop. + line_done = true; // to break out of second loop. break; } } @@ -707,16 +707,16 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen { if (pos!=seg_start) { - LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, pos, editor); + LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, static_cast<S32>(pos), editor); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); } - LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos); + LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, static_cast<S32>(pos)); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); - seg_start = pos+1; + seg_start = static_cast<S32>(pos) + 1; pos = wtext.find('\n',seg_start); } @@ -803,9 +803,9 @@ void LLKeywords::dump() void LLKeywordToken::dump() { LL_INFOS() << "[" << - mColor.mV[VX] << ", " << - mColor.mV[VY] << ", " << - mColor.mV[VZ] << "] [" << + mColor.mV[VRED] << ", " << + mColor.mV[VGREEN] << ", " << + mColor.mV[VBLUE] << "] [" << wstring_to_utf8str(mToken) << "]" << LL_ENDL; } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 9dcdea121b..f498b3ddee 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -82,8 +82,8 @@ public: { } - S32 getLengthHead() const { return mToken.size(); } - S32 getLengthTail() const { return mDelimiter.size(); } + S32 getLengthHead() const { return static_cast<S32>(mToken.size()); } + S32 getLengthTail() const { return static_cast<S32>(mDelimiter.size()); } bool isHead(const llwchar* s) const; bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 13d6faa673..6db9f64a97 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -61,7 +61,7 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMinDim(p.min_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), - mCollapsed(FALSE), + mCollapsed(false), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible mResizeBar(NULL), @@ -144,16 +144,14 @@ void LLLayoutPanel::setOrientation( LLView::EOrientation orientation ) ? getRect().getWidth() : getRect().getHeight())); - if (mAutoResize == FALSE - && mUserResize == TRUE - && mMinDim == -1 ) + if (!mAutoResize && mUserResize && mMinDim == -1) { setMinDim(layout_dim); } mTargetDim = llmax(layout_dim, getMinDim()); } -void LLLayoutPanel::setVisible( BOOL visible ) +void LLLayoutPanel::setVisible( bool visible ) { if (visible != getVisible()) { @@ -166,11 +164,11 @@ void LLLayoutPanel::setVisible( BOOL visible ) LLPanel::setVisible(visible); } -void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ ) +void LLLayoutPanel::reshape( S32 width, S32 height, bool called_from_parent /*= true*/ ) { if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return; - if (!mIgnoreReshape && mAutoResize == false) + if (!mIgnoreReshape && !mAutoResize) { mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent()); @@ -314,10 +312,10 @@ void LLLayoutStack::removeChild(LLView* view) } } -BOOL LLLayoutStack::postBuild() +bool LLLayoutStack::postBuild() { updateLayout(); - return TRUE; + return true; } bool LLLayoutStack::addChild(LLView* child, S32 tab_group) @@ -330,7 +328,7 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) createResizeBar(panelp); mNeedsLayout = true; } - BOOL result = LLView::addChild(child, tab_group); + bool result = LLView::addChild(child, tab_group); updateFractionalSizes(); return result; @@ -344,11 +342,11 @@ void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate) if (animate == ANIMATE) { panel->mVisibleAmt = 0.f; - panel->setVisible(TRUE); + panel->setVisible(true); } } -void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) +void LLLayoutStack::collapsePanel(LLPanel* panel, bool collapsed) { LLLayoutPanel* panel_container = findEmbeddedPanel(panel); if (!panel_container) return; @@ -615,7 +613,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); addBorder(border_params); - setBorderVisible(TRUE); + setBorderVisible(true); LLImagePanel::Params image_panel; mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle"); @@ -628,7 +626,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) //if (mShowDragHandle) //{ - // setBackgroundVisible(TRUE); + // setBackgroundVisible(true); // setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody")); //} @@ -985,7 +983,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& //normalizeFractionalSizes(); } -void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent) { mNeedsLayout = true; LLView::reshape(width, height, called_from_parent); @@ -998,7 +996,7 @@ void LLLayoutStack::updateResizeBarLimits() { if (!visible_panelp->getVisible() || visible_panelp->mCollapsed) { - visible_panelp->mResizeBar->setVisible(FALSE); + visible_panelp->mResizeBar->setVisible(false); continue; } @@ -1008,14 +1006,14 @@ void LLLayoutStack::updateResizeBarLimits() && (visible_panelp->mAutoResize || visible_panelp->mUserResize) // current panel is resizable && (previous_visible_panelp->mAutoResize || previous_visible_panelp->mUserResize)) // previous panel is resizable { - visible_panelp->mResizeBar->setVisible(TRUE); + visible_panelp->mResizeBar->setVisible(true); S32 previous_panel_headroom = previous_visible_panelp->getVisibleDim() - previous_visible_panelp->getRelevantMinDim(); visible_panelp->mResizeBar->setResizeLimits(visible_panelp->getRelevantMinDim(), visible_panelp->getVisibleDim() + previous_panel_headroom); } else { - visible_panelp->mResizeBar->setVisible(FALSE); + visible_panelp->mResizeBar->setVisible(false); } previous_visible_panelp = visible_panelp; diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 884850285a..9e5f8048ba 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -71,9 +71,9 @@ public: /*virtual*/ void draw(); /*virtual*/ void deleteAllChildren(); /*virtual*/ void removeChild(LLView*); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); @@ -85,8 +85,8 @@ public: } EAnimate; void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); - void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); - S32 getNumPanels() { return mPanels.size(); } + void collapsePanel(LLPanel* panel, bool collapsed = true); + S32 getNumPanels() { return static_cast<S32>(mPanels.size()); } void updateLayout(); @@ -156,10 +156,10 @@ public: void handleReshape(const LLRect& new_rect, bool by_user); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + void reshape(S32 width, S32 height, bool called_from_parent = true); - void setVisible(BOOL visible); + void setVisible(bool visible); S32 getLayoutDim() const; S32 getTargetDim() const; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 05de46b852..fa71c7704d 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -74,7 +74,7 @@ static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor"); // Compiler optimization, generate extern template template class LLLineEditor* LLView::getChild<class LLLineEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; // // Member functions @@ -131,10 +131,10 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTextLeftEdge(0), // computed in updateTextPadding() below mTextRightEdge(0), // computed in updateTextPadding() below mCommitOnFocusLost( p.commit_on_focus_lost ), - mKeystrokeOnEsc(FALSE), + mKeystrokeOnEsc(false), mRevertOnEsc( p.revert_on_esc ), mKeystrokeCallback( p.keystroke_callback() ), - mIsSelecting( FALSE ), + mIsSelecting( false ), mSelectionStart( 0 ), mSelectionEnd( 0 ), mLastSelectionX(-1), @@ -142,7 +142,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mLastSelectionStart(-1), mLastSelectionEnd(-1), mBorderThickness( 0 ), - mIgnoreArrowKeys( FALSE ), + mIgnoreArrowKeys( false ), mIgnoreTab( p.ignore_tab ), mDrawAsterixes( p.is_password ), mAllowEmoji( p.allow_emoji ), @@ -150,17 +150,17 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mSpellCheckStart(-1), mSpellCheckEnd(-1), mSelectAllonFocusReceived( p.select_on_focus ), - mSelectAllonCommit( TRUE ), - mPassDelete(FALSE), - mReadOnly(FALSE), + mSelectAllonCommit( true ), + mPassDelete(false), + mReadOnly(false), mBgImage( p.background_image ), mBgImageDisabled( p.background_image_disabled ), mBgImageFocused( p.background_image_focused ), mShowImageFocused( p.bg_image_always_focused ), mShowLabelFocused( p.show_label_focused ), mUseBgColor(p.use_bg_color), - mHaveHistory(FALSE), - mReplaceNewlinesWithSpaces( TRUE ), + mHaveHistory(false), + mReplaceNewlinesWithSpaces( true ), mPrevalidator(p.prevalidator()), mInputPrevalidator(p.input_prevalidator()), mLabel(p.label), @@ -177,7 +177,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) { llassert( mMaxLengthBytes > 0 ); - LLUICtrl::setEnabled(TRUE); + LLUICtrl::setEnabled(true); setEnabled(p.enabled); mScrollTimer.reset(); @@ -221,7 +221,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) LLLineEditor::~LLLineEditor() { - mCommitOnFocusLost = FALSE; + mCommitOnFocusLost = false; // Make sure no context menu linger around once the widget is deleted LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get()); @@ -238,7 +238,7 @@ LLLineEditor::~LLLineEditor() void LLLineEditor::initFromParams(const LLLineEditor::Params& params) { LLUICtrl::initFromParams(params); - LLUICtrl::setEnabled(TRUE); + LLUICtrl::setEnabled(true); setEnabled(params.enabled); } @@ -287,9 +287,9 @@ void LLLineEditor::onCommit() if (mSelectAllonCommit) selectAll(); } -// Returns TRUE if user changed value at all +// Returns true if user changed value at all // virtual -BOOL LLLineEditor::isDirty() const +bool LLLineEditor::isDirty() const { return mText.getString() != mPrevText; } @@ -350,14 +350,14 @@ void LLLineEditor::updateHistory() } } -void LLLineEditor::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLLineEditor::reshape(S32 width, S32 height, bool called_from_parent) { LLUICtrl::reshape(width, height, called_from_parent); updateTextPadding(); // For clamping side-effect. setCursor(mCursorPos); // For clamping side-effect. } -void LLLineEditor::setEnabled(BOOL enabled) +void LLLineEditor::setEnabled(bool enabled) { mReadOnly = !enabled; setTabStop(!mReadOnly); @@ -412,7 +412,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text, bool use_size_limit // Check to see if entire field is selected. S32 len = mText.length(); - BOOL all_selected = (len > 0) + bool all_selected = (len > 0) && (( mSelectionStart == 0 && mSelectionEnd == len ) || ( mSelectionStart == len && mSelectionEnd == 0 )); @@ -529,7 +529,7 @@ void LLLineEditor::resetScrollPosition() setCursor(getCursor()); } -BOOL LLLineEditor::canDeselect() const +bool LLLineEditor::canDeselect() const { return hasSelection(); } @@ -538,13 +538,13 @@ void LLLineEditor::deselect() { mSelectionStart = 0; mSelectionEnd = 0; - mIsSelecting = FALSE; + mIsSelecting = false; } void LLLineEditor::startSelection() { - mIsSelecting = TRUE; + mIsSelecting = true; mSelectionStart = getCursor(); mSelectionEnd = getCursor(); } @@ -553,14 +553,14 @@ void LLLineEditor::endSelection() { if( mIsSelecting ) { - mIsSelecting = FALSE; + mIsSelecting = false; mSelectionEnd = getCursor(); } } -BOOL LLLineEditor::canSelectAll() const +bool LLLineEditor::canSelectAll() const { - return TRUE; + return true; } void LLLineEditor::selectAll() @@ -574,7 +574,7 @@ void LLLineEditor::selectAll() mSelectionEnd = 0; setCursor(mSelectionEnd); //mScrollHPos = 0; - mIsSelecting = TRUE; + mIsSelecting = true; updatePrimary(); } @@ -590,7 +590,7 @@ const std::string& LLLineEditor::getSuggestion(U32 index) const U32 LLLineEditor::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast<U32>(mSuggestionList.size()); } void LLLineEditor::replaceWithSuggestion(U32 index) @@ -680,9 +680,9 @@ void LLLineEditor::onSpellCheckSettingsChange() mSpellCheckStart = mSpellCheckEnd = -1; } -BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { - setFocus( TRUE ); + setFocus( true ); mTripleClickTimer.setTimerExpirySec(TRIPLE_CLICK_INTERVAL); if (mSelectionEnd == 0 && mSelectionStart == mText.length()) @@ -694,7 +694,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { const LLWString& wtext = mText.getWString(); - BOOL doSelectAll = TRUE; + bool doSelectAll = true; // Select the word we're on if( LLWStringUtil::isPartOfWord( wtext[mCursorPos] ) ) @@ -729,7 +729,7 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection // here. - mIsSelecting = FALSE; + mIsSelecting = false; // delay cursor flashing mKeystrokeTimer.reset(); @@ -737,15 +737,15 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); - return TRUE; + return true; } -BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) { // Check first whether the "clear search" button wants to deal with this. if(childrenHandleMouseDown(x, y, mask) != NULL) { - return TRUE; + return true; } if (!mSelectAllonFocusReceived @@ -757,7 +757,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) if (mask & MASK_SHIFT) { // assume we're starting a drag select - mIsSelecting = TRUE; + mIsSelecting = true; // Handle selection extension S32 old_cursor_pos = getCursor(); @@ -813,14 +813,14 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection // here. - mIsSelecting = FALSE; + mIsSelecting = false; } } gFocusMgr.setMouseCapture( this ); } - setFocus(TRUE); + setFocus(true); // delay cursor flashing mKeystrokeTimer.reset(); @@ -828,40 +828,40 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) if (mMouseDownSignal) (*mMouseDownSignal)(this,x,y,mask); - return TRUE; + return true; } -BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { // LL_INFOS() << "MiddleMouseDown" << LL_ENDL; - setFocus( TRUE ); + setFocus( true ); if( canPastePrimary() ) { setCursorAtLocalPos(x); pastePrimary(); } - return TRUE; + return true; } -BOOL LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) { - setFocus(TRUE); + setFocus(true); if (!LLUICtrl::handleRightMouseDown(x, y, mask) && getShowContextMenu()) { showContextMenu(x, y); } - return TRUE; + return true; } -BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // Check first whether the "clear search" button wants to deal with this. if(!hasMouseCapture()) { if(childrenHandleHover(x, y, mask) != NULL) { - return TRUE; + return true; } } @@ -904,34 +904,34 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_IBEAM); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; - handled = TRUE; + handled = true; } if( !handled ) { getWindow()->setCursor(UI_CURSOR_IBEAM); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } return handled; } -BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } // Check first whether the "clear search" button wants to deal with this. if(!handled && childrenHandleMouseUp(x, y, mask) != NULL) { - return TRUE; + return true; } if( mIsSelecting ) @@ -939,7 +939,7 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) setCursorAtLocalPos( x ); mSelectionEnd = getCursor(); - handled = TRUE; + handled = true; } if( handled ) @@ -994,23 +994,23 @@ void LLLineEditor::addChar(const llwchar uni_char) mText.erase(getCursor(), 1); } - S32 cur_bytes = mText.getString().size(); + S32 cur_bytes = static_cast<S32>(mText.getString().size()); S32 new_bytes = wchar_utf8_length(new_c); - BOOL allow_char = TRUE; + bool allow_char = true; // Check byte length limit if ((new_bytes + cur_bytes) > mMaxLengthBytes) { - allow_char = FALSE; + allow_char = false; } else if (mMaxLengthChars) { - S32 wide_chars = mText.getWString().size(); + auto wide_chars = mText.getWString().size(); if ((wide_chars + 1) > mMaxLengthChars) { - allow_char = FALSE; + allow_char = false; } } @@ -1074,7 +1074,7 @@ void LLLineEditor::setSelection(S32 start, S32 end) { S32 len = mText.length(); - mIsSelecting = TRUE; + mIsSelecting = true; // JC, yes, this seems odd, but I think you have to presume a // selection dragged from the end towards the start. @@ -1083,7 +1083,7 @@ void LLLineEditor::setSelection(S32 start, S32 end) setCursor(start); } -void LLLineEditor::setDrawAsterixes(BOOL b) +void LLLineEditor::setDrawAsterixes(bool b) { mDrawAsterixes = b; updateAllowingLanguageInput(); @@ -1118,13 +1118,13 @@ S32 LLLineEditor::nextWordPos(S32 cursorPos) const } -BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) +bool LLLineEditor::handleSelectionKey(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( mask & MASK_SHIFT ) { - handled = TRUE; + handled = true; switch( key ) { @@ -1177,7 +1177,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } default: - handled = FALSE; + handled = false; break; } } @@ -1208,7 +1208,7 @@ void LLLineEditor::deleteSelection() } } -BOOL LLLineEditor::canCut() const +bool LLLineEditor::canCut() const { return !mReadOnly && !mDrawAsterixes && hasSelection(); } @@ -1232,7 +1232,7 @@ void LLLineEditor::cut() deleteSelection(); // Validate new string and rollback the if needed. - BOOL need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); + bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); if (need_to_rollback) { rollback.doRollback( this ); @@ -1246,7 +1246,7 @@ void LLLineEditor::cut() } } -BOOL LLLineEditor::canCopy() const +bool LLLineEditor::canCopy() const { return !mDrawAsterixes && hasSelection(); } @@ -1263,7 +1263,7 @@ void LLLineEditor::copy() } } -BOOL LLLineEditor::canPaste() const +bool LLLineEditor::canPaste() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(); } @@ -1351,7 +1351,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if (mMaxLengthChars) { - U32 available_chars = mMaxLengthChars - mText.getWString().size(); + auto available_chars = mMaxLengthChars - mText.getWString().size(); if (available_chars < clean_string.size()) { @@ -1366,7 +1366,7 @@ void LLLineEditor::pasteHelper(bool is_primary) deselect(); // Validate new string and rollback the if needed. - BOOL need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); + bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); if (need_to_rollback) { rollback.doRollback( this ); @@ -1392,7 +1392,7 @@ void LLLineEditor::copyPrimary() } } -BOOL LLLineEditor::canPastePrimary() const +bool LLLineEditor::canPastePrimary() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(true); } @@ -1405,9 +1405,9 @@ void LLLineEditor::updatePrimary() } } -BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) +bool LLLineEditor::handleSpecialKey(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch( key ) { @@ -1417,7 +1417,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) gKeyboard->toggleInsertMode(); } - handled = TRUE; + handled = true; break; case KEY_BACKSPACE: @@ -1438,7 +1438,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) LLUI::getInstance()->reportBadKeystroke(); } } - handled = TRUE; + handled = true; break; case KEY_PAGE_UP: @@ -1446,7 +1446,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) if (!mIgnoreArrowKeys) { setCursor(0); - handled = TRUE; + handled = true; } break; @@ -1459,7 +1459,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { setCursor(len); } - handled = TRUE; + handled = true; } break; @@ -1486,7 +1486,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; @@ -1513,32 +1513,32 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; // handle ctrl-uparrow if we have a history enabled line editor. case KEY_UP: - if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) + if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask))) { - if( mCurrentHistoryLine > mLineHistory.begin() ) + if (mCurrentHistoryLine > mLineHistory.begin()) { - mText.assign( *(--mCurrentHistoryLine) ); + mText.assign(*(--mCurrentHistoryLine)); setCursorToEnd(); } else { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; // handle [ctrl]-downarrow if we have a history enabled line editor case KEY_DOWN: - if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) + if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask))) { - if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 ) + if (!mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1) { mText.assign( *(++mCurrentHistoryLine) ); setCursorToEnd(); @@ -1547,7 +1547,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { LLUI::getInstance()->reportBadKeystroke(); } - handled = TRUE; + handled = true; } break; @@ -1576,10 +1576,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } -BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) +bool LLLineEditor::handleKeyHere(KEY key, MASK mask ) { - BOOL handled = FALSE; - BOOL selection_modified = FALSE; + bool handled = false; + bool selection_modified = false; if ( gFocusMgr.getKeyboardFocus() == this ) { @@ -1653,18 +1653,18 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) } -BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) +bool LLLineEditor::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; if ( (gFocusMgr.getKeyboardFocus() == this) && getVisible() && !mReadOnly) { - handled = TRUE; + handled = true; LLLineEditorRollback rollback( this ); @@ -1704,7 +1704,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) { auto handled = FALSE; @@ -1735,7 +1735,7 @@ BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) return handled; } -BOOL LLLineEditor::canDoDelete() const +bool LLLineEditor::canDoDelete() const { return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); } @@ -1787,7 +1787,7 @@ void LLLineEditor::drawBackground() F32 alpha = getCurrentTransparency(); if (mUseBgColor) { - gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE); + gl_rect_2d(getLocalRect(), mBgColor % alpha, true); } else { @@ -2009,7 +2009,7 @@ void LLLineEditor::draw() &rendered_pixels_right); } #if 1 // for when we're ready for image art. - mBorder->setVisible(FALSE); // no more programmatic art. + mBorder->setVisible(false); // no more programmatic art. #endif if ( (getSpellCheck()) && (mText.length() > 2) ) @@ -2110,7 +2110,7 @@ void LLLineEditor::draw() // If we're editing... if( hasFocus()) { - //mBorder->setVisible(TRUE); // ok, programmer art just this once. + //mBorder->setVisible(true); // ok, programmer art just this once. // (Flash the cursor every half second) if (!mReadOnly && gFocusMgr.getAppHasFocus()) { @@ -2166,16 +2166,16 @@ void LLLineEditor::draw() LLFontGL::NO_SHADOW, S32_MAX, mTextRightEdge - ll_round(rendered_pixels_right), - &rendered_pixels_right, FALSE); + &rendered_pixels_right, false); } // Draw children (border) - //mBorder->setVisible(TRUE); - mBorder->setKeyboardFocusHighlight( TRUE ); + //mBorder->setVisible(true); + mBorder->setKeyboardFocusHighlight( true ); LLView::draw(); - mBorder->setKeyboardFocusHighlight( FALSE ); - //mBorder->setVisible(FALSE); + mBorder->setKeyboardFocusHighlight( false ); + //mBorder->setVisible(false); } else // does not have keyboard input { @@ -2248,19 +2248,19 @@ void LLLineEditor::onTabInto() } //virtual -BOOL LLLineEditor::acceptsTextInput() const +bool LLLineEditor::acceptsTextInput() const { - return TRUE; + return true; } // Start or stop the editor from accepting text-editing keystrokes -void LLLineEditor::setFocus( BOOL new_state ) +void LLLineEditor::setFocus( bool new_state ) { - BOOL old_state = hasFocus(); + bool old_state = hasFocus(); if (!new_state) { - getWindow()->allowLanguageTextInput(this, FALSE); + getWindow()->allowLanguageTextInput(this, false); } @@ -2271,7 +2271,7 @@ void LLLineEditor::setFocus( BOOL new_state ) // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection // here. - mIsSelecting = FALSE; + mIsSelecting = false; } if( new_state ) @@ -2339,20 +2339,20 @@ bool LLLineEditor::prevalidateInput(const LLWString& wstr) } // static -BOOL LLLineEditor::postvalidateFloat(const std::string &str) +bool LLLineEditor::postvalidateFloat(const std::string &str) { LLLocale locale(LLLocale::USER_LOCALE); - BOOL success = TRUE; - BOOL has_decimal = FALSE; - BOOL has_digit = FALSE; + bool success = true; + bool has_decimal = false; + bool has_digit = false; LLWString trimmed = utf8str_to_wstring(str); LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if( 0 < len ) { - S32 i = 0; + size_t i = 0; // First character can be a negative sign if( '-' == trimmed[0] ) @@ -2370,22 +2370,22 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str) if( has_decimal ) { // can't have two - success = FALSE; + success = false; break; } else { - has_decimal = TRUE; + has_decimal = true; } } else if( LLStringOps::isDigit( trimmed[i] ) ) { - has_digit = TRUE; + has_digit = true; } else { - success = FALSE; + success = false; break; } } @@ -2397,7 +2397,7 @@ BOOL LLLineEditor::postvalidateFloat(const std::string &str) return success; } -BOOL LLLineEditor::evaluateFloat() +bool LLLineEditor::evaluateFloat() { bool success; F32 result = 0.f; @@ -2409,7 +2409,7 @@ BOOL LLLineEditor::evaluateFloat() if (!success) { // Move the cursor to near the error on failure - setCursor(LLCalc::getInstance()->getLastErrorPos()); + setCursor(static_cast<S32>(LLCalc::getInstance()->getLastErrorPos())); // *TODO: Translated error message indicating the type of error? Select error text? } else @@ -2429,7 +2429,7 @@ void LLLineEditor::onMouseCaptureLost() } -void LLLineEditor::setSelectAllonFocusReceived(BOOL b) +void LLLineEditor::setSelectAllonFocusReceived(bool b) { mSelectAllonFocusReceived = b; } @@ -2450,16 +2450,16 @@ void LLLineEditor::setKeystrokeCallback(callback_t callback, void* user_data) } -BOOL LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); - return TRUE; + return true; } -BOOL LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); - return TRUE; + return true; } @@ -2479,15 +2479,15 @@ void LLLineEditor::updateAllowingLanguageInput() } if (hasFocus() && !mReadOnly && !mDrawAsterixes && !mPrevalidator) { - window->allowLanguageTextInput(this, TRUE); + window->allowLanguageTextInput(this, true); } else { - window->allowLanguageTextInput(this, FALSE); + window->allowLanguageTextInput(this, false); } } -BOOL LLLineEditor::hasPreeditString() const +bool LLLineEditor::hasPreeditString() const { return (mPreeditPositions.size() > 1); } @@ -2550,7 +2550,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString.assign( LLWString( mText, insert_preedit_at, mPreeditWString.length() ) ); - mText.erase(insert_preedit_at, mPreeditWString.length()); + mText.erase(insert_preedit_at, static_cast<S32>(mPreeditWString.length())); } else { @@ -2570,7 +2570,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); } -BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const +bool LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const { if (control) { @@ -2592,13 +2592,13 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect if (preedit_right_column < mScrollHPos) { // This should not occure... - return FALSE; + return false; } const S32 query = (query_offset >= 0 ? preedit_left_column + query_offset : getCursor()); if (query < mScrollHPos || query < preedit_left_column || query > preedit_right_column) { - return FALSE; + return false; } if (coord) @@ -2625,7 +2625,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds); } - return TRUE; + return true; } void LLLineEditor::getPreeditRange(S32 *position, S32 *length) const @@ -2671,7 +2671,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length) mPreeditPositions[0] = position; mPreeditPositions[1] = position + length; mPreeditStandouts.resize(1); - mPreeditStandouts[0] = FALSE; + mPreeditStandouts[0] = false; } else { @@ -2693,7 +2693,7 @@ S32 LLLineEditor::getPreeditFontSize() const return ll_round(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } -void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) +void LLLineEditor::setReplaceNewlinesWithSpaces(bool replace) { mReplaceNewlinesWithSpaces = replace; } @@ -2749,7 +2749,7 @@ void LLLineEditor::showContextMenu(S32 x, S32 y) // If the cursor is on a misspelled word, retrieve suggestions for it std::string misspelled_word = getMisspelledWord(mCursorPos); - if ((is_misspelled = !misspelled_word.empty()) == true) + if ((is_misspelled = !misspelled_word.empty())) { LLSpellChecker::instance().getSuggestions(misspelled_word, mSuggestionList); } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 10f486643a..2d9c3ac58a 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -125,38 +125,38 @@ public: virtual ~LLLineEditor(); // mousehandler overrides - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask) override; - /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask) override; - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask) override; - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char) override; - /*virtual*/ BOOL handleUnicodeStringHere(char *uni_str, bool editing) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x,S32 y,MASK mask) override; + /*virtual*/ bool handleMiddleMouseDown(S32 x,S32 y,MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleKeyHere(KEY key, MASK mask) override; + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char) override; + /*virtual*/ bool handleUnicodeStringHere(char *uni_str, bool editing) override; /*virtual*/ void onMouseCaptureLost() override; // LLEditMenuHandler overrides /*virtual*/ void cut() override; - /*virtual*/ BOOL canCut() const override; + /*virtual*/ bool canCut() const override; /*virtual*/ void copy() override; - /*virtual*/ BOOL canCopy() const override; + /*virtual*/ bool canCopy() const override; /*virtual*/ void paste() override; - /*virtual*/ BOOL canPaste() const override; + /*virtual*/ bool canPaste() const override; virtual void updatePrimary(); virtual void copyPrimary(); virtual void pastePrimary(); - virtual BOOL canPastePrimary() const; + virtual bool canPastePrimary() const; /*virtual*/ void doDelete() override; - /*virtual*/ BOOL canDoDelete() const override; + /*virtual*/ bool canDoDelete() const override; /*virtual*/ void selectAll() override; - /*virtual*/ BOOL canSelectAll() const override; + /*virtual*/ bool canSelectAll() const override; /*virtual*/ void deselect() override; - /*virtual*/ BOOL canDeselect() const override; + /*virtual*/ bool canDeselect() const override; // LLSpellCheckMenuHandler overrides /*virtual*/ bool getSpellCheck() const override; @@ -178,26 +178,26 @@ public: // view overrides /*virtual*/ void draw() override; - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override; + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true) override; /*virtual*/ void onFocusReceived() override; /*virtual*/ void onFocusLost() override; - /*virtual*/ void setEnabled(BOOL enabled) override; + /*virtual*/ void setEnabled(bool enabled) override; // UI control overrides /*virtual*/ void clear() override; /*virtual*/ void onTabInto() override; - /*virtual*/ void setFocus(BOOL b) override; + /*virtual*/ void setFocus(bool b) override; /*virtual*/ void setRect(const LLRect& rect) override; - /*virtual*/ BOOL acceptsTextInput() const override; + /*virtual*/ bool acceptsTextInput() const override; /*virtual*/ void onCommit() override; - /*virtual*/ BOOL isDirty() const override; // Returns TRUE if user changed value at all + /*virtual*/ bool isDirty() const override; // Returns true if user changed value at all /*virtual*/ void resetDirty() override; // Clear dirty state // assumes UTF8 text /*virtual*/ void setValue(const LLSD& value) override; /*virtual*/ LLSD getValue() const override; - /*virtual*/ BOOL setTextArg(const std::string& key, const LLStringExplicit& text) override; - /*virtual*/ BOOL setLabelArg(const std::string& key, const LLStringExplicit& text) override; + /*virtual*/ bool setTextArg(const std::string& key, const LLStringExplicit& text) override; + /*virtual*/ bool setLabelArg(const std::string& key, const LLStringExplicit& text) override; void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; } const std::string& getLabel() { return mLabel.getString(); } @@ -221,9 +221,9 @@ public: void setSelection(S32 start, S32 end); /*virtual*/ void getSelectionRange(S32 *position, S32 *length) const override; - void setCommitOnFocusLost( BOOL b ) { mCommitOnFocusLost = b; } - void setRevertOnEsc( BOOL b ) { mRevertOnEsc = b; } - void setKeystrokeOnEsc(BOOL b) { mKeystrokeOnEsc = b; } + void setCommitOnFocusLost( bool b ) { mCommitOnFocusLost = b; } + void setRevertOnEsc( bool b ) { mRevertOnEsc = b; } + void setKeystrokeOnEsc(bool b) { mKeystrokeOnEsc = b; } void setCursorColor(const LLColor4& c) { mCursorColor = c; } const LLColor4& getCursorColor() const { return mCursorColor.get(); } @@ -239,24 +239,24 @@ public: const LLFontGL* getFont() const override { return mGLFont; } void setFont(const LLFontGL* font); - void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; } - void setIgnoreTab(BOOL b) { mIgnoreTab = b; } - void setPassDelete(BOOL b) { mPassDelete = b; } - void setAllowEmoji(BOOL b) { mAllowEmoji = b; } - void setDrawAsterixes(BOOL b); + void setIgnoreArrowKeys(bool b) { mIgnoreArrowKeys = b; } + void setIgnoreTab(bool b) { mIgnoreTab = b; } + void setPassDelete(bool b) { mPassDelete = b; } + void setAllowEmoji(bool b) { mAllowEmoji = b; } + void setDrawAsterixes(bool b); // get the cursor position of the beginning/end of the prev/next word in the text S32 prevWordPos(S32 cursorPos) const; S32 nextWordPos(S32 cursorPos) const; - BOOL hasSelection() const { return (mSelectionStart != mSelectionEnd); } + bool hasSelection() const { return (mSelectionStart != mSelectionEnd); } void startSelection(); void endSelection(); void extendSelection(S32 new_cursor_pos); void deleteSelection(); - void setSelectAllonFocusReceived(BOOL b); - void setSelectAllonCommit(BOOL b) { mSelectAllonCommit = b; } + void setSelectAllonFocusReceived(bool b); + void setSelectAllonCommit(bool b) { mSelectAllonCommit = b; } void onKeystroke(); typedef boost::function<void (LLLineEditor* caller, void* user_data)> callback_t; @@ -275,16 +275,16 @@ public: // Also callback that this method sets differs from setPrevalidate in a way that it validates just inputed // symbols, before existing text is modified, but setPrevalidate validates line after it was modified. void setPrevalidateInput(LLTextValidate::Validator validator); - static BOOL postvalidateFloat(const std::string &str); + static bool postvalidateFloat(const std::string &str); bool prevalidateInput(const LLWString& wstr); - BOOL evaluateFloat(); + bool evaluateFloat(); // line history support: - void setEnableLineHistory( BOOL enabled ) { mHaveHistory = enabled; } // switches line history on or off + void setEnableLineHistory( bool enabled ) { mHaveHistory = enabled; } // switches line history on or off void updateHistory(); // stores current line in history - void setReplaceNewlinesWithSpaces(BOOL replace); + void setReplaceNewlinesWithSpaces(bool replace); void resetContextMenu() { setContextMenu(NULL); }; @@ -305,9 +305,9 @@ public: void setCursorAtLocalPos(S32 local_mouse_x); S32 findPixelNearestPos(S32 cursor_offset = 0) const; S32 calcCursorPos(S32 mouse_x); - BOOL handleSpecialKey(KEY key, MASK mask); - BOOL handleSelectionKey(KEY key, MASK mask); - BOOL handleControlKey(KEY key, MASK mask); + bool handleSpecialKey(KEY key, MASK mask); + bool handleSelectionKey(KEY key, MASK mask); + bool handleControlKey(KEY key, MASK mask); S32 handleCommitKey(KEY key, MASK mask); void updateTextPadding(); @@ -318,14 +318,14 @@ public: // private data members // void updateAllowingLanguageInput(); - BOOL hasPreeditString() const; + bool hasPreeditString() const; // Implementation (overrides) of LLPreeditor /*virtual*/ void resetPreedit() override; /*virtual*/ void updatePreedit(const LLWString &preedit_string, const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position) override; /*virtual*/ void markAsPreedit(S32 position, S32 length) override; /*virtual*/ void getPreeditRange(S32 *position, S32 *length) const override; - /*virtual*/ BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const override; + /*virtual*/ bool getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const override; /*virtual*/ S32 getPreeditFontSize() const override; /*virtual*/ LLWString getPreeditString() const override { return getWText(); } @@ -339,7 +339,7 @@ protected: LLUIString mLabel; // text label that is visible when no user text provided // line history support: - BOOL mHaveHistory; // flag for enabled line history + bool mHaveHistory; // flag for enabled line history typedef std::vector<std::string> line_history_t; line_history_t mLineHistory; // line history storage line_history_t::iterator mCurrentHistoryLine; // currently browsed history line @@ -356,13 +356,13 @@ protected: S32 mTextLeftEdge; // Pixels, cached left edge of text based on left padding and width S32 mTextRightEdge; // Pixels, cached right edge of text based on right padding and width - BOOL mCommitOnFocusLost; - BOOL mRevertOnEsc; - BOOL mKeystrokeOnEsc; + bool mCommitOnFocusLost; + bool mRevertOnEsc; + bool mKeystrokeOnEsc; keystroke_callback_t mKeystrokeCallback; - BOOL mIsSelecting; // Selection for clipboard operations + bool mIsSelecting; // Selection for clipboard operations S32 mSelectionStart; S32 mSelectionEnd; S32 mLastSelectionX; @@ -393,18 +393,18 @@ protected: S32 mBorderThickness; - BOOL mIgnoreArrowKeys; - BOOL mIgnoreTab; - BOOL mDrawAsterixes; + bool mIgnoreArrowKeys; + bool mIgnoreTab; + bool mDrawAsterixes; - BOOL mSelectAllonFocusReceived; - BOOL mSelectAllonCommit; - BOOL mPassDelete; + bool mSelectAllonFocusReceived; + bool mSelectAllonCommit; + bool mPassDelete; - BOOL mReadOnly; + bool mReadOnly; - BOOL mShowImageFocused; - BOOL mShowLabelFocused; + bool mShowImageFocused; + bool mShowLabelFocused; bool mAllowEmoji; bool mUseBgColor; @@ -424,7 +424,7 @@ private: LLPointer<LLUIImage> mBgImageDisabled; LLPointer<LLUIImage> mBgImageFocused; - BOOL mReplaceNewlinesWithSpaces; // if false, will replace pasted newlines with paragraph symbol. + bool mReplaceNewlinesWithSpaces; // if false, will replace pasted newlines with paragraph symbol. // private helper class class LLLineEditorRollback @@ -458,7 +458,7 @@ private: std::string mText; S32 mCursorPos; S32 mScrollHPos; - BOOL mIsSelecting; + bool mIsSelecting; S32 mSelectionStart; S32 mSelectionEnd; }; // end class LLLineEditorRollback @@ -468,7 +468,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLLINEEDITOR_CPP extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LINEEDITOR_ diff --git a/indra/llui/lllocalcliprect.cpp b/indra/llui/lllocalcliprect.cpp index f8ccb807e6..0204946125 100644 --- a/indra/llui/lllocalcliprect.cpp +++ b/indra/llui/lllocalcliprect.cpp @@ -32,7 +32,7 @@ /*static*/ std::stack<LLRect> LLScreenClipRect::sClipRectStack; -LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled) +LLScreenClipRect::LLScreenClipRect(const LLRect& rect, bool enabled) : mScissorState(GL_SCISSOR_TEST), mEnabled(enabled) { @@ -99,7 +99,7 @@ void LLScreenClipRect::updateScissorRegion() //--------------------------------------------------------------------------- // LLLocalClipRect //--------------------------------------------------------------------------- -LLLocalClipRect::LLLocalClipRect(const LLRect& rect, BOOL enabled /* = TRUE */) +LLLocalClipRect::LLLocalClipRect(const LLRect& rect, bool enabled /* = true */) : LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX, rect.mTop + LLFontGL::sCurOrigin.mY, rect.mRight + LLFontGL::sCurOrigin.mX, diff --git a/indra/llui/lllocalcliprect.h b/indra/llui/lllocalcliprect.h index cb74de7c22..2a858e6163 100644 --- a/indra/llui/lllocalcliprect.h +++ b/indra/llui/lllocalcliprect.h @@ -38,7 +38,7 @@ class LLScreenClipRect { public: - LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE); + LLScreenClipRect(const LLRect& rect, bool enabled = true); virtual ~LLScreenClipRect(); private: @@ -48,7 +48,7 @@ private: private: LLGLState mScissorState; - BOOL mEnabled; + bool mEnabled; static std::stack<LLRect> sClipRectStack; }; @@ -56,7 +56,7 @@ private: class LLLocalClipRect : public LLScreenClipRect { public: - LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE); + LLLocalClipRect(const LLRect& rect, bool enabled = true); ~LLLocalClipRect(); }; diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index bfc4c089f3..2f91dcb046 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -78,7 +78,7 @@ void LLMenuButton::hideMenu() LLToggleableMenu* menu = getMenu(); if (menu) { - menu->setVisible(FALSE); + menu->setVisible(false); } } @@ -118,9 +118,9 @@ void LLMenuButton::setMenu(LLToggleableMenu* menu, EMenuPosition position /*MP_T menu->setVisibilityChangeCallback(boost::bind(&LLMenuButton::onMenuVisibilityChange, this, _2)); } -BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask ) +bool LLMenuButton::handleKeyHere(KEY key, MASK mask ) { - if (!getMenu()) return FALSE; + if (!getMenu()) return false; if( KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key)) { @@ -129,26 +129,26 @@ BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask ) LLUICtrl::handleMouseDown(-1, -1, MASK_NONE); toggleMenu(); - return TRUE; + return true; } LLToggleableMenu* menu = getMenu(); if (menu && menu->getVisible() && key == KEY_ESCAPE && mask == MASK_NONE) { - menu->setVisible(FALSE); - return TRUE; + menu->setVisible(false); + return true; } - return FALSE; + return false; } -BOOL LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask) { LLButton::handleMouseDown(x, y, mask); toggleMenu(); - return TRUE; + return true; } void LLMenuButton::toggleMenu() diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 1039560827..a77ae7dae7 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -65,8 +65,8 @@ public: boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask ); void hideMenu(); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 8fcb558aae..dffaf69a9f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -100,7 +100,7 @@ const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); const F32 MAX_MOUSE_SLOPE_SUB_MENU = 0.9f; -BOOL LLMenuGL::sKeyboardMode = FALSE; +bool LLMenuGL::sKeyboardMode = false; LLHandle<LLView> LLMenuHolderGL::sItemLastSelectedHandle; LLFrameTimer LLMenuHolderGL::sItemActivationTimer; @@ -150,10 +150,10 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) : LLUICtrl(p), mJumpKey(p.jump_key), mAllowKeyRepeat(p.allow_key_repeat), - mHighlight( FALSE ), - mGotHover( FALSE ), - mBriefItem( FALSE ), - mDrawTextDisabled( FALSE ), + mHighlight( false ), + mGotHover( false ), + mBriefItem( false ), + mDrawTextDisabled( false ), mFont(p.font), mAcceleratorKey(KEY_NONE), mAcceleratorMask(MASK_NONE), @@ -165,7 +165,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) { #ifdef LL_DARWIN // See if this Mac accelerator should really use the ctrl key and not get mapped to cmd - BOOL useMacCtrl = p.use_mac_ctrl; + bool useMacCtrl = p.use_mac_ctrl; #endif // LL_DARWIN std::string shortcut = p.shortcut; @@ -187,7 +187,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) { mAcceleratorMask |= MASK_SHIFT; } - S32 pipe_pos = shortcut.rfind("|"); + auto pipe_pos = shortcut.rfind("|"); std::string key_str = shortcut.substr(pipe_pos+1); LLKeyboard::keyFromString(key_str, &mAcceleratorKey); @@ -218,49 +218,49 @@ bool LLMenuItemGL::hasAccelerator(const KEY &key, const MASK &mask) const } //virtual -BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask) { if( getEnabled() && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) { onCommit(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } //virtual -BOOL LLMenuItemGL::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleRightMouseDown(S32 x, S32 y, MASK mask) { return LLUICtrl::handleRightMouseDown(x,y,mask); } void LLMenuItemGL::onMouseEnter(S32 x, S32 y, MASK mask) { - setHover(TRUE); + setHover(true); LLUICtrl::onMouseEnter(x,y,mask); } void LLMenuItemGL::onMouseLeave(S32 x, S32 y, MASK mask) { - setHover(FALSE); + setHover(false); LLUICtrl::onMouseLeave(x,y,mask); } //virtual -BOOL LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) { // If this event came from a right-click context menu spawn, // process as a left-click to allow menu items to be hit if (LLMenuHolderGL::sContextMenuSpawnPos.mX != S32_MAX || LLMenuHolderGL::sContextMenuSpawnPos.mY != S32_MAX) { - BOOL handled = handleMouseUp(x, y, mask); + bool handled = handleMouseUp(x, y, mask); return handled; } return LLUICtrl::handleRightMouseUp(x,y,mask); @@ -268,7 +268,7 @@ BOOL LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) // This function checks to see if the accelerator key is already in use; // if not, it will be added to the list -BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp) +bool LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp) { LLMenuKeyboardBinding *accelerator = NULL; @@ -293,7 +293,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *list // LL_WARNS() << warning << LL_ENDL; // LLAlertDialog::modalAlert(warning); - return FALSE; + return false; } } if (!accelerator) @@ -308,7 +308,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *list listp->push_back(accelerator);//addData(accelerator); } } - return TRUE; + return true; } // This function appends the character string representation of @@ -332,13 +332,13 @@ U32 LLMenuItemGL::getNominalHeight( void ) const } //virtual -void LLMenuItemGL::setBriefItem(BOOL brief) +void LLMenuItemGL::setBriefItem(bool brief) { mBriefItem = brief; } //virtual -BOOL LLMenuItemGL::isBriefItem() const +bool LLMenuItemGL::isBriefItem() const { return mBriefItem; } @@ -402,7 +402,7 @@ void LLMenuItemGL::onCommit( void ) } // set the hover status (called by it's menu) - void LLMenuItemGL::setHighlight( BOOL highlight ) + void LLMenuItemGL::setHighlight( bool highlight ) { if (highlight) { @@ -418,7 +418,7 @@ void LLMenuItemGL::onCommit( void ) } -BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) { if (getHighlight() && getMenu()->isOpen()) @@ -426,52 +426,52 @@ BOOL LLMenuItemGL::handleKeyHere( KEY key, MASK mask ) if (key == KEY_UP) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); getMenu()->highlightPrevItem(this); - return TRUE; + return true; } else if (key == KEY_DOWN) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); getMenu()->highlightNextItem(this); - return TRUE; + return true; } else if (key == KEY_RETURN && mask == MASK_NONE) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); onCommit(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleMouseUp( S32 x, S32 y, MASK mask) { // switch to mouse navigation mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); onCommit(); make_ui_sound("UISndClickRelease"); return LLView::handleMouseUp(x, y, mask); } -BOOL LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK mask) +bool LLMenuItemGL::handleMouseDown( S32 x, S32 y, MASK mask) { // switch to mouse navigation mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); - setHighlight(TRUE); + setHighlight(true); return LLView::handleMouseDown(x, y, mask); } -BOOL LLMenuItemGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLMenuItemGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // If the menu is scrollable let it handle the wheel event. return !getMenu()->isScrollable(); @@ -521,19 +521,19 @@ void LLMenuItemGL::draw( void ) if( !mDrawBoolLabel.empty() ) { mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); } mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); if( !mDrawAccelLabel.empty() ) { mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); } if( !mDrawBranchLabel.empty() ) { mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); + LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); } } @@ -545,20 +545,20 @@ void LLMenuItemGL::draw( void ) std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { - S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset); - S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset + 1); + S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset)); + S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1); } } } -BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); - return TRUE; + return true; } -void LLMenuItemGL::onVisibilityChange(BOOL new_visibility) +void LLMenuItemGL::onVisibilityChange(bool new_visibility) { if (getMenu()) { @@ -609,49 +609,49 @@ void LLMenuItemSeparatorGL::buildDrawLabel( void ) } } -BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask) { LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { // the menu items are in the child list in bottom up order LLView* prev_menu_item = parent_menu->findNextSibling(this); - return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; + return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : false; } else { LLView* next_menu_item = parent_menu->findPrevSibling(this); - return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseDown(x, 0, mask) : FALSE; + return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseDown(x, 0, mask) : false; } } -BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask) { LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { LLView* prev_menu_item = parent_menu->findNextSibling(this); - return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : FALSE; + return (prev_menu_item && prev_menu_item->getVisible() && prev_menu_item->getEnabled()) ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : false; } else { LLView* next_menu_item = parent_menu->findPrevSibling(this); - return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseUp(x, 0, mask) : FALSE; + return (next_menu_item && next_menu_item->getVisible() && next_menu_item->getEnabled()) ? next_menu_item->handleMouseUp(x, 0, mask) : false; } } -BOOL LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask) +bool LLMenuItemSeparatorGL::handleHover(S32 x, S32 y, MASK mask) { LLMenuGL* parent_menu = getMenu(); if (y > getRect().getHeight() / 2) { - parent_menu->highlightPrevItem(this, FALSE); - return FALSE; + parent_menu->highlightPrevItem(this, false); + return false; } else { - parent_menu->highlightNextItem(this, FALSE); - return FALSE; + parent_menu->highlightNextItem(this, false); + return false; } } @@ -667,7 +667,7 @@ class LLMenuItemVerticalSeparatorGL public: LLMenuItemVerticalSeparatorGL( void ); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) { return false; } }; LLMenuItemVerticalSeparatorGL::LLMenuItemVerticalSeparatorGL( void ) @@ -739,12 +739,12 @@ void LLMenuItemTearOffGL::onCommit() { if (parent_floater) { - parent_floater->addDependentFloater(tear_off_menu, FALSE); + parent_floater->addDependentFloater(tear_off_menu, false); } // give focus to torn off menu because it will have // been taken away when parent menu closes - tear_off_menu->setFocus(TRUE); + tear_off_menu->setFocus(true); } } LLMenuItemGL::onCommit(); @@ -864,12 +864,12 @@ void LLMenuItemCallGL::buildDrawLabel( void ) LLMenuItemGL::buildDrawLabel(); } -BOOL LLMenuItemCallGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemCallGL::handleKeyHere( KEY key, MASK mask ) { return LLMenuItemGL::handleKeyHere(key, mask); } -BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) +bool LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) { if( (!gKeyboard->getKeyRepeated(key) || getAllowKeyRepeat()) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) ) { @@ -877,10 +877,10 @@ BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask ) if (getEnabled()) { onCommit(); - return TRUE; + return true; } } - return FALSE; + return false; } // handleRightMouseUp moved into base class LLMenuItemGL so clicks are @@ -972,7 +972,7 @@ LLMenuItemBranchGL::LLMenuItemBranchGL(const LLMenuItemBranchGL::Params& p) if (branch) { mBranchHandle = branch->getHandle(); - branch->setVisible(FALSE); + branch->setVisible(false); branch->setParentMenuItem(this); } } @@ -988,7 +988,7 @@ LLMenuItemBranchGL::~LLMenuItemBranchGL() // virtual -LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) const +LLView* LLMenuItemBranchGL::getChildView(const std::string& name, bool recurse) const { LLMenuGL* branch = getBranch(); if (branch) @@ -1005,7 +1005,7 @@ LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) return LLView::getChildView(name, recurse); } -LLView* LLMenuItemBranchGL::findChildView(const std::string& name, BOOL recurse) const +LLView* LLMenuItemBranchGL::findChildView(const std::string& name, bool recurse) const { LLMenuGL* branch = getBranch(); if (branch) @@ -1023,14 +1023,14 @@ LLView* LLMenuItemBranchGL::findChildView(const std::string& name, BOOL recurse) } // virtual -BOOL LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLMenuItemBranchGL::handleMouseUp(S32 x, S32 y, MASK mask) { // switch to mouse navigation mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); onCommit(); make_ui_sound("UISndClickRelease"); - return TRUE; + return true; } bool LLMenuItemBranchGL::hasAccelerator(const KEY &key, const MASK &mask) const @@ -1038,18 +1038,18 @@ bool LLMenuItemBranchGL::hasAccelerator(const KEY &key, const MASK &mask) const return getBranch() && getBranch()->hasAccelerator(key, mask); } -BOOL LLMenuItemBranchGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuItemBranchGL::handleAcceleratorKey(KEY key, MASK mask) { return getBranch() && getBranch()->handleAcceleratorKey(key, mask); } // This function checks to see if the accelerator key is already in use; // if not, it will be added to the list -BOOL LLMenuItemBranchGL::addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp) +bool LLMenuItemBranchGL::addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp) { LLMenuGL* branch = getBranch(); if (!branch) - return FALSE; + return false; U32 item_count = branch->getItemCount(); LLMenuItemGL *item; @@ -1062,7 +1062,7 @@ BOOL LLMenuItemBranchGL::addToAcceleratorList(std::list<LLMenuKeyboardBinding*> } } - return FALSE; + return false; } @@ -1090,9 +1090,9 @@ void LLMenuItemBranchGL::onCommit( void ) LLUICtrl::onCommit(); } -BOOL LLMenuItemBranchGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLMenuItemBranchGL::handleKey(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getBranch() && called_from_parent) { handled = getBranch()->handleKey(key, mask, called_from_parent); @@ -1106,12 +1106,12 @@ BOOL LLMenuItemBranchGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) return handled; } -BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getBranch() && called_from_parent) { - handled = getBranch()->handleUnicodeChar(uni_char, TRUE); + handled = getBranch()->handleUnicodeChar(uni_char, true); } if (!handled) @@ -1123,7 +1123,7 @@ BOOL LLMenuItemBranchGL::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa } -void LLMenuItemBranchGL::setHighlight( BOOL highlight ) +void LLMenuItemBranchGL::setHighlight( bool highlight ) { if (highlight == getHighlight()) return; @@ -1132,17 +1132,17 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight ) if (!branch) return; - BOOL auto_open = getEnabled() && (!branch->getVisible() || branch->getTornOff()); + bool auto_open = getEnabled() && (!branch->getVisible() || branch->getTornOff()); // torn off menus don't open sub menus on hover unless they have focus LLFloater * menu_parent = dynamic_cast<LLFloater *>(getMenu()->getParent()); if (getMenu()->getTornOff() && menu_parent && !menu_parent->hasFocus()) { - auto_open = FALSE; + auto_open = false; } // don't auto open torn off sub-menus (need to explicitly active menu item to give them focus) if (branch->getTornOff()) { - auto_open = FALSE; + auto_open = false; } LLMenuItemGL::setHighlight(highlight); if( highlight ) @@ -1159,13 +1159,13 @@ void LLMenuItemBranchGL::setHighlight( BOOL highlight ) LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); if (branch_parent) { - branch_parent->setFocus(FALSE); + branch_parent->setFocus(false); } branch->clearHoverItem(); } else { - branch->setVisible( FALSE ); + branch->setVisible( false ); } } } @@ -1175,7 +1175,7 @@ void LLMenuItemBranchGL::draw() LLMenuItemGL::draw(); if (getBranch() && getBranch()->getVisible() && !getBranch()->getTornOff()) { - setHighlight(TRUE); + setHighlight(true); } } @@ -1188,16 +1188,16 @@ void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) } } -void LLMenuItemBranchGL::onVisibilityChange( BOOL new_visibility ) +void LLMenuItemBranchGL::onVisibilityChange(bool new_visibility) { - if (new_visibility == FALSE && getBranch() && !getBranch()->getTornOff()) + if (!new_visibility && getBranch() && !getBranch()->getTornOff()) { - getBranch()->setVisible(FALSE); + getBranch()->setVisible(false); } LLMenuItemGL::onVisibilityChange(new_visibility); } -BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemBranchGL::handleKeyHere(KEY key, MASK mask) { LLMenuGL* branch = getBranch(); if (!branch) @@ -1212,15 +1212,15 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) if (branch->getVisible() && key == KEY_LEFT) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); - BOOL handled = branch->clearHoverItem(); + bool handled = branch->clearHoverItem(); if (branch->getTornOff()) { LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); if (branch_parent) { - branch_parent->setFocus(FALSE); + branch_parent->setFocus(false); } } if (handled && getMenu()->getTornOff()) @@ -1228,7 +1228,7 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) LLFloater * menu_parent = dynamic_cast<LLFloater *>(getMenu()->getParent()); if (menu_parent) { - menu_parent->setFocus(TRUE); + menu_parent->setFocus(true); } } return handled; @@ -1237,12 +1237,12 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) if (key == KEY_RIGHT && !branch->getHighlightedItem()) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); LLMenuItemGL* itemp = branch->highlightNextItem(NULL); if (itemp) { - return TRUE; + return true; } } } @@ -1250,13 +1250,13 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) } //virtual -BOOL LLMenuItemBranchGL::isActive() const +bool LLMenuItemBranchGL::isActive() const { return isOpen() && getBranch() && getBranch()->getHighlightedItem(); } //virtual -BOOL LLMenuItemBranchGL::isOpen() const +bool LLMenuItemBranchGL::isOpen() const { return getBranch() && getBranch()->isOpen(); } @@ -1327,7 +1327,7 @@ void LLMenuItemBranchGL::openMenu() } branch->translate( delta_x, delta_y ); - branch->setVisible( TRUE ); + branch->setVisible( true ); branch->getParent()->sendChildToFront(branch); dirtyRect(); @@ -1362,20 +1362,20 @@ public: // set the hover status (called by it's menu) and if the object is // active. This is used for behavior transfer. - virtual void setHighlight( BOOL highlight ); + virtual void setHighlight( bool highlight ); - virtual BOOL isActive( void ) const; + virtual bool isActive( void ) const; // LLView functionality - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); virtual void draw( void ); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); virtual void onFocusLost(); - virtual void setFocus(BOOL b); + virtual void setFocus(bool b); }; LLMenuItemBranchDownGL::LLMenuItemBranchDownGL( const Params& p) : @@ -1407,7 +1407,7 @@ void LLMenuItemBranchDownGL::openMenu( void ) LLMenuGL* branch = getBranch(); if( branch->getVisible() && !branch->getTornOff() ) { - branch->setVisible( FALSE ); + branch->setVisible( false ); } else { @@ -1448,15 +1448,15 @@ void LLMenuItemBranchDownGL::openMenu( void ) } branch->translate( delta_x, 0 ); - setHighlight(TRUE); - branch->setVisible( TRUE ); + setHighlight(true); + branch->setVisible( true ); branch->getParent()->sendChildToFront(branch); } } } // set the hover status (called by it's menu) -void LLMenuItemBranchDownGL::setHighlight( BOOL highlight ) +void LLMenuItemBranchDownGL::setHighlight( bool highlight ) { if (highlight == getHighlight()) return; @@ -1475,18 +1475,18 @@ void LLMenuItemBranchDownGL::setHighlight( BOOL highlight ) LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); if (branch_parent) { - branch_parent->setFocus(FALSE); + branch_parent->setFocus(false); } branch->clearHoverItem(); } else { - branch->setVisible( FALSE ); + branch->setVisible( false ); } } } -BOOL LLMenuItemBranchDownGL::isActive() const +bool LLMenuItemBranchDownGL::isActive() const { // for top level menus, being open is sufficient to be considered // active, because clicking on them with the mouse will open @@ -1494,10 +1494,10 @@ BOOL LLMenuItemBranchDownGL::isActive() const return isOpen(); } -BOOL LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) { // switch to mouse control mode - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); if (getVisible() && isOpen()) { @@ -1509,19 +1509,19 @@ BOOL LLMenuItemBranchDownGL::handleMouseDown( S32 x, S32 y, MASK mask ) } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLMenuItemBranchDownGL::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLMenuItemBranchDownGL::handleMouseUp( S32 x, S32 y, MASK mask ) { - return TRUE; + return true; } -BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask) { - BOOL branch_visible = getBranch()->getVisible(); - BOOL handled = getBranch()->handleAcceleratorKey(key, mask); + bool branch_visible = getBranch()->getVisible(); + bool handled = getBranch()->handleAcceleratorKey(key, mask); if (handled && !branch_visible && isInVisibleChain()) { // flash this menu entry because we triggered an invisible menu item @@ -1534,11 +1534,11 @@ void LLMenuItemBranchDownGL::onFocusLost() { // needed for tab-based selection LLMenuItemBranchGL::onFocusLost(); - LLMenuGL::setKeyboardMode(FALSE); - setHighlight(FALSE); + LLMenuGL::setKeyboardMode(false); + setHighlight(false); } -void LLMenuItemBranchDownGL::setFocus(BOOL b) +void LLMenuItemBranchDownGL::setFocus(bool b) { // needed for tab-based selection LLMenuItemBranchGL::setFocus(b); @@ -1546,16 +1546,16 @@ void LLMenuItemBranchDownGL::setFocus(BOOL b) setHighlight(b); } -BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) +bool LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) { - BOOL menu_open = getBranch()->getVisible(); + bool menu_open = getBranch()->getVisible(); // don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded if (getHighlight() && getMenu()->isOpen() && (isActive() || LLMenuGL::getKeyboardMode())) { if (key == KEY_LEFT) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); LLMenuItemGL* itemp = getMenu()->highlightPrevItem(this); // open new menu only if previous menu was open @@ -1564,12 +1564,12 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) itemp->onCommit(); } - return TRUE; + return true; } else if (key == KEY_RIGHT) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); LLMenuItemGL* itemp = getMenu()->highlightNextItem(this); // open new menu only if previous menu was open @@ -1578,35 +1578,35 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) itemp->onCommit(); } - return TRUE; + return true; } else if (key == KEY_DOWN) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); if (!isActive()) { onCommit(); } getBranch()->highlightNextItem(NULL); - return TRUE; + return true; } else if (key == KEY_UP) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); if (!isActive()) { onCommit(); } getBranch()->highlightPrevItem(NULL); - return TRUE; + return true; } } - return FALSE; + return false; } void LLMenuItemBranchDownGL::draw( void ) @@ -1614,7 +1614,7 @@ void LLMenuItemBranchDownGL::draw( void ) //FIXME: try removing this if (getBranch()->getVisible() && !getBranch()->getTornOff()) { - setHighlight(TRUE); + setHighlight(true); } if( getHighlight() ) @@ -1649,8 +1649,8 @@ void LLMenuItemBranchDownGL::draw( void ) if (offset != std::string::npos) { S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); - S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset); - S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1); + S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset)); + S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); } } @@ -1686,8 +1686,8 @@ protected: public: /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); - /*virtual*/ void setEnabled(BOOL enabled); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent); + /*virtual*/ void setEnabled(bool enabled); virtual void onCommit( void ); private: @@ -1737,14 +1737,14 @@ void LLMenuScrollItem::draw() } /*virtual*/ -void LLMenuScrollItem::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLMenuScrollItem::reshape(S32 width, S32 height, bool called_from_parent) { mArrowBtn->reshape(width, height, called_from_parent); LLView::reshape(width, height, called_from_parent); } /*virtual*/ -void LLMenuScrollItem::setEnabled(BOOL enabled) +void LLMenuScrollItem::setEnabled(bool enabled) { mArrowBtn->setEnabled(enabled); LLView::setEnabled(enabled); @@ -1766,7 +1766,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mDropShadowed( p.drop_shadow ), mHasSelection(false), mHorizontalLayout( p.horizontal_layout ), - mScrollable(mHorizontalLayout ? FALSE : p.scrollable), // Scrolling is supported only for vertical layout + mScrollable(mHorizontalLayout ? false : p.scrollable), // Scrolling is supported only for vertical layout mMaxScrollableItems(p.max_scrollable_items), mPreferredWidth(p.preferred_width), mKeepFixedSize( p.keep_fixed_size ), @@ -1775,7 +1775,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mLastMouseY(0), mMouseVelX(0), mMouseVelY(0), - mTornOff(FALSE), + mTornOff(false), mTearOffItem(NULL), mSpilloverBranch(NULL), mFirstVisibleItem(NULL), @@ -1784,8 +1784,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mSpilloverMenu(NULL), mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), - mNeedsArrange(FALSE), - mAlwaysShowMenu(FALSE), + mNeedsArrange(false), + mAlwaysShowMenu(false), mResetScrollPositionOnShow(true), mShortcutPad(p.shortcut_pad), mFont(p.font) @@ -1826,7 +1826,7 @@ LLMenuGL::~LLMenuGL( void ) mJumpKeys.clear(); } -void LLMenuGL::setCanTearOff(BOOL tear_off) +void LLMenuGL::setCanTearOff(bool tear_off) { if (tear_off && mTearOffItem == NULL) { @@ -1916,7 +1916,7 @@ void LLMenuGL::removeChild( LLView* ctrl) return LLUICtrl::removeChild(ctrl); } -BOOL LLMenuGL::postBuild() +bool LLMenuGL::postBuild() { createJumpKeys(); return LLUICtrl::postBuild(); @@ -1924,10 +1924,10 @@ BOOL LLMenuGL::postBuild() // are we the childmost active menu and hence our jump keys should be enabled? // or are we a free-standing torn-off menu (which uses jump keys too) -BOOL LLMenuGL::jumpKeysActive() +bool LLMenuGL::jumpKeysActive() { LLMenuItemGL* highlighted_item = getHighlightedItem(); - BOOL active = getVisible() && getEnabled(); + bool active = getVisible() && getEnabled(); if (active) { @@ -1953,7 +1953,7 @@ BOOL LLMenuGL::jumpKeysActive() return active; } -BOOL LLMenuGL::isOpen() +bool LLMenuGL::isOpen() { if (getTornOff()) { @@ -1962,7 +1962,7 @@ BOOL LLMenuGL::isOpen() // the open menu chain even if we don't have focus if (itemp && itemp->isOpen()) { - return TRUE; + return true; } // otherwise we are only active if we have keyboard focus LLFloater * parent = dynamic_cast<LLFloater *>(getParent()); @@ -1970,7 +1970,7 @@ BOOL LLMenuGL::isOpen() { return parent->hasFocus(); } - return FALSE; + return false; } else { @@ -2068,7 +2068,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) // Otherwise viewer will hang for a time needed to scroll U32_MAX // times in std::advance(). STORM-659. size_t nitems = mItems.size(); - U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems; + U32 scrollable_items = nitems < mMaxScrollableItems ? static_cast<U32>(nitems) : mMaxScrollableItems; // Advance by mMaxScrollableItems back from the end of the list // to make the last item visible. @@ -2080,7 +2080,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) LL_WARNS() << "Unknown scrolling direction: " << direction << LL_ENDL; } - mNeedsArrange = TRUE; + mNeedsArrange = true; arrangeAndClear(); return true; @@ -2337,11 +2337,11 @@ void LLMenuGL::arrange( void ) LLRect rect; mArrowUpItem->setRect(rect.setLeftTopAndSize( 0, cur_height, width, mArrowUpItem->getNominalHeight())); - mArrowUpItem->setVisible(TRUE); + mArrowUpItem->setVisible(true); mArrowUpItem->setEnabled(height_before_first_visible_item > MENU_ITEM_PADDING); mArrowUpItem->reshape(width, mArrowUpItem->getNominalHeight()); mArrowDownItem->setRect(rect.setLeftTopAndSize( 0, mArrowDownItem->getNominalHeight(), width, mArrowDownItem->getNominalHeight())); - mArrowDownItem->setVisible(TRUE); + mArrowDownItem->setVisible(true); mArrowDownItem->setEnabled(height_before_first_visible_item + visible_items_height < (S32)height); mArrowDownItem->reshape(width, mArrowDownItem->getNominalHeight()); @@ -2353,11 +2353,11 @@ void LLMenuGL::arrange( void ) { if (NULL != mArrowUpItem) { - mArrowUpItem->setVisible(FALSE); + mArrowUpItem->setVisible(false); } if (NULL != mArrowDownItem) { - mArrowDownItem->setVisible(FALSE); + mArrowDownItem->setVisible(false); } } @@ -2420,7 +2420,7 @@ void LLMenuGL::arrangeAndClear( void ) if (mNeedsArrange) { arrange(); - mNeedsArrange = FALSE; + mNeedsArrange = false; } } @@ -2482,7 +2482,7 @@ void LLMenuGL::cleanupSpilloverBranch() void LLMenuGL::createJumpKeys() { if (!mCreateJumpKeys) return; - mCreateJumpKeys = FALSE; + mCreateJumpKeys = false; mJumpKeys.clear(); @@ -2547,7 +2547,7 @@ void LLMenuGL::createJumpKeys() tokenizer tokens(uppercase_label, sep); tokenizer::iterator token_iter; - BOOL found_key = FALSE; + bool found_key = false; for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { std::string uppercase_word = *token_iter; @@ -2565,7 +2565,7 @@ void LLMenuGL::createJumpKeys() { mJumpKeys.insert(std::pair<KEY, LLMenuItemGL*>(jump_key, (*item_it))); (*item_it)->setJumpKey(jump_key); - found_key = TRUE; + found_key = true; break; } } @@ -2594,7 +2594,7 @@ void LLMenuGL::empty( void ) // erase group of items from menu void LLMenuGL::erase( S32 begin, S32 end, bool arrange/* = true*/) { - S32 items = mItems.size(); + auto items = mItems.size(); if ( items == 0 || begin >= end || begin < 0 || end > items ) { @@ -2648,7 +2648,7 @@ void LLMenuGL::setLeftAndBottom(S32 left, S32 bottom) needsArrange(); } -BOOL LLMenuGL::handleJumpKey(KEY key) +bool LLMenuGL::handleJumpKey(KEY key) { // must perform case-insensitive comparison, so just switch to uppercase input key key = toupper(key); @@ -2656,31 +2656,31 @@ BOOL LLMenuGL::handleJumpKey(KEY key) if(found_it != mJumpKeys.end() && found_it->second->getEnabled()) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); // force highlight to close old menus and open and sub-menus - found_it->second->setHighlight(TRUE); + found_it->second->setHighlight(true); found_it->second->onCommit(); } // if we are navigating the menus, we need to eat the keystroke // so rest of UI doesn't handle it - return TRUE; + return true; } // Add the menu item to this menu. -BOOL LLMenuGL::append( LLMenuItemGL* item ) +bool LLMenuGL::append( LLMenuItemGL* item ) { - if (!item) return FALSE; + if (!item) return false; mItems.push_back( item ); LLUICtrl::addChild(item); needsArrange(); - return TRUE; + return true; } // add a separator to this menu -BOOL LLMenuGL::addSeparator() +bool LLMenuGL::addSeparator() { LLMenuItemSeparatorGL::Params p; LLMenuItemGL* separator = LLUICtrlFactory::create<LLMenuItemSeparatorGL>(p); @@ -2688,14 +2688,14 @@ BOOL LLMenuGL::addSeparator() } // add a menu - this will create a cascading menu -BOOL LLMenuGL::appendMenu( LLMenuGL* menu ) +bool LLMenuGL::appendMenu( LLMenuGL* menu ) { if( menu == this ) { LL_ERRS() << "** Attempt to attach menu to itself. This is certainly " << "a logic error." << LL_ENDL; } - BOOL success = TRUE; + bool success = true; LLMenuItemBranchGL::Params p; p.name = menu->getName(); @@ -2717,7 +2717,7 @@ BOOL LLMenuGL::appendMenu( LLMenuGL* menu ) } // add a context menu branch -BOOL LLMenuGL::appendContextSubMenu(LLMenuGL *menu) +bool LLMenuGL::appendContextSubMenu(LLMenuGL *menu) { if (menu == this) { @@ -2740,7 +2740,7 @@ BOOL LLMenuGL::appendContextSubMenu(LLMenuGL *menu) return append( item ); } -void LLMenuGL::setEnabledSubMenus(BOOL enable) +void LLMenuGL::setEnabledSubMenus(bool enable) { setEnabled(enable); item_list_t::iterator item_iter; @@ -2751,8 +2751,8 @@ void LLMenuGL::setEnabledSubMenus(BOOL enable) } // setItemEnabled() - pass the label and the enable flag for a menu -// item. TRUE will make sure it's enabled, FALSE will disable it. -void LLMenuGL::setItemEnabled( const std::string& name, BOOL enable ) +// item. true will make sure it's enabled, false will disable it. +void LLMenuGL::setItemEnabled( const std::string& name, bool enable ) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) @@ -2766,7 +2766,7 @@ void LLMenuGL::setItemEnabled( const std::string& name, BOOL enable ) } } -void LLMenuGL::setItemVisible( const std::string& name, BOOL visible ) +void LLMenuGL::setItemVisible( const std::string& name, bool visible ) { item_list_t::iterator item_iter; for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) @@ -2801,19 +2801,19 @@ void LLMenuGL::setItemLastSelected(LLMenuItemGL* item) } // Set whether drop shadowed -void LLMenuGL::setDropShadowed( const BOOL shadowed ) +void LLMenuGL::setDropShadowed( const bool shadowed ) { mDropShadowed = shadowed; } -void LLMenuGL::setTornOff(BOOL torn_off) +void LLMenuGL::setTornOff(bool torn_off) { mTornOff = torn_off; } U32 LLMenuGL::getItemCount() { - return mItems.size(); + return static_cast<U32>(mItems.size()); } LLMenuItemGL* LLMenuGL::getItem(S32 number) @@ -2859,7 +2859,7 @@ LLMenuItemGL* LLMenuGL::getHighlightedItem() return NULL; } -LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled) +LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, bool skip_disabled) { if (mItems.empty()) return NULL; // highlighting first item on a torn off menu is the @@ -2869,7 +2869,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa LLFloater * parent = dynamic_cast<LLFloater *>(getParent()); if (parent) { - parent->setFocus(TRUE); + parent->setFocus(true); } } @@ -2938,9 +2938,9 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa { if (cur_item) { - cur_item->setHighlight(FALSE); + cur_item->setHighlight(false); } - (*next_item_iter)->setHighlight(TRUE); + (*next_item_iter)->setHighlight(true); return (*next_item_iter); } @@ -2964,7 +2964,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa return NULL; } -LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disabled) +LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disabled) { if (mItems.empty()) return NULL; @@ -2975,7 +2975,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa LLFloater * parent = dynamic_cast<LLFloater *>(getParent()); if (parent) { - parent->setFocus(TRUE); + parent->setFocus(true); } } @@ -3030,7 +3030,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa // skip separators and disabled/invisible items if ((*prev_item_iter)->getEnabled() && (*prev_item_iter)->getVisible() && (*prev_item_iter)->getName() != SEPARATOR_NAME) { - (*prev_item_iter)->setHighlight(TRUE); + (*prev_item_iter)->setHighlight(true); return (*prev_item_iter); } @@ -3101,12 +3101,12 @@ bool LLMenuGL::hasAccelerator(const KEY &key, const MASK &mask) const return false; } -BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) { // don't handle if not enabled if(!getEnabled()) { - return FALSE; + return false; } // Pass down even if not visible @@ -3116,26 +3116,26 @@ BOOL LLMenuGL::handleAcceleratorKey(KEY key, MASK mask) LLMenuItemGL* itemp = *item_iter; if (itemp->handleAcceleratorKey(key, mask)) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMenuGL::handleUnicodeCharHere( llwchar uni_char ) +bool LLMenuGL::handleUnicodeCharHere( llwchar uni_char ) { if (jumpKeysActive()) { return handleJumpKey((KEY)uni_char); } - return FALSE; + return false; } -BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) +bool LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) { // leave submenu in place if slope of mouse < MAX_MOUSE_SLOPE_SUB_MENU - BOOL no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; + bool no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; S32 mouse_delta_x = no_mouse_data ? 0 : x - mLastMouseX; S32 mouse_delta_y = no_mouse_data ? 0 : y - mLastMouseY; LLVector2 mouse_dir((F32)mouse_delta_x, (F32)mouse_delta_y); @@ -3166,7 +3166,7 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) // moving mouse always highlights new item if (mouse_delta_x != 0 || mouse_delta_y != 0) { - ((LLMenuItemGL*)viewp)->setHighlight(FALSE); + ((LLMenuItemGL*)viewp)->setHighlight(false); } } } @@ -3188,8 +3188,8 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) // moving mouse always highlights new item if (mouse_delta_x != 0 || mouse_delta_y != 0) { - ((LLMenuItemGL*)viewp)->setHighlight(TRUE); - LLMenuGL::setKeyboardMode(FALSE); + ((LLMenuItemGL*)viewp)->setHighlight(true); + LLMenuGL::setKeyboardMode(false); } mHasSelection = true; } @@ -3202,10 +3202,10 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) // drop-down menu is shown. Otherwise any other view won't be able to handle mouse events // until the user chooses one of the drop-down menu items. - return TRUE; + return true; } -BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) { if (!mScrollable) return blockMouseEvent(x, y); @@ -3221,7 +3221,7 @@ BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks ) scrollItems(SD_UP); } - return TRUE; + return true; } @@ -3230,7 +3230,7 @@ void LLMenuGL::draw( void ) if (mNeedsArrange) { arrange(); - mNeedsArrange = FALSE; + mNeedsArrange = false; } if (mDropShadowed && !mTornOff) { @@ -3254,7 +3254,7 @@ void LLMenuGL::drawBackground(LLMenuItemGL* itemp, F32 alpha) gl_rect_2d( 0, item_rect.getHeight(), item_rect.getWidth(), 0); } -void LLMenuGL::setVisible(BOOL visible) +void LLMenuGL::setVisible(bool visible) { if (visible != getVisible()) { @@ -3277,7 +3277,7 @@ void LLMenuGL::setVisible(BOOL visible) } } -LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, BOOL recurse) const +LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, bool recurse) const { LLView* view = findChildView(name, recurse); if (view) @@ -3298,23 +3298,23 @@ LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, BOOL recurse) c return NULL; } -BOOL LLMenuGL::clearHoverItem() +bool LLMenuGL::clearHoverItem() { for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLMenuItemGL* itemp = (LLMenuItemGL*)*child_it; if (itemp->getHighlight()) { - itemp->setHighlight(FALSE); - return TRUE; + itemp->setHighlight(false); + return true; } } - return FALSE; + return false; } void hide_top_view( LLView* view ) { - if( view ) view->setVisible( FALSE ); + if( view ) view->setVisible( false ); } @@ -3331,12 +3331,12 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S3 return; } - menu->setVisible( TRUE ); + menu->setVisible( true ); if(!menu->getAlwaysShowMenu()) { //Do not show menu if all menu items are disabled - BOOL item_enabled = false; + bool item_enabled = false; for (LLView::child_list_t::const_iterator itor = menu->getChildList()->begin(); itor != menu->getChildList()->end(); ++itor) @@ -3347,7 +3347,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S3 if(!item_enabled) { - menu->setVisible( FALSE ); + menu->setVisible( false ); return; } } @@ -3412,7 +3412,7 @@ static LLDefaultChildRegistry::Register<LLMenuBarGL> r2("menu_bar"); LLMenuBarGL::LLMenuBarGL( const Params& p ) : LLMenuGL(p), - mAltKeyTrigger(FALSE) + mAltKeyTrigger(false) {} // Default destructor @@ -3422,19 +3422,19 @@ LLMenuBarGL::~LLMenuBarGL() mAccelerators.clear(); } -BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) +bool LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) { if (getHighlightedItem() && mask == MASK_NONE) { // unmodified key accelerators are ignored when navigating menu // (but are used as jump keys so will still work when appropriate menu is up) - return FALSE; + return false; } - BOOL result = LLMenuGL::handleAcceleratorKey(key, mask); + bool result = LLMenuGL::handleAcceleratorKey(key, mask); if (result && mask & MASK_ALT) { // ALT key used to trigger hotkey, don't use as shortcut to open menu - mAltKeyTrigger = FALSE; + mAltKeyTrigger = false; } if(!result @@ -3445,16 +3445,16 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) if (getHighlightedItem()) { clearHoverItem(); - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); } else { // close menus originating from other menu bars when first opening menu via keyboard LLMenuGL::sMenuContainer->hideMenus(); highlightNextItem(NULL); - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); } - return TRUE; + return true; } if (result && !getHighlightedItem() && LLMenuGL::sMenuContainer->hasVisibleMenu()) @@ -3466,22 +3466,22 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) return result; } -BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask) +bool LLMenuBarGL::handleKeyHere(KEY key, MASK mask) { static LLUICachedControl<bool> use_altkey_for_menus ("UseAltKeyForMenus", 0); if(key == KEY_ALT && !gKeyboard->getKeyRepeated(key) && use_altkey_for_menus) { - mAltKeyTrigger = TRUE; + mAltKeyTrigger = true; } else // if any key other than ALT hit, clear out waiting for Alt key mode { - mAltKeyTrigger = FALSE; + mAltKeyTrigger = false; } if (key == KEY_ESCAPE && mask == MASK_NONE) { - LLMenuGL::setKeyboardMode(FALSE); - // if any menus are visible, this will return TRUE, stopping further processing of ESCAPE key + LLMenuGL::setKeyboardMode(false); + // if any menus are visible, this will return true, stopping further processing of ESCAPE key return LLMenuGL::sMenuContainer->hideMenus(); } @@ -3491,7 +3491,7 @@ BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask) return LLMenuGL::handleKeyHere(key, mask); } -BOOL LLMenuBarGL::handleJumpKey(KEY key) +bool LLMenuBarGL::handleJumpKey(KEY key) { // perform case-insensitive comparison key = toupper(key); @@ -3499,15 +3499,15 @@ BOOL LLMenuBarGL::handleJumpKey(KEY key) if(found_it != mJumpKeys.end() && found_it->second->getEnabled()) { // switch to keyboard navigation mode - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); - found_it->second->setHighlight(TRUE); + found_it->second->setHighlight(true); found_it->second->onCommit(); } - return TRUE; + return true; } -BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) { // clicks on menu bar closes existing menus from other contexts but leave // own menu open so that we get toggle behavior @@ -3519,7 +3519,7 @@ BOOL LLMenuBarGL::handleMouseDown(S32 x, S32 y, MASK mask) return LLMenuGL::handleMouseDown(x, y, mask); } -BOOL LLMenuBarGL::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLMenuBarGL::handleDoubleClick(S32 x, S32 y, MASK mask) { return LLMenuGL::handleMouseDown(x, y, mask); } @@ -3563,14 +3563,14 @@ void LLMenuBarGL::checkMenuTrigger() LLMenuGL::sMenuContainer->hideMenus(); highlightNextItem(NULL); - LLMenuGL::setKeyboardMode(TRUE); + LLMenuGL::setKeyboardMode(true); } } - mAltKeyTrigger = FALSE; + mAltKeyTrigger = false; } } -BOOL LLMenuBarGL::jumpKeysActive() +bool LLMenuBarGL::jumpKeysActive() { // require user to be in keyboard navigation mode to activate key triggers // as menu bars are always visible and it is easy to leave the mouse cursor over them @@ -3619,14 +3619,14 @@ S32 LLMenuBarGL::getRightmostMenuEdge() } // add a vertical separator to this menu -BOOL LLMenuBarGL::addSeparator() +bool LLMenuBarGL::addSeparator() { LLMenuItemGL* separator = new LLMenuItemVerticalSeparatorGL(); return append( separator ); } // add a menu - this will create a drop down menu. -BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) +bool LLMenuBarGL::appendMenu( LLMenuGL* menu ) { if( menu == this ) { @@ -3634,7 +3634,7 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) << "a logic error." << LL_ENDL; } - BOOL success = TRUE; + bool success = true; // *TODO: Hack! Fix this LLMenuItemBranchDownGL::Params p; @@ -3657,12 +3657,12 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) return success; } -BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) +bool LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; LLView* active_menu = NULL; - BOOL no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; + bool no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; S32 mouse_delta_x = no_mouse_data ? 0 : x - mLastMouseX; S32 mouse_delta_y = no_mouse_data ? 0 : y - mLastMouseY; mMouseVelX = (mMouseVelX / 2) + (mouse_delta_x / 2); @@ -3695,14 +3695,14 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) viewp->pointInView(local_x, local_y) && viewp->handleHover(local_x, local_y, mask)) { - ((LLMenuItemGL*)viewp)->setHighlight(TRUE); - handled = TRUE; + ((LLMenuItemGL*)viewp)->setHighlight(true); + handled = true; if (active_menu && active_menu != viewp) { ((LLMenuItemGL*)viewp)->onCommit(); - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); } - LLMenuGL::setKeyboardMode(FALSE); + LLMenuGL::setKeyboardMode(false); } } @@ -3716,7 +3716,7 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) S32 local_y = y - viewp->getRect().mBottom; if (!viewp->pointInView(local_x, local_y) && ((LLMenuItemGL*)viewp)->getHighlight()) { - ((LLMenuItemGL*)viewp)->setHighlight(FALSE); + ((LLMenuItemGL*)viewp)->setHighlight(false); } } } @@ -3724,7 +3724,7 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) getWindow()->setCursor(UI_CURSOR_ARROW); - return TRUE; + return true; } ///============================================================================ @@ -3736,7 +3736,7 @@ LLMenuHolderGL::LLMenuHolderGL(const LLMenuHolderGL::Params& p) : LLPanel(p) { sItemActivationTimer.stop(); - mCanHide = TRUE; + mCanHide = true; } void LLMenuHolderGL::draw() @@ -3764,9 +3764,9 @@ void LLMenuHolderGL::draw() } } -BOOL LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; if (!handled) { LLMenuGL* visible_menu = (LLMenuGL*)getVisibleMenu(); @@ -3791,9 +3791,9 @@ BOOL LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) return handled; } -BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) +bool LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - BOOL handled = LLView::childrenHandleRightMouseDown(x, y, mask) != NULL; + bool handled = LLView::childrenHandleRightMouseDown(x, y, mask) != NULL; if (!handled) { // clicked off of menu, hide them all @@ -3804,7 +3804,7 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) // This occurs when you mouse-down to spawn a context menu, hold the button // down, move off the menu, then mouse-up. We want this to close the menu. -BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) +bool LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) { const S32 SLOP = 2; S32 spawn_dx = (x - sContextMenuSpawnPos.mX); @@ -3816,10 +3816,10 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) // so interpret the mouse-up as a single-click to show and leave on // screen sContextMenuSpawnPos.set(S32_MAX, S32_MAX); - return TRUE; + return true; } - BOOL handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; + bool handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; if (!handled) { // clicked off of menu, hide them all @@ -3828,9 +3828,9 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) return handled; } -BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLMenuHolderGL::handleKey(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = false; + bool handled = false; LLMenuGL* const pMenu = dynamic_cast<LLMenuGL*>(getVisibleMenu()); if (pMenu) @@ -3838,7 +3838,7 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) //eat TAB key - EXT-7000 if (key == KEY_TAB && mask == MASK_NONE) { - return TRUE; + return true; } //handle ESCAPE and RETURN key @@ -3847,7 +3847,7 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) { if (pMenu->getHighlightedItem()) { - handled = pMenu->handleKey(key, mask, TRUE); + handled = pMenu->handleKey(key, mask, true); } else if (mask == MASK_NONE || (key >= KEY_LEFT && key <= KEY_DOWN)) { @@ -3864,7 +3864,7 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent) } -void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLMenuHolderGL::reshape(S32 width, S32 height, bool called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight()) { @@ -3887,14 +3887,14 @@ LLView* const LLMenuHolderGL::getVisibleMenu() const } -BOOL LLMenuHolderGL::hideMenus() +bool LLMenuHolderGL::hideMenus() { if (!mCanHide) { - return FALSE; + return false; } - LLMenuGL::setKeyboardMode(FALSE); - BOOL menu_visible = hasVisibleMenu(); + LLMenuGL::setKeyboardMode(false); + bool menu_visible = hasVisibleMenu(); if (menu_visible) { // clicked off of menu, hide them all @@ -3903,7 +3903,7 @@ BOOL LLMenuHolderGL::hideMenus() LLView* viewp = *child_it; if (dynamic_cast<LLMenuGL*>(viewp) != NULL && viewp->getVisible()) { - viewp->setVisible(FALSE); + viewp->setVisible(false); } } } @@ -3932,9 +3932,9 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : setName(menup->getName()); setTitle(menup->getLabel()); - setCanMinimize(FALSE); + setCanMinimize(false); // flag menu as being torn off - menup->setTornOff(TRUE); + menup->setTornOff(true); // update menu layout as torn off menu (no spillover menus) menup->needsArrange(); @@ -3949,12 +3949,12 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : menup->setFollows( FOLLOWS_LEFT | FOLLOWS_BOTTOM ); mOldParent = menup->getParent(); addChild(menup); - menup->setVisible(TRUE); + menup->setVisible(true); LLRect menu_rect = menup->getRect(); menu_rect.setOriginAndSize( 1, 1, menu_rect.getWidth(), menu_rect.getHeight()); menup->setRect(menu_rect); - menup->setDropShadowed(FALSE); + menup->setDropShadowed(false); mMenu = menup; @@ -4002,7 +4002,7 @@ void LLTearOffMenu::onFocusReceived() { if (parent_menu_item->getMenu()->getVisible()) { - parent_menu_item->setHighlight(TRUE); + parent_menu_item->setHighlight(true); parent_menu_item = parent_menu_item->getMenu()->getParentMenuItem(); } else @@ -4020,29 +4020,29 @@ void LLTearOffMenu::onFocusLost() LLFloater::onFocusLost(); } -BOOL LLTearOffMenu::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLTearOffMenu::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { // pass keystrokes down to menu - return mMenu->handleUnicodeChar(uni_char, TRUE); + return mMenu->handleUnicodeChar(uni_char, true); } -BOOL LLTearOffMenu::handleKeyHere(KEY key, MASK mask) +bool LLTearOffMenu::handleKeyHere(KEY key, MASK mask) { if (!mMenu->getHighlightedItem()) { if (key == KEY_UP) { mMenu->highlightPrevItem(NULL); - return TRUE; + return true; } else if (key == KEY_DOWN) { mMenu->highlightNextItem(NULL); - return TRUE; + return true; } } // pass keystrokes down to menu - return mMenu->handleKey(key, mask, TRUE); + return mMenu->handleKey(key, mask, true); } void LLTearOffMenu::translate(S32 x, S32 y) @@ -4060,7 +4060,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup) { LLTearOffMenu* tearoffp = new LLTearOffMenu(menup); // keep onscreen - gFloaterView->adjustToFitScreen(tearoffp, FALSE); + gFloaterView->adjustToFitScreen(tearoffp, false); tearoffp->openFloater(LLSD()); return tearoffp; @@ -4097,10 +4097,10 @@ void LLTearOffMenu::closeTearOff() mOldParent->addChild(mMenu); mMenu->clearHoverItem(); mMenu->setFollowsNone(); - mMenu->setBackgroundVisible(TRUE); - mMenu->setVisible(FALSE); - mMenu->setTornOff(FALSE); - mMenu->setDropShadowed(TRUE); + mMenu->setBackgroundVisible(true); + mMenu->setVisible(false); + mMenu->setTornOff(false); + mMenu->setDropShadowed(true); mQuitRequested = true; } @@ -4134,19 +4134,19 @@ void LLContextMenuBranch::buildDrawLabel( void ) // enabled, this item is enabled. JC U32 sub_count = menu->getItemCount(); U32 i; - BOOL any_enabled = FALSE; + bool any_enabled = false; for (i = 0; i < sub_count; i++) { LLMenuItemGL* item = menu->getItem(i); item->buildDrawLabel(); if (item->getEnabled() && !item->getDrawTextDisabled() ) { - any_enabled = TRUE; + any_enabled = true; break; } } setDrawTextDisabled(!any_enabled); - setEnabled(TRUE); + setEnabled(true); } mDrawAccelLabel.clear(); @@ -4179,7 +4179,7 @@ void LLContextMenuBranch::onCommit( void ) showSubMenu(); } -void LLContextMenuBranch::setHighlight( BOOL highlight ) +void LLContextMenuBranch::setHighlight( bool highlight ) { if (highlight == getHighlight()) return; LLMenuItemGL::setHighlight(highlight); @@ -4209,13 +4209,13 @@ static MenuRegistry::Register<LLContextMenu> context_menu_register2("context_men LLContextMenu::LLContextMenu(const Params& p) : LLMenuGL(p), - mHoveredAnyItem(FALSE), + mHoveredAnyItem(false), mHoverItem(NULL) { - //setBackgroundVisible(TRUE); + //setBackgroundVisible(true); } -void LLContextMenu::setVisible(BOOL visible) +void LLContextMenu::setVisible(bool visible) { if (!visible) hide(); @@ -4284,53 +4284,53 @@ void LLContextMenu::show(S32 x, S32 y, LLView* spawning_view) { mSpawningViewHandle.markDead(); } - LLView::setVisible(TRUE); + LLView::setVisible(true); } void LLContextMenu::hide() { if (!getVisible()) return; - LLView::setVisible(FALSE); + LLView::setVisible(false); if (mHoverItem) { - mHoverItem->setHighlight( FALSE ); + mHoverItem->setHighlight( false ); } mHoverItem = NULL; } -BOOL LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) +bool LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) { LLMenuGL::handleHover(x,y,mask); - BOOL handled = FALSE; + bool handled = false; LLMenuItemGL *item = getHighlightedItem(); if (item && item->getEnabled()) { getWindow()->setCursor(UI_CURSOR_ARROW); - handled = TRUE; + handled = true; if (item != mHoverItem) { if (mHoverItem) { - mHoverItem->setHighlight( FALSE ); + mHoverItem->setHighlight( false ); } mHoverItem = item; - mHoverItem->setHighlight( TRUE ); + mHoverItem->setHighlight( true ); } - mHoveredAnyItem = TRUE; + mHoveredAnyItem = true; } else { // clear out our selection if (mHoverItem) { - mHoverItem->setHighlight(FALSE); + mHoverItem->setHighlight(false); mHoverItem = NULL; } } @@ -4338,7 +4338,7 @@ BOOL LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) if( !handled && pointInView( x, y ) ) { getWindow()->setCursor(UI_CURSOR_ARROW); - handled = TRUE; + handled = true; } return handled; @@ -4347,9 +4347,9 @@ BOOL LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) // handleMouseDown and handleMouseUp are handled by LLMenuGL -BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // The click was somewhere within our rectangle LLMenuItemGL *item = getHighlightedItem(); @@ -4357,13 +4357,13 @@ BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; - BOOL clicked_in_menu = pointInView(local_x, local_y) ; + bool clicked_in_menu = pointInView(local_x, local_y) ; // grab mouse if right clicking anywhere within pie (even deadzone in middle), to detect drag outside of pie if (clicked_in_menu) { // capture mouse cursor as if on initial menu show - handled = TRUE; + handled = true; } if (item) @@ -4372,14 +4372,14 @@ BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) // to make sure it's within the item's rectangle if (item->handleMouseDown( 0, 0, mask )) { - handled = TRUE; + handled = true; } } return handled; } -BOOL LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) +bool LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) { S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; @@ -4387,12 +4387,12 @@ BOOL LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) if (!mHoveredAnyItem && !pointInView(local_x, local_y)) { sMenuContainer->hideMenus(); - return TRUE; + return true; } - BOOL result = handleMouseUp( x, y, mask ); - mHoveredAnyItem = FALSE; + bool result = handleMouseUp( x, y, mask ); + mHoveredAnyItem = false; return result; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 72e041672a..51766afe85 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -89,17 +89,17 @@ protected: friend class LLUICtrlFactory; public: // LLView overrides - /*virtual*/ void onVisibilityChange(BOOL new_visibility); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ void onVisibilityChange(bool new_visibility); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); // LLUICtrl overrides /*virtual*/ void setValue(const LLSD& value); /*virtual*/ LLSD getValue() const; virtual bool hasAccelerator(const KEY &key, const MASK &mask) const; - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); LLColor4 getHighlightBgColor() { return mHighlightBackground.get(); } @@ -114,17 +114,17 @@ public: virtual U32 getNominalHeight( void ) const; // Marks item as not needing space for check marks or accelerator keys - virtual void setBriefItem(BOOL brief); - virtual BOOL isBriefItem() const; + virtual void setBriefItem(bool brief); + virtual bool isBriefItem() const; - virtual BOOL addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp); - void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; } - BOOL getAllowKeyRepeat() const { return mAllowKeyRepeat; } + virtual bool addToAcceleratorList(std::list<LLMenuKeyboardBinding*> *listp); + void setAllowKeyRepeat(bool allow) { mAllowKeyRepeat = allow; } + bool getAllowKeyRepeat() const { return mAllowKeyRepeat; } // change the label void setLabel( const LLStringExplicit& label ) { mLabel = label; } std::string getLabel( void ) const { return mLabel.getString(); } - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); // Get the parent menu for this item virtual class LLMenuGL* getMenu() const; @@ -150,35 +150,35 @@ public: virtual void onCommit( void ); - virtual void setHighlight( BOOL highlight ); - virtual BOOL getHighlight() const { return mHighlight; } + virtual void setHighlight( bool highlight ); + virtual bool getHighlight() const { return mHighlight; } // determine if this represents an active sub-menu - virtual BOOL isActive( void ) const { return FALSE; } + virtual bool isActive( void ) const { return false; } // determine if this represents an open sub-menu - virtual BOOL isOpen( void ) const { return FALSE; } + virtual bool isOpen( void ) const { return false; } - virtual void setEnabledSubMenus(BOOL enable){}; + virtual void setEnabledSubMenus(bool enable){}; // LLView Functionality - virtual BOOL handleKeyHere( KEY key, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleKeyHere( KEY key, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseUp( S32 x, S32 y, MASK mask ); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void draw( void ); - BOOL getHover() const { return mGotHover; } + bool getHover() const { return mGotHover; } - void setDrawTextDisabled(BOOL disabled) { mDrawTextDisabled = disabled; } - BOOL getDrawTextDisabled() const { return mDrawTextDisabled; } + void setDrawTextDisabled(bool disabled) { mDrawTextDisabled = disabled; } + bool getDrawTextDisabled() const { return mDrawTextDisabled; } protected: - void setHover(BOOL hover) { mGotHover = hover; } + void setHover(bool hover) { mGotHover = hover; } // This function appends the character string representation of // the current accelerator key and mask to the provided string. @@ -207,19 +207,19 @@ protected: LLUIColor mHighlightBackground; LLUIColor mHighlightForeground; - BOOL mHighlight; + bool mHighlight; private: // Keyboard and mouse variables - BOOL mAllowKeyRepeat; - BOOL mGotHover; + bool mAllowKeyRepeat; + bool mGotHover; // If true, suppress normal space for check marks on the left and accelerator // keys on the right. - BOOL mBriefItem; + bool mBriefItem; // Font for this item const LLFontGL* mFont; - BOOL mDrawTextDisabled; + bool mDrawTextDisabled; KEY mJumpKey; }; @@ -241,9 +241,9 @@ public: LLMenuItemSeparatorGL(const LLMenuItemSeparatorGL::Params& p = LLMenuItemSeparatorGL::Params()); /*virtual*/ void draw( void ); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); virtual void buildDrawLabel(); @@ -288,8 +288,8 @@ public: virtual void onCommit( void ); - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); //virtual void draw(); @@ -442,23 +442,23 @@ public: void parseChildXML(LLXMLNodePtr child, LLView* parent); // LLView Functionality - /*virtual*/ BOOL handleUnicodeCharHere( llwchar uni_char ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + /*virtual*/ bool handleUnicodeCharHere( llwchar uni_char ); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleScrollWheel( S32 x, S32 y, S32 clicks ); /*virtual*/ void draw( void ); /*virtual*/ void drawBackground(LLMenuItemGL* itemp, F32 alpha); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); /*virtual*/ void deleteAllChildren(); /*virtual*/ void removeChild( LLView* ctrl); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); virtual bool hasAccelerator(const KEY &key, const MASK &mask) const; - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); - LLMenuGL* findChildMenuByName(const std::string& name, BOOL recurse) const; + LLMenuGL* findChildMenuByName(const std::string& name, bool recurse) const; - BOOL clearHoverItem(); + bool clearHoverItem(); // return the name label const std::string& getLabel( void ) const { return mLabel.getString(); } @@ -467,37 +467,37 @@ public: // background colors void setBackgroundColor( const LLUIColor& color ) { mBackgroundColor = color; } const LLUIColor& getBackgroundColor() const { return mBackgroundColor; } - void setBackgroundVisible( BOOL b ) { mBgVisible = b; } - void setCanTearOff(BOOL tear_off); + void setBackgroundVisible( bool b ) { mBgVisible = b; } + void setCanTearOff(bool tear_off); // add a separator to this menu - virtual BOOL addSeparator(); + virtual bool addSeparator(); // for branching menu items, bring sub menus up to root level of menu hierarchy virtual void updateParent( LLView* parentp ); // setItemEnabled() - pass the name and the enable flag for a - // menu item. TRUE will make sure it's enabled, FALSE will disable + // menu item. true will make sure it's enabled, false will disable // it. - void setItemEnabled( const std::string& name, BOOL enable ); + void setItemEnabled( const std::string& name, bool enable ); // propagate message to submenus - void setEnabledSubMenus(BOOL enable); + void setEnabledSubMenus(bool enable); - void setItemVisible( const std::string& name, BOOL visible); + void setItemVisible( const std::string& name, bool visible); void setItemLabel(const std::string &name, const std::string &label); // sets the left,bottom corner of menu, useful for popups void setLeftAndBottom(S32 left, S32 bottom); - virtual BOOL handleJumpKey(KEY key); + virtual bool handleJumpKey(KEY key); - virtual BOOL jumpKeysActive(); + virtual bool jumpKeysActive(); - virtual BOOL isOpen(); + virtual bool isOpen(); - void needsArrange() { mNeedsArrange = TRUE; } + void needsArrange() { mNeedsArrange = true; } // Shape this menu to fit the current state of the children, and // adjust the child rects to fit. This is called automatically // when you add items. *FIX: We may need to deal with visibility @@ -520,8 +520,8 @@ public: LLMenuItemGL* getItem(std::string name); LLMenuItemGL* getHighlightedItem(); - LLMenuItemGL* highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled = TRUE); - LLMenuItemGL* highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disabled = TRUE); + LLMenuItemGL* highlightNextItem(LLMenuItemGL* cur_item, bool skip_disabled = true); + LLMenuItemGL* highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disabled = true); void buildDrawLabels(); void createJumpKeys(); @@ -530,37 +530,37 @@ public: static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x = 0, S32 mouse_y = 0); // Whether to drop shadow menu bar - void setDropShadowed( const BOOL shadowed ); + void setDropShadowed( const bool shadowed ); void setParentMenuItem( LLMenuItemGL* parent_menu_item ) { mParentMenuItem = parent_menu_item->getHandle(); } LLMenuItemGL* getParentMenuItem() const { return dynamic_cast<LLMenuItemGL*>(mParentMenuItem.get()); } - void setTornOff(BOOL torn_off); - BOOL getTornOff() { return mTornOff; } + void setTornOff(bool torn_off); + bool getTornOff() { return mTornOff; } - BOOL getCanTearOff() { return mTearOffItem != NULL; } + bool getCanTearOff() { return mTearOffItem != NULL; } KEY getJumpKey() const { return mJumpKey; } void setJumpKey(KEY key) { mJumpKey = key; } - static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; } - static BOOL getKeyboardMode() { return sKeyboardMode; } + static void setKeyboardMode(bool mode) { sKeyboardMode = mode; } + static bool getKeyboardMode() { return sKeyboardMode; } S32 getShortcutPad() { return mShortcutPad; } bool scrollItems(EScrollingDirection direction); - BOOL isScrollable() const { return mScrollable; } + bool isScrollable() const { return mScrollable; } static class LLMenuHolderGL* sMenuContainer; void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; } bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; } - void setAlwaysShowMenu(BOOL show) { mAlwaysShowMenu = show; } - BOOL getAlwaysShowMenu() { return mAlwaysShowMenu; } + void setAlwaysShowMenu(bool show) { mAlwaysShowMenu = show; } + bool getAlwaysShowMenu() { return mAlwaysShowMenu; } // add a context menu branch - BOOL appendContextSubMenu(LLMenuGL *menu); + bool appendContextSubMenu(LLMenuGL *menu); const LLFontGL *getFont() const { return mFont; } @@ -568,10 +568,10 @@ public: void createSpilloverBranch(); void cleanupSpilloverBranch(); // Add the menu item to this menu. - virtual BOOL append( LLMenuItemGL* item ); + virtual bool append( LLMenuItemGL* item ); // add a menu - this will create a cascading menu - virtual BOOL appendMenu( LLMenuGL* menu ); + virtual bool appendMenu( LLMenuGL* menu ); // Used in LLContextMenu and in LLTogleableMenu // to add an item of context menu branch @@ -591,10 +591,10 @@ public: S32 mMouseVelY; U32 mMaxScrollableItems; U32 mPreferredWidth; - BOOL mHorizontalLayout; - BOOL mScrollable; - BOOL mKeepFixedSize; - BOOL mNeedsArrange; + bool mHorizontalLayout; + bool mScrollable; + bool mKeepFixedSize; + bool mNeedsArrange; // Font for top menu items only const LLFontGL* mFont; @@ -603,24 +603,24 @@ private: static LLColor4 sDefaultBackgroundColor; - static BOOL sKeyboardMode; + static bool sKeyboardMode; - BOOL mAlwaysShowMenu; + bool mAlwaysShowMenu; LLUIColor mBackgroundColor; - BOOL mBgVisible; + bool mBgVisible; LLHandle<LLView> mParentMenuItem; LLUIString mLabel; - BOOL mDropShadowed; // Whether to drop shadow + bool mDropShadowed; // Whether to drop shadow bool mHasSelection; LLFrameTimer mFadeTimer; LLTimer mScrollItemsTimer; - BOOL mTornOff; + bool mTornOff; class LLMenuItemTearOffGL* mTearOffItem; class LLMenuItemBranchGL* mSpilloverBranch; LLMenuGL* mSpilloverMenu; KEY mJumpKey; - BOOL mCreateJumpKeys; + bool mCreateJumpKeys; S32 mShortcutPad; bool mResetScrollPositionOnShow; }; // end class LLMenuGL @@ -648,47 +648,47 @@ protected: public: virtual ~LLMenuItemBranchGL(); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual bool hasAccelerator(const KEY &key, const MASK &mask) const; - virtual BOOL handleAcceleratorKey(KEY key, MASK mask); + virtual bool handleAcceleratorKey(KEY key, MASK mask); // check if we've used these accelerators already - virtual BOOL addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp); + virtual bool addToAcceleratorList(std::list <LLMenuKeyboardBinding*> *listp); // called to rebuild the draw label virtual void buildDrawLabel( void ); virtual void onCommit( void ); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); + virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); // set the hover status (called by it's menu) and if the object is // active. This is used for behavior transfer. - virtual void setHighlight( BOOL highlight ); + virtual void setHighlight( bool highlight ); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - virtual BOOL isActive() const; + virtual bool isActive() const; - virtual BOOL isOpen() const; + virtual bool isOpen() const; LLMenuGL* getBranch() const { return (LLMenuGL*)mBranchHandle.get(); } virtual void updateBranchParent( LLView* parentp ); // LLView Functionality - virtual void onVisibilityChange( BOOL curVisibilityIn ); + virtual void onVisibilityChange( bool curVisibilityIn ); virtual void draw(); - virtual void setEnabledSubMenus(BOOL enabled) { if (getBranch()) getBranch()->setEnabledSubMenus(enabled); } + virtual void setEnabledSubMenus(bool enabled) { if (getBranch()) getBranch()->setEnabledSubMenus(enabled); } virtual void openMenu(); - virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const; - virtual LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const; + virtual LLView* getChildView(const std::string& name, bool recurse = true) const; + virtual LLView* findChildView(const std::string& name, bool recurse = true) const; private: LLHandle<LLView> mBranchHandle; @@ -721,14 +721,14 @@ public: // LLView Functionality // can't set visibility directly, must call show or hide - virtual void setVisible (BOOL visible); + virtual void setVisible (bool visible); virtual void show (S32 x, S32 y, LLView* spawning_view = NULL); virtual void hide (); - virtual BOOL handleHover ( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseUp ( S32 x, S32 y, MASK mask ); + virtual bool handleHover ( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseUp ( S32 x, S32 y, MASK mask ); virtual bool addChild (LLView* view, S32 tab_group = 0); @@ -738,7 +738,7 @@ public: void setSpawningView(LLHandle<LLView> spawning_view) { mSpawningViewHandle = spawning_view; } protected: - BOOL mHoveredAnyItem; + bool mHoveredAnyItem; LLMenuItemGL* mHoverItem; LLRootHandle<LLContextMenu> mHandle; LLHandle<LLView> mSpawningViewHandle; @@ -767,7 +767,7 @@ public: virtual void onCommit( void ); LLContextMenu* getBranch() { return mBranch.get(); } - void setHighlight( BOOL highlight ); + void setHighlight( bool highlight ); protected: void showSubMenu(); @@ -790,29 +790,29 @@ public: LLMenuBarGL( const Params& p ); virtual ~LLMenuBarGL(); - /*virtual*/ BOOL handleAcceleratorKey(KEY key, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleJumpKey(KEY key); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleAcceleratorKey(KEY key, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleJumpKey(KEY key); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ void draw(); - /*virtual*/ BOOL jumpKeysActive(); + /*virtual*/ bool jumpKeysActive(); // add a vertical separator to this menu - virtual BOOL addSeparator(); + virtual bool addSeparator(); // LLView Functionality - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); + virtual bool handleHover( S32 x, S32 y, MASK mask ); // Returns x position of rightmost child, usually Help menu S32 getRightmostMenuEdge(); - void resetMenuTrigger() { mAltKeyTrigger = FALSE; } + void resetMenuTrigger() { mAltKeyTrigger = false; } private: // add a menu - this will create a drop down menu. - virtual BOOL appendMenu( LLMenuGL* menu ); + virtual bool appendMenu( LLMenuGL* menu ); // rearrange the child rects so they fit the shape of the menu // bar. virtual void arrange( void ); @@ -820,7 +820,7 @@ private: void checkMenuTrigger(); std::list <LLMenuKeyboardBinding*> mAccelerators; - BOOL mAltKeyTrigger; + bool mAltKeyTrigger; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -836,22 +836,22 @@ public: LLMenuHolderGL(const Params& p); virtual ~LLMenuHolderGL() {} - virtual BOOL hideMenus(); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - void setCanHide(BOOL can_hide) { mCanHide = can_hide; } + virtual bool hideMenus(); + void reshape(S32 width, S32 height, bool called_from_parent = true); + void setCanHide(bool can_hide) { mCanHide = can_hide; } // LLView functionality virtual void draw(); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleMouseDown( S32 x, S32 y, MASK mask ); + virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); // Close context menus on right mouse up not handled by menus. - /*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleRightMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); + virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); virtual const LLRect getMenuRect() const { return getLocalRect(); } LLView*const getVisibleMenu() const; - virtual BOOL hasVisibleMenu() const {return getVisibleMenu() != NULL;} + virtual bool hasVisibleMenu() const {return getVisibleMenu() != NULL;} static void setActivatedItem(LLMenuItemGL* item); @@ -863,7 +863,7 @@ private: static LLHandle<LLView> sItemLastSelectedHandle; static LLFrameTimer sItemActivationTimer; - BOOL mCanHide; + bool mCanHide; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -881,8 +881,8 @@ public: virtual void draw(void); virtual void onFocusReceived(); virtual void onFocusLost(); - virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); + virtual bool handleKeyHere(KEY key, MASK mask); virtual void translate(S32 x, S32 y); void updateSize(); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index eac43900f6..c5c31f7252 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -38,18 +38,18 @@ // static std::list<LLModalDialog*> LLModalDialog::sModalStack; -LLModalDialog::LLModalDialog( const LLSD& key, BOOL modal ) +LLModalDialog::LLModalDialog( const LLSD& key, bool modal ) : LLFloater(key), mModal( modal ) { if (modal) { - setCanMinimize(FALSE); - setCanClose(FALSE); + setCanMinimize(false); + setCanClose(false); } - setVisible( FALSE ); - setBackgroundVisible(TRUE); - setBackgroundOpaque(TRUE); + setVisible( false ); + setBackgroundVisible(true); + setBackgroundOpaque(true); centerOnScreen(); // default position mCloseSignal.connect(boost::bind(&LLModalDialog::stopModal, this)); } @@ -72,7 +72,7 @@ LLModalDialog::~LLModalDialog() } // virtual -BOOL LLModalDialog::postBuild() +bool LLModalDialog::postBuild() { return LLFloater::postBuild(); } @@ -87,7 +87,7 @@ void LLModalDialog::openFloater(const LLSD& key) LLFloater::setFloaterHost(thost); } -void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLModalDialog::reshape(S32 width, S32 height, bool called_from_parent) { LLFloater::reshape(width, height, called_from_parent); centerOnScreen(); @@ -104,14 +104,14 @@ void LLModalDialog::onOpen(const LLSD& key) LLModalDialog* front = sModalStack.front(); if (front != this) { - front->setVisible(FALSE); + front->setVisible(false); } } // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( this ); LLUI::getInstance()->addPopup(this); - setFocus(TRUE); + setFocus(true); std::list<LLModalDialog*>::iterator iter = std::find(sModalStack.begin(), sModalStack.end(), this); if (iter != sModalStack.end()) @@ -144,12 +144,12 @@ void LLModalDialog::stopModal() if (!sModalStack.empty()) { LLModalDialog* front = sModalStack.front(); - front->setVisible(TRUE); + front->setVisible(true); } } -void LLModalDialog::setVisible( BOOL visible ) +void LLModalDialog::setVisible( bool visible ) { if (mModal) { @@ -160,7 +160,7 @@ void LLModalDialog::setVisible( BOOL visible ) // The dialog view is a root view LLUI::getInstance()->addPopup(this); - setFocus( TRUE ); + setFocus( true ); } else { @@ -171,7 +171,7 @@ void LLModalDialog::setVisible( BOOL visible ) LLFloater::setVisible( visible ); } -BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) { LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); if (popup_menu != NULL) @@ -199,10 +199,10 @@ BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) } - return TRUE; + return true; } -BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleHover(S32 x, S32 y, MASK mask) { if( childrenHandleHover(x, y, mask) == NULL ) { @@ -225,60 +225,60 @@ BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLModalDialog::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleMouseUp(S32 x, S32 y, MASK mask) { childrenHandleMouseUp(x, y, mask); - return TRUE; + return true; } -BOOL LLModalDialog::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLModalDialog::handleScrollWheel(S32 x, S32 y, S32 clicks) { childrenHandleScrollWheel(x, y, clicks); - return TRUE; + return true; } -BOOL LLModalDialog::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleDoubleClick(S32 x, S32 y, MASK mask) { if (!LLFloater::handleDoubleClick(x, y, mask)) { // Click outside the panel make_ui_sound("UISndInvalidOp"); } - return TRUE; + return true; } -BOOL LLModalDialog::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLModalDialog::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLMenuGL::sMenuContainer->hideMenus(); childrenHandleRightMouseDown(x, y, mask); - return TRUE; + return true; } -BOOL LLModalDialog::handleKeyHere(KEY key, MASK mask ) +bool LLModalDialog::handleKeyHere(KEY key, MASK mask ) { LLFloater::handleKeyHere(key, mask ); if (mModal) { // Suck up all keystokes except CTRL-Q. - BOOL is_quit = ('Q' == key) && (MASK_CONTROL == mask); + bool is_quit = ('Q' == key) && (MASK_CONTROL == mask); return !is_quit; } else { // don't process escape key until message box has been on screen a minimal amount of time // to avoid accidentally destroying the message box when user is hitting escape at the time it appears - BOOL enough_time_elapsed = mVisibleTime.getElapsedTimeF32() > 1.0f; + bool enough_time_elapsed = mVisibleTime.getElapsedTimeF32() > 1.0f; if (enough_time_elapsed && key == KEY_ESCAPE) { closeFloater(); - return TRUE; + return true; } - return FALSE; + return false; } } @@ -313,7 +313,7 @@ void LLModalDialog::onAppFocusLost() gFocusMgr.setMouseCapture( NULL ); } - instance->setFocus(FALSE); + instance->setFocus(false); } } @@ -326,7 +326,7 @@ void LLModalDialog::onAppFocusGained() // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( instance ); - instance->setFocus(TRUE); + instance->setFocus(true); LLUI::getInstance()->addPopup(instance); instance->centerOnScreen(); diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index bf729c61bf..177664dde4 100644 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h @@ -39,34 +39,34 @@ class LLModalDialog; class LLModalDialog : public LLFloater { public: - LLModalDialog( const LLSD& key, BOOL modal = true ); + LLModalDialog( const LLSD& key, bool modal = true ); virtual ~LLModalDialog(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void openFloater(const LLSD& key = LLSD()); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask ); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); /*virtual*/ void draw(); - BOOL isModal() const { return mModal; } + bool isModal() const { return mModal; } void stopModal(); static void onAppFocusLost(); static void onAppFocusGained(); - static S32 activeCount() { return sModalStack.size(); } + static S32 activeCount() { return static_cast<S32>(sModalStack.size()); } static void shutdownModals(); protected: @@ -75,7 +75,7 @@ protected: private: LLFrameTimer mVisibleTime; - const BOOL mModal; + const bool mModal; static std::list<LLModalDialog*> sModalStack; // Top of stack is currently being displayed }; diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 17f24a0f87..a7f9b8b2d9 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -40,7 +40,7 @@ LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params) : LLFloater(key), mTabContainer(NULL), mTabPos(LLTabContainer::TOP), - mAutoResize(TRUE), + mAutoResize(true), mOrigMinWidth(params.min_width), mOrigMinHeight(params.min_height) { @@ -71,7 +71,7 @@ void LLMultiFloater::onClose(bool app_quitting) { if(isMinimized()) { - setMinimized(FALSE); + setMinimized(false); } LLFloater::onClose(app_quitting); } @@ -89,7 +89,7 @@ void LLMultiFloater::draw() } } -BOOL LLMultiFloater::closeAllFloaters() +bool LLMultiFloater::closeAllFloaters() { S32 tabToClose = 0; S32 lastTabCount = mTabContainer->getTabCount(); @@ -110,8 +110,8 @@ BOOL LLMultiFloater::closeAllFloaters() } } if( mTabContainer->getTabCount() != 0 ) - return FALSE; // Couldn't close all the tabs (pending save dialog?) so return FALSE. - return TRUE; //else all tabs were successfully closed... + return false; // Couldn't close all the tabs (pending save dialog?) so return false. + return true; //else all tabs were successfully closed... } void LLMultiFloater::growToFit(S32 content_width, S32 content_height) @@ -139,7 +139,7 @@ void LLMultiFloater::growToFit(S32 content_width, S32 content_height) } /** - void addFloater(LLFloater* floaterp, BOOL select_added_floater) + void addFloater(LLFloater* floaterp, bool select_added_floater) Adds the LLFloater pointed to by floaterp to this. If floaterp is already hosted by this, then it is re-added to get @@ -149,7 +149,7 @@ void LLMultiFloater::growToFit(S32 content_width, S32 content_height) Affects: mTabContainer, floaterp **/ -void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point) +void LLMultiFloater::addFloater(LLFloater* floaterp, bool select_added_floater, LLTabContainer::eInsertionPoint insertion_point) { if (!floaterp) { @@ -190,13 +190,13 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, floater_data.mSaveRect = floaterp->mSaveRect; // remove minimize and close buttons - floaterp->setCanMinimize(FALSE); - floaterp->setCanResize(FALSE); - floaterp->setCanDrag(FALSE); - floaterp->mSaveRect = FALSE; + floaterp->setCanMinimize(false); + floaterp->setCanResize(false); + floaterp->setCanDrag(false); + floaterp->mSaveRect = false; floaterp->storeRectControl(); // avoid double rendering of floater background (makes it more opaque) - floaterp->setBackgroundVisible(FALSE); + floaterp->setBackgroundVisible(false); if (mAutoResize) { @@ -226,7 +226,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, floaterp->setHost(this); if (isMinimized()) { - floaterp->setVisible(FALSE); + floaterp->setVisible(false); } // Tabs sometimes overlap resize handle @@ -244,14 +244,14 @@ void LLMultiFloater::updateFloaterTitle(LLFloater* floaterp) /** - BOOL selectFloater(LLFloater* floaterp) + bool selectFloater(LLFloater* floaterp) If the LLFloater pointed to by floaterp is hosted by this, then its tab is selected and returns true. Otherwise returns false. Affects: mTabContainer **/ -BOOL LLMultiFloater::selectFloater(LLFloater* floaterp) +bool LLMultiFloater::selectFloater(LLFloater* floaterp) { return mTabContainer->selectTabPanel(floaterp); } @@ -278,7 +278,7 @@ void LLMultiFloater::showFloater(LLFloater* floaterp, LLTabContainer::eInsertion if (floaterp != mTabContainer->getCurrentPanel() && !mTabContainer->selectTabPanel(floaterp)) { - addFloater(floaterp, TRUE, insertion_point); + addFloater(floaterp, true, insertion_point); } } @@ -302,8 +302,8 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) mFloaterDataMap.erase(found_data_it); } mTabContainer->removeTabPanel(floaterp); - floaterp->setBackgroundVisible(TRUE); - floaterp->setCanDrag(TRUE); + floaterp->setBackgroundVisible(true); + floaterp->setCanDrag(true); floaterp->setHost(NULL); floaterp->applyRectControl(); @@ -326,7 +326,7 @@ void LLMultiFloater::tabClose() } } -void LLMultiFloater::setVisible(BOOL visible) +void LLMultiFloater::setVisible(bool visible) { // *FIX: shouldn't have to do this, fix adding to minimized multifloater LLFloater::setVisible(visible); @@ -349,7 +349,7 @@ void LLMultiFloater::setVisible(BOOL visible) } } -BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) +bool LLMultiFloater::handleKeyHere(KEY key, MASK mask) { if (key == 'W' && mask == MASK_CONTROL) { @@ -363,10 +363,10 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask) // bring back focus on tab container if there are any tab left if(mTabContainer->getTabCount() > 0) { - mTabContainer->setFocus(TRUE); + mTabContainer->setFocus(true); } } - return TRUE; + return true; } return LLFloater::handleKeyHere(key, mask); @@ -396,7 +396,7 @@ S32 LLMultiFloater::getFloaterCount() } /** - BOOL isFloaterFlashing(LLFloater* floaterp) + bool isFloaterFlashing(LLFloater* floaterp) Returns true if the LLFloater pointed to by floaterp is currently in a flashing state and is hosted by this. @@ -404,24 +404,24 @@ S32 LLMultiFloater::getFloaterCount() Requires: floaterp != NULL **/ -BOOL LLMultiFloater::isFloaterFlashing(LLFloater* floaterp) +bool LLMultiFloater::isFloaterFlashing(LLFloater* floaterp) { if ( floaterp && floaterp->getHost() == this ) return mTabContainer->getTabPanelFlashing(floaterp); - return FALSE; + return false; } /** - BOOL setFloaterFlashing(LLFloater* floaterp, BOOL flashing) + bool setFloaterFlashing(LLFloater* floaterp, bool flashing) Sets the current flashing state of the LLFloater pointed - to by floaterp to be the BOOL flashing if the LLFloater pointed + to by floaterp to be the bool flashing if the LLFloater pointed to by floaterp is hosted by this. Requires: floaterp != NULL **/ -void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, BOOL flashing) +void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, bool flashing) { if ( floaterp && floaterp->getHost() == this ) mTabContainer->setTabPanelFlashing(floaterp, flashing); @@ -436,7 +436,7 @@ void LLMultiFloater::onTabSelected() } } -void LLMultiFloater::setCanResize(BOOL can_resize) +void LLMultiFloater::setCanResize(bool can_resize) { LLFloater::setCanResize(can_resize); if (!mTabContainer) return; @@ -450,7 +450,7 @@ void LLMultiFloater::setCanResize(BOOL can_resize) } } -BOOL LLMultiFloater::postBuild() +bool LLMultiFloater::postBuild() { mCloseSignal.connect(boost::bind(&LLMultiFloater::closeAllFloaters, this)); @@ -459,13 +459,13 @@ BOOL LLMultiFloater::postBuild() if (mTabContainer) { - return TRUE; + return true; } mTabContainer = getChild<LLTabContainer>("Preview Tabs"); setCanResize(mResizable); - return TRUE; + return true; } void LLMultiFloater::updateResizeLimits() @@ -498,7 +498,7 @@ void LLMultiFloater::updateResizeLimits() // make sure this window is visible on screen when it has been modified // (tab added, etc) - gFloaterView->adjustToFitScreen(this, TRUE); + gFloaterView->adjustToFitScreen(this, true); } } diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index f2d83f4449..eb0f917695 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -43,16 +43,16 @@ public: void buildTabContainer(); - virtual BOOL postBuild(); + virtual bool postBuild(); /*virtual*/ void onClose(bool app_quitting); virtual void draw(); - virtual void setVisible(BOOL visible); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + virtual void setVisible(bool visible); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); - virtual void setCanResize(BOOL can_resize); + virtual void setCanResize(bool can_resize); virtual void growToFit(S32 content_width, S32 content_height); - virtual void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); + virtual void addFloater(LLFloater* floaterp, bool select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); virtual void showFloater(LLFloater* floaterp, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); virtual void removeFloater(LLFloater* floaterp); @@ -60,16 +60,16 @@ public: virtual void tabOpen(LLFloater* opened_floater, bool from_click); virtual void tabClose(); - virtual BOOL selectFloater(LLFloater* floaterp); + virtual bool selectFloater(LLFloater* floaterp); virtual void selectNextFloater(); virtual void selectPrevFloater(); virtual LLFloater* getActiveFloater(); - virtual BOOL isFloaterFlashing(LLFloater* floaterp); + virtual bool isFloaterFlashing(LLFloater* floaterp); virtual S32 getFloaterCount(); - virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing); - virtual BOOL closeAllFloaters(); //Returns FALSE if the floater could not be closed due to pending confirmation dialogs + virtual void setFloaterFlashing(LLFloater* floaterp, bool flashing); + virtual bool closeAllFloaters(); //Returns false if the floater could not be closed due to pending confirmation dialogs void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } void onTabSelected(); @@ -81,9 +81,9 @@ protected: { S32 mWidth; S32 mHeight; - BOOL mCanMinimize; - BOOL mCanResize; - BOOL mSaveRect; + bool mCanMinimize; + bool mCanResize; + bool mSaveRect; }; LLTabContainer* mTabContainer; @@ -92,7 +92,7 @@ protected: floater_data_map_t mFloaterDataMap; LLTabContainer::TabPosition mTabPos; - BOOL mAutoResize; + bool mAutoResize; S32 mOrigMinWidth, mOrigMinHeight; // logically const but initialized late private: diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 26882ba8ec..cfbf491610 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -161,7 +161,7 @@ F32 LLMultiSlider::getNearestIncrement(F32 value) const return mMinValue + value; } -void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) +void LLMultiSlider::setSliderValue(const std::string& name, F32 value, bool from_event) { // exit if not there if(!mValue.has(name)) { @@ -263,7 +263,7 @@ void LLMultiSlider::setValue(const LLSD& value) mCurSlider = mIt->first; for(; mIt != value.endMap(); mIt++) { - setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE); + setSliderValue(mIt->first, (F32)mIt->second.asReal(), true); } } } @@ -378,7 +378,7 @@ const std::string& LLMultiSlider::addSlider(F32 val) mCurSlider = newName.str(); // move the slider - setSliderValue(mCurSlider, initVal, TRUE); + setSliderValue(mCurSlider, initVal, true); return mCurSlider; } @@ -411,7 +411,7 @@ bool LLMultiSlider::addSlider(F32 val, const std::string& name) mCurSlider = name; // move the slider - setSliderValue(mCurSlider, initVal, TRUE); + setSliderValue(mCurSlider, initVal, true); return true; } @@ -498,7 +498,7 @@ void LLMultiSlider::clear() LLF32UICtrl::clear(); } -BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) +bool LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if( gFocusMgr.getMouseCapture() == this ) { @@ -531,12 +531,12 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } - return TRUE; + return true; } -BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( gFocusMgr.getMouseCapture() == this ) { @@ -545,23 +545,23 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) if (mMouseUpSignal) (*mMouseUpSignal)( this, LLSD() ); - handled = TRUE; + handled = true; make_ui_sound("UISndClickRelease"); } else { - handled = TRUE; + handled = true; } return handled; } -BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) { // only do sticky-focus on non-chrome widgets if (!getIsChrome()) { - setFocus(TRUE); + setFocus(true); } if (mMouseDownSignal) (*mMouseDownSignal)( this, LLSD() ); @@ -611,28 +611,28 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLMultiSlider::handleKeyHere(KEY key, MASK mask) +bool LLMultiSlider::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch(key) { case KEY_UP: case KEY_DOWN: // eat up and down keys to be consistent - handled = TRUE; + handled = true; break; case KEY_LEFT: setCurSliderValue(getCurSliderValue() - getIncrement()); onCommit(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: setCurSliderValue(getCurSliderValue() + getIncrement()); onCommit(); - handled = TRUE; + handled = true; break; default: break; @@ -700,7 +700,7 @@ void LLMultiSlider::draw() mIt->second.mTop + extra_triangle_height, mIt->second.mLeft + mIt->second.getWidth() / 2, mIt->second.mBottom - extra_triangle_height, - mTriangleColor.get() % opacity, TRUE); + mTriangleColor.get() % opacity, true); } } else if (!mRoundedSquareImgp && !mThumbImagep) @@ -725,23 +725,23 @@ void LLMultiSlider::draw() } // the draw command - gl_rect_2d(mIt->second, curThumbColor, TRUE); + gl_rect_2d(mIt->second, curThumbColor, true); } // now draw the current and hover sliders if(curSldrIt != mThumbRects.end()) { - gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor.get(), TRUE); + gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor.get(), true); } // and draw the drag start if (gFocusMgr.getMouseCapture() == this) { - gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, FALSE); + gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, false); } else if (hoverSldrIt != mThumbRects.end()) { - gl_rect_2d(hoverSldrIt->second, mThumbCenterSelectedColor.get(), TRUE); + gl_rect_2d(hoverSldrIt->second, mThumbCenterSelectedColor.get(), true); } } else diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 963c6e5fab..b2bfc8bc84 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -81,7 +81,7 @@ public: // Multi-slider rounds values to nearest increments (bias towards rounding down) F32 getNearestIncrement(F32 value) const; - void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); + void setSliderValue(const std::string& name, F32 value, bool from_event = false); F32 getSliderValue(const std::string& name) const; F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; LLRect getSliderThumbRect(const std::string& name) const; @@ -94,7 +94,7 @@ public: F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } void setCurSlider(const std::string& name); void resetCurSlider(); - void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); } + void setCurSliderValue(F32 val, bool from_event = false) { setSliderValue(mCurSlider, val, from_event); } /*virtual*/ void setValue(const LLSD& value) override; /*virtual*/ LLSD getValue() const override { return mValue; } @@ -110,15 +110,15 @@ public: void deleteCurSlider() { deleteSlider(mCurSlider); } /*virtual*/ void clear() override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleKeyHere(KEY key, MASK mask) override; /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; /*virtual*/ void draw() override; S32 getMaxNumSliders() { return mMaxNumSliders; } - S32 getCurNumSliders() { return mValue.size(); } + S32 getCurNumSliders() { return static_cast<S32>(mValue.size()); } F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } @@ -130,11 +130,11 @@ protected: static S32 mNameCounter; S32 mMaxNumSliders; - BOOL mAllowOverlap; - BOOL mLoopOverlap; + bool mAllowOverlap; + bool mLoopOverlap; F32 mOverlapThreshold; - BOOL mDrawTrack; - BOOL mUseTriangle; /// hacked in toggle to use a triangle + bool mDrawTrack; + bool mUseTriangle; /// hacked in toggle to use a triangle S32 mMouseOffset; LLRect mDragStartThumbRect; diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index b0598b4388..01e2fc6ac9 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -144,7 +144,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) mEditor->setFocusReceivedCallback( boost::bind(LLMultiSliderCtrl::onEditorGainFocus, _1, this) ); // don't do this, as selecting the entire text is single clicking in some cases // and double clicking in others - //mEditor->setSelectAllonFocusReceived(TRUE); + //mEditor->setSelectAllonFocusReceived(true); addChild(mEditor); } else @@ -219,7 +219,7 @@ void LLMultiSliderCtrl::setValue(const LLSD& value) updateText(); } -void LLMultiSliderCtrl::setSliderValue(const std::string& name, F32 v, BOOL from_event) +void LLMultiSliderCtrl::setSliderValue(const std::string& name, F32 v, bool from_event) { mMultiSlider->setSliderValue(name, v, from_event ); mCurValue = mMultiSlider->getCurSliderValue(); @@ -237,9 +237,9 @@ void LLMultiSliderCtrl::resetCurSlider() mMultiSlider->resetCurSlider(); } -BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - BOOL res = FALSE; + bool res = false; if (mLabelBox) { res = mLabelBox->setTextArg(key, text); @@ -329,7 +329,7 @@ void LLMultiSliderCtrl::clear() } -BOOL LLMultiSliderCtrl::isMouseHeldDown() +bool LLMultiSliderCtrl::isMouseHeldDown() { return gFocusMgr.getMouseCapture() == mMultiSlider; } @@ -368,7 +368,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) if (!self) // cast failed - wrong type! :O return; - BOOL success = FALSE; + bool success = false; F32 val = self->mCurValue; F32 saved_val = self->mCurValue; @@ -382,7 +382,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { - success = TRUE; + success = true; } } } @@ -409,14 +409,14 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata) if (!self) return; - BOOL success = FALSE; + bool success = false; F32 saved_val = self->mCurValue; F32 new_val = self->mMultiSlider->getCurSliderValue(); self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { - success = TRUE; + success = true; } if( success ) @@ -434,7 +434,7 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata) self->updateText(); } -void LLMultiSliderCtrl::setEnabled(BOOL b) +void LLMultiSliderCtrl::setEnabled(bool b) { LLF32UICtrl::setEnabled( b ); @@ -457,7 +457,7 @@ void LLMultiSliderCtrl::setEnabled(BOOL b) } -void LLMultiSliderCtrl::setTentative(BOOL b) +void LLMultiSliderCtrl::setTentative(bool b) { if( mEditor ) { @@ -469,11 +469,11 @@ void LLMultiSliderCtrl::setTentative(BOOL b) void LLMultiSliderCtrl::onCommit() { - setTentative(FALSE); + setTentative(false); if( mEditor ) { - mEditor->setTentative(FALSE); + mEditor->setTentative(false); } setControlValue(getValueF32()); diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index e3b190a938..fee05c92fd 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -83,24 +83,24 @@ public: virtual ~LLMultiSliderCtrl(); F32 getSliderValue(const std::string& name) const { return mMultiSlider->getSliderValue(name); } - void setSliderValue(const std::string& name, F32 v, BOOL from_event = FALSE); + void setSliderValue(const std::string& name, F32 v, bool from_event = false); virtual void setValue(const LLSD& value ); virtual LLSD getValue() const { return mMultiSlider->getValue(); } - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); const std::string& getCurSlider() const { return mMultiSlider->getCurSlider(); } F32 getCurSliderValue() const { return mCurValue; } void setCurSlider(const std::string& name); void resetCurSlider(); - void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); } + void setCurSliderValue(F32 val, bool from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); } virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } virtual void setMaxValue(const LLSD& max_value) { setMaxValue((F32)max_value.asReal()); } - BOOL isMouseHeldDown(); + bool isMouseHeldDown(); - virtual void setEnabled( BOOL b ); + virtual void setEnabled( bool b ); virtual void clear(); virtual void setPrecision(S32 precision); void setMinValue(F32 min_value) {mMultiSlider->setMinValue(min_value);} @@ -138,7 +138,7 @@ public: virtual void onTabInto(); - virtual void setTentative(BOOL b); // marks value as tentative + virtual void setTentative(bool b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit virtual void setControlName(const std::string& control_name, LLView* context); @@ -155,8 +155,8 @@ private: private: const LLFontGL* mFont; - BOOL mShowText; - BOOL mCanEditText; + bool mShowText; + bool mCanEditText; S32 mPrecision; LLTextBox* mLabelBox; diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 2fbae73b65..bee7d5bb3f 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -216,10 +216,10 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica ui_inst->mSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name)); } - BOOL show_notification = TRUE; + bool show_notification = true; if (p.ignore.control.isProvided()) { - mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control); + mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control()); mInvertSetting = p.ignore.invert_control; } else if (mIgnore > IGNORE_NO) @@ -1187,7 +1187,7 @@ bool LLNotificationChannel::isEmpty() const S32 LLNotificationChannel::size() const { - return mItems.size(); + return static_cast<S32>(mItems.size()); } size_t LLNotificationChannel::size() @@ -1560,7 +1560,7 @@ bool LLNotifications::loadTemplates() std::string base_filename = search_paths.front(); LLXMLNodePtr root; - BOOL success = LLXMLNode::getLayeredXMLNode(root, search_paths); + bool success = LLXMLNode::getLayeredXMLNode(root, search_paths); if (!success || root.isNull() || !root->hasName( "notifications" )) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index ab4f009a80..d3615b6601 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -249,7 +249,7 @@ public: void fromLLSD(const LLSD& sd); LLSD asLLSD() const; - S32 getNumElements() { return mFormData.size(); } + S32 getNumElements() { return static_cast<S32>(mFormData.size()); } LLSD getElement(S32 index) { return mFormData.get(index); } LLSD getElement(const std::string& element_name); void getElements(LLSD& elements, S32 offset = 0); @@ -444,11 +444,11 @@ public: // return response LLSD filled in with default form contents and (optionally) the default button selected LLSD getResponseTemplate(EResponseTemplateType type = WITHOUT_DEFAULT_BUTTON); - // returns index of first button with value==TRUE + // returns index of first button with value==true // usually this the button the user clicked on // returns -1 if no button clicked (e.g. form has not been displayed) static S32 getSelectedOption(const LLSD& notification, const LLSD& response); - // returns name of first button with value==TRUE + // returns name of first button with value==true static std::string getSelectedOptionName(const LLSD& notification); // after someone responds to a notification (usually by clicking a button, diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index d580566b13..468cdb10fb 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -55,7 +55,7 @@ LLPanel::factory_stack_t LLPanel::sFactoryStack; // Compiler optimization, generate extern template template class LLPanel* LLView::getChild<class LLPanel>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLPanel::LocalizedString::LocalizedString() : name("name"), @@ -127,9 +127,9 @@ LLPanel::~LLPanel() } // virtual -BOOL LLPanel::isPanel() const +bool LLPanel::isPanel() const { - return TRUE; + return true; } void LLPanel::addBorder(LLViewBorder::Params p) @@ -167,13 +167,13 @@ void LLPanel::clearCtrls() for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) { LLUICtrl* ctrl = *ctrl_it; - ctrl->setFocus( FALSE ); - ctrl->setEnabled( FALSE ); + ctrl->setFocus( false ); + ctrl->setEnabled( false ); ctrl->clear(); } } -void LLPanel::setCtrlsEnabled( BOOL b ) +void LLPanel::setCtrlsEnabled( bool b ) { LLPanel::ctrl_list_t ctrls = getCtrlList(); for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) @@ -247,13 +247,13 @@ void LLPanel::updateDefaultBtn() if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) { LLButton* buttonp = dynamic_cast<LLButton*>(gFocusMgr.getKeyboardFocus()); - BOOL focus_is_child_button = buttonp && buttonp->getCommitOnReturn(); + bool focus_is_child_button = buttonp && buttonp->getCommitOnReturn(); // only enable default button when current focus is not a return-capturing button mDefaultBtn->setBorderEnabled(!focus_is_child_button); } else { - mDefaultBtn->setBorderEnabled(FALSE); + mDefaultBtn->setBorderEnabled(false); } } } @@ -261,19 +261,19 @@ void LLPanel::updateDefaultBtn() void LLPanel::refresh() { // do nothing by default - // but is automatically called in setFocus(TRUE) + // but is automatically called in setFocus(true) } void LLPanel::setDefaultBtn(LLButton* btn) { if (mDefaultBtn && mDefaultBtn->getEnabled()) { - mDefaultBtn->setBorderEnabled(FALSE); + mDefaultBtn->setBorderEnabled(false); } mDefaultBtn = btn; if (mDefaultBtn) { - mDefaultBtn->setBorderEnabled(TRUE); + mDefaultBtn->setBorderEnabled(true); } } @@ -290,17 +290,17 @@ void LLPanel::setDefaultBtn(const std::string& id) } } -BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) +bool LLPanel::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus()); // handle user hitting ESC to defocus if (key == KEY_ESCAPE) { - setFocus(FALSE); - return TRUE; + setFocus(false); + return true; } else if( (mask == MASK_SHIFT) && (KEY_TAB == key)) { @@ -310,7 +310,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); if (focus_root) { - handled = focus_root->focusPrevItem(FALSE); + handled = focus_root->focusPrevItem(false); } } } @@ -322,7 +322,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot(); if (focus_root) { - handled = focus_root->focusNextItem(FALSE); + handled = focus_root->focusNextItem(false); } } } @@ -335,38 +335,38 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) { // current focus is a return-capturing button, // let *that* button handle the return key - handled = FALSE; + handled = false; } else if (mDefaultBtn && mDefaultBtn->getVisible() && mDefaultBtn->getEnabled()) { // If we have a default button, click it when return is pressed mDefaultBtn->onCommit(); - handled = TRUE; + handled = true; } else if (cur_focus->acceptsTextInput()) { // call onCommit for text input handling control cur_focus->onCommit(); - handled = TRUE; + handled = true; } } return handled; } -void LLPanel::onVisibilityChange ( BOOL new_visibility ) +void LLPanel::onVisibilityChange ( bool new_visibility ) { LLUICtrl::onVisibilityChange ( new_visibility ); if (mVisibleSignal) - (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD + (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass bool as LLSD } -void LLPanel::setFocus(BOOL b) +void LLPanel::setFocus(bool b) { if( b && !hasFocus()) { // give ourselves focus preemptively, to avoid infinite loop - LLUICtrl::setFocus(TRUE); + LLUICtrl::setFocus(true); // then try to pass to first valid child focusFirstItem(); } @@ -376,7 +376,7 @@ void LLPanel::setFocus(BOOL b) } } -void LLPanel::setBorderVisible(BOOL b) +void LLPanel::setBorderVisible(bool b) { if (mBorder) { @@ -504,7 +504,7 @@ static LLTrace::BlockTimerStatHandle FTM_PANEL_SETUP("Panel Setup"); static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference"); static LLTrace::BlockTimerStatHandle FTM_PANEL_POSTBUILD("Panel PostBuild"); -BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) +bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) { Params params(default_params); { @@ -533,7 +533,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); - return TRUE; + return true; } LLUICtrlFactory::instance().pushFileName(xml_filename); @@ -543,7 +543,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu { LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; - return FALSE; + return false; } parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName()); @@ -590,7 +590,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu postBuild(); } } - return TRUE; + return true; } bool LLPanel::hasString(const std::string& name) @@ -658,7 +658,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled) } } -void LLPanel::childSetFocus(const std::string& id, BOOL focus) +void LLPanel::childSetFocus(const std::string& id, bool focus) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) @@ -667,7 +667,7 @@ void LLPanel::childSetFocus(const std::string& id, BOOL focus) } } -BOOL LLPanel::childHasFocus(const std::string& id) +bool LLPanel::childHasFocus(const std::string& id) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) @@ -676,7 +676,7 @@ BOOL LLPanel::childHasFocus(const std::string& id) } else { - return FALSE; + return false; } } @@ -752,24 +752,24 @@ LLSD LLPanel::childGetValue(const std::string& id) const return LLSD(); } -BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text) +bool LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) { return child->setTextArg(key, text); } - return FALSE; + return false; } -BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text) +bool LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { LLView* child = findChild<LLView>(id); if (child) { return child->setLabelArg(key, text); } - return FALSE; + return false; } void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function) @@ -803,10 +803,10 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: //----------------------------------------------------------------------------- // buildPanel() //----------------------------------------------------------------------------- -BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) +bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) { LL_PROFILE_ZONE_SCOPED; - BOOL didPost = FALSE; + bool didPost = false; LLXMLNodePtr root; if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 365cac9fe6..2be5573faf 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -40,8 +40,8 @@ #include <queue> const S32 LLPANEL_BORDER_WIDTH = 1; -const BOOL BORDER_YES = TRUE; -const BOOL BORDER_NO = FALSE; +const bool BORDER_YES = true; +const bool BORDER_NO = false; class LLButton; class LLUIImage; @@ -107,20 +107,20 @@ protected: public: typedef std::vector<class LLUICtrl *> ctrl_list_t; - BOOL buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); + bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); static LLPanel* createFactoryPanel(const std::string& name); /*virtual*/ ~LLPanel(); // LLView interface - /*virtual*/ BOOL isPanel() const; + /*virtual*/ bool isPanel() const; /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ bool handleKeyHere( KEY key, MASK mask ); + /*virtual*/ void onVisibilityChange ( bool new_visibility ); // From LLFocusableElement - /*virtual*/ void setFocus( BOOL b ); + /*virtual*/ void setFocus( bool b ); // New virtuals virtual void refresh(); // called in setFocus() @@ -131,8 +131,8 @@ public: void addBorder( LLViewBorder::Params p); void addBorder(); void removeBorder(); - BOOL hasBorder() const { return mBorder != NULL; } - void setBorderVisible( BOOL b ); + bool hasBorder() const { return mBorder != NULL; } + void setBorderVisible( bool b ); void setBackgroundColor( const LLColor4& color ) { mBgOpaqueColor = color; } const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; } @@ -144,10 +144,10 @@ public: LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; } LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } LLColor4 getTransparentImageOverlay() { return mBgAlphaImageOverlay; } - void setBackgroundVisible( BOOL b ) { mBgVisible = b; } - BOOL isBackgroundVisible() const { return mBgVisible; } - void setBackgroundOpaque(BOOL b) { mBgOpaque = b; } - BOOL isBackgroundOpaque() const { return mBgOpaque; } + void setBackgroundVisible( bool b ) { mBgVisible = b; } + bool isBackgroundVisible() const { return mBgVisible; } + void setBackgroundOpaque(bool b) { mBgOpaque = b; } + bool isBackgroundOpaque() const { return mBgOpaque; } void setDefaultBtn(LLButton* btn = NULL); void setDefaultBtn(const std::string& id); void updateDefaultBtn(); @@ -156,7 +156,7 @@ public: void setHelpTopic(const std::string& help_topic) { mHelpTopic = help_topic; } std::string getHelpTopic() const { return mHelpTopic; } - void setCtrlsEnabled(BOOL b); + void setCtrlsEnabled(bool b); ctrl_list_t getCtrlList() const; LLHandle<LLPanel> getHandle() const { return getDerivedHandle<LLPanel>(); } @@ -167,7 +167,7 @@ public: EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; } void initFromParams(const Params& p); - BOOL initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params); + bool initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params); bool hasString(const std::string& name); std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const; @@ -184,8 +184,8 @@ public: void childDisable(const std::string& name) { childSetEnabled(name, false); }; // LLUICtrl - void childSetFocus(const std::string& id, BOOL focus = TRUE); - BOOL childHasFocus(const std::string& id); + void childSetFocus(const std::string& id, bool focus = true); + bool childHasFocus(const std::string& id); // *TODO: Deprecate; for backwards compatability only: // Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)), @@ -203,9 +203,9 @@ public: LLSD childGetValue(const std::string& id) const; // For setting text / label replacement params, e.g. "Hello [NAME]" - // Not implemented for all types, defaults to noop, returns FALSE if not applicaple - BOOL childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text); - BOOL childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text); + // Not implemented for all types, defaults to noop, returns false if not applicaple + bool childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text); + bool childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text); // LLButton void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value); @@ -238,8 +238,8 @@ protected: std::string mXMLFilename; private: - BOOL mBgVisible; // any background at all? - BOOL mBgOpaque; // use opaque color or image + bool mBgVisible; // any background at all? + bool mBgOpaque; // use opaque color or image LLUIColor mBgOpaqueColor; LLUIColor mBgAlphaColor; LLUIColor mBgOpaqueImageOverlay; @@ -259,7 +259,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLPANEL_CPP extern template class LLPanel* LLView::getChild<class LLPanel>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc; diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index ff53563a4c..2aff434612 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -53,8 +53,8 @@ public: /*virtual*/ ~LLRadioCtrl(); /*virtual*/ void setValue(const LLSD& value); - /*virtual*/ BOOL postBuild(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool postBuild(); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); LLSD getPayload() { return mPayload; } @@ -119,16 +119,16 @@ LLRadioGroup::~LLRadioGroup() } // virtual -BOOL LLRadioGroup::postBuild() +bool LLRadioGroup::postBuild() { if (!mRadioButtons.empty()) { mRadioButtons[0]->setTabStop(true); } - return TRUE; + return true; } -void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled) +void LLRadioGroup::setIndexEnabled(S32 index, bool enabled) { S32 count = 0; for (button_list_t::iterator iter = mRadioButtons.begin(); @@ -138,7 +138,7 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled) if (count == index) { child->setEnabled(enabled); - if (index == mSelectedIndex && enabled == FALSE) + if (index == mSelectedIndex && !enabled) { setSelectedIndex(-1); } @@ -173,30 +173,30 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled) } } -BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) +bool LLRadioGroup::setSelectedIndex(S32 index, bool from_event) { if ((S32)mRadioButtons.size() <= index ) { - return FALSE; + return false; } if (index < -1) { // less then minimum value - return FALSE; + return false; } if (index < 0 && mSelectedIndex >= 0 && !mAllowDeselect) { // -1 is "nothing selected" - return FALSE; + return false; } if (mSelectedIndex >= 0) { LLRadioCtrl* old_radio_item = mRadioButtons[mSelectedIndex]; old_radio_item->setTabStop(false); - old_radio_item->setValue( FALSE ); + old_radio_item->setValue( false ); } else { @@ -209,11 +209,11 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) { LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex]; radio_item->setTabStop(true); - radio_item->setValue( TRUE ); + radio_item->setValue( true ); if (hasFocus()) { - radio_item->focusFirstItem(FALSE, FALSE); + radio_item->focusFirstItem(false, false); } } @@ -222,7 +222,7 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) setControlValue(getValue()); } - return TRUE; + return true; } void LLRadioGroup::focusSelectedRadioBtn() @@ -232,18 +232,18 @@ void LLRadioGroup::focusSelectedRadioBtn() LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex]; if (radio_item->hasTabStop() && radio_item->getEnabled()) { - radio_item->focusFirstItem(FALSE, FALSE); + radio_item->focusFirstItem(false, false); } } else if (mRadioButtons[0]->hasTabStop() || hasTabStop()) { - focusFirstItem(FALSE, FALSE); + focusFirstItem(false, false); } } -BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) +bool LLRadioGroup::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // do any of the tab buttons have keyboard focus? if (mask == MASK_NONE) { @@ -258,7 +258,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; case KEY_UP: if (!setSelectedIndex((getSelectedIndex() - 1))) @@ -269,7 +269,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; case KEY_LEFT: if (!setSelectedIndex((getSelectedIndex() - 1))) @@ -280,7 +280,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; case KEY_RIGHT: if (!setSelectedIndex((getSelectedIndex() + 1))) @@ -291,7 +291,7 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { onCommit(); } - handled = TRUE; + handled = true; break; default: break; @@ -358,11 +358,11 @@ void LLRadioGroup::setValue( const LLSD& value ) // string not found, try integer if (value.isInteger()) { - setSelectedIndex((S32) value.asInteger(), TRUE); + setSelectedIndex((S32) value.asInteger(), true); } else { - setSelectedIndex(-1, TRUE); + setSelectedIndex(-1, true); } } } @@ -381,9 +381,9 @@ LLSD LLRadioGroup::getValue() const } // LLCtrlSelectionInterface functions -BOOL LLRadioGroup::setCurrentByID( const LLUUID& id ) +bool LLRadioGroup::setCurrentByID( const LLUUID& id ) { - return FALSE; + return false; } LLUUID LLRadioGroup::getCurrentID() const @@ -391,7 +391,7 @@ LLUUID LLRadioGroup::getCurrentID() const return LLUUID::null; } -BOOL LLRadioGroup::setSelectedByValue(const LLSD& value, BOOL selected) +bool LLRadioGroup::setSelectedByValue(const LLSD& value, bool selected) { S32 idx = 0; for (button_list_t::const_iterator iter = mRadioButtons.begin(); @@ -400,12 +400,12 @@ BOOL LLRadioGroup::setSelectedByValue(const LLSD& value, BOOL selected) if((*iter)->getPayload().asString() == value.asString()) { setSelectedIndex(idx); - return TRUE; + return true; } idx++; } - return FALSE; + return false; } LLSD LLRadioGroup::getSelectedValue() @@ -413,7 +413,7 @@ LLSD LLRadioGroup::getSelectedValue() return getValue(); } -BOOL LLRadioGroup::isSelected(const LLSD& value) const +bool LLRadioGroup::isSelected(const LLSD& value) const { S32 idx = 0; for (button_list_t::const_iterator iter = mRadioButtons.begin(); @@ -423,22 +423,22 @@ BOOL LLRadioGroup::isSelected(const LLSD& value) const { if (idx == mSelectedIndex) { - return TRUE; + return true; } } idx++; } - return FALSE; + return false; } -BOOL LLRadioGroup::operateOnSelection(EOperation op) +bool LLRadioGroup::operateOnSelection(EOperation op) { - return FALSE; + return false; } -BOOL LLRadioGroup::operateOnAll(EOperation op) +bool LLRadioGroup::operateOnAll(EOperation op) { - return FALSE; + return false; } LLRadioGroup::ItemParams::ItemParams() @@ -458,7 +458,7 @@ LLRadioCtrl::LLRadioCtrl(const LLRadioGroup::ItemParams& p) } } -BOOL LLRadioCtrl::postBuild() +bool LLRadioCtrl::postBuild() { // Old-style radio_item used the text contents to indicate the label, // but new-style radio_item uses label attribute. @@ -467,15 +467,15 @@ BOOL LLRadioCtrl::postBuild() { setLabel(value); } - return TRUE; + return true; } -BOOL LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { // Grab focus preemptively, before button takes mousecapture if (hasTabStop() && getEnabled()) { - focusFirstItem(FALSE, FALSE); + focusFirstItem(false, false); } else { diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index ca8883dce4..a24a7c86b2 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -64,15 +64,15 @@ public: virtual ~LLRadioGroup(); - virtual BOOL postBuild(); + virtual bool postBuild(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); - void setIndexEnabled(S32 index, BOOL enabled); + void setIndexEnabled(S32 index, bool enabled); // return the index value of the selected item S32 getSelectedIndex() const { return mSelectedIndex; } // set the index value programatically - BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE); + bool setSelectedIndex(S32 index, bool from_event = false); // foxus child by index if it can get focus void focusSelectedRadioBtn(); @@ -87,19 +87,19 @@ public: LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; }; // LLCtrlSelectionInterface functions - /*virtual*/ S32 getItemCount() const { return mRadioButtons.size(); } - /*virtual*/ BOOL getCanSelect() const { return TRUE; } - /*virtual*/ BOOL selectFirstItem() { return setSelectedIndex(0); } - /*virtual*/ BOOL selectNthItem( S32 index ) { return setSelectedIndex(index); } - /*virtual*/ BOOL selectItemRange( S32 first, S32 last ) { return setSelectedIndex(first); } + /*virtual*/ S32 getItemCount() const { return static_cast<S32>(mRadioButtons.size()); } + /*virtual*/ bool getCanSelect() const { return true; } + /*virtual*/ bool selectFirstItem() { return setSelectedIndex(0); } + /*virtual*/ bool selectNthItem( S32 index ) { return setSelectedIndex(index); } + /*virtual*/ bool selectItemRange( S32 first, S32 last ) { return setSelectedIndex(first); } /*virtual*/ S32 getFirstSelectedIndex() const { return getSelectedIndex(); } - /*virtual*/ BOOL setCurrentByID( const LLUUID& id ); + /*virtual*/ bool setCurrentByID( const LLUUID& id ); /*virtual*/ LLUUID getCurrentID() const; // LLUUID::null if no items in menu - /*virtual*/ BOOL setSelectedByValue(const LLSD& value, BOOL selected); + /*virtual*/ bool setSelectedByValue(const LLSD& value, bool selected); /*virtual*/ LLSD getSelectedValue(); - /*virtual*/ BOOL isSelected(const LLSD& value) const; - /*virtual*/ BOOL operateOnSelection(EOperation op); - /*virtual*/ BOOL operateOnAll(EOperation op); + /*virtual*/ bool isSelected(const LLSD& value) const; + /*virtual*/ bool operateOnSelection(EOperation op); + /*virtual*/ bool operateOnAll(EOperation op); private: const LLFontGL* mFont; diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index cec0734735..a022fd2853 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -89,9 +89,9 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) } } -BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) { - if (!canResize()) return FALSE; + if (!canResize()) return false; // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. @@ -101,31 +101,31 @@ BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) mLastMouseScreenX = mDragLastScreenX; mLastMouseScreenY = mDragLastScreenY; - return TRUE; + return true; } -BOOL LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { // Release the mouse gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else { - handled = TRUE; + handled = true; } return handled; } -BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -289,11 +289,11 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) } } - handled = TRUE; + handled = true; } else { - handled = TRUE; + handled = true; } if( handled && canResize() ) @@ -320,7 +320,7 @@ BOOL LLResizeBar::handleHover(S32 x, S32 y, MASK mask) return handled; } // end LLResizeBar::handleHover -BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) { LLRect orig_rect = mResizingView->getRect(); LLRect scaled_rect = orig_rect; @@ -350,7 +350,7 @@ BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) mResizingView->setShape(scaled_rect, true); } - return TRUE; + return true; } void LLResizeBar::setImagePanel(LLPanel * panelp) diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 0fcecd1dbe..4b0f435834 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -53,14 +53,14 @@ protected: public: - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; } - void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; } - void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; } + void setEnableSnapping(bool enable) { mSnappingEnabled = enable; } + void setAllowDoubleClickSnapping(bool allow) { mAllowDoubleClickSnapping = allow; } bool canResize() { return getEnabled() && mMaxSize > mMinSize; } void setResizeListener(boost::function<void(void*)> listener) {mResizeListener = listener;} void setImagePanel(LLPanel * panelp); diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 29ae13b7ff..0b7bb55360 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -76,12 +76,12 @@ LLResizeHandle::~LLResizeHandle() } -BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( pointInHandle(x, y) ) { - handled = TRUE; + handled = true; // Route future Mouse messages here preemptively. (Release on mouse up.) // No handler needed for focus lost since this clas has no state that depends on it. gFocusMgr.setMouseCapture( this ); @@ -95,28 +95,28 @@ BOOL LLResizeHandle::handleMouseDown(S32 x, S32 y, MASK mask) } -BOOL LLResizeHandle::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLResizeHandle::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { // Release the mouse gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else if( pointInHandle(x, y) ) { - handled = TRUE; + handled = true; } return handled; } -BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) +bool LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) @@ -327,13 +327,13 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) } } - handled = TRUE; + handled = true; } else // don't have mouse capture { if( pointInHandle( x, y ) ) { - handled = TRUE; + handled = true; } } @@ -366,7 +366,7 @@ void LLResizeHandle::draw() } -BOOL LLResizeHandle::pointInHandle( S32 x, S32 y ) +bool LLResizeHandle::pointInHandle( S32 x, S32 y ) { if( pointInView(x, y) ) { @@ -378,8 +378,8 @@ BOOL LLResizeHandle::pointInHandle( S32 x, S32 y ) case LEFT_TOP: return (x <= RESIZE_BORDER_WIDTH) || (y >= TOP_BORDER); case LEFT_BOTTOM: return (x <= RESIZE_BORDER_WIDTH) || (y <= RESIZE_BORDER_WIDTH); case RIGHT_TOP: return (x >= RIGHT_BORDER) || (y >= TOP_BORDER); - case RIGHT_BOTTOM: return TRUE; + case RIGHT_BOTTOM: return true; } } - return FALSE; + return false; } diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index d29894f607..9cc4123544 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -51,14 +51,14 @@ protected: friend class LLUICtrlFactory; public: virtual void draw(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } private: - BOOL pointInHandle( S32 x, S32 y ); + bool pointInHandle( S32 x, S32 y ); S32 mDragLastScreenX; S32 mDragLastScreenY; diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index a6a4a541f2..111c732548 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -51,14 +51,6 @@ char LLResMgr::getDecimalPoint() const { char decimal = localeconv()->decimal_point[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(decimal == 0) - { - decimal = '.'; - } -#endif - return decimal; } @@ -66,14 +58,6 @@ char LLResMgr::getThousandsSeparator() const { char separator = localeconv()->thousands_sep[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(separator == 0) - { - separator = ','; - } -#endif - return separator; } @@ -81,14 +65,6 @@ char LLResMgr::getMonetaryDecimalPoint() const { char decimal = localeconv()->mon_decimal_point[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(decimal == 0) - { - decimal = '.'; - } -#endif - return decimal; } @@ -96,14 +72,6 @@ char LLResMgr::getMonetaryThousandsSeparator() const { char separator = localeconv()->mon_thousands_sep[0]; -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - if(separator == 0) - { - separator = ','; - } -#endif - return separator; } @@ -116,29 +84,6 @@ std::string LLResMgr::getMonetaryString( S32 input ) const LLLocale locale(LLLocale::USER_LOCALE); struct lconv *conv = localeconv(); -#if LL_DARWIN - // On the Mac, locale support is broken before 10.4, which causes things to go all pear-shaped. - // Fake up a conv structure with some reasonable values for the fields this function uses. - struct lconv fakeconv; - char fake_neg[2] = "-"; - char fake_mon_group[4] = "\x03\x03\x00"; // commas every 3 digits - if(conv->negative_sign[0] == 0) // Real locales all seem to have something here... - { - fakeconv = *conv; // start with what's there. - switch(mLocale) - { - default: // Unknown -- use the US defaults. - case LLLOCALE_USA: - case LLLOCALE_UK: // UK ends up being the same as US for the items used here. - fakeconv.negative_sign = fake_neg; - fakeconv.mon_grouping = fake_mon_group; - fakeconv.n_sign_posn = 1; // negative sign before the string - break; - } - conv = &fakeconv; - } -#endif - char* negative_sign = conv->negative_sign; char separator = getMonetaryThousandsSeparator(); char* grouping = conv->mon_grouping; @@ -154,9 +99,9 @@ std::string LLResMgr::getMonetaryString( S32 input ) const // Note: we assume here that the currency symbol goes on the left. (Hey, it's Lindens! We can just decide.) - BOOL negative = (input < 0 ); - BOOL negative_before = negative && (conv->n_sign_posn != 2); - BOOL negative_after = negative && (conv->n_sign_posn == 2); + bool negative = (input < 0 ); + bool negative_before = negative && (conv->n_sign_posn != 2); + bool negative_after = negative && (conv->n_sign_posn == 2); std::string digits = llformat("%u", abs(input)); if( !grouping || !grouping[0] ) @@ -195,7 +140,7 @@ std::string LLResMgr::getMonetaryString( S32 input ) const S32 output_pos = 0; cur_group = 0; - S32 pos = digits.size()-1; + S32 pos = static_cast<S32>(digits.size()) - 1; S32 count_within_group = 0; while( (pos >= 0) && (groupings[cur_group] >= 0) ) { diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index fda4a750cd..9c73b1ba3f 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -73,7 +73,7 @@ LLScrollbar::LLScrollbar(const Params & p) mDocPos( p.doc_pos ), mPageSize( p.page_size ), mStepSize( p.step_size ), - mDocChanged(FALSE), + mDocChanged(false), mDragStartX( 0 ), mDragStartY( 0 ), mHoverGlowStrength(0.15f), @@ -136,19 +136,19 @@ void LLScrollbar::setDocParams( S32 size, S32 pos ) { mDocSize = size; setDocPos(pos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } // returns true if document position really changed -bool LLScrollbar::setDocPos(S32 pos, BOOL update_thumb) +bool LLScrollbar::setDocPos(S32 pos, bool update_thumb) { pos = llclamp(pos, 0, getDocPosMax()); if (pos != mDocPos) { mDocPos = pos; - mDocChanged = TRUE; + mDocChanged = true; if( mChangeCallback ) { @@ -170,7 +170,7 @@ void LLScrollbar::setDocSize(S32 size) { mDocSize = size; setDocPos(mDocPos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } @@ -182,7 +182,7 @@ void LLScrollbar::setPageSize( S32 page_size ) { mPageSize = page_size; setDocPos(mDocPos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } @@ -238,10 +238,10 @@ void LLScrollbar::updateThumbRect() } } -BOOL LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) { // Check children first - BOOL handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; if( !handled_by_child ) { if( mThumbRect.pointInRect(x,y) ) @@ -279,16 +279,16 @@ BOOL LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleHover(S32 x, S32 y, MASK mask) { // Note: we don't bother sending the event to the children (the arrow buttons) // because they'll capture the mouse whenever they need hover events. - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { S32 height = getRect().getHeight(); @@ -329,7 +329,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) S32 new_pos = llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ); // Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly // out of sync (less than a line's worth) to make the thumb feel responsive. - changeLine( new_pos - mDocPos, FALSE ); + changeLine( new_pos - mDocPos, false ); } } @@ -373,7 +373,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) // Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly // out of sync (less than a line's worth) to make the thumb feel responsive. - changeLine( new_pos - mDocPos, FALSE ); + changeLine( new_pos - mDocPos, false ); } } @@ -382,7 +382,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; - handled = TRUE; + handled = true; } else { @@ -394,31 +394,31 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } - mDocChanged = FALSE; + mDocChanged = false; return handled; } // end handleHover -BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = changeLine( clicks * mStepSize, TRUE ); + bool handled = changeLine( clicks * mStepSize, true ); return handled; } -BOOL LLScrollbar::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollbar::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; if (LLScrollbar::HORIZONTAL == mOrientation) { - handled = changeLine(clicks * mStepSize, TRUE); + handled = changeLine(clicks * mStepSize, true); } return handled; } -BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) { // enable this to get drag and drop to control scrollbars @@ -434,19 +434,19 @@ BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // : F32(pos - SCROLLBAR_SIZE) / usable_track_length; // S32 new_pos = (VERTICAL == mOrientation) ? llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ) // : llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines ); - // changeLine( new_pos - mDocPos, TRUE ); + // changeLine( new_pos - mDocPos, true ); //} - //return TRUE; - return FALSE; + //return true; + return false; } -BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else { @@ -457,14 +457,14 @@ BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLScrollbar::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); } -void LLScrollbar::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent) { if (width == getRect().getWidth() && height == getRect().getHeight()) return; LLView::reshape( width, height, called_from_parent ); @@ -495,14 +495,14 @@ void LLScrollbar::draw() if(mBGVisible) { - gl_rect_2d(getLocalRect(), mBGColor.get(), TRUE); + gl_rect_2d(getLocalRect(), mBGColor.get(), true); } S32 local_mouse_x; S32 local_mouse_y; LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); - BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; - BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); + bool other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; + bool hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) { mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f)); @@ -519,9 +519,9 @@ void LLScrollbar::draw() gl_rect_2d(mOrientation == HORIZONTAL ? mThickness : 0, mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(), mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * mThickness : getRect().getWidth(), - mOrientation == VERTICAL ? mThickness : 0, mTrackColor.get(), TRUE); + mOrientation == VERTICAL ? mThickness : 0, mTrackColor.get(), true); - gl_rect_2d(mThumbRect, mThumbColor.get(), TRUE); + gl_rect_2d(mThumbRect, mThumbColor.get(), true); } else @@ -580,7 +580,7 @@ void LLScrollbar::draw() } // end draw -bool LLScrollbar::changeLine( S32 delta, BOOL update_thumb ) +bool LLScrollbar::changeLine( S32 delta, bool update_thumb ) { return setDocPos(mDocPos + delta, update_thumb); } @@ -591,35 +591,35 @@ void LLScrollbar::setValue(const LLSD& value) } -BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask) +bool LLScrollbar::handleKeyHere(KEY key, MASK mask) { if (getDocPosMax() == 0 && !getVisible()) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; switch( key ) { case KEY_HOME: setDocPos( 0 ); - handled = TRUE; + handled = true; break; case KEY_END: setDocPos( getDocPosMax() ); - handled = TRUE; + handled = true; break; case KEY_DOWN: setDocPos( getDocPos() + mStepSize ); - handled = TRUE; + handled = true; break; case KEY_UP: setDocPos( getDocPos() - mStepSize ); - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -638,7 +638,7 @@ void LLScrollbar::pageUp(S32 overlap) { if (mDocSize > mPageSize) { - changeLine( -(mPageSize - overlap), TRUE ); + changeLine( -(mPageSize - overlap), true ); } } @@ -646,18 +646,18 @@ void LLScrollbar::pageDown(S32 overlap) { if (mDocSize > mPageSize) { - changeLine( mPageSize - overlap, TRUE ); + changeLine( mPageSize - overlap, true ); } } void LLScrollbar::onLineUpBtnPressed( const LLSD& data ) { - changeLine( -mStepSize, TRUE ); + changeLine( -mStepSize, true ); } void LLScrollbar::onLineDownBtnPressed( const LLSD& data ) { - changeLine( mStepSize, TRUE ); + changeLine( mStepSize, true ); } void LLScrollbar::setThickness(S32 thickness) diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index bbfc3a0340..7b935aa51b 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -82,17 +82,17 @@ public: virtual void setValue(const LLSD& value); // Overrides from LLView - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg); - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); virtual void draw(); @@ -102,7 +102,7 @@ public: // How many "lines" the "document" has scrolled. // 0 <= DocPos <= DocSize - DocVisibile - bool setDocPos( S32 pos, BOOL update_thumb = TRUE ); + bool setDocPos( S32 pos, bool update_thumb = true ); S32 getDocPos() const { return mDocPos; } bool isAtBeginning() const; @@ -129,7 +129,7 @@ public: private: void updateThumbRect(); - bool changeLine(S32 delta, BOOL update_thumb ); + bool changeLine(S32 delta, bool update_thumb ); callback_t mChangeCallback; @@ -138,7 +138,7 @@ private: S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size) S32 mPageSize; // Maximum number of lines that can be seen at one time. S32 mStepSize; - BOOL mDocChanged; + bool mDocChanged; LLRect mThumbRect; S32 mDragStartX; diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index d0b28e8f22..df99c4f636 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -82,7 +82,7 @@ LLScrollContainer::Params::Params() // Default constructor LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p) : LLUICtrl(p), - mAutoScrolling( FALSE ), + mAutoScrolling( false ), mAutoScrollRate( 0.f ), mBackgroundColor(p.bg_color()), mIsOpaque(p.is_opaque), @@ -180,7 +180,7 @@ void LLScrollContainer::scrollVertical( S32 new_pos ) // LLView functionality void LLScrollContainer::reshape(S32 width, S32 height, - BOOL called_from_parent) + bool called_from_parent) { LLUICtrl::reshape( width, height, called_from_parent ); @@ -193,8 +193,8 @@ void LLScrollContainer::reshape(S32 width, S32 height, S32 visible_width = 0; S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; + bool show_v_scrollbar = false; + bool show_h_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); mScrollbar[VERTICAL]->setDocSize( scrolled_rect.getHeight() ); @@ -207,7 +207,7 @@ void LLScrollContainer::reshape(S32 width, S32 height, } // virtual -BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) +bool LLScrollContainer::handleKeyHere(KEY key, MASK mask) { if (mIgnoreArrowKeys) { @@ -221,7 +221,7 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) case KEY_PAGE_DOWN: case KEY_HOME: case KEY_END: - return FALSE; + return false; default: break; } @@ -234,35 +234,35 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) // call LLScrollContainer::handleKeyHere in turn if (mScrolledView && mScrolledView->handleKeyHere(key, mask)) { - return TRUE; + return true; } for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { if( mScrollbar[i]->handleKeyHere(key, mask) ) { updateScroll(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLScrollContainer::handleUnicodeCharHere(llwchar uni_char) +bool LLScrollContainer::handleUnicodeCharHere(llwchar uni_char) { if (mScrolledView && mScrolledView->handleUnicodeCharHere(uni_char)) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // Give event to my child views - they may have scroll bars // (Bad UI design, but technically possible.) if (LLUICtrl::handleScrollWheel(x,y,clicks)) - return TRUE; + return true; // When the vertical scrollbar is visible, scroll wheel // only affects vertical scrolling. It's confusing to have @@ -278,7 +278,7 @@ BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) updateScroll(); } // Always eat the event - return TRUE; + return true; } LLScrollbar* horizontal = mScrollbar[HORIZONTAL]; @@ -289,16 +289,16 @@ BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) && horizontal->handleScrollWheel( 0, 0, clicks ) ) { updateScroll(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLScrollContainer::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollContainer::handleScrollHWheel(S32 x, S32 y, S32 clicks) { if (LLUICtrl::handleScrollHWheel(x,y,clicks)) { - return TRUE; + return true; } LLScrollbar* horizontal = mScrollbar[HORIZONTAL]; @@ -307,14 +307,14 @@ BOOL LLScrollContainer::handleScrollHWheel(S32 x, S32 y, S32 clicks) && horizontal->handleScrollHWheel( 0, 0, clicks ) ) { updateScroll(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, +bool LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -322,7 +322,7 @@ BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, { // Scroll folder view if needed. Never accepts a drag or drop. *accept = ACCEPT_NO; - BOOL handled = autoScroll(x, y); + bool handled = autoScroll(x, y); if( !handled ) { @@ -330,7 +330,7 @@ BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, cargo_data, accept, tooltip_msg) != NULL; } - return TRUE; + return true; } bool LLScrollContainer::canAutoScroll(S32 x, S32 y) @@ -387,7 +387,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() - auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -399,7 +399,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() + auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -413,7 +413,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() + auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -425,7 +425,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) if (do_scroll) { mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() - auto_scroll_speed); - mAutoScrolling = TRUE; + mAutoScrolling = true; } scrolling = true; } @@ -434,7 +434,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) return scrolling; } -void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const +void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height, bool* show_h_scrollbar, bool* show_v_scrollbar ) const { const LLRect& doc_rect = getScrolledViewRect(); static LLUICachedControl<S32> scrollbar_size_control ("UIScrollbarSize", 0); @@ -447,8 +447,8 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height *visible_width = getRect().getWidth() - 2 * border_width; *visible_height = getRect().getHeight() - 2 * border_width; - *show_v_scrollbar = FALSE; - *show_h_scrollbar = FALSE; + *show_v_scrollbar = false; + *show_h_scrollbar = false; if (!mHideScrollbar) { @@ -456,12 +456,12 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height // the display of sliders. if ((doc_height - *visible_height) > 1) { - *show_v_scrollbar = TRUE; + *show_v_scrollbar = true; *visible_width -= scrollbar_size; } if ((doc_width - *visible_width) > 1) { - *show_h_scrollbar = TRUE; + *show_h_scrollbar = true; *visible_height -= scrollbar_size; // Note: Do *not* recompute *show_v_scrollbar here because with // The view inside the scroll container should not be extended @@ -470,7 +470,7 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) ) { - *show_v_scrollbar = TRUE; + *show_v_scrollbar = true; *visible_width -= scrollbar_size; } } @@ -494,7 +494,7 @@ void LLScrollContainer::draw() mAutoScrollRate = mMinAutoScrollRate; } // clear this flag to be set on next call to autoScroll - mAutoScrolling = FALSE; + mAutoScrolling = false; // auto-focus when scrollbar active // this allows us to capture user intent (i.e. stop automatically scrolling the view/etc) @@ -527,8 +527,8 @@ void LLScrollContainer::draw() { S32 visible_width = 0; S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; + bool show_v_scrollbar = false; + bool show_h_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); LLLocalClipRect clip(LLRect(mInnerRect.mLeft, @@ -599,8 +599,8 @@ void LLScrollContainer::updateScroll() S32 doc_height = doc_rect.getHeight(); S32 visible_width = 0; S32 visible_height = 0; - BOOL show_v_scrollbar = FALSE; - BOOL show_h_scrollbar = FALSE; + bool show_v_scrollbar = false; + bool show_h_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); S32 border_width = getBorderWidth(); @@ -612,14 +612,14 @@ void LLScrollContainer::updateScroll() } scrollVertical( mScrollbar[VERTICAL]->getDocPos() ); - mScrollbar[VERTICAL]->setVisible( TRUE ); + mScrollbar[VERTICAL]->setVisible( true ); S32 v_scrollbar_height = visible_height; if( !show_h_scrollbar && mReserveScrollCorner ) { v_scrollbar_height -= scrollbar_size; } - mScrollbar[VERTICAL]->reshape( scrollbar_size, v_scrollbar_height, TRUE ); + mScrollbar[VERTICAL]->reshape( scrollbar_size, v_scrollbar_height, true ); // Make room for the horizontal scrollbar (or not) S32 v_scrollbar_offset = 0; @@ -635,7 +635,7 @@ void LLScrollContainer::updateScroll() { mScrolledView->translate( 0, getRect().getHeight() - border_width - doc_rect.mTop ); - mScrollbar[VERTICAL]->setVisible( FALSE ); + mScrollbar[VERTICAL]->setVisible( false ); mScrollbar[VERTICAL]->setDocPos( 0 ); } @@ -651,19 +651,19 @@ void LLScrollContainer::updateScroll() scrollHorizontal( mScrollbar[HORIZONTAL]->getDocPos() ); } - mScrollbar[HORIZONTAL]->setVisible( TRUE ); + mScrollbar[HORIZONTAL]->setVisible( true ); S32 h_scrollbar_width = visible_width; if( !show_v_scrollbar && mReserveScrollCorner ) { h_scrollbar_width -= scrollbar_size; } - mScrollbar[HORIZONTAL]->reshape( h_scrollbar_width, scrollbar_size, TRUE ); + mScrollbar[HORIZONTAL]->reshape( h_scrollbar_width, scrollbar_size, true ); } else { mScrolledView->translate( border_width - doc_rect.mLeft, 0 ); - mScrollbar[HORIZONTAL]->setVisible( FALSE ); + mScrollbar[HORIZONTAL]->setVisible( false ); mScrollbar[HORIZONTAL]->setDocPos( 0 ); } @@ -674,7 +674,7 @@ void LLScrollContainer::updateScroll() mScrollbar[VERTICAL]->setPageSize( visible_height ); } // end updateScroll -void LLScrollContainer::setBorderVisible(BOOL b) +void LLScrollContainer::setBorderVisible(bool b) { mBorder->setVisible( b ); // Recompute inner rect, as border visibility changes it @@ -697,8 +697,8 @@ LLRect LLScrollContainer::getContentWindowRect() LLRect scroller_view_rect; S32 visible_width = 0; S32 visible_height = 0; - BOOL show_h_scrollbar = FALSE; - BOOL show_v_scrollbar = FALSE; + bool show_h_scrollbar = false; + bool show_v_scrollbar = false; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); S32 border_width = getBorderWidth(); scroller_view_rect.setOriginAndSize(border_width, diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 1295406a3d..859750d71c 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -86,12 +86,12 @@ public: virtual void setValue(const LLSD& value) { mInnerRect.setValue(value); } - void setBorderVisible( BOOL b ); + void setBorderVisible( bool b ); void scrollToShowRect( const LLRect& rect, const LLRect& constraint); void scrollToShowRect( const LLRect& rect) { scrollToShowRect(rect, LLRect(0, mInnerRect.getHeight(), mInnerRect.getWidth(), 0)); } - void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; } + void setReserveScrollCorner( bool b ) { mReserveScrollCorner = b; } LLRect getVisibleContentRect(); LLRect getContentWindowRect(); virtual const LLRect getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; } @@ -106,12 +106,12 @@ public: S32 getBorderWidth() const; // LLView functionality - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); - virtual BOOL handleScrollHWheel( S32 x, S32 y, S32 clicks ); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleScrollWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleScrollHWheel( S32 x, S32 y, S32 clicks ); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -135,16 +135,16 @@ private: virtual void scrollVertical( S32 new_pos ); void updateScroll(); bool autoScroll(S32 x, S32 y, bool do_scroll); - void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const; + void calcVisibleSize( S32 *visible_width, S32 *visible_height, bool* show_h_scrollbar, bool* show_v_scrollbar ) const; LLScrollbar* mScrollbar[ORIENTATION_COUNT]; S32 mSize; - BOOL mIsOpaque; + bool mIsOpaque; LLUIColor mBackgroundColor; LLRect mInnerRect; LLViewBorder* mBorder; - BOOL mReserveScrollCorner; - BOOL mAutoScrolling; + bool mReserveScrollCorner; + bool mAutoScrolling; F32 mAutoScrollRate; F32 mMinAutoScrollRate; F32 mMaxAutoScrollRate; diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp index b07f22d7ef..b158d7b1b7 100644 --- a/indra/llui/llscrollingpanellist.cpp +++ b/indra/llui/llscrollingpanellist.cpp @@ -114,7 +114,7 @@ void LLScrollingPanelList::removePanel( U32 panel_index ) rearrange(); } -void LLScrollingPanelList::updatePanels(BOOL allow_modify) +void LLScrollingPanelList::updatePanels(bool allow_modify) { for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin(); iter != mPanelList.end(); ++iter) @@ -224,7 +224,7 @@ void LLScrollingPanelList::updatePanelVisiblilty() local_rect.getWidth(), local_rect.getHeight(), &screen_rect.mRight, &screen_rect.mTop ); - BOOL intersects = + bool intersects = ( (screen_rect.mRight > parent_screen_rect.mLeft) && (screen_rect.mLeft < parent_screen_rect.mRight) ) && ( (screen_rect.mTop > parent_screen_rect.mBottom) && (screen_rect.mBottom < parent_screen_rect.mTop) ); diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index ad717a455b..309ce4592d 100644 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h @@ -40,7 +40,7 @@ class LLScrollingPanel : public LLPanel { public: LLScrollingPanel(const LLPanel::Params& params) : LLPanel(params) {} - virtual void updatePanel(BOOL allow_modify) = 0; + virtual void updatePanel(bool allow_modify) = 0; }; @@ -74,7 +74,7 @@ public: S32 addPanel(LLScrollingPanel* panel, bool back = false); void removePanel(LLScrollingPanel* panel); void removePanel(U32 panel_index); - void updatePanels(BOOL allow_modify); + void updatePanels(bool allow_modify); void rearrange(); const panel_list_t& getPanelList() const { return mPanelList; } diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 7fcb91bba3..403879646d 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -281,9 +281,9 @@ void LLScrollListText::highlightText(S32 offset, S32 num_chars) } //virtual -BOOL LLScrollListText::isText() const +bool LLScrollListText::isText() const { - return TRUE; + return true; } // virtual @@ -298,7 +298,7 @@ const std::string &LLScrollListText::getToolTip() const } // virtual -BOOL LLScrollListText::needsToolTip() const +bool LLScrollListText::needsToolTip() const { // If base class has a tooltip, return that if (LLScrollListCell::needsToolTip()) @@ -309,7 +309,7 @@ BOOL LLScrollListText::needsToolTip() const } //virtual -BOOL LLScrollListText::getVisible() const +bool LLScrollListText::getVisible() const { return mVisible; } @@ -335,7 +335,7 @@ S32 LLScrollListText::getContentWidth() const void LLScrollListText::setColor(const LLColor4& color) { mColor = color; - mUseColor = TRUE; + mUseColor = true; } void LLScrollListText::setText(const LLStringExplicit& text) @@ -436,7 +436,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col string_chars, getTextWidth(), &right_x, - TRUE); + true); } // @@ -480,14 +480,14 @@ void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_co mCheckBox->draw(); } -BOOL LLScrollListCheck::handleClick() +bool LLScrollListCheck::handleClick() { if (mCheckBox->getEnabled()) { mCheckBox->toggle(); } // don't change selection when clicking on embedded checkbox - return TRUE; + return true; } /*virtual*/ @@ -509,7 +509,7 @@ void LLScrollListCheck::onCommit() } /*virtual*/ -void LLScrollListCheck::setEnabled(BOOL enable) +void LLScrollListCheck::setEnabled(bool enable) { mCheckBox->setEnabled(enable); } @@ -660,7 +660,7 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight string_chars, getTextWidth(), &right_x, - TRUE); + true); if (mIcon) { diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index ea2327961a..c5d785ae52 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -106,16 +106,16 @@ public: virtual void setAltValue(const LLSD& value) { } virtual const std::string &getToolTip() const { return mToolTip; } virtual void setToolTip(const std::string &str) { mToolTip = str; } - virtual BOOL getVisible() const { return TRUE; } + virtual bool getVisible() const { return true; } virtual void setWidth(S32 width) { mWidth = width; } virtual void highlightText(S32 offset, S32 num_chars) {} - virtual BOOL isText() const { return FALSE; } - virtual BOOL needsToolTip() const { return ! mToolTip.empty(); } + virtual bool isText() const { return false; } + virtual bool needsToolTip() const { return ! mToolTip.empty(); } virtual void setColor(const LLColor4&) {} virtual void onCommit() {}; - virtual BOOL handleClick() { return FALSE; } - virtual void setEnabled(BOOL enable) { } + virtual bool handleClick() { return false; } + virtual void setEnabled(bool enable) { } private: S32 mWidth; @@ -146,13 +146,13 @@ public: /*virtual*/ void setAltValue(const LLSD& value); /*virtual*/ const LLSD getValue() const; /*virtual*/ const LLSD getAltValue() const; - /*virtual*/ BOOL getVisible() const; + /*virtual*/ bool getVisible() const; /*virtual*/ void highlightText(S32 offset, S32 num_chars); /*virtual*/ void setColor(const LLColor4&); - /*virtual*/ BOOL isText() const; + /*virtual*/ bool isText() const; /*virtual*/ const std::string & getToolTip() const; - /*virtual*/ BOOL needsToolTip() const; + /*virtual*/ bool needsToolTip() const; S32 getTextWidth() const { return mTextWidth;} void setTextWidth(S32 value) { mTextWidth = value;} @@ -171,7 +171,7 @@ protected: LLColor4 mHighlightColor; U8 mUseColor; LLFontGL::HAlign mFontAlignment; - BOOL mVisible; + bool mVisible; S32 mHighlightCount; S32 mHighlightOffset; @@ -235,8 +235,8 @@ public: /*virtual*/ void setValue(const LLSD& value); /*virtual*/ void onCommit(); - /*virtual*/ BOOL handleClick(); - /*virtual*/ void setEnabled(BOOL enable); + /*virtual*/ bool handleClick(); + /*virtual*/ void setEnabled(bool enable); LLCheckBoxCtrl* getCheckBox() { return mCheckBox; } diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index 2ef19d1b5a..a4510d1fc2 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -52,7 +52,7 @@ LLScrollColumnHeader::Params::Params() LLScrollColumnHeader::LLScrollColumnHeader(const LLScrollColumnHeader::Params& p) : LLButton(p), // use combobox params to steal images mColumn(p.column), - mHasResizableElement(FALSE) + mHasResizableElement(false) { setClickedCallback(boost::bind(&LLScrollColumnHeader::onClick, this, _2)); @@ -74,12 +74,12 @@ LLScrollColumnHeader::~LLScrollColumnHeader() void LLScrollColumnHeader::draw() { std::string sort_column = mColumn->mParentCtrl->getSortColumnName(); - BOOL draw_arrow = !mColumn->mLabel.empty() + bool draw_arrow = !mColumn->mLabel.empty() && mColumn->mParentCtrl->isSorted() // check for indirect sorting column as well as column's sorting name && (sort_column == mColumn->mSortingColumn || sort_column == mColumn->mName); - BOOL is_ascending = mColumn->mParentCtrl->getSortAscending(); + bool is_ascending = mColumn->mParentCtrl->getSortAscending(); if (draw_arrow) { setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, LLColor4::white); @@ -93,7 +93,7 @@ void LLScrollColumnHeader::draw() LLButton::draw(); } -BOOL LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) { if (canResize() && mResizeBar->getRect().pointInRect(x, y)) { @@ -107,7 +107,7 @@ BOOL LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) { onClick(LLSD()); } - return TRUE; + return true; } void LLScrollColumnHeader::onClick(const LLSD& data) @@ -241,7 +241,7 @@ void LLScrollColumnHeader::handleReshape(const LLRect& new_rect, bool by_user) } } -void LLScrollColumnHeader::setHasResizableElement(BOOL resizable) +void LLScrollColumnHeader::setHasResizableElement(bool resizable) { if (mHasResizableElement != resizable) { @@ -270,7 +270,7 @@ void LLScrollColumnHeader::updateResizeBars() { LLScrollListColumn* columnp = mColumn->mParentCtrl->getColumn(col); if (!columnp || !columnp->mHeader) continue; - BOOL enable = num_resizable_columns >= 2 && num_resizers_enabled < (num_resizable_columns - 1) && columnp->mHeader->canResize(); + bool enable = num_resizable_columns >= 2 && num_resizers_enabled < (num_resizable_columns - 1) && columnp->mHeader->canResize(); columnp->mHeader->enableResizeBar(enable); if (enable) { @@ -279,12 +279,12 @@ void LLScrollColumnHeader::updateResizeBars() } } -void LLScrollColumnHeader::enableResizeBar(BOOL enable) +void LLScrollColumnHeader::enableResizeBar(bool enable) { mResizeBar->setEnabled(enable); } -BOOL LLScrollColumnHeader::canResize() +bool LLScrollColumnHeader::canResize() { return getVisible() && (mHasResizableElement || mColumn->mDynamicWidth); } diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index d535d96c76..72dfcdafe0 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -50,23 +50,23 @@ public: ~LLScrollColumnHeader(); /*virtual*/ void draw(); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); LLScrollListColumn* getColumn() { return mColumn; } - void setHasResizableElement(BOOL resizable); + void setHasResizableElement(bool resizable); void updateResizeBars(); - BOOL canResize(); - void enableResizeBar(BOOL enable); + bool canResize(); + void enableResizeBar(bool enable); void onClick(const LLSD& data); private: LLScrollListColumn* mColumn; LLResizeBar* mResizeBar; - BOOL mHasResizableElement; + bool mHasResizableElement; }; /* @@ -158,7 +158,7 @@ public: ESortDirection mSortDirection; LLUIString mLabel; F32 mRelWidth; - BOOL mDynamicWidth; + bool mDynamicWidth; S32 mMaxContentWidth; S32 mIndex; LLScrollListCtrl* mParentCtrl; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7fb732eca3..1d9564d107 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -66,7 +66,7 @@ static LLDefaultChildRegistry::Register<LLScrollListCtrl> r("scroll_list"); // local structures & classes. struct SortScrollListItem { - SortScrollListItem(const std::vector<std::pair<S32, BOOL> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal, bool alternate_sort) + SortScrollListItem(const std::vector<std::pair<S32, bool> >& sort_orders,const LLScrollListCtrl::sort_signal_t* sort_signal, bool alternate_sort) : mSortOrders(sort_orders) , mSortSignal(sort_signal) , mAltSort(alternate_sort) @@ -80,7 +80,7 @@ struct SortScrollListItem it != mSortOrders.rend(); ++it) { S32 col_idx = it->first; - BOOL sort_ascending = it->second; + bool sort_ascending = it->second; S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column? @@ -114,7 +114,7 @@ struct SortScrollListItem } - typedef std::vector<std::pair<S32, BOOL> > sort_order_t; + typedef std::vector<std::pair<S32, bool> > sort_order_t; const LLScrollListCtrl::sort_signal_t* mSortSignal; const sort_order_t& mSortOrders; const bool mAltSort; @@ -357,7 +357,7 @@ LLScrollListCtrl::~LLScrollListCtrl() } -BOOL LLScrollListCtrl::setMaxItemCount(S32 max_count) +bool LLScrollListCtrl::setMaxItemCount(S32 max_count) { if (max_count >= getItemCount()) { @@ -373,10 +373,10 @@ S32 LLScrollListCtrl::isEmpty() const S32 LLScrollListCtrl::getItemCount() const { - return mItemList.size(); + return static_cast<S32>(mItemList.size()); } -BOOL LLScrollListCtrl::hasSelectedItem() const +bool LLScrollListCtrl::hasSelectedItem() const { item_list::iterator iter; for (iter = mItemList.begin(); iter < mItemList.end(); ) @@ -384,11 +384,11 @@ BOOL LLScrollListCtrl::hasSelectedItem() const LLScrollListItem* itemp = *iter; if (itemp && itemp->getSelected()) { - return TRUE; + return true; } iter++; } - return FALSE; + return false; } // virtual LLScrolListInterface function (was deleteAllItems) @@ -523,7 +523,7 @@ LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const } -void LLScrollListCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) +void LLScrollListCtrl::reshape( S32 width, S32 height, bool called_from_parent ) { LLUICtrl::reshape( width, height, called_from_parent ); @@ -551,7 +551,7 @@ void LLScrollListCtrl::updateLayout() // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); - BOOL scrollbar_visible = mLineHeight * getItemCount() > mItemListRect.getHeight(); + bool scrollbar_visible = mLineHeight * getItemCount() > mItemListRect.getHeight(); if (scrollbar_visible) { // provide space on the right for scrollbar @@ -593,9 +593,9 @@ LLRect LLScrollListCtrl::getRequiredRect() } -BOOL LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, BOOL requires_column ) +bool LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, bool requires_column ) { - BOOL not_too_big = getItemCount() < mMaxItemCount; + bool not_too_big = getItemCount() < mMaxItemCount; if (not_too_big) { switch( pos ) @@ -851,12 +851,12 @@ void LLScrollListCtrl::setPageLines(S32 new_page_lines) updateLayout(); } -BOOL LLScrollListCtrl::selectFirstItem() +bool LLScrollListCtrl::selectFirstItem() { - BOOL success = FALSE; + bool success = false; // our $%&@#$()^%#$()*^ iterators don't let us check against the first item inside out iteration - BOOL first_item = TRUE; + bool first_item = true; item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -876,7 +876,7 @@ BOOL LLScrollListCtrl::selectFirstItem() selectItem(itemp, -1); } } - success = TRUE; + success = true; mOriginalSelection = 0; } else @@ -894,17 +894,17 @@ BOOL LLScrollListCtrl::selectFirstItem() // Deselects all other items // virtual -BOOL LLScrollListCtrl::selectNthItem( S32 target_index ) +bool LLScrollListCtrl::selectNthItem( S32 target_index ) { return selectItemRange(target_index, target_index); } // virtual -BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) +bool LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) { if (mItemList.empty()) { - return FALSE; + return false; } // make sure sort is up to date @@ -918,7 +918,7 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) else last_index = llclamp(last_index, first_index, listlen-1); - BOOL success = FALSE; + bool success = false; S32 index = 0; for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); ) { @@ -934,8 +934,8 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) if( itemp->getEnabled() ) { // TODO: support range selection for cells - selectItem(itemp, -1, FALSE); - success = TRUE; + selectItem(itemp, -1, false); + success = true; } } else @@ -1083,7 +1083,7 @@ S32 LLScrollListCtrl::selectMultiple( uuid_vec_t ids ) if (item->getEnabled() && (item->getUUID() == (*iditr))) { // TODO: support multiple selection for cells - selectItem(item, -1, FALSE); + selectItem(item, -1, false); ++count; break; } @@ -1134,7 +1134,7 @@ S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const return -1; } -void LLScrollListCtrl::selectPrevItem( BOOL extend_selection) +void LLScrollListCtrl::selectPrevItem( bool extend_selection) { LLScrollListItem* prev_item = NULL; @@ -1179,7 +1179,7 @@ void LLScrollListCtrl::selectPrevItem( BOOL extend_selection) } -void LLScrollListCtrl::selectNextItem( BOOL extend_selection) +void LLScrollListCtrl::selectNextItem( bool extend_selection) { LLScrollListItem* next_item = NULL; @@ -1224,7 +1224,7 @@ void LLScrollListCtrl::selectNextItem( BOOL extend_selection) -void LLScrollListCtrl::deselectAllItems(BOOL no_commit_on_change) +void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change) { item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1263,9 +1263,9 @@ LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos) // Selects first enabled item of the given name. // Returns false if item not found. // Calls getItemByLabel in order to combine functionality -BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sensitive, S32 column/* = 0*/) +bool LLScrollListCtrl::selectItemByLabel(const std::string& label, bool case_sensitive, S32 column/* = 0*/) { - deselectAllItems(TRUE); // ensure that no stale items are selected, even if we don't find a match + deselectAllItems(true); // ensure that no stale items are selected, even if we don't find a match LLScrollListItem* item = getItemByLabel(label, case_sensitive, column); bool found = NULL != item; @@ -1282,7 +1282,7 @@ BOOL LLScrollListCtrl::selectItemByLabel(const std::string& label, BOOL case_sen return found; } -LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOOL case_sensitive, S32 column) +LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, bool case_sensitive, S32 column) { if (label.empty()) //RN: assume no empty items { @@ -1313,19 +1313,19 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOO } -BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive, S32 column) +bool LLScrollListCtrl::selectItemByPrefix(const std::string& target, bool case_sensitive, S32 column) { return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive, column); } // Selects first enabled item that has a name where the name's first part matched the target string. // Returns false if item not found. -BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sensitive, S32 column) +bool LLScrollListCtrl::selectItemByPrefix(const LLWString& target, bool case_sensitive, S32 column) { - BOOL found = FALSE; + bool found = false; LLWString target_trimmed( target ); - S32 target_len = target_trimmed.size(); + auto target_len = target_trimmed.size(); if( 0 == target_len ) { @@ -1336,11 +1336,11 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen LLScrollListItem* item = *iter; // Only select enabled items with matching names LLScrollListCell* cellp = item->getColumn(column == -1 ? getSearchColumn() : column); - BOOL select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : FALSE; + bool select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : false; if (select) { selectItem(item, -1); - found = TRUE; + found = true; break; } } @@ -1372,15 +1372,15 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen LLWString trimmed_label = item_label; LLWStringUtil::trim(trimmed_label); - BOOL select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0; + bool select = item->getEnabled() && trimmed_label.compare(0, target_trimmed.size(), target_trimmed) == 0; if (select) { // find offset of matching text (might have leading whitespace) - S32 offset = item_label.find(target_trimmed); - cellp->highlightText(offset, target_trimmed.size()); + auto offset = item_label.find(target_trimmed); + cellp->highlightText(static_cast<S32>(offset), static_cast<S32>(target_trimmed.size())); selectItem(item, -1); - found = TRUE; + found = true; break; } } @@ -1404,7 +1404,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv U32 found = 0; LLWString substring_trimmed(substring); - S32 len = substring_trimmed.size(); + auto len = substring_trimmed.size(); if (0 == len) { @@ -1413,7 +1413,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv } else { - deselectAllItems(TRUE); + deselectAllItems(true); if (!case_sensitive) { // do comparisons in lower case @@ -1446,8 +1446,8 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv if (found_iter != std::string::npos) { // find offset of matching text - cellp->highlightText(found_iter, substring_trimmed.size()); - selectItem(item, -1, FALSE); + cellp->highlightText(static_cast<S32>(found_iter), static_cast<S32>(substring_trimmed.size())); + selectItem(item, -1, false); found++; @@ -1479,7 +1479,11 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const item = getFirstSelected(); if (item) { - return item->getColumn(column)->getValue().asString(); + auto col = item->getColumn(column); + if(col) + { + return col->getValue().asString(); + } } return LLStringUtil::null; @@ -1489,7 +1493,7 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. -LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, BOOL enabled) +LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos, bool enabled) { if (getItemCount() < mMaxItemCount) { @@ -1504,16 +1508,16 @@ LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_te } // Select the line or lines that match this UUID -BOOL LLScrollListCtrl::selectByID( const LLUUID& id ) +bool LLScrollListCtrl::selectByID( const LLUUID& id ) { return selectByValue( LLSD(id) ); } -BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) +bool LLScrollListCtrl::setSelectedByValue(const LLSD& value, bool selected) { - BOOL found = FALSE; + bool found = false; - if (selected && !mAllowMultipleSelection) deselectAllItems(TRUE); + if (selected && !mAllowMultipleSelection) deselectAllItems(true); item_list::iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1527,12 +1531,12 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) { LLSD::Binary data1 = value.asBinary(); LLSD::Binary data2 = item->getValue().asBinary(); - found = std::equal(data1.begin(), data1.end(), data2.begin()) ? TRUE : FALSE; + found = std::equal(data1.begin(), data1.end(), data2.begin()); } } else { - found = item->getValue().asString() == value.asString() ? TRUE : FALSE; + found = item->getValue().asString() == value.asString(); } if (found) @@ -1558,7 +1562,7 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) return found; } -BOOL LLScrollListCtrl::isSelected(const LLSD& value) const +bool LLScrollListCtrl::isSelected(const LLSD& value) const { item_list::const_iterator iter; for (iter = mItemList.begin(); iter != mItemList.end(); iter++) @@ -1569,7 +1573,7 @@ BOOL LLScrollListCtrl::isSelected(const LLSD& value) const return item->getSelected(); } } - return FALSE; + return false; } LLUUID LLScrollListCtrl::getStringUUIDSelectedItem() const @@ -1736,36 +1740,36 @@ void LLScrollListCtrl::draw() LLUICtrl::draw(); } -void LLScrollListCtrl::setEnabled(BOOL enabled) +void LLScrollListCtrl::setEnabled(bool enabled) { mCanSelect = enabled; setTabStop(enabled); mScrollbar->setTabStop(!enabled && mScrollbar->getPageSize() < mScrollbar->getDocSize()); } -BOOL LLScrollListCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLScrollListCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; // Pretend the mouse is over the scrollbar handled = mScrollbar->handleScrollWheel( 0, 0, clicks ); if (mMouseWheelOpaque) { - return TRUE; + return true; } return handled; } -BOOL LLScrollListCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollListCtrl::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; // Pretend the mouse is over the scrollbar handled = mScrollbar->handleScrollHWheel( 0, 0, clicks ); if (mMouseWheelOpaque) { - return TRUE; + return true; } return handled; @@ -1783,20 +1787,20 @@ LLRect LLScrollListCtrl::getCellRect(S32 row_index, S32 column_index) return cell_rect; } -BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) { S32 column_index = getColumnIndexFromOffset(x); LLScrollListColumn* columnp = getColumn(column_index); - if (columnp == NULL) return FALSE; + if (columnp == NULL) return false; - BOOL handled = FALSE; + bool handled = false; // show tooltip for full name of hovered item if it has been truncated LLScrollListItem* hit_item = hitItem(x, y); if (hit_item) { LLScrollListCell* hit_cell = hit_item->getColumn(column_index); - if (!hit_cell) return FALSE; + if (!hit_cell) return false; if (hit_cell && hit_cell->isText() && hit_cell->needsToolTip()) @@ -1815,7 +1819,7 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) .delay_time(0.2f) .sticky_rect(sticky_rect)); } - handled = TRUE; + handled = true; } // otherwise, look for a tooltip associated with this column @@ -1828,11 +1832,11 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) return handled; } -BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) { - if (!mCanSelect) return FALSE; + if (!mCanSelect) return false; - BOOL selection_changed = FALSE; + bool selection_changed = false; LLScrollListItem* hit_item = hitItem(x, y); @@ -1868,17 +1872,17 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) LLScrollListItem *item = *itor; if (item == hit_item || item == lastSelected) { - selectItem(item, getColumnIndexFromOffset(x), FALSE); + selectItem(item, getColumnIndexFromOffset(x), false); selecting = !selecting; if (hit_item == lastSelected) { // stop selecting now, since we just clicked on our last selected item - selecting = FALSE; + selecting = false; } } if (selecting) { - selectItem(item, getColumnIndexFromOffset(x), FALSE); + selectItem(item, getColumnIndexFromOffset(x), false); } } } @@ -1893,7 +1897,7 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) { if(!(mMaxSelectable > 0 && getAllSelected().size() >= mMaxSelectable)) { - selectItem(hit_item, getColumnIndexFromOffset(x), FALSE); + selectItem(hit_item, getColumnIndexFromOffset(x), false); } else { @@ -1906,7 +1910,7 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) } else { - deselectAllItems(TRUE); + deselectAllItems(true); selectItem(hit_item, getColumnIndexFromOffset(x)); } } @@ -1927,21 +1931,21 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) else { //mLastSelected = NULL; - //deselectAllItems(TRUE); + //deselectAllItems(true); } return selection_changed; } -BOOL LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = childrenHandleMouseDown(x, y, mask) != NULL; + bool handled = childrenHandleMouseDown(x, y, mask) != NULL; if( !handled ) { // set keyboard focus first, in case click action wants to move focus elsewhere - setFocus(TRUE); + setFocus(true); // clear selection changed flag because user is starting a selection operation mSelectionChanged = false; @@ -1949,10 +1953,10 @@ BOOL LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) handleClick(x, y, mask); } - return TRUE; + return true; } -BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -1978,7 +1982,7 @@ BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) } // virtual -BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLScrollListItem *item = hitItem(x, y); if (item) @@ -2030,12 +2034,12 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) menu->show(x, y); LLMenuGL::showPopup(this, menu, x, y); - return TRUE; + return true; } } return LLUICtrl::handleRightMouseDown(x, y, mask); } - return FALSE; + return false; } void LLScrollListCtrl::showProfile(std::string id, bool is_group) @@ -2108,10 +2112,10 @@ void LLScrollListCtrl::copySLURLToClipboard(std::string id, bool is_group) LLUrlAction::copyURLToClipboard(slurl); } -BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { - //BOOL handled = FALSE; - BOOL handled = handleClick(x, y, mask); + //bool handled = false; + bool handled = handleClick(x, y, mask); if (!handled) { @@ -2127,19 +2131,19 @@ BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) +bool LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) { // which row was clicked on? LLScrollListItem* hit_item = hitItem(x, y); - if (!hit_item) return FALSE; + if (!hit_item) return false; // get appropriate cell from that row S32 column_index = getColumnIndexFromOffset(x); LLScrollListCell* hit_cell = hit_item->getColumn(column_index); - if (!hit_cell) return FALSE; + if (!hit_cell) return false; // if cell handled click directly (i.e. clicked on an embedded checkbox) if (hit_cell->handleClick()) @@ -2175,7 +2179,7 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) onCommit(); } // eat click (e.g. do not trigger double click callback) - return TRUE; + return true; } else { @@ -2184,7 +2188,7 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) gFocusMgr.setMouseCapture(this); mNeedsScroll = true; // do not eat click (allow double click callback) - return FALSE; + return false; } } @@ -2279,9 +2283,9 @@ S32 LLScrollListCtrl::getRowOffsetFromIndex(S32 index) } -BOOL LLScrollListCtrl::handleHover(S32 x,S32 y,MASK mask) +bool LLScrollListCtrl::handleHover(S32 x,S32 y,MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (hasMouseCapture()) { @@ -2337,9 +2341,9 @@ void LLScrollListCtrl::onMouseLeave(S32 x, S32 y, MASK mask) mouseOverHighlightNthItem(-1); } -BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) +bool LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { - BOOL handled = FALSE; + bool handled = false; // not called from parent means we have keyboard focus or a child does if (mCanSelect) @@ -2352,18 +2356,18 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) if (mAllowKeyboardMovement || hasFocus()) { // commit implicit in call - selectPrevItem(FALSE); + selectPrevItem(false); mNeedsScroll = true; - handled = TRUE; + handled = true; } break; case KEY_DOWN: if (mAllowKeyboardMovement || hasFocus()) { // commit implicit in call - selectNextItem(FALSE); + selectNextItem(false); mNeedsScroll = true; - handled = TRUE; + handled = true; } break; case KEY_LEFT: @@ -2388,7 +2392,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) break; } item->setSelectedCell(cell); - handled = TRUE; + handled = true; } } break; @@ -2414,7 +2418,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) break; } item->setSelectedCell(cell); - handled = TRUE; + handled = true; } } break; @@ -2428,7 +2432,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_PAGE_DOWN: @@ -2441,7 +2445,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_HOME: @@ -2454,7 +2458,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_END: @@ -2467,7 +2471,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); } - handled = TRUE; + handled = true; } break; case KEY_RETURN: @@ -2478,7 +2482,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { onCommit(); mSearchString.clear(); - handled = TRUE; + handled = true; } break; case KEY_BACKSPACE: @@ -2498,7 +2502,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) } } } - else if (selectItemByPrefix(wstring_to_utf8str(mSearchString), FALSE)) + else if (selectItemByPrefix(wstring_to_utf8str(mSearchString), false)) { mNeedsScroll = true; // update search string only on successful match @@ -2521,11 +2525,11 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) return handled; } -BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) +bool LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) { if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL { - return FALSE; + return false; } // perform incremental search based on keyboard input @@ -2538,7 +2542,7 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) // type ahead search is case insensitive uni_char = LLStringOps::toLower((llwchar)uni_char); - if (selectItemByPrefix(wstring_to_utf8str(mSearchString + (llwchar)uni_char), FALSE)) + if (selectItemByPrefix(wstring_to_utf8str(mSearchString + (llwchar)uni_char), false)) { // update search string only on successful match mNeedsScroll = true; @@ -2609,7 +2613,7 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) } } - return TRUE; + return true; } @@ -2618,11 +2622,11 @@ void LLScrollListCtrl::reportInvalidInput() make_ui_sound("UISndBadKeystroke"); } -BOOL LLScrollListCtrl::isRepeatedChars(const LLWString& string) const +bool LLScrollListCtrl::isRepeatedChars(const LLWString& string) const { if (string.empty()) { - return FALSE; + return false; } llwchar first_char = string[0]; @@ -2631,14 +2635,14 @@ BOOL LLScrollListCtrl::isRepeatedChars(const LLWString& string) const { if (string[i] != first_char) { - return FALSE; + return false; } } - return TRUE; + return true; } -void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, BOOL select_single_item) +void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, bool select_single_item) { if (!itemp) return; @@ -2654,9 +2658,9 @@ void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, BOOL select } if (select_single_item) { - deselectAllItems(TRUE); + deselectAllItems(true); } - itemp->setSelected(TRUE); + itemp->setSelected(true); switch (mSelectionType) { case CELL: @@ -2685,7 +2689,7 @@ void LLScrollListCtrl::deselectItem(LLScrollListItem* itemp) mLastSelected = NULL; } - itemp->setSelected(FALSE); + itemp->setSelected(false); LLScrollListCell* cellp = itemp->getColumn(getSearchColumn()); if (cellp) { @@ -2700,7 +2704,7 @@ void LLScrollListCtrl::commitIfChanged() if (mSelectionChanged) { mDirty = true; - mSelectionChanged = FALSE; + mSelectionChanged = false; onCommit(); } } @@ -2710,13 +2714,13 @@ struct SameSortColumn SameSortColumn(S32 column) : mColumn(column) {} S32 mColumn; - bool operator()(std::pair<S32, BOOL> sort_column) { return sort_column.first == mColumn; } + bool operator()(std::pair<S32, bool> sort_column) { return sort_column.first == mColumn; } }; -BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending) +bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending) { LLScrollListColumn* sort_column = getColumn(column_idx); - if (!sort_column) return FALSE; + if (!sort_column) return false; sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING; @@ -2727,7 +2731,7 @@ BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending) if (mSortColumns.empty()) { mSortColumns.push_back(new_sort_column); - return TRUE; + return true; } else { @@ -2765,7 +2769,7 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar ) } -void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) +void LLScrollListCtrl::sortByColumn(const std::string& name, bool ascending) { column_map_t::iterator itor = mColumns.find(name); if (itor != mColumns.end()) @@ -2775,7 +2779,7 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) } // First column is column 0 -void LLScrollListCtrl::sortByColumnIndex(U32 column, BOOL ascending) +void LLScrollListCtrl::sortByColumnIndex(U32 column, bool ascending) { setSort(column, ascending); updateSort(); @@ -2796,9 +2800,9 @@ void LLScrollListCtrl::updateSort() const } // for one-shot sorts, does not save sort column/order -void LLScrollListCtrl::sortOnce(S32 column, BOOL ascending) +void LLScrollListCtrl::sortOnce(S32 column, bool ascending) { - std::vector<std::pair<S32, BOOL> > sort_column; + std::vector<std::pair<S32, bool> > sort_column; sort_column.push_back(std::make_pair(column, ascending)); // do stable sort to preserve any previous sorts @@ -2897,11 +2901,11 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, static_cast<S32>(buffer.length())); } // virtual -BOOL LLScrollListCtrl::canCopy() const +bool LLScrollListCtrl::canCopy() const { return (getFirstSelected() != NULL); } @@ -2914,7 +2918,7 @@ void LLScrollListCtrl::cut() } // virtual -BOOL LLScrollListCtrl::canCut() const +bool LLScrollListCtrl::canCut() const { return canCopy() && canDoDelete(); } @@ -2929,7 +2933,7 @@ void LLScrollListCtrl::selectAll() LLScrollListItem *itemp = *iter; if( itemp->getEnabled() ) { - selectItem(itemp, -1, FALSE); + selectItem(itemp, -1, false); } } @@ -2940,7 +2944,7 @@ void LLScrollListCtrl::selectAll() } // virtual -BOOL LLScrollListCtrl::canSelectAll() const +bool LLScrollListCtrl::canSelectAll() const { return getCanSelect() && mAllowMultipleSelection && !(mMaxSelectable > 0 && mItemList.size() > mMaxSelectable); } @@ -2952,7 +2956,7 @@ void LLScrollListCtrl::deselect() } // virtual -BOOL LLScrollListCtrl::canDeselect() const +bool LLScrollListCtrl::canDeselect() const { return getCanSelect(); } @@ -2981,7 +2985,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params // Add column mColumns[name] = new LLScrollListColumn(column_params, this); LLScrollListColumn* new_column = mColumns[name]; - new_column->mIndex = mColumns.size()-1; + new_column->mIndex = static_cast<S32>(mColumns.size()) - 1; // Add button if (new_column->getWidth() > 0 || new_column->mRelWidth > 0 || new_column->mDynamicWidth) @@ -3093,7 +3097,7 @@ std::string LLScrollListCtrl::getSortColumnName() else return ""; } -BOOL LLScrollListCtrl::hasSortOrder() const +bool LLScrollListCtrl::hasSortOrder() const { return !mSortColumns.empty(); } @@ -3177,7 +3181,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if (!item_p.validateBlock() || !new_item) return NULL; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); // Add any columns we don't already have S32 col_index = 0; @@ -3212,7 +3216,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS } addColumn(new_column); columnp = mColumns[column]; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); } S32 index = columnp->mIndex; @@ -3230,7 +3234,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS && cell->isText() && !cell->getValue().asString().empty()) { - columnp->mHeader->setHasResizableElement(TRUE); + columnp->mHeader->setHasResizableElement(true); } } @@ -3245,7 +3249,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS new_column.name = "0"; addColumn(new_column); - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); } LLScrollListCell* cell = LLScrollListCell::create(LLScrollListCell::Params().value(item_p.value)); @@ -3258,7 +3262,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS && cell->isText() && !cell->getValue().asString().empty()) { - columnp->mHeader->setHasResizableElement(TRUE); + columnp->mHeader->setHasResizableElement(true); } } } @@ -3315,26 +3319,26 @@ LLSD LLScrollListCtrl::getValue() const return item->getValue(); } -BOOL LLScrollListCtrl::operateOnSelection(EOperation op) +bool LLScrollListCtrl::operateOnSelection(EOperation op) { if (op == OP_DELETE) { deleteSelectedItems(); - return TRUE; + return true; } else if (op == OP_DESELECT) { deselectAllItems(); } - return FALSE; + return false; } -BOOL LLScrollListCtrl::operateOnAll(EOperation op) +bool LLScrollListCtrl::operateOnAll(EOperation op) { if (op == OP_DELETE) { clearRows(); - return TRUE; + return true; } else if (op == OP_DESELECT) { @@ -3344,10 +3348,10 @@ BOOL LLScrollListCtrl::operateOnAll(EOperation op) { selectAll(); } - return FALSE; + return false; } //virtual -void LLScrollListCtrl::setFocus(BOOL b) +void LLScrollListCtrl::setFocus(bool b) { // for tabbing into pristine scroll lists (Finder) if (!getFirstSelected()) @@ -3360,9 +3364,9 @@ void LLScrollListCtrl::setFocus(BOOL b) // virtual -BOOL LLScrollListCtrl::isDirty() const +bool LLScrollListCtrl::isDirty() const { - BOOL grubby = mDirty; + bool grubby = mDirty; if ( !mAllowMultipleSelection ) { grubby = (mOriginalSelection != getFirstSelectedIndex()); @@ -3373,7 +3377,7 @@ BOOL LLScrollListCtrl::isDirty() const // Clear dirty state void LLScrollListCtrl::resetDirty() { - mDirty = FALSE; + mDirty = false; mOriginalSelection = getFirstSelectedIndex(); } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index c525fd72a8..f25ba61fd4 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -166,7 +166,7 @@ public: // Sets an array of column descriptors void setColumnHeadings(const LLSD& headings); - void sortByColumnIndex(U32 column, BOOL ascending); + void sortByColumnIndex(U32 column, bool ascending); // LLCtrlListInterface functions virtual S32 getItemCount() const; @@ -178,7 +178,7 @@ public: virtual bool preProcessChildNode(LLXMLNodePtr child); virtual LLScrollListColumn* getColumn(S32 index); virtual LLScrollListColumn* getColumn(const std::string& name); - virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } + virtual S32 getNumColumns() const { return static_cast<S32>(mColumnsIndexed.size()); } // Adds a single element, from an array of: // "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid @@ -189,7 +189,7 @@ public: // Simple add element. Takes a single array of: // [ "value" => value, "font" => font, "font-style" => style ] virtual void clearRows(); // clears all elements - virtual void sortByColumn(const std::string& name, BOOL ascending); + virtual void sortByColumn(const std::string& name, bool ascending); // These functions take and return an array of arrays of elements, as above virtual void setValue(const LLSD& value ); @@ -200,37 +200,37 @@ public: LLCtrlScrollInterface* getScrollInterface() { return (LLCtrlScrollInterface*)this; } // DEPRECATED: Use setSelectedByValue() below. - BOOL setCurrentByID( const LLUUID& id ) { return selectByID(id); } + bool setCurrentByID( const LLUUID& id ) { return selectByID(id); } virtual LLUUID getCurrentID() const { return getStringUUIDSelectedItem(); } - BOOL operateOnSelection(EOperation op); - BOOL operateOnAll(EOperation op); + bool operateOnSelection(EOperation op); + bool operateOnAll(EOperation op); - // returns FALSE if unable to set the max count so low - BOOL setMaxItemCount(S32 max_count); + // returns false if unable to set the max count so low + bool setMaxItemCount(S32 max_count); - BOOL selectByID( const LLUUID& id ); // FALSE if item not found + bool selectByID( const LLUUID& id ); // false if item not found // Match item by value.asString(), which should work for string, integer, uuid. - // Returns FALSE if not found. - BOOL setSelectedByValue(const LLSD& value, BOOL selected); + // Returns false if not found. + bool setSelectedByValue(const LLSD& value, bool selected); - BOOL isSorted() const { return mSorted; } + bool isSorted() const { return mSorted; } - virtual BOOL isSelected(const LLSD& value) const; + virtual bool isSelected(const LLSD& value) const; - BOOL hasSelectedItem() const; + bool hasSelectedItem() const; - BOOL handleClick(S32 x, S32 y, MASK mask); - BOOL selectFirstItem(); - BOOL selectNthItem( S32 index ); - BOOL selectItemRange( S32 first, S32 last ); - BOOL selectItemAt(S32 x, S32 y, MASK mask); + bool handleClick(S32 x, S32 y, MASK mask); + bool selectFirstItem(); + bool selectNthItem( S32 index ); + bool selectItemRange( S32 first, S32 last ); + bool selectItemAt(S32 x, S32 y, MASK mask); void deleteSingleItem( S32 index ); void deleteItems(const LLSD& sd); void deleteSelectedItems(); - void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change + void deselectAllItems(bool no_commit_on_change = false); // by default, go ahead and commit on selection change void clearHighlightedItems(); @@ -247,8 +247,8 @@ public: void swapWithNext(S32 index); void swapWithPrevious(S32 index); - void setCanSelect(BOOL can_select) { mCanSelect = can_select; } - virtual BOOL getCanSelect() const { return mCanSelect; } + void setCanSelect(bool can_select) { mCanSelect = can_select; } + virtual bool getCanSelect() const { return mCanSelect; } S32 getItemIndex( LLScrollListItem* item ) const; S32 getItemIndex( const LLUUID& item_id ) const; @@ -260,10 +260,10 @@ public: // one of which can be selected at a time. virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); - BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); // FALSE if item not found - BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE, S32 column = -1); - BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE, S32 column = -1); - LLScrollListItem* getItemByLabel(const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0); + bool selectItemByLabel( const std::string& item, bool case_sensitive = true, S32 column = 0 ); // false if item not found + bool selectItemByPrefix(const std::string& target, bool case_sensitive = true, S32 column = -1); + bool selectItemByPrefix(const LLWString& target, bool case_sensitive = true, S32 column = -1); + LLScrollListItem* getItemByLabel( const std::string& item, bool case_sensitive = true, S32 column = 0 ); const std::string getSelectedItemLabel(S32 column = 0) const; LLSD getSelectedValue(); @@ -278,7 +278,7 @@ public: // DEPRECATED: Use LLSD versions of setCommentText() and getSelectedValue(). // "StringUUID" interface: use this when you're creating a list that contains non-unique strings each of which // has an associated, unique UUID, and only one of which can be selected at a time. - LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); + LLScrollListItem* addStringUUIDItem(const std::string& item_text, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, bool enabled = true); LLUUID getStringUUIDSelectedItem() const; LLScrollListItem* getFirstSelected() const; @@ -294,7 +294,7 @@ public: LLScrollListItem* getItem(const LLSD& sd) const; - void setAllowMultipleSelection(BOOL mult ) { mAllowMultipleSelection = mult; } + void setAllowMultipleSelection(bool mult ) { mAllowMultipleSelection = mult; } void setBgWriteableColor(const LLColor4 &c) { mBgWriteableColor = c; } void setReadOnlyBgColor(const LLColor4 &c) { mBgReadOnlyColor = c; } @@ -306,15 +306,15 @@ public: void setHighlightedColor(const LLColor4 &c) { mHighlightedColor = c; } void setFgDisableColor(const LLColor4 &c) { mFgDisabledColor = c; } - void setBackgroundVisible(BOOL b) { mBackgroundVisible = b; } - void setDrawStripes(BOOL b) { mDrawStripes = b; } + void setBackgroundVisible(bool b) { mBackgroundVisible = b; } + void setDrawStripes(bool b) { mDrawStripes = b; } void setColumnPadding(const S32 c) { mColumnPadding = c; } S32 getColumnPadding() const { return mColumnPadding; } void setRowPadding(const S32 c) { mColumnPadding = c; } S32 getRowPadding() const { return mColumnPadding; } - void setCommitOnKeyboardMovement(BOOL b) { mCommitOnKeyboardMovement = b; } - void setCommitOnSelectionChange(BOOL b) { mCommitOnSelectionChange = b; } - void setAllowKeyboardMovement(BOOL b) { mAllowKeyboardMovement = b; } + void setCommitOnKeyboardMovement(bool b) { mCommitOnKeyboardMovement = b; } + void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } + void setAllowKeyboardMovement(bool b) { mAllowKeyboardMovement = b; } void setMaxSelectable(U32 max_selected) { mMaxSelectable = max_selected; } S32 getMaxSelectable() { return mMaxSelectable; } @@ -337,31 +337,31 @@ public: // Overridden from LLView /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ void setEnabled(BOOL enabled); - /*virtual*/ void setFocus( BOOL b ); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ void setEnabled(bool enabled); + /*virtual*/ void setFocus( bool b ); /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); - virtual BOOL isDirty() const; + virtual bool isDirty() const; virtual void resetDirty(); // Clear dirty state virtual void updateLayout(); virtual void fitContents(S32 max_width, S32 max_height); virtual LLRect getRequiredRect(); - static BOOL rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); + static bool rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); LLRect getItemListRect() { return mItemListRect; } @@ -383,39 +383,39 @@ public: * then display all items. */ void setPageLines(S32 page_lines ); - void setCollapseEmptyColumns(BOOL collapse); + void setCollapseEmptyColumns(bool collapse); LLScrollListItem* hitItem(S32 x,S32 y); virtual void scrollToShowSelected(); // LLEditMenuHandler functions virtual void copy(); - virtual BOOL canCopy() const; + virtual bool canCopy() const; virtual void cut(); - virtual BOOL canCut() const; + virtual bool canCut() const; virtual void selectAll(); - virtual BOOL canSelectAll() const; + virtual bool canSelectAll() const; virtual void deselect(); - virtual BOOL canDeselect() const; + virtual bool canDeselect() const; void setNumDynamicColumns(S32 num) { mNumDynamicWidthColumns = num; } void updateStaticColumnWidth(LLScrollListColumn* col, S32 new_width); S32 getTotalStaticColumnWidth() { return mTotalStaticColumnWidth; } std::string getSortColumnName(); - BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } - BOOL hasSortOrder() const; + bool getSortAscending() { return mSortColumns.empty() ? true : mSortColumns.back().second; } + bool hasSortOrder() const; void clearSortOrder(); - void setAlternateSort() { mAlternateSort = TRUE; } + void setAlternateSort() { mAlternateSort = true; } - void selectPrevItem(BOOL extend_selection = FALSE); - void selectNextItem(BOOL extend_selection = FALSE); + void selectPrevItem(bool extend_selection = false); + void selectNextItem(bool extend_selection = false); S32 selectMultiple(uuid_vec_t ids); // conceptually const, but mutates mItemList void updateSort() const; // sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example) - void sortOnce(S32 column, BOOL ascending); + void sortOnce(S32 column, bool ascending); // manually call this whenever editing list items in place to flag need for resorting void setNeedsSort(bool val = true) { mSorted = !val; } @@ -447,8 +447,8 @@ protected: // (except in the case that the addItem() call fails, in which case it is up // to the caller to delete the item) // - // returns FALSE if item faile to be added to list, does NOT delete 'item' - BOOL addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, BOOL requires_column = TRUE ); + // returns false if item faile to be added to list, does NOT delete 'item' + bool addItem( LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM, bool requires_column = true ); typedef std::deque<LLScrollListItem *> item_list; item_list& getItemList() { return mItemList; } @@ -460,11 +460,11 @@ private: void updateLineHeightInsert(LLScrollListItem* item); void reportInvalidInput(); - BOOL isRepeatedChars(const LLWString& string) const; - void selectItem(LLScrollListItem* itemp, S32 cell, BOOL single_select = TRUE); + bool isRepeatedChars(const LLWString& string) const; + void selectItem(LLScrollListItem* itemp, S32 cell, bool single_select = true); void deselectItem(LLScrollListItem* itemp); void commitIfChanged(); - BOOL setSort(S32 column, BOOL ascending); + bool setSort(S32 column, bool ascending); S32 getLinesPerPage(); static void showProfile(std::string id, bool is_group); @@ -508,8 +508,8 @@ private: S32 mColumnPadding; S32 mRowPadding; - BOOL mBackgroundVisible; - BOOL mDrawStripes; + bool mBackgroundVisible; + bool mDrawStripes; LLUIColor mBgWriteableColor; LLUIColor mBgReadOnlyColor; @@ -553,7 +553,7 @@ private: typedef std::vector<LLScrollListColumn*> ordered_columns_t; ordered_columns_t mColumnsIndexed; - typedef std::pair<S32, BOOL> sort_column_t; + typedef std::pair<S32, bool> sort_column_t; std::vector<sort_column_t> mSortColumns; sort_signal_t* mSortCallback; diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index a928a57465..0d79d19a37 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -38,8 +38,8 @@ //--------------------------------------------------------------------------- LLScrollListItem::LLScrollListItem( const Params& p ) -: mSelected(FALSE), - mHighlighted(FALSE), +: mSelected(false), + mHighlighted(false), mHoverIndex(-1), mSelectedIndex(-1), mEnabled(p.enabled), @@ -56,13 +56,13 @@ LLScrollListItem::~LLScrollListItem() mColumns.clear(); } -void LLScrollListItem::setSelected(BOOL b) +void LLScrollListItem::setSelected(bool b) { mSelected = b; mSelectedIndex = -1; } -void LLScrollListItem::setHighlighted(BOOL b) +void LLScrollListItem::setHighlighted(bool b) { mHighlighted = b; mHoverIndex = -1; @@ -85,7 +85,7 @@ void LLScrollListItem::addColumn(const LLScrollListCell::Params& p) void LLScrollListItem::setNumColumns(S32 columns) { - S32 prev_columns = mColumns.size(); + auto prev_columns = mColumns.size(); if (columns < prev_columns) { std::for_each(mColumns.begin()+columns, mColumns.end(), DeletePointer()); @@ -93,7 +93,7 @@ void LLScrollListItem::setNumColumns(S32 columns) mColumns.resize(columns); - for (S32 col = prev_columns; col < columns; ++col) + for (auto col = prev_columns; col < columns; ++col) { mColumns[col] = NULL; } @@ -115,7 +115,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell ) S32 LLScrollListItem::getNumColumns() const { - return mColumns.size(); + return static_cast<S32>(mColumns.size()); } LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h index 8a78efbd7c..ee8a8bb556 100644 --- a/indra/llui/llscrolllistitem.h +++ b/indra/llui/llscrolllistitem.h @@ -79,14 +79,14 @@ public: virtual ~LLScrollListItem(); - void setSelected( BOOL b ); - BOOL getSelected() const { return mSelected; } + void setSelected( bool b ); + bool getSelected() const { return mSelected; } - void setEnabled( BOOL b ) { mEnabled = b; } - BOOL getEnabled() const { return mEnabled; } + void setEnabled( bool b ) { mEnabled = b; } + bool getEnabled() const { return mEnabled; } - void setHighlighted( BOOL b ); - BOOL getHighlighted() const { return mHighlighted; } + void setHighlighted( bool b ); + bool getHighlighted() const { return mHighlighted; } void setSelectedCell( S32 cell ); S32 getSelectedCell() const { return mSelectedIndex; } @@ -127,11 +127,11 @@ protected: LLScrollListItem( const Params& ); private: - BOOL mSelected; - BOOL mHighlighted; + bool mSelected; + bool mHighlighted; S32 mHoverIndex; S32 mSelectedIndex; - BOOL mEnabled; + bool mEnabled; void* mUserdata; LLSD mItemValue; LLSD mItemAltValue; diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 9a35c628af..a0c1e9d0c0 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -72,7 +72,7 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) line_editor_params.keystroke_callback(boost::bind(&LLSearchEditor::handleKeystroke, this)); mSearchEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_params); - mSearchEditor->setPassDelete(TRUE); + mSearchEditor->setPassDelete(true); addChild(mSearchEditor); if (p.search_button_visible) @@ -106,6 +106,10 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) LLSearchEditor::~LLSearchEditor() { + mKeystrokeCallback = NULL; + mTextChangedCallback = NULL; + setCommitOnFocusLost(false); + mSearchButton = NULL; mClearButton = NULL; mSearchEditor->deleteAllChildren(); @@ -148,13 +152,13 @@ LLSD LLSearchEditor::getValue() const } //virtual -BOOL LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLSearchEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { return mSearchEditor->setTextArg(key, text); } //virtual -BOOL LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLSearchEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { return mSearchEditor->setLabelArg(key, text); } @@ -175,7 +179,7 @@ void LLSearchEditor::clear() } //virtual -void LLSearchEditor::setFocus( BOOL b ) +void LLSearchEditor::setFocus( bool b ) { if (mSearchEditor) { diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index 26f6b72aa3..d99dc6f200 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -67,7 +67,7 @@ public: {} }; - void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } + void setCommitOnFocusLost(bool b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } protected: LLSearchEditor(const Params&); @@ -84,11 +84,11 @@ public: // LLUICtrl interface virtual void setValue(const LLSD& value ); virtual LLSD getValue() const; - virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void setLabel( const LLStringExplicit &new_label ); virtual void clear(); - virtual void setFocus( BOOL b ); + virtual void setFocus( bool b ); void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; } void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; } diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index ed8d508ba3..0507733fd8 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -93,7 +93,7 @@ LLSlider::~LLSlider() delete mMouseUpSignal; } -void LLSlider::setValue(F32 value, BOOL from_event) +void LLSlider::setValue(F32 value, bool from_event) { value = llclamp( value, mMinValue, mMaxValue ); @@ -157,7 +157,7 @@ void LLSlider::setValueAndCommit(F32 value) } -BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask) +bool LLSlider::handleHover(S32 x, S32 y, MASK mask) { if( hasMouseCapture() ) { @@ -193,12 +193,12 @@ BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } - return TRUE; + return true; } -BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { @@ -207,23 +207,23 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) if (mMouseUpSignal) (*mMouseUpSignal)( this, getValueF32() ); - handled = TRUE; + handled = true; make_ui_sound("UISndClickRelease"); } else { - handled = TRUE; + handled = true; } return handled; } -BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) { // only do sticky-focus on non-chrome widgets if (!getIsChrome()) { - setFocus(TRUE); + setFocus(true); } if (mMouseDownSignal) (*mMouseDownSignal)( this, getValueF32() ); @@ -253,23 +253,23 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) } make_ui_sound("UISndClick"); - return TRUE; + return true; } -BOOL LLSlider::handleKeyHere(KEY key, MASK mask) +bool LLSlider::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch(key) { case KEY_DOWN: case KEY_LEFT: setValueAndCommit(getValueF32() - getIncrement()); - handled = TRUE; + handled = true; break; case KEY_UP: case KEY_RIGHT: setValueAndCommit(getValueF32() + getIncrement()); - handled = TRUE; + handled = true; break; default: break; @@ -277,13 +277,13 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask) return handled; } -BOOL LLSlider::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLSlider::handleScrollWheel(S32 x, S32 y, S32 clicks) { if ( mOrientation == VERTICAL ) { F32 new_val = getValueF32() - clicks * getIncrement(); setValueAndCommit(new_val); - return TRUE; + return true; } return LLF32UICtrl::handleScrollWheel(x,y,clicks); } diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 4f4acdc50c..03fad5a05d 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -60,9 +60,9 @@ protected: friend class LLUICtrlFactory; public: virtual ~LLSlider(); - void setValue( F32 value, BOOL from_event = FALSE ); + void setValue( F32 value, bool from_event = false ); // overrides for LLF32UICtrl methods - virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } + virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), true); } virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } virtual void setMaxValue(const LLSD& max_value) { setMaxValue((F32)max_value.asReal()); } @@ -72,18 +72,18 @@ public: boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void draw(); private: void setValueAndCommit(F32 value); void updateThumbRect(); - BOOL mVolumeSlider; + bool mVolumeSlider; S32 mMouseOffset; LLRect mDragStartThumbRect; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index e16ba9408e..22579205d8 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -173,7 +173,7 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) mEditor->setFocusReceivedCallback( boost::bind(&LLSliderCtrl::onEditorGainFocus, _1, this )); // don't do this, as selecting the entire text is single clicking in some cases // and double clicking in others - //mEditor->setSelectAllonFocusReceived(TRUE); + //mEditor->setSelectAllonFocusReceived(true); addChild(mEditor); } else @@ -210,16 +210,16 @@ void LLSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata } -void LLSliderCtrl::setValue(F32 v, BOOL from_event) +void LLSliderCtrl::setValue(F32 v, bool from_event) { mSlider->setValue( v, from_event ); mValue = mSlider->getValueF32(); updateText(); } -BOOL LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - BOOL res = FALSE; + bool res = false; if (mLabelBox) { res = mLabelBox->setTextArg(key, text); @@ -319,7 +319,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) if (!self) return; - BOOL success = FALSE; + bool success = false; F32 val = self->mValue; F32 saved_val = self->mValue; @@ -333,7 +333,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) self->setValue( val ); // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { - success = TRUE; + success = true; } } } @@ -362,14 +362,14 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) if (!self) return; - BOOL success = FALSE; + bool success = false; F32 saved_val = self->mValue; F32 new_val = self->mSlider->getValueF32(); self->mValue = new_val; // set the value temporarily so that the callback can retrieve it. if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { - success = TRUE; + success = true; } if( success ) @@ -387,7 +387,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) self->updateText(); } -void LLSliderCtrl::setEnabled(BOOL b) +void LLSliderCtrl::setEnabled(bool b) { LLView::setEnabled( b ); @@ -410,7 +410,7 @@ void LLSliderCtrl::setEnabled(BOOL b) } -void LLSliderCtrl::setTentative(BOOL b) +void LLSliderCtrl::setTentative(bool b) { if( mEditor ) { @@ -422,11 +422,11 @@ void LLSliderCtrl::setTentative(BOOL b) void LLSliderCtrl::onCommit() { - setTentative(FALSE); + setTentative(false); if( mEditor ) { - mEditor->setTentative(FALSE); + mEditor->setTentative(false); } setControlValue(getValueF32()); @@ -440,7 +440,7 @@ void LLSliderCtrl::setRect(const LLRect& rect) } //virtual -void LLSliderCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLSliderCtrl::reshape(S32 width, S32 height, bool called_from_parent) { LLF32UICtrl::reshape(width, height, called_from_parent); updateSliderRect(); diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 48e59045a7..a55e3bf6e9 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -84,17 +84,17 @@ public: virtual ~LLSliderCtrl(); /*virtual*/ F32 getValueF32() const { return mSlider->getValueF32(); } - void setValue(F32 v, BOOL from_event = FALSE); + void setValue(F32 v, bool from_event = false); - /*virtual*/ void setValue(const LLSD& value) { setValue((F32)value.asReal(), TRUE); } + /*virtual*/ void setValue(const LLSD& value) { setValue((F32)value.asReal(), true); } /*virtual*/ LLSD getValue() const { return LLSD(getValueF32()); } - /*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + /*virtual*/ bool setLabelArg( const std::string& key, const LLStringExplicit& text ); - BOOL isMouseHeldDown() const { return mSlider->hasMouseCapture(); } + bool isMouseHeldDown() const { return mSlider->hasMouseCapture(); } virtual void setPrecision(S32 precision); - /*virtual*/ void setEnabled( BOOL b ); + /*virtual*/ void setEnabled( bool b ); /*virtual*/ void clear(); /*virtual*/ void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } @@ -116,7 +116,7 @@ public: /*virtual*/ void onTabInto(); - /*virtual*/ void setTentative(BOOL b); // marks value as tentative + /*virtual*/ void setTentative(bool b); // marks value as tentative /*virtual*/ void onCommit(); // mark not tentative, then commit /*virtual*/ void setControlName(const std::string& control_name, LLView* context) @@ -126,7 +126,7 @@ public: } /*virtual*/ void setRect(const LLRect& rect); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); static void onSliderCommit(LLUICtrl* caller, const LLSD& userdata); @@ -154,8 +154,8 @@ private: const LLFontGL* mFont; const LLFontGL* mLabelFont; - BOOL mShowText; - BOOL mCanEditText; + bool mShowText; + bool mCanEditText; S32 mPrecision; LLTextBox* mLabelBox; diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index b8aeb3b91f..1615db5b52 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -94,7 +94,7 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str } mHunspell->free_list(&suggestion_list, suggestion_cnt); } - return suggestions.size(); + return static_cast<S32>(suggestions.size()); } const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language) diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 888edd093e..7d41d80334 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -63,7 +63,7 @@ LLSpinCtrl::Params::Params() LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) : LLF32UICtrl(p), mLabelBox(NULL), - mbHasBeenSet( FALSE ), + mbHasBeenSet( false ), mPrecision(p.decimal_digits), mTextEnabledColor(p.text_enabled_color()), mTextDisabledColor(p.text_disabled_color()) @@ -143,12 +143,12 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) //RN: this seems to be a BAD IDEA, as it makes the editor behavior different when it has focus // than when it doesn't. Instead, if you always have to double click to select all the text, // it's easier to understand - //mEditor->setSelectAllonFocusReceived(TRUE); - mEditor->setSelectAllonCommit(FALSE); + //mEditor->setSelectAllonFocusReceived(true); + mEditor->setSelectAllonCommit(false); addChild(mEditor); updateEditor(); - setUseBoundingRect( TRUE ); + setUseBoundingRect( true ); } F32 clamp_precision(F32 value, S32 decimal_precision) @@ -275,7 +275,7 @@ void LLSpinCtrl::setValue(const LLSD& value ) F32 v = (F32)value.asReal(); if (getValueF32() != v || !mbHasBeenSet) { - mbHasBeenSet = TRUE; + mbHasBeenSet = true; LLF32UICtrl::setValue(value); if (!mEditor->hasFocus()) @@ -291,7 +291,7 @@ void LLSpinCtrl::forceSetValue(const LLSD& value ) F32 v = (F32)value.asReal(); if (getValueF32() != v || !mbHasBeenSet) { - mbHasBeenSet = TRUE; + mbHasBeenSet = true; LLF32UICtrl::setValue(value); updateEditor(); @@ -303,7 +303,7 @@ void LLSpinCtrl::clear() { setValue(mMinValue); mEditor->clear(); - mbHasBeenSet = FALSE; + mbHasBeenSet = false; } void LLSpinCtrl::updateLabelColor() @@ -333,7 +333,7 @@ void LLSpinCtrl::updateEditor() void LLSpinCtrl::onEditorCommit( const LLSD& data ) { - BOOL success = FALSE; + bool success = false; if( mEditor->evaluateFloat() ) { @@ -349,7 +349,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data ) setValue(val); if( !mValidateSignal || (*mValidateSignal)( this, val ) ) { - success = TRUE; + success = true; onCommit(); } else @@ -378,13 +378,13 @@ void LLSpinCtrl::forceEditorCommit() } -void LLSpinCtrl::setFocus(BOOL b) +void LLSpinCtrl::setFocus(bool b) { LLUICtrl::setFocus( b ); mEditor->setFocus( b ); } -void LLSpinCtrl::setEnabled(BOOL b) +void LLSpinCtrl::setEnabled(bool b) { LLView::setEnabled( b ); mEditor->setEnabled( b ); @@ -392,14 +392,14 @@ void LLSpinCtrl::setEnabled(BOOL b) } -void LLSpinCtrl::setTentative(BOOL b) +void LLSpinCtrl::setTentative(bool b) { mEditor->setTentative(b); LLUICtrl::setTentative(b); } -BOOL LLSpinCtrl::isMouseHeldDown() const +bool LLSpinCtrl::isMouseHeldDown() const { return mDownBtn->hasMouseCapture() @@ -408,7 +408,7 @@ BOOL LLSpinCtrl::isMouseHeldDown() const void LLSpinCtrl::onCommit() { - setTentative(FALSE); + setTentative(false); setControlValue(getValueF32()); LLF32UICtrl::onCommit(); } @@ -439,7 +439,7 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label) updateLabelColor(); } -void LLSpinCtrl::setAllowEdit(BOOL allow_edit) +void LLSpinCtrl::setAllowEdit(bool allow_edit) { mEditor->setEnabled(allow_edit); mAllowEdit = allow_edit; @@ -457,7 +457,7 @@ void LLSpinCtrl::reportInvalidData() make_ui_sound("UISndBadKeystroke"); } -BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) { if( clicks > 0 ) { @@ -472,10 +472,10 @@ BOOL LLSpinCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks) onUpBtn(getValue()); } - return TRUE; + return true; } -BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask) +bool LLSpinCtrl::handleKeyHere(KEY key, MASK mask) { if (mEditor->hasFocus()) { @@ -485,20 +485,20 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask) // but not allowing revert on a spinner seems dangerous updateEditor(); mEditor->resetScrollPosition(); - mEditor->setFocus(FALSE); - return TRUE; + mEditor->setFocus(false); + return true; } if(key == KEY_UP) { onUpBtn(getValue()); - return TRUE; + return true; } if(key == KEY_DOWN) { onDownBtn(getValue()); - return TRUE; + return true; } } - return FALSE; + return false; } diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 7eddc2ce4e..75f1830d80 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -66,12 +66,12 @@ public: F32 get() const { return getValueF32(); } void set(F32 value) { setValue(value); mInitialValue = value; } - BOOL isMouseHeldDown() const; + bool isMouseHeldDown() const; - virtual void setEnabled( BOOL b ); - virtual void setFocus( BOOL b ); + virtual void setEnabled( bool b ); + virtual void setFocus( bool b ); virtual void clear(); - virtual BOOL isDirty() const { return( getValueF32() != mInitialValue ); } + virtual bool isDirty() const { return( getValueF32() != mInitialValue ); } virtual void resetDirty() { mInitialValue = getValueF32(); } virtual void setPrecision(S32 precision); @@ -79,17 +79,17 @@ public: void setLabel(const LLStringExplicit& label); void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();} - void setAllowEdit(BOOL allow_edit); + void setAllowEdit(bool allow_edit); virtual void onTabInto(); - virtual void setTentative(BOOL b); // marks value as tentative + virtual void setTentative(bool b); // marks value as tentative virtual void onCommit(); // mark not tentative, then commit void forceEditorCommit(); // for commit on external button - virtual BOOL handleScrollWheel(S32 x,S32 y,S32 clicks); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleScrollWheel(S32 x,S32 y,S32 clicks); + virtual bool handleKeyHere(KEY key, MASK mask); void onEditorCommit(const LLSD& data); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); @@ -117,8 +117,8 @@ private: class LLButton* mUpBtn; class LLButton* mDownBtn; - BOOL mbHasBeenSet; - BOOL mAllowEdit; + bool mbHasBeenSet; + bool mAllowEdit; }; #endif // LL_LLSPINCTRL_H diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 5ea2eaabcd..adb1d51813 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -209,7 +209,7 @@ LLStatBar::LLStatBar(const Params& p) setStat(p.stat); } -BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask) +bool LLStatBar::handleHover(S32 x, S32 y, MASK mask) { switch(mStatType) { @@ -225,38 +225,38 @@ BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask) default: break; } - return TRUE; + return true; } -BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleMouseDown(x, y, mask); + bool handled = LLView::handleMouseDown(x, y, mask); if (!handled) { if (mDisplayBar) { if (mDisplayHistory || mOrientation == HORIZONTAL) { - mDisplayBar = FALSE; - mDisplayHistory = FALSE; + mDisplayBar = false; + mDisplayHistory = false; } else { - mDisplayHistory = TRUE; + mDisplayHistory = true; } } else { - mDisplayBar = TRUE; + mDisplayBar = true; if (mOrientation == HORIZONTAL) { - mDisplayHistory = TRUE; + mDisplayHistory = true; } } LLView* parent = getParent(); - parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); + parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), false); } - return TRUE; + return true; } template<typename T> @@ -455,7 +455,7 @@ void LLStatBar::draw() if (mDisplayHistory && mStat.valid) { - const S32 num_values = frame_recording.getNumRecordedPeriods() - 1; + const S32 num_values = static_cast<S32>(frame_recording.getNumRecordedPeriods()) - 1; F32 min_value = 0.f, max_value = 0.f; diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index e398c41601..c36a138566 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -61,8 +61,8 @@ public: LLStatBar(const Params&); virtual void draw(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); void setStat(const std::string& stat_name); diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index bf08055554..d37f927073 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -104,14 +104,14 @@ void LLStatGraph::draw() color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); gGL.color4fv(color.mV); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true); gGL.color4fv(LLColor4::black.mV); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, FALSE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, false); color = it->mColor; gGL.color4fv(color.mV); - gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE); + gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, true); } void LLStatGraph::setMin(const F32 min) diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 679cd72cd4..c254821870 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -106,7 +106,7 @@ public: private: LLTrace::StatType<LLTrace::CountAccumulator>* mNewStatFloatp; - BOOL mPerSec; + bool mPerSec; F32 mValue; diff --git a/indra/llui/llstatview.cpp b/indra/llui/llstatview.cpp index 377474084d..1c7656ecd2 100644 --- a/indra/llui/llstatview.cpp +++ b/indra/llui/llstatview.cpp @@ -40,7 +40,7 @@ LLStatView::LLStatView(const LLStatView::Params& p) : LLContainerView(p), mSetting(p.setting) { - BOOL isopen = getDisplayChildren(); + bool isopen = getDisplayChildren(); if (mSetting.length() > 0) { isopen = LLUI::getInstance()->mSettingGroups["config"]->getBOOL(mSetting); @@ -53,7 +53,7 @@ LLStatView::~LLStatView() // Children all cleaned up by default view destructor. if (mSetting.length() > 0) { - BOOL isopen = getDisplayChildren(); + bool isopen = getDisplayChildren(); LLUI::getInstance()->mSettingGroups["config"]->setBOOL(mSetting, isopen); } } diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index a8c0aa8ad6..abf6e1284b 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -73,17 +73,17 @@ void LLStyle::setLinkHREF(const std::string& href) mLink = href; } -BOOL LLStyle::isLink() const +bool LLStyle::isLink() const { return mIsLink; } -BOOL LLStyle::isVisible() const +bool LLStyle::isVisible() const { return mVisible; } -void LLStyle::setVisible(BOOL is_visible) +void LLStyle::setVisible(bool is_visible) { mVisible = is_visible; } diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index 2a60bd265e..7dbccfff87 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -61,8 +61,8 @@ public: const LLUIColor& getSelectedColor() const { return mSelectedColor; } void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; } - BOOL isVisible() const; - void setVisible(BOOL is_visible); + bool isVisible() const; + void setVisible(bool is_visible); LLFontGL::ShadowType getShadowType() const { return mDropShadow; } @@ -71,13 +71,13 @@ public: const std::string& getLinkHREF() const { return mLink; } void setLinkHREF(const std::string& href); - BOOL isLink() const; + bool isLink() const; LLPointer<LLUIImage> getImage() const; void setImage(const LLUUID& src); void setImage(const std::string& name); - BOOL isImage() const { return mImagep.notNull(); } + bool isImage() const { return mImagep.notNull(); } bool operator==(const LLStyle &rhs) const { @@ -101,7 +101,7 @@ protected: ~LLStyle() { } private: - BOOL mVisible; + bool mVisible; LLUIColor mColor; LLUIColor mReadOnlyColor; LLUIColor mSelectedColor; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 78c4f3c03c..06f584d372 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -75,7 +75,7 @@ public: mTabContainer(c), mTabPanel(p), mButton(b), - mOldState(FALSE), + mOldState(false), mPlaceholderText(placeholder), mPadding(0), mVisible(true) @@ -84,7 +84,7 @@ public: LLTabContainer* mTabContainer; LLPanel* mTabPanel; LLButton* mButton; - BOOL mOldState; + bool mOldState; LLTextBox* mPlaceholderText; S32 mPadding; @@ -233,7 +233,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) : LLPanel(p), mCurrentTabIdx(-1), mTabsHidden(p.hide_tabs), - mScrolled(FALSE), + mScrolled(false), mScrollPos(0), mScrollPosPixels(0), mMaxScrollPos(0), @@ -308,14 +308,14 @@ void LLTabContainer::setValue(const LLSD& value) } //virtual -void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLTabContainer::reshape(S32 width, S32 height, bool called_from_parent) { LLPanel::reshape( width, height, called_from_parent ); updateMaxScrollPos(); } //virtual -LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) const +LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -343,7 +343,7 @@ LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) cons } //virtual -LLView* LLTabContainer::findChildView(const std::string& name, BOOL recurse) const +LLView* LLTabContainer::findChildView(const std::string& name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -385,11 +385,11 @@ bool LLTabContainer::addChild(LLView* view, S32 tab_group) } } -BOOL LLTabContainer::postBuild() +bool LLTabContainer::postBuild() { selectFirstTab(); - return TRUE; + return true; } // virtual @@ -433,7 +433,7 @@ void LLTabContainer::draw() setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f))); - BOOL has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); + bool has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) { mJumpPrevArrowBtn->setVisible( has_scroll_arrows ); @@ -461,7 +461,7 @@ void LLTabContainer::draw() for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( FALSE ); + tuple->mButton->setVisible( false ); } } @@ -480,7 +480,7 @@ void LLTabContainer::draw() for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); + tuple->mButton->setVisible( true ); } S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos(); @@ -506,14 +506,14 @@ void LLTabContainer::draw() { if( tuple->mButton->getFlashing() ) { - mPrevArrowBtn->setFlashing( TRUE ); + mPrevArrowBtn->setFlashing( true ); } } else if( max_scroll_visible < idx ) { if( tuple->mButton->getFlashing() ) { - mNextArrowBtn->setFlashing( TRUE ); + mNextArrowBtn->setFlashing( true ); } } } @@ -543,11 +543,11 @@ void LLTabContainer::draw() // virtual -BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -606,7 +606,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) index = llclamp(index, 0, tab_count-1); LLButton* tab_button = getTab(index)->mButton; gFocusMgr.setMouseCapture(this); - tab_button->setFocus(TRUE); + tab_button->setFocus(true); mMouseDownTimer.start(); } } @@ -619,10 +619,10 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -665,10 +665,10 @@ BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; @@ -712,11 +712,11 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { if (cur_panel) { - if (!cur_panel->focusFirstItem(FALSE)) + if (!cur_panel->focusFirstItem(false)) { // if nothing in the panel gets focus, make sure the new tab does // otherwise the last tab might keep focus - getTab(getCurrentPanelIndex())->mButton->setFocus(TRUE); + getTab(getCurrentPanelIndex())->mButton->setFocus(true); } } gFocusMgr.setMouseCapture(NULL); @@ -729,15 +729,15 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) +bool LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL handled = LLPanel::handleToolTip( x, y, mask); + bool handled = LLPanel::handleToolTip( x, y, mask); if (!handled && getTabCount() > 0 && !getTabsHidden()) { LLTabTuple* firsttuple = getTab(0); - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); LLRect clip; if (mIsVertical) { @@ -774,25 +774,25 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) } // virtual -BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) +bool LLTabContainer::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (key == KEY_LEFT && mask == MASK_ALT) { selectPrevTab(); - handled = TRUE; + handled = true; } else if (key == KEY_RIGHT && mask == MASK_ALT) { selectNextTab(); - handled = TRUE; + handled = true; } if (handled) { if (getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } } @@ -805,21 +805,21 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) { case KEY_UP: selectPrevTab(); - handled = TRUE; + handled = true; break; case KEY_DOWN: selectNextTab(); - handled = TRUE; + handled = true; break; case KEY_LEFT: - handled = TRUE; + handled = true; break; case KEY_RIGHT: if (getTabPosition() == LEFT && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; default: break; @@ -832,24 +832,24 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) case KEY_UP: if (getTabPosition() == BOTTOM && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; case KEY_DOWN: if (getTabPosition() == TOP && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; case KEY_LEFT: selectPrevTab(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: selectNextTab(); - handled = TRUE; + handled = true; break; default: break; @@ -860,9 +860,9 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) } // virtual -BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) +bool LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); if(mOpenTabsOnDragAndDrop && !getTabsHidden()) { @@ -903,7 +903,7 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDra for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); + tuple->mButton->setVisible( true ); S32 local_x = x - tuple->mButton->getRect().mLeft; S32 local_y = y - tuple->mButton->getRect().mBottom; if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) @@ -966,9 +966,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) const std::string& label = panel.label.isProvided() ? panel.label() : panel.panel()->getLabel(); - BOOL select = panel.select_tab(); + bool select = panel.select_tab(); S32 indent = panel.indent(); - BOOL placeholder = panel.is_placeholder; + bool placeholder = panel.is_placeholder; eInsertionPoint insertion_point = panel.insert_at(); static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); @@ -1031,10 +1031,10 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) } child->setFollowsAll(); child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom); - child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE ); + child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), true ); // add this child later - child->setVisible( FALSE ); // Will be made visible when selected + child->setVisible( false ); // Will be made visible when selected mTotalTabWidth += button_width; @@ -1256,7 +1256,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) } } - BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); + bool has_focus = gFocusMgr.childHasKeyboardFocus(this); // If the tab being deleted is the selected one, select a different tab. for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) @@ -1298,7 +1298,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) if (mCurrentTabIdx >= (S32)mTabList.size()) { - mCurrentTabIdx = mTabList.size()-1; + mCurrentTabIdx = static_cast<S32>(mTabList.size()) - 1; } selectTab(mCurrentTabIdx); if (has_focus) @@ -1306,7 +1306,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) LLPanel* panelp = getPanelByIndex(mCurrentTabIdx); if (panelp) { - panelp->setFocus(TRUE); + panelp->setFocus(true); } } @@ -1325,7 +1325,7 @@ void LLTabContainer::unlockTabs() mLockedTabCount = 0; } -void LLTabContainer::enableTabButton(S32 which, BOOL enable) +void LLTabContainer::enableTabButton(S32 which, bool enable) { if (which >= 0 && which < (S32)mTabList.size()) { @@ -1377,7 +1377,7 @@ S32 LLTabContainer::getCurrentPanelIndex() S32 LLTabContainer::getTabCount() { - return mTabList.size(); + return static_cast<S32>(mTabList.size()); } LLPanel* LLTabContainer::getPanelByIndex(S32 index) @@ -1444,7 +1444,7 @@ void LLTabContainer::selectFirstTab() void LLTabContainer::selectLastTab() { - selectTab( mTabList.size()-1 ); + selectTab(static_cast<S32>(mTabList.size()) - 1); } void LLTabContainer::selectNextTab() @@ -1454,10 +1454,10 @@ void LLTabContainer::selectNextTab() return; } - BOOL tab_has_focus = FALSE; + bool tab_has_focus = false; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { - tab_has_focus = TRUE; + tab_has_focus = true; } S32 idx = mCurrentTabIdx+1; if (idx >= (S32)mTabList.size()) @@ -1469,33 +1469,33 @@ void LLTabContainer::selectNextTab() if (tab_has_focus) { - mTabList[idx]->mButton->setFocus(TRUE); + mTabList[idx]->mButton->setFocus(true); } } void LLTabContainer::selectPrevTab() { - BOOL tab_has_focus = FALSE; + bool tab_has_focus = false; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { - tab_has_focus = TRUE; + tab_has_focus = true; } S32 idx = mCurrentTabIdx-1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; while (!selectTab(idx) && idx != mCurrentTabIdx) { idx = idx - 1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; } if (tab_has_focus) { - mTabList[idx]->mButton->setFocus(TRUE); + mTabList[idx]->mButton->setFocus(true); } } -BOOL LLTabContainer::selectTabPanel(LLPanel* child) +bool LLTabContainer::selectTabPanel(LLPanel* child) { S32 idx = 0; for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) @@ -1507,23 +1507,23 @@ BOOL LLTabContainer::selectTabPanel(LLPanel* child) } idx++; } - return FALSE; + return false; } -BOOL LLTabContainer::selectTab(S32 which) +bool LLTabContainer::selectTab(S32 which) { if (which >= getTabCount() || which < 0) - return FALSE; + return false; LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) - return FALSE; + return false; LLSD cbdata; if (selected_tuple->mTabPanel) cbdata = selected_tuple->mTabPanel->getName(); - BOOL result = FALSE; + bool result = false; if (!mValidateSignal || (*mValidateSignal)(this, cbdata)) { result = setTab(which); @@ -1537,16 +1537,16 @@ BOOL LLTabContainer::selectTab(S32 which) } // private -BOOL LLTabContainer::setTab(S32 which) +bool LLTabContainer::setTab(S32 which) { static LLUICachedControl<S32> tabcntr_arrow_btn_size ("UITabCntrArrowBtnSize", 0); LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) { - return FALSE; + return false; } - BOOL is_visible = FALSE; + bool is_visible = false; if( selected_tuple->mButton->getEnabled() && selected_tuple->mVisible ) { setCurrentPanelIndex(which); @@ -1555,7 +1555,7 @@ BOOL LLTabContainer::setTab(S32 which) for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - BOOL is_selected = ( tuple == selected_tuple ); + bool is_selected = ( tuple == selected_tuple ); // Although the selected tab must be complete, we may have hollow LLTabTuple tucked in the list if (tuple && tuple->mButton) { @@ -1582,11 +1582,11 @@ BOOL LLTabContainer::setTab(S32 which) if( i >= getScrollPos() && i <= getScrollPos() + num_visible) { setCurrentPanelIndex(which); - is_visible = TRUE; + is_visible = true; } else { - is_visible = FALSE; + is_visible = false; } } else if (!mHideScrollArrows && getMaxScrollPos() > 0) @@ -1618,11 +1618,11 @@ BOOL LLTabContainer::setTab(S32 which) setScrollPos(llclamp(getScrollPos(), min_scroll_pos, i)); setScrollPos(llmin(getScrollPos(), getMaxScrollPos())); } - is_visible = TRUE; + is_visible = true; } else { - is_visible = TRUE; + is_visible = true; } } i++; @@ -1631,36 +1631,36 @@ BOOL LLTabContainer::setTab(S32 which) if (mIsVertical && getCurrentPanelIndex() >= 0) { LLTabTuple* tuple = getTab(getCurrentPanelIndex()); - tuple->mTabPanel->setVisible( TRUE ); - tuple->mButton->setToggleState( TRUE ); + tuple->mTabPanel->setVisible( true ); + tuple->mButton->setToggleState( true ); } return is_visible; } -BOOL LLTabContainer::selectTabByName(const std::string& name) +bool LLTabContainer::selectTabByName(const std::string& name) { LLPanel* panel = getPanelByName(name); if (!panel) { LL_WARNS() << "LLTabContainer::selectTabByName(" << name << ") failed" << LL_ENDL; - return FALSE; + return false; } - BOOL result = selectTabPanel(panel); + bool result = selectTabPanel(panel); return result; } -BOOL LLTabContainer::getTabPanelFlashing(LLPanel *child) +bool LLTabContainer::getTabPanelFlashing(LLPanel *child) { LLTabTuple* tuple = getTabByPanel(child); if( tuple ) { return tuple->mButton->getFlashing(); } - return FALSE; + return false; } -void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state ) +void LLTabContainer::setTabPanelFlashing(LLPanel* child, bool state ) { LLTabTuple* tuple = getTabByPanel(child); if( tuple ) @@ -1810,7 +1810,7 @@ void LLTabContainer::onTabBtn( const LLSD& data, LLPanel* panel ) if (tuple) { - tuple->mTabPanel->setFocus(TRUE); + tuple->mTabPanel->setFocus(true); } } @@ -1820,7 +1820,7 @@ void LLTabContainer::onNextBtn( const LLSD& data ) { scrollNext(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx < mTabList.size()-1) { @@ -1839,7 +1839,7 @@ void LLTabContainer::onNextBtnHeld( const LLSD& data ) { selectNextTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -1849,7 +1849,7 @@ void LLTabContainer::onPrevBtn( const LLSD& data ) { scrollPrev(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx > 0) { @@ -1878,7 +1878,7 @@ void LLTabContainer::onPrevBtnHeld( const LLSD& data ) { selectPrevTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -2008,21 +2008,21 @@ void LLTabContainer::initButtons() } } - mPrevArrowBtn->setTabStop(FALSE); + mPrevArrowBtn->setTabStop(false); addChild(mPrevArrowBtn); - mNextArrowBtn->setTabStop(FALSE); + mNextArrowBtn->setTabStop(false); addChild(mNextArrowBtn); if (mJumpPrevArrowBtn) { - mJumpPrevArrowBtn->setTabStop(FALSE); + mJumpPrevArrowBtn->setTabStop(false); addChild(mJumpPrevArrowBtn); } if (mJumpNextArrowBtn) { - mJumpNextArrowBtn->setTabStop(FALSE); + mJumpNextArrowBtn->setTabStop(false); addChild(mJumpNextArrowBtn); } @@ -2087,7 +2087,7 @@ void LLTabContainer::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_p void LLTabContainer::updateMaxScrollPos() { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL no_scroll = TRUE; + bool no_scroll = true; if (mIsVertical) { S32 tab_total_height = (BTN_HEIGHT + tabcntrv_pad) * getTabCount(); @@ -2098,7 +2098,7 @@ void LLTabContainer::updateMaxScrollPos() S32 available_height_with_arrows = getRect().getHeight() - 2*(tabcntrv_arrow_btn_size + 3*tabcntrv_pad) - mNextArrowBtn->getRect().mBottom; S32 additional_needed = tab_total_height - available_height_with_arrows; setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT + tabcntrv_pad) ) ); - no_scroll = FALSE; + no_scroll = false; } } else @@ -2130,7 +2130,7 @@ void LLTabContainer::updateMaxScrollPos() } // in case last tab doesn't actually fit on screen, make it the last scrolling position setMaxScrollPos(llmin(getMaxScrollPos(), getTabCount() - 1)); - no_scroll = FALSE; + no_scroll = false; } } if (no_scroll) @@ -2196,9 +2196,9 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible ) } if( foundTab ) - this->setVisible( TRUE ); + this->setVisible( true ); else - this->setVisible( FALSE ); + this->setVisible( false ); updateMaxScrollPos(); } diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 626255be8c..b22eec2fe5 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -132,28 +132,28 @@ protected: public: //LLTabContainer( const std::string& name, const LLRect& rect, TabPosition pos, - // BOOL bordered, BOOL is_vertical); + // bool bordered, bool is_vertical); /*virtual*/ ~LLTabContainer(); // from LLView /*virtual*/ void setValue(const LLSD& value); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); /*virtual*/ void draw(); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + /*virtual*/ bool handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleMouseUp( S32 x, S32 y, MASK mask ); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType type, void* cargo_data, EAcceptance* accept, std::string& tooltip); - /*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const; - /*virtual*/ LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const; + /*virtual*/ LLView* getChildView(const std::string& name, bool recurse = true) const; + /*virtual*/ LLView* findChildView(const std::string& name, bool recurse = true) const; /*virtual*/ void initFromParams(const LLPanel::Params& p); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); struct TabPanelParams : public LLInitParam::Block<TabPanelParams> { @@ -183,7 +183,7 @@ public: void lockTabs(S32 num_tabs = 0); void unlockTabs(); S32 getNumLockedTabs() { return mLockedTabCount; } - void enableTabButton(S32 which, BOOL enable); + void enableTabButton(S32 which, bool enable); void deleteAllTabs(); LLPanel* getCurrentPanel(); S32 getCurrentPanelIndex(); @@ -199,13 +199,13 @@ public: void selectLastTab(); void selectNextTab(); void selectPrevTab(); - BOOL selectTabPanel( LLPanel* child ); - BOOL selectTab(S32 which); - BOOL selectTabByName(const std::string& title); + bool selectTabPanel( LLPanel* child ); + bool selectTab(S32 which); + bool selectTabByName(const std::string& title); void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } - BOOL getTabPanelFlashing(LLPanel* child); - void setTabPanelFlashing(LLPanel* child, BOOL state); + bool getTabPanelFlashing(LLPanel* child); + void setTabPanelFlashing(LLPanel* child, bool state); void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, LLIconCtrl* icon); @@ -240,7 +240,7 @@ private: void initButtons(); - BOOL setTab(S32 which); + bool setTab(S32 which); LLTabTuple* getTab(S32 index) { return mTabList[index]; } LLTabTuple* getTabByPanel(LLPanel* child); @@ -253,8 +253,8 @@ private: S32 getScrollPosPixels() const { return mScrollPosPixels; } void setScrollPosPixels(S32 pixels) { mScrollPosPixels = pixels; } - void setTabsHidden(BOOL hidden) { mTabsHidden = hidden; } - BOOL getTabsHidden() const { return mTabsHidden; } + void setTabsHidden(bool hidden) { mTabsHidden = hidden; } + bool getTabsHidden() const { return mTabsHidden; } void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap @@ -272,10 +272,10 @@ private: tuple_list_t mTabList; S32 mCurrentTabIdx; - BOOL mTabsHidden; - BOOL mHideScrollArrows; + bool mTabsHidden; + bool mHideScrollArrows; - BOOL mScrolled; + bool mScrolled; LLFrameTimer mScrollTimer; S32 mScrollPos; S32 mScrollPosPixels; @@ -290,7 +290,7 @@ private: LLButton* mPrevArrowBtn; LLButton* mNextArrowBtn; - BOOL mIsVertical; + bool mIsVertical; // Horizontal specific LLButton* mJumpPrevArrowBtn; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c1eedf93a7..1d358a0e9d 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -207,7 +207,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mSelectedBGColor(p.bg_selected_color), mReflowIndex(S32_MAX), mCursorPos( 0 ), - mScrollNeeded(FALSE), + mScrollNeeded(false), mDesiredXPixel(-1), mHPad(p.h_pad), mVPad(p.v_pad), @@ -224,7 +224,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mScrollIndex(-1), mSelectionStart( 0 ), mSelectionEnd( 0 ), - mIsSelecting( FALSE ), + mIsSelecting( false ), mPlainText ( p.plain_text ), mWordWrap(p.wrap), mUseEllipses( p.use_ellipses ), @@ -309,7 +309,7 @@ void LLTextBase::initFromParams(const LLTextBase::Params& p) bool LLTextBase::truncate() { - BOOL did_truncate = FALSE; + bool did_truncate = false; // First rough check - if we're less than 1/4th the size, we're OK if (getLength() >= S32(mMaxTextByteLength / 4)) @@ -320,12 +320,12 @@ bool LLTextBase::truncate() if (value.type() == LLSD::TypeString) { // save a copy for strings. - utf8_byte_size = value.size(); + utf8_byte_size = static_cast<S32>(value.size()); } else { // non string LLSDs need explicit conversion to string - utf8_byte_size = value.asString().size(); + utf8_byte_size = static_cast<S32>(value.asString().size()); } if ( utf8_byte_size > mMaxTextByteLength ) @@ -335,8 +335,8 @@ bool LLTextBase::truncate() temp_utf8_text = utf8str_truncate( temp_utf8_text, mMaxTextByteLength ); LLWString text = utf8str_to_wstring( temp_utf8_text ); // remove extra bit of current string, to preserve formatting, etc. - removeStringNoUndo(text.size(), getWText().size() - text.size()); - did_truncate = TRUE; + removeStringNoUndo(static_cast<S32>(text.size()), static_cast<S32>(getWText().size() - text.size())); + did_truncate = true; } } @@ -617,7 +617,7 @@ void LLTextBase::drawText() } else if (useLabel()) { - text_len = mLabel.getWString().length(); + text_len = static_cast<S32>(mLabel.getWString().length()); } S32 selection_left = -1; @@ -686,7 +686,7 @@ void LLTextBase::drawText() // Find the start of the first word U32 word_start = seg_start, word_end = -1; - U32 text_length = wstrText.length(); + U32 text_length = static_cast<U32>(wstrText.length()); while ( (word_start < text_length) && (!LLStringOps::isAlpha(wstrText[word_start])) ) { word_start++; @@ -789,7 +789,7 @@ void LLTextBase::drawText() } // Draw squiggly lines under any visible misspelled words - while ( (mMisspellRanges.end() != misspell_it) && (misspell_it->first < seg_end) && (misspell_it->second > seg_start) ) + while ( (mMisspellRanges.end() != misspell_it) && (misspell_it->first < (U32)seg_end) && (misspell_it->second > (U32)seg_start) ) { // Skip the current word if the user is still busy editing it if ( (!mSpellCheckTimer.hasExpired()) && (misspell_it->first <= (U32)mCursorPos) && (misspell_it->second >= (U32)mCursorPos) ) @@ -798,7 +798,7 @@ void LLTextBase::drawText() continue; } - U32 misspell_start = llmax<U32>(misspell_it->first, seg_start), misspell_end = llmin<U32>(misspell_it->second, seg_end); + U32 misspell_start = llmax<U32>(misspell_it->first, (U32)seg_start), misspell_end = llmin<U32>(misspell_it->second, (U32)seg_end); S32 squiggle_start = 0, squiggle_end = 0, pony = 0; cur_segment->getDimensions(seg_start - cur_segment->getStart(), misspell_start - seg_start, squiggle_start, pony); cur_segment->getDimensions(misspell_start - cur_segment->getStart(), misspell_end - misspell_start, squiggle_end, pony); @@ -821,7 +821,7 @@ void LLTextBase::drawText() squiggle_start += 4; } - if (misspell_it->second > seg_end) + if (misspell_it->second > (U32)seg_end) { break; } @@ -845,9 +845,16 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s beforeValueChange(); S32 old_len = getLength(); // length() returns character length - S32 insert_len = wstr.length(); + S32 insert_len = static_cast<S32>(wstr.length()); pos = getEditableIndex(pos, true); + if (pos > old_len) + { + pos = old_len; + // Should not happen, + // if you encounter this, check where wrong position comes from + llassert(false); + } segment_set_t::iterator seg_iter = getEditableSegIterContaining(pos); @@ -909,7 +916,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s { LLStyleSP emoji_style; LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : NULL; - for (S32 text_kitty = 0, text_len = wstr.size(); text_kitty < text_len; text_kitty++) + for (S32 text_kitty = 0, text_len = static_cast<S32>(wstr.size()); text_kitty < text_len; text_kitty++) { llwchar code = wstr[text_kitty]; bool isEmoji = ed ? ed->isEmoji(code) : LLStringOps::isEmoji(code); @@ -1111,14 +1118,14 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert) } //virtual -BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) { // handle triple click if (!mTripleClickTimer.hasExpired()) { if (mSkipTripleClick) { - return TRUE; + return true; } S32 real_line = getLineNumFromDocIndex(mCursorPos, false); @@ -1146,27 +1153,27 @@ BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) if (line_start == -1) { - return TRUE; + return true; } mSelectionEnd = line_start; mSelectionStart = line_end; setCursorPos(line_start); - return TRUE; + return true; } LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleMouseDown(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleMouseDown(x, y, mask); } //virtual -BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (hasMouseCapture() && cur_segment && cur_segment->handleMouseUp(x, y, mask)) @@ -1179,62 +1186,62 @@ BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask) // *TODO: send URL here? (*mURLClickSignal)(this, LLSD() ); } - return TRUE; + return true; } return LLUICtrl::handleMouseUp(x, y, mask); } //virtual -BOOL LLTextBase::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleMiddleMouseDown(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleMiddleMouseDown(x, y, mask); } //virtual -BOOL LLTextBase::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBase::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleMiddleMouseUp(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleMiddleMouseUp(x, y, mask); } //virtual -BOOL LLTextBase::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLTextBase::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleRightMouseDown(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleRightMouseDown(x, y, mask); } //virtual -BOOL LLTextBase::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLTextBase::handleRightMouseUp(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleRightMouseUp(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleRightMouseUp(x, y, mask); } //virtual -BOOL LLTextBase::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLTextBase::handleDoubleClick(S32 x, S32 y, MASK mask) { //Don't start triple click timer if user have clicked on scrollbar mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect(); @@ -1247,50 +1254,50 @@ BOOL LLTextBase::handleDoubleClick(S32 x, S32 y, MASK mask) LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleDoubleClick(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleDoubleClick(x, y, mask); } //virtual -BOOL LLTextBase::handleHover(S32 x, S32 y, MASK mask) +bool LLTextBase::handleHover(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleHover(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleHover(x, y, mask); } //virtual -BOOL LLTextBase::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLTextBase::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleScrollWheel(x, y, clicks)) { - return TRUE; + return true; } return LLUICtrl::handleScrollWheel(x, y, clicks); } //virtual -BOOL LLTextBase::handleToolTip(S32 x, S32 y, MASK mask) +bool LLTextBase::handleToolTip(S32 x, S32 y, MASK mask) { LLTextSegmentPtr cur_segment = getSegmentAtLocalPos(x, y); if (cur_segment && cur_segment->handleToolTip(x, y, mask)) { - return TRUE; + return true; } return LLUICtrl::handleToolTip(x, y, mask); } //virtual -void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLTextBase::reshape(S32 width, S32 height, bool called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight() || LLView::sForceReshape) { @@ -1366,7 +1373,7 @@ void LLTextBase::draw() : hasFocus() ? mFocusBgColor.get() : mWriteableBgColor.get(); - gl_rect_2d(text_rect, bg_color % alpha, TRUE); + gl_rect_2d(text_rect, bg_color % alpha, true); } // Draw highlighted if needed @@ -1377,7 +1384,7 @@ void LLTextBase::draw() if( mScroller ) bg_rect.intersectWith( text_rect ); - gl_rect_2d( text_rect, bg_color, TRUE ); + gl_rect_2d( text_rect, bg_color, true ); } bool should_clip = mClip || mScroller != NULL; @@ -1398,9 +1405,9 @@ void LLTextBase::draw() drawCursor(); } - mDocumentView->setVisibleDirect(FALSE); + mDocumentView->setVisibleDirect(false); LLUICtrl::draw(); - mDocumentView->setVisibleDirect(TRUE); + mDocumentView->setVisibleDirect(true); } @@ -1419,7 +1426,7 @@ void LLTextBase::setReadOnlyColor(const LLColor4 &c) } //virtual -void LLTextBase::onVisibilityChange( BOOL new_visibility ) +void LLTextBase::onVisibilityChange( bool new_visibility ) { LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get()); if(!new_visibility && menu) @@ -1436,7 +1443,7 @@ void LLTextBase::setValue(const LLSD& value ) } //virtual -BOOL LLTextBase::canDeselect() const +bool LLTextBase::canDeselect() const { return hasSelection(); } @@ -1447,7 +1454,7 @@ void LLTextBase::deselect() { mSelectionStart = 0; mSelectionEnd = 0; - mIsSelecting = FALSE; + mIsSelecting = false; } bool LLTextBase::getSpellCheck() const @@ -1462,7 +1469,7 @@ const std::string& LLTextBase::getSuggestion(U32 index) const U32 LLTextBase::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast<U32>(mSuggestionList.size()); } void LLTextBase::replaceWithSuggestion(U32 index) @@ -1575,7 +1582,7 @@ void LLTextBase::updateScrollFromCursor() { return; } - mScrollNeeded = FALSE; + mScrollNeeded = false; // scroll so that the cursor is at the top of the page LLRect scroller_doc_window = getVisibleDocumentRect(); @@ -2055,7 +2062,7 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 i LLTextSegmentPtr LLTextBase::getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line) { // Find the cursor position at the requested local screen position - S32 offset = getDocIndexFromLocalCoord( x, y, FALSE, hit_past_end_of_line); + S32 offset = getDocIndexFromLocalCoord( x, y, false, hit_past_end_of_line); segment_set_t::iterator seg_iter = getSegIterContaining(offset); if (seg_iter != mSegments.end()) { @@ -2312,10 +2319,10 @@ void LLTextBase::setLabel(const LLStringExplicit& label) resetLabel(); } -BOOL LLTextBase::setLabelArg(const std::string& key, const LLStringExplicit& text ) +bool LLTextBase::setLabelArg(const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); - return TRUE; + return true; } void LLTextBase::resetLabel() @@ -2328,7 +2335,7 @@ void LLTextBase::resetLabel() style->setColor(mTentativeFgColor); LLStyleConstSP sp(style); - LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, mLabel.getWString().length() + 1, *this); + LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, static_cast<S32>(mLabel.getWString().length()) + 1, *this); insertSegment(label); } } @@ -2388,7 +2395,7 @@ void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const s { segment_vec_t segments; LLWString widget_wide_text = utf8str_to_wstring(text); - segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size())); + segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + static_cast<S32>(widget_wide_text.size()))); insertStringNoUndo(getLength(), widget_wide_text, &segments); } @@ -2398,10 +2405,10 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig // 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(); @@ -2429,11 +2436,11 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig { highlight_params.font.style("NORMAL"); LLStyleConstSP normal_sp(new LLStyle(highlight_params)); - segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + static_cast<S32>(wide_text.size()), *this); } else { - segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + static_cast<S32>(wide_text.size()), *this); } segment_vec_t segments; segments.push_back(segmentp); @@ -2447,7 +2454,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig segment_vec_t segments; S32 segment_start = old_length; - S32 segment_end = old_length + wide_text.size(); + S32 segment_end = old_length + static_cast<S32>(wide_text.size()); LLStyleConstSP sp(new LLStyle(style_params)); if (underline_on_hover_only || mSkipLinkUnderline) { @@ -2538,7 +2545,7 @@ void LLTextBase::replaceUrl(const std::string &url, S32 start = seg->getStart(); S32 end = seg->getEnd(); text = text.substr(0, start) + wlabel + text.substr(end, text.size() - end + 1); - seg->setEnd(start + wlabel.size()); + seg->setEnd(start + static_cast<S32>(wlabel.size())); modified = true; } @@ -2586,7 +2593,7 @@ const LLWString& LLTextBase::getWText() const // will be put to its right. If round is false, the cursor will always be put to the // character's left. -S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line) const +S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, bool hit_past_end_of_line) const { // Figure out which line we're nearest to. LLRect doc_rect = mDocumentView->getRect(); @@ -2866,7 +2873,7 @@ void LLTextBase::changeLine( S32 delta ) { LLRect visible_region = getVisibleDocumentRect(); S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, - mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, TRUE); + mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, true); S32 actual_line = getLineNumFromDocIndex(new_cursor_pos); if (actual_line != new_line) { @@ -2891,7 +2898,7 @@ bool LLTextBase::setCursor(S32 row, S32 column) { if (row < 0 || column < 0) return false; - S32 n_lines = mLineInfoList.size(); + S32 n_lines = static_cast<S32>(mLineInfoList.size()); for (S32 line = row; line < n_lines; ++line) { const line_info& li = mLineInfoList[line]; @@ -3129,7 +3136,7 @@ void LLTextBase::startSelection() { if( !mIsSelecting ) { - mIsSelecting = TRUE; + mIsSelecting = true; mSelectionStart = mCursorPos; mSelectionEnd = mCursorPos; } @@ -3139,7 +3146,7 @@ void LLTextBase::endSelection() { if( mIsSelecting ) { - mIsSelecting = FALSE; + mIsSelecting = false; mSelectionEnd = mCursorPos; } } @@ -3248,17 +3255,17 @@ void LLTextSegment::setToken( LLKeywordToken* token ) {} LLKeywordToken* LLTextSegment::getToken() const { return NULL; } void LLTextSegment::setToolTip( const std::string &msg ) {} void LLTextSegment::dump() const {} -BOOL LLTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return FALSE; } -BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; } -BOOL LLTextSegment::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return FALSE; } -BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; } +bool LLTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleRightMouseUp(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return false; } +bool LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return false; } +bool LLTextSegment::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return false; } +bool LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return false; } const std::string& LLTextSegment::getName() const { return LLStringUtil::null; @@ -3266,7 +3273,7 @@ const std::string& LLTextSegment::getName() const void LLTextSegment::onMouseCaptureLost() {} void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {} void LLTextSegment::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {} -BOOL LLTextSegment::hasMouseCapture() { return FALSE; } +bool LLTextSegment::hasMouseCapture() { return false; } // // LLNormalTextSegment @@ -3287,7 +3294,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e } } -LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) +LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLTextSegment(start, end), mToken(NULL), mEditor(editor) @@ -3387,7 +3394,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele return right_x; } -BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3395,13 +3402,13 @@ BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3409,13 +3416,13 @@ BOOL LLNormalTextSegment::handleRightMouseDown(S32 x, S32 y, MASK mask) if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { mEditor.createUrlContextMenu(x, y, getStyle()->getLinkHREF()); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3423,14 +3430,14 @@ BOOL LLNormalTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { // eat mouse down event on hyperlinks, so we get the mouse up - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { if (getStyle() && getStyle()->isLink()) { @@ -3446,14 +3453,14 @@ BOOL LLNormalTextSegment::handleMouseUp(S32 x, S32 y, MASK mask) { LLUrlAction::openURLExternal(url); } - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) +bool LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { std::string msg; // do we have a tooltip for a loaded keyword (for script editor)? @@ -3461,16 +3468,16 @@ BOOL LLNormalTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { const LLWString& wmsg = mToken->getToolTip(); LLToolTipMgr::instance().show(wstring_to_utf8str(wmsg), (mToken->getType() == LLKeywordToken::TT_FUNCTION)); - return TRUE; + return true; } // or do we have an explicitly set tooltip (e.g., for Urls) if (!mTooltip.empty()) { LLToolTipMgr::instance().show(mTooltip); - return TRUE; + return true; } - return FALSE; + return false; } void LLNormalTextSegment::setToolTip(const std::string& tooltip) @@ -3530,7 +3537,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin : LLFontGL::ONLY_WORD_BOUNDARIES; - S32 offsetLength = text.length() - (segment_offset + mStart); + S32 offsetLength = static_cast<S32>(text.length()) - (segment_offset + mStart); if(getLength() < segment_offset + mStart) { @@ -3572,9 +3579,9 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin void LLNormalTextSegment::dump() const { LL_INFOS() << "Segment [" << -// mColor.mV[VX] << ", " << -// mColor.mV[VY] << ", " << -// mColor.mV[VZ] << "]\t[" << +// mColor.mV[VRED] << ", " << +// mColor.mV[VGREEN] << ", " << +// mColor.mV[VBLUE] << "]\t[" << mStart << ", " << getEnd() << "]" << LL_ENDL; @@ -3597,7 +3604,7 @@ LLLabelTextSegment::LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end { } -LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) +LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } @@ -3610,7 +3617,7 @@ const LLWString& LLLabelTextSegment::getWText() const /*virtual*/ const S32 LLLabelTextSegment::getLength() const { - return mEditor.getWlabel().length(); + return static_cast<S32>(mEditor.getWlabel().length()); } // @@ -3621,12 +3628,12 @@ LLEmojiTextSegment::LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, { } -LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) +LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } -BOOL LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask) +bool LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { if (mTooltip.empty()) { @@ -3661,7 +3668,7 @@ F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start } /*virtual*/ -BOOL LLOnHoverChangeableTextSegment::handleHover(S32 x, S32 y, MASK mask) +bool LLOnHoverChangeableTextSegment::handleHover(S32 x, S32 y, MASK mask) { mStyle = mEditor.getSkipLinkUnderline() ? mNormalStyle : mHoveredStyle; return LLNormalTextSegment::handleHover(x, y, mask); @@ -3836,15 +3843,15 @@ S32 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin return 0; } -BOOL LLImageTextSegment::handleToolTip(S32 x, S32 y, MASK mask) +bool LLImageTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { if (!mTooltip.empty()) { LLToolTipMgr::instance().show(mTooltip); - return TRUE; + return true; } - return FALSE; + return false; } void LLImageTextSegment::setToolTip(const std::string& tooltip) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 97507fe800..4120d9ea32 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -94,22 +94,22 @@ public: virtual void dump() const; // LLMouseHandler interface - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - /*virtual*/ BOOL hasMouseCapture(); + /*virtual*/ bool hasMouseCapture(); S32 getStart() const { return mStart; } void setStart(S32 start) { mStart = start; } @@ -125,7 +125,7 @@ class LLNormalTextSegment : public LLTextSegment { public: LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); virtual ~LLNormalTextSegment(); /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; @@ -138,15 +138,15 @@ public: /*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; } /*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; } /*virtual*/ LLKeywordToken* getToken() const { return mToken; } - /*virtual*/ BOOL getToolTip( std::string& msg ) const; + /*virtual*/ bool getToolTip( std::string& msg ) const; /*virtual*/ void setToolTip(const std::string& tooltip); /*virtual*/ void dump() const; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); protected: F32 drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRectf rect); @@ -170,7 +170,7 @@ class LLLabelTextSegment : public LLNormalTextSegment { public: LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); protected: @@ -184,10 +184,10 @@ class LLEmojiTextSegment : public LLNormalTextSegment { public: LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor); - LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); bool canEdit() const override { return false; } - BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + bool handleToolTip(S32 x, S32 y, MASK mask) override; }; // Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment) @@ -196,7 +196,7 @@ class LLOnHoverChangeableTextSegment : public LLNormalTextSegment public: LLOnHoverChangeableTextSegment( LLStyleConstSP style, LLStyleConstSP normal_style, S32 start, S32 end, LLTextBase& editor ); /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); protected: // Style used for text when mouse pointer is over segment LLStyleConstSP mHoveredStyle; @@ -267,7 +267,7 @@ public: S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 char_offset, S32 max_chars, S32 line_ind) const; F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ void setToolTip(const std::string& tooltip); private: @@ -355,32 +355,32 @@ public: }; // LLMouseHandler interface - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks) override; + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask) override; // LLView interface - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override; + /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true) override; /*virtual*/ void draw() override; // LLUICtrl interface - /*virtual*/ BOOL acceptsTextInput() const override { return !mReadOnly; } + /*virtual*/ bool acceptsTextInput() const override { return !mReadOnly; } /*virtual*/ void setColor(const LLColor4& c) override; virtual void setReadOnlyColor(const LLColor4 &c); - /*virtual*/ void onVisibilityChange(BOOL new_visibility) override; + /*virtual*/ void onVisibilityChange(bool new_visibility) override; /*virtual*/ void setValue(const LLSD& value) override; /*virtual*/ LLTextViewModel* getViewModel() const override; // LLEditMenuHandler interface - /*virtual*/ BOOL canDeselect() const override; + /*virtual*/ bool canDeselect() const override; /*virtual*/ void deselect() override; virtual void onFocusReceived() override; @@ -436,7 +436,7 @@ public: void appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params()); void setLabel(const LLStringExplicit& label); - /*virtual*/ BOOL setLabelArg(const std::string& key, const LLStringExplicit& text) override; + /*virtual*/ bool setLabelArg(const std::string& key, const LLStringExplicit& text) override; const std::string& getLabel() { return mLabel.getString(); } const LLWString& getWlabel() { return mLabel.getWString();} @@ -454,8 +454,8 @@ public: // force reflow of text void needsReflow(S32 index = 0); - S32 getLength() const { return getWText().length(); } - S32 getLineCount() const { return mLineInfoList.size(); } + S32 getLength() const { return static_cast<S32>(getWText().length()); } + S32 getLineCount() const { return static_cast<S32>(mLineInfoList.size()); } S32 removeFirstLine(); // returns removed length void addDocumentChild(LLView* view); @@ -470,7 +470,7 @@ public: F32 getLineSpacingMult() { return mLineSpacingMult; } S32 getLineSpacingPixels() { return mLineSpacingPixels; } // only for multiline - S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line = true) const; + S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, bool hit_past_end_of_line = true) const; LLRect getLocalRectFromDocIndex(S32 pos) const; LLRect getDocRectFromDocIndex(S32 pos) const; @@ -545,7 +545,7 @@ protected: class TextCmd { public: - TextCmd( S32 pos, BOOL group_with_next, LLTextSegmentPtr segment = LLTextSegmentPtr() ) + TextCmd( S32 pos, bool group_with_next, LLTextSegmentPtr segment = LLTextSegmentPtr() ) : mPos(pos), mGroupWithNext(group_with_next) { @@ -555,13 +555,13 @@ protected: } } virtual ~TextCmd() {} - virtual BOOL execute(LLTextBase* editor, S32* delta) = 0; + virtual bool execute(LLTextBase* editor, S32* delta) = 0; virtual S32 undo(LLTextBase* editor) = 0; virtual S32 redo(LLTextBase* editor) = 0; - virtual BOOL canExtend(S32 pos) const { return FALSE; } + virtual bool canExtend(S32 pos) const { return false; } virtual void blockExtensions() {} - virtual BOOL extendAndExecute( LLTextBase* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; } - virtual BOOL hasExtCharValue( llwchar value ) const { return FALSE; } + virtual bool extendAndExecute( LLTextBase* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; } + virtual bool hasExtCharValue( llwchar value ) const { return false; } // Defined here so they can access protected LLTextEditor editing methods S32 insert(LLTextBase* editor, S32 pos, const LLWString &wstr) { return editor->insertStringNoUndo( pos, wstr, &mSegments ); } @@ -569,11 +569,11 @@ protected: S32 overwrite(LLTextBase* editor, S32 pos, llwchar wc) { return editor->overwriteCharNoUndo(pos, wc); } S32 getPosition() const { return mPos; } - BOOL groupWithNext() const { return mGroupWithNext; } + bool groupWithNext() const { return mGroupWithNext; } protected: const S32 mPos; - BOOL mGroupWithNext; + bool mGroupWithNext; segment_vec_t mSegments; }; @@ -641,7 +641,7 @@ protected: // misc void updateRects(); - void needsScroll() { mScrollNeeded = TRUE; } + void needsScroll() { mScrollNeeded = true; } struct URLLabelCallback; // Replace a URL with a new icon and label, for example, when @@ -695,7 +695,7 @@ protected: S32 mSelectionEnd; LLTimer mTripleClickTimer; - BOOL mIsSelecting; // Are we in the middle of a drag-select? + bool mIsSelecting; // Are we in the middle of a drag-select? // spell checking bool mSpellCheck; diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index ba756a2906..92551b682c 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -39,7 +39,7 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text"); // Compiler optimization, generate extern template template class LLTextBox* LLView::getChild<class LLTextBox>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), @@ -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,26 +96,26 @@ 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; } -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(); diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index cdff041646..c1f829c2b9 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -48,11 +48,11 @@ protected: public: virtual ~LLTextBox(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ void setEnabled(BOOL enabled); + /*virtual*/ void setEnabled(bool enabled); /*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() ); @@ -60,13 +60,13 @@ public: void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); - void reshapeToFitText(BOOL called_from_parent = FALSE); + void reshapeToFitText(bool called_from_parent = false); S32 getTextPixelWidth(); S32 getTextPixelHeight(); /*virtual*/ LLSD getValue() const; - /*virtual*/ BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); + /*virtual*/ bool setTextArg( const std::string& key, const LLStringExplicit& text ); void setShowCursorHand(bool show_cursor) { mShowCursorHand = show_cursor; } @@ -81,7 +81,7 @@ protected: // Build time optimization, generate once in .cpp file #ifndef LLTEXTBOX_CPP extern template class LLTextBox* LLView::getChild<class LLTextBox>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a76b11621a..5d30c1299a 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 s 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); @@ -98,13 +98,13 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast<S32>(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast<S32>(mWString.length()); } private: @@ -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; @@ -151,18 +151,18 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast<S32>(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast<S32>(mWString.length()); } private: LLWString mWString; - BOOL mBlockExtensions; + bool mBlockExtensions; }; @@ -170,7 +170,7 @@ private: class LLTextEditor::TextCmdAddString : public LLTextBase::TextCmd { public: - TextCmdAddString(S32 pos, BOOL group_with_next, char *str, + TextCmdAddString(S32 pos, bool group_with_next, char *str, LLTextSegmentPtr segment) : TextCmd(pos, group_with_next, segment), mWString(utf8str_to_wstring(str)), @@ -181,14 +181,14 @@ public: { mBlockExtensions = TRUE; } - virtual BOOL canExtend(S32 pos) const + virtual bool canExtend(S32 pos) const { 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); @@ -207,7 +207,7 @@ public: private: LLWString mWString; - BOOL mBlockExtensions; + bool mBlockExtensions; }; /////////////////////////////////////////////////////////////////// @@ -215,15 +215,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 ) { @@ -246,12 +246,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 ); @@ -260,7 +260,7 @@ public: virtual S32 undo( LLTextBase* editor ) { insert(editor, getPosition(), mWString); - return getPosition() + mWString.length(); + return getPosition() + static_cast<S32>(mWString.length()); } virtual S32 redo( LLTextBase* editor ) { @@ -293,7 +293,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() ), @@ -387,7 +387,7 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Param 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()) { @@ -409,22 +409,22 @@ void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insen if (selected_text == search_text) { // We already have this word selected, we are searching for the next. - setCursorPos(mCursorPos + search_text.size()); + setCursorPos(mCursorPos + static_cast<S32>(search_text.size())); } } - S32 loc = text.find(search_text,mCursorPos); + S32 loc = static_cast<S32>(text.find(search_text,mCursorPos)); // If Maybe we wrapped, search again if (wrap && (-1 == loc)) { - loc = text.find(search_text); + loc = static_cast<S32>(text.find(search_text)); } // If still -1, then search_text just isn't found. if (-1 == loc) { - mIsSelecting = FALSE; + mIsSelecting = false; mSelectionEnd = 0; mSelectionStart = 0; return; @@ -432,15 +432,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()) { @@ -462,7 +462,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; } } @@ -470,15 +470,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); } } @@ -566,7 +566,7 @@ void LLTextEditor::setShowEmojiHelper(bool show) mShowEmojiHelper = show; } -BOOL LLTextEditor::selectionContainsLineBreaks() +bool LLTextEditor::selectionContainsLineBreaks() { if (hasSelection()) { @@ -578,11 +578,11 @@ BOOL LLTextEditor::selectionContainsLineBreaks() { if (wtext[i] == '\n') { - return TRUE; + return true; } } } - return FALSE; + return false; } @@ -613,7 +613,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 ); } } } @@ -628,7 +628,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 @@ -707,9 +707,9 @@ void LLTextEditor::indentSelectedLines( S32 spaces ) } //virtual -BOOL LLTextEditor::canSelectAll() const +bool LLTextEditor::canSelectAll() const { - return TRUE; + return true; } // virtual @@ -751,15 +751,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 @@ -772,7 +772,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 @@ -791,7 +791,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) mSelectionEnd = mCursorPos; } // assume we're starting a drag select - mIsSelecting = TRUE; + mIsSelecting = true; } else { @@ -800,7 +800,7 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) } } - handled = TRUE; + handled = true; } // Delay cursor flashing @@ -813,11 +813,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; @@ -825,7 +825,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; @@ -843,16 +843,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)) @@ -864,13 +864,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() ) { @@ -887,7 +887,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 ) @@ -905,16 +905,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())) @@ -940,7 +940,7 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); - handled = TRUE; + handled = true; } // Delay cursor flashing @@ -950,16 +950,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); @@ -997,7 +997,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(); @@ -1005,7 +1005,7 @@ BOOL LLTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // take selection to 'primary' clipboard updatePrimary(); - handled = TRUE; + handled = true; } return handled; @@ -1068,7 +1068,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 @@ -1090,7 +1090,7 @@ S32 LLTextEditor::overwriteChar(S32 pos, llwchar wc) } else { - return execute(new TextCmdOverwriteChar(pos, FALSE, wc)); + return execute(new TextCmdOverwriteChar(pos, false, wc)); } } @@ -1205,7 +1205,7 @@ S32 LLTextEditor::addChar(S32 pos, llwchar wc) return delta; } - return execute(new TextCmdAddChar(pos, FALSE, wc, LLTextSegmentPtr())); + return execute(new TextCmdAddChar(pos, false, wc, LLTextSegmentPtr())); } S32 LLTextEditor::addString(S32 pos, char *str) @@ -1229,7 +1229,7 @@ void LLTextEditor::addChar(llwchar wc) if (hasSelection()) { - deleteSelection(TRUE); + deleteSelection(true); } else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { @@ -1320,7 +1320,7 @@ void LLTextEditor::tryToShowEmojiHelper() } } -void LLTextEditor::addLineBreakChar(BOOL group_together) +void LLTextEditor::addLineBreakChar(bool group_together) { if( !getEnabled() ) { @@ -1328,7 +1328,7 @@ void LLTextEditor::addLineBreakChar(BOOL group_together) } if( hasSelection() ) { - deleteSelection(TRUE); + deleteSelection(true); } else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { @@ -1344,13 +1344,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 ) { @@ -1431,7 +1431,7 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } } @@ -1445,14 +1445,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: @@ -1517,7 +1517,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } } @@ -1530,7 +1530,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() ) { @@ -1545,7 +1545,7 @@ void LLTextEditor::deleteSelection(BOOL group_with_next_op ) } // virtual -BOOL LLTextEditor::canCut() const +bool LLTextEditor::canCut() const { return !mReadOnly && hasSelection(); } @@ -1560,12 +1560,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(); } @@ -1582,7 +1582,7 @@ void LLTextEditor::copy() LLClipboard::instance().copyToClipboard(getWText(), left_pos, length); } -BOOL LLTextEditor::canPaste() const +bool LLTextEditor::canPaste() const { return !mReadOnly && LLClipboard::instance().isTextAvailable(); } @@ -1637,7 +1637,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). @@ -1666,8 +1666,8 @@ void LLTextEditor::cleanStringForPaste(LLWString & clean_string) if( mAllowEmbeddedItems ) { const llwchar LF = 10; - S32 len = clean_string.length(); - for( S32 i = 0; i < len; i++ ) + auto len = clean_string.length(); + for( size_t i = 0; i < len; i++ ) { llwchar wc = clean_string[i]; if( (wc < LLFontFreetype::FIRST_CHAR) && (wc != LF) ) @@ -1693,9 +1693,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); @@ -1704,11 +1704,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. } } @@ -1724,7 +1724,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); } @@ -1737,13 +1737,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 ) { @@ -1807,7 +1807,7 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } } @@ -1821,11 +1821,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 ) { @@ -1839,7 +1839,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) case KEY_BACKSPACE: if( hasSelection() ) { - deleteSelection(FALSE); + deleteSelection(false); } else if( 0 < mCursorPos ) @@ -1858,7 +1858,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) { if( hasSelection() && !mKeepSelectionOnReturn ) { - deleteSelection(FALSE); + deleteSelection(false); } if (mAutoIndent) { @@ -1867,7 +1867,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) } else { - handled = FALSE; + handled = false; break; } break; @@ -1875,7 +1875,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() ) @@ -1886,7 +1886,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) { if( hasSelection() ) { - deleteSelection(FALSE); + deleteSelection(false); } S32 offset = getLineOffsetFromDocIndex(mCursorPos); @@ -1900,7 +1900,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) break; default: - handled = FALSE; + handled = false; break; } @@ -1938,15 +1938,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) @@ -1959,7 +1959,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) { if (!mReadOnly && mShowEmojiHelper && LLEmojiHelper::instance().handleKey(this, key, mask)) { - return TRUE; + return true; } if (mEnableTooltipPaste && @@ -1976,7 +1976,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); @@ -1988,7 +1988,7 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) // Add the text cleanStringForPaste(tool_tip_text); pasteTextWithLinebreaks(tool_tip_text); - handled = TRUE; + handled = true; } } else @@ -2016,21 +2016,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 ) @@ -2044,7 +2044,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) // Keys that add characters temporarily hide the cursor getWindow()->hideCursorUntilMouseMove(); - handled = TRUE; + handled = true; } if( handled ) @@ -2060,7 +2060,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -BOOL LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) { auto handled = FALSE; @@ -2080,7 +2080,7 @@ BOOL LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) } // virtual -BOOL LLTextEditor::canDoDelete() const +bool LLTextEditor::canDoDelete() const { return !mReadOnly && ( !mPassDelete || ( hasSelection() || (mCursorPos < getLength())) ); } @@ -2093,7 +2093,7 @@ void LLTextEditor::doDelete() } if( hasSelection() ) { - deleteSelection(FALSE); + deleteSelection(false); } else if( mCursorPos < getLength() ) @@ -2137,14 +2137,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; } @@ -2175,7 +2175,7 @@ void LLTextEditor::undo() onKeyStroke(); } -BOOL LLTextEditor::canRedo() const +bool LLTextEditor::canRedo() const { return !mReadOnly && (mUndoStack.size() > 0) && (mLastCmd != mUndoStack.front()); } @@ -2254,7 +2254,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; @@ -2287,7 +2287,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; @@ -2321,7 +2321,7 @@ void LLTextEditor::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); } @@ -2465,9 +2465,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; @@ -2475,7 +2475,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 ); @@ -2507,7 +2507,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); @@ -2549,32 +2549,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 ); } @@ -2584,10 +2584,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(); @@ -2595,8 +2595,8 @@ 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); + LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + static_cast<S32>(widget_wide_text.size())); + insert(getLength(), widget_wide_text, false, segment); // Set the cursor and scroll position if( selection_start != selection_end ) @@ -2626,7 +2626,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)); @@ -2642,7 +2642,7 @@ void LLTextEditor::onSpellCheckPerformed() { if (isPristine()) { - mBaseDocIsPristine = FALSE; + mBaseDocIsPristine = false; } } @@ -2659,7 +2659,7 @@ void LLTextEditor::makePristine() } } -BOOL LLTextEditor::isPristine() const +bool LLTextEditor::isPristine() const { if( mPristineCmd ) { @@ -2672,7 +2672,7 @@ BOOL LLTextEditor::isPristine() const } } -BOOL LLTextEditor::tryToRevertToPristineState() +bool LLTextEditor::tryToRevertToPristineState() { if( !isPristine() ) { @@ -2701,7 +2701,7 @@ BOOL LLTextEditor::tryToRevertToPristineState() } } - return isPristine(); // TRUE => success + return isPristine(); // true => success } void LLTextEditor::updateLinkSegments() @@ -2760,7 +2760,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); @@ -2779,20 +2779,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; @@ -2800,37 +2800,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 ) @@ -2847,7 +2847,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); @@ -2858,7 +2858,7 @@ BOOL LLTextEditor::exportBuffer(std::string &buffer ) outstream << getText(); outstream << "}\n"; - return TRUE; + return true; } void LLTextEditor::updateAllowingLanguageInput() @@ -2871,17 +2871,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); } @@ -2897,7 +2897,7 @@ void LLTextEditor::resetPreedit() } else { - deleteSelection(TRUE); + deleteSelection(true); } } if (hasPreeditString()) @@ -2949,7 +2949,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString = getWText().substr(insert_preedit_at, mPreeditWString.length()); - removeStringNoUndo(insert_preedit_at, mPreeditWString.length()); + removeStringNoUndo(insert_preedit_at, static_cast<S32>(mPreeditWString.length())); } else { @@ -2970,7 +2970,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) { @@ -2993,13 +2993,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; @@ -3060,7 +3060,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 @@ -3106,7 +3106,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 { @@ -3128,11 +3128,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 ) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index a654425230..6ce08f48b5 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -88,7 +88,7 @@ public: void setKeystrokeCallback(const keystroke_signal_t::slot_type& callback); - void setParseHighlights(BOOL parsing) {mParseHighlights=parsing;} + void setParseHighlights(bool parsing) {mParseHighlights=parsing;} static S32 spacesPerTab(); @@ -96,16 +96,16 @@ public: void handleEmojiCommit(llwchar emoji); // mousehandler overrides - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); - virtual BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask ); + virtual bool handleMiddleMouseDown(S32 x,S32 y,MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask ); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleUnicodeStringHere(char *uni_str, bool editing); + virtual bool handleKeyHere(KEY key, MASK mask ); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleUnicodeStringHere(char *uni_str, bool editing); virtual void onMouseCaptureLost(); @@ -114,51 +114,51 @@ public: virtual void onFocusReceived(); virtual void onFocusLost(); virtual void onCommit(); - virtual void setEnabled(BOOL enabled); + virtual void setEnabled(bool enabled); // uictrl overrides virtual void clear(); - virtual void setFocus( BOOL b ); - virtual BOOL isDirty() const; + virtual void setFocus( bool b ); + virtual bool isDirty() const; // LLEditMenuHandler interface virtual void undo(); - virtual BOOL canUndo() const; + virtual bool canUndo() const; virtual void redo(); - virtual BOOL canRedo() const; + virtual bool canRedo() const; virtual void cut(); - virtual BOOL canCut() const; + virtual bool canCut() const; virtual void copy(); - virtual BOOL canCopy() const; + virtual bool canCopy() const; virtual void paste(); - virtual BOOL canPaste() const; + virtual bool canPaste() const; virtual void updatePrimary(); virtual void copyPrimary(); virtual void pastePrimary(); - virtual BOOL canPastePrimary() const; + virtual bool canPastePrimary() const; virtual void doDelete(); - virtual BOOL canDoDelete() const; + virtual bool canDoDelete() const; virtual void selectAll(); - virtual BOOL canSelectAll() const; + virtual bool canSelectAll() const; void selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_pos); virtual bool canLoadOrSaveToFile(); - void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); - BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); - void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); + void selectNext(const std::string& search_text_in, bool case_insensitive, bool wrap = true); + bool replaceText(const std::string& search_text, const std::string& replace_text, bool case_insensitive, bool wrap = true); + void replaceTextAll(const std::string& search_text, const std::string& replace_text, bool case_insensitive); // Undo/redo stack void blockUndo(); // Text editing virtual void makePristine(); - BOOL isPristine() const; - BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; } + bool isPristine() const; + bool allowsEmbeddedItems() const { return mAllowEmbeddedItems; } // Autoreplace (formerly part of LLLineEditor) typedef boost::function<void(S32&, S32&, LLWString&, S32&, const LLWString&)> autoreplace_callback_t; @@ -184,19 +184,19 @@ public: // Does not change highlight or cursor position. void removeTextFromEnd(S32 num_chars); - BOOL tryToRevertToPristineState(); + bool tryToRevertToPristineState(); void setCursorAndScrollToEnd(); - void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); + void getCurrentLineAndColumn( S32* line, S32* col, bool include_wordwrap ); // Hacky methods to make it into a word-wrapping, potentially scrolling, // read-only text box. - void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } + void setCommitOnFocusLost(bool b) { mCommitOnFocusLost = b; } // Hack to handle Notecards - virtual BOOL importBuffer(const char* buffer, S32 length ); - virtual BOOL exportBuffer(std::string& buffer ); + virtual bool importBuffer(const char* buffer, S32 length ); + virtual bool exportBuffer(std::string& buffer ); const LLUUID& getSourceID() const { return mSourceID; } @@ -211,7 +211,7 @@ public: void setShowEmojiHelper(bool show); bool getShowEmojiHelper() const { return mShowEmojiHelper; } - void setPassDelete(BOOL b) { mPassDelete = b; } + void setPassDelete(bool b) { mPassDelete = b; } protected: void showContextMenu(S32 x, S32 y); @@ -225,13 +225,13 @@ protected: S32 indentLine( S32 pos, S32 spaces ); void unindentLineBeforeCloseBrace(); - virtual BOOL handleSpecialKey(const KEY key, const MASK mask); - BOOL handleNavigationKey(const KEY key, const MASK mask); - BOOL handleSelectionKey(const KEY key, const MASK mask); - BOOL handleControlKey(const KEY key, const MASK mask); + virtual bool handleSpecialKey(const KEY key, const MASK mask); + bool handleNavigationKey(const KEY key, const MASK mask); + bool handleSelectionKey(const KEY key, const MASK mask); + bool handleControlKey(const KEY key, const MASK mask); - BOOL selectionContainsLineBreaks(); - void deleteSelection(BOOL transient_operation); + bool selectionContainsLineBreaks(); + void deleteSelection(bool transient_operation); S32 prevWordPos(S32 cursorPos) const; S32 nextWordPos(S32 cursorPos) const; @@ -252,7 +252,7 @@ protected: S32 addChar(S32 pos, llwchar wc); void addString(char *s, bool editing); S32 addString(S32 pos, char *str); - void addLineBreakChar(BOOL group_together = FALSE); + void addLineBreakChar(bool group_together = false); S32 overwriteChar(S32 pos, llwchar wc); void removeChar(); S32 removeChar(S32 pos); @@ -262,7 +262,7 @@ protected: void tryToShowEmojiHelper(); void focusLostHelper(); void updateAllowingLanguageInput(); - BOOL hasPreeditString() const; + bool hasPreeditString() const; // Overrides LLPreeditor virtual void resetPreedit(); @@ -271,7 +271,7 @@ protected: virtual void markAsPreedit(S32 position, S32 length); virtual void getPreeditRange(S32 *position, S32 *length) const; virtual void getSelectionRange(S32 *position, S32 *length) const; - virtual BOOL getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; + virtual bool getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; virtual S32 getPreeditFontSize() const; virtual LLWString getPreeditString() const { return getWText(); } // @@ -288,7 +288,7 @@ protected: LLWString mPreeditWString; LLWString mPreeditOverwrittenWString; std::vector<S32> mPreeditPositions; - std::vector<BOOL> mPreeditStandouts; + LLPreeditor::standouts_t mPreeditStandouts; protected: LLUIColor mDefaultColor; @@ -317,7 +317,7 @@ private: class TextCmdOverwriteChar; class TextCmdRemove; - BOOL mBaseDocIsPristine; + bool mBaseDocIsPristine; TextCmd* mPristineCmd; TextCmd* mLastCmd; @@ -325,11 +325,11 @@ private: typedef std::deque<TextCmd*> undo_stack_t; undo_stack_t mUndoStack; - BOOL mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces - BOOL mCommitOnFocusLost; - BOOL mTakesFocus; + bool mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces + bool mCommitOnFocusLost; + bool mTakesFocus; - BOOL mAllowEmbeddedItems; + bool mAllowEmbeddedItems; bool mShowContextMenu; bool mShowEmojiHelper; bool mEnableTooltipPaste; @@ -349,7 +349,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLTEXTEDITOR_CPP extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_TEXTEDITOR_H diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 7bb7c7f7bb..097b168106 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -73,11 +73,11 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight) found = (! ltext.find(pattern) ? 0 : std::string::npos); break; case ENDS_WITH: - S32 pos = ltext.rfind(pattern); - if (pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos; + auto pos = ltext.rfind(pattern); + if (pos != std::string::npos && pos >= 0 && (ltext.length() - pattern.length() == pos)) found = pos; break; } - return found; + return static_cast<S32>(found); } LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index) @@ -99,8 +99,8 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC S32 start = findPattern(text,mHighlights[i]); if (start >= 0 ) { - S32 end = std::string(mHighlights[i]["pattern"]).length(); - S32 len = text.length(); + auto end = std::string(mHighlights[i]["pattern"]).length(); + auto len = text.length(); EHighlightPosition newpart; if (start==0) { @@ -184,11 +184,11 @@ bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *co { LLSD color_llsd = mHighlights[i]["color"]; color->setValue(color_llsd); - return TRUE; + return true; } } } - return FALSE; //No matches found. + return false; //No matches found. } std::string LLTextParser::getFileName() @@ -229,11 +229,11 @@ bool LLTextParser::saveToDisk(LLSD highlights) if (filename.empty()) { LL_WARNS() << "LLTextParser::saveToDisk() no valid user directory." << LL_ENDL; - return FALSE; + return false; } llofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(mHighlights, file); file.close(); - return TRUE; + return true; } diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9e27ed6232..9a087d8230 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -1,25 +1,25 @@ -/** +/** * @file lltextvalidate.cpp * @brief Text validation helper functions * * $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$ */ @@ -73,7 +73,7 @@ class ValidatorFloat : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { // May be a comma or period, depending on the locale @@ -118,7 +118,7 @@ class ValidatorInt : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { S32 i = 0; @@ -157,7 +157,7 @@ class ValidatorPositiveS32 : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -167,7 +167,7 @@ class ValidatorPositiveS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinusOrZero", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -177,7 +177,7 @@ class ValidatorPositiveS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val <= 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -201,7 +201,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -211,7 +211,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -221,7 +221,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -244,7 +244,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl LLLocale locale(LLLocale::USER_LOCALE); std::basic_string<CHAR> test_str = str; - S32 len = test_str.length(); + auto len = test_str.length(); if (0 < len) { CHAR ch = test_str.front(); @@ -254,7 +254,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = test_str[i]; if (!LLStringOps::isDigit(ch) || LLStringOps::isSpace(ch)) @@ -264,7 +264,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl } } - S32 val = strtol(test_str); + auto val = strtol(test_str); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(test_str))); @@ -286,7 +286,7 @@ class ValidatorAlphaNum : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -313,7 +313,7 @@ class ValidatorAlphaNumSpace : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -341,7 +341,7 @@ class ValidatorASCIIPrintableNoPipe : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -368,7 +368,7 @@ class ValidatorASCIIPrintableNoSpace : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -395,7 +395,7 @@ protected: template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -441,7 +441,7 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h index 2c2941de7f..a4ff144d82 100644 --- a/indra/llui/lltextvalidate.h +++ b/indra/llui/lltextvalidate.h @@ -1,4 +1,4 @@ -/** +/** * @file lltextbase.h * @author Martin Reddy * @brief The base class of text box/editor, providing Url handling support @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2009&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$ */ diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp index 3d404293c6..e2e735b131 100644 --- a/indra/llui/lltimectrl.cpp +++ b/indra/llui/lltimectrl.cpp @@ -161,7 +161,7 @@ LLTimeCtrl::LLTimeCtrl(const LLTimeCtrl::Params& p) mDownBtn = LLUICtrlFactory::create<LLButton>(down_button_params); addChild(mDownBtn); - setUseBoundingRect( TRUE ); + setUseBoundingRect( true ); } F32 LLTimeCtrl::getTime24() const @@ -188,27 +188,27 @@ void LLTimeCtrl::setTime24(F32 time) updateText(); } -BOOL LLTimeCtrl::handleKeyHere(KEY key, MASK mask) +bool LLTimeCtrl::handleKeyHere(KEY key, MASK mask) { if (mEditor->hasFocus()) { if(key == KEY_UP) { onUpBtn(); - return TRUE; + return true; } if(key == KEY_DOWN) { onDownBtn(); - return TRUE; + return true; } if (key == KEY_RETURN) { onCommit(); - return TRUE; + return true; } } - return FALSE; + return false; } void LLTimeCtrl::onUpBtn() @@ -343,7 +343,7 @@ LLTimeCtrl::EEditingPart LLTimeCtrl::getEditingPart() S32 cur_pos = mEditor->getCursor(); std::string time_str = mEditor->getText(); - S32 colon_index = time_str.find_first_of(':'); + auto colon_index = time_str.find_first_of(':'); if (cur_pos <= colon_index) { @@ -376,7 +376,7 @@ std::string LLTimeCtrl::getMinutesString(const std::string& str) size_t colon_index = str.find_first_of(':'); ++colon_index; - int minutes_len = str.length() - colon_index - AMPM_LEN; + auto minutes_len = str.length() - colon_index - AMPM_LEN; std::string minutes_str = str.substr(colon_index, minutes_len); return minutes_str; @@ -411,7 +411,7 @@ bool LLTimeCtrl::isMinutesStringValid(const std::string& str) // static bool LLTimeCtrl::isPMAMStringValid(const std::string& str) { - S32 len = str.length(); + auto len = str.length(); bool valid = (str[--len] == 'M') && (str[--len] == 'P' || str[len] == 'A'); diff --git a/indra/llui/lltimectrl.h b/indra/llui/lltimectrl.h index a2c016ab6f..6973c9a02b 100644 --- a/indra/llui/lltimectrl.h +++ b/indra/llui/lltimectrl.h @@ -93,7 +93,7 @@ private: }; virtual void onFocusLost(); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); void onUpBtn(); void onDownBtn(); @@ -124,6 +124,6 @@ private: U32 mTime; // minutes since midnight: 0 - 1439 U32 mSnapToMin; // interval in minutes to snap to - BOOL mAllowEdit; + bool mAllowEdit; }; #endif /* LLTIMECTRL_H_ */ diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 636df7a87e..cfa520f693 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -52,7 +52,7 @@ boost::signals2::connection LLToggleableMenu::setVisibilityChangeCallback(const } // virtual -void LLToggleableMenu::onVisibilityChange (BOOL curVisibilityIn) +void LLToggleableMenu::onVisibilityChange (bool curVisibilityIn) { S32 x,y; LLUI::getInstance()->getMousePositionLocal(LLUI::getInstance()->getRootView(), &x, &y); @@ -94,7 +94,7 @@ bool LLToggleableMenu::toggleVisibility() if (getVisible()) { - setVisible(FALSE); + setVisible(false); mClosedByButtonClick = false; return false; } diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index 1cf37ad647..7cbbd417a4 100644 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h @@ -45,7 +45,7 @@ public: boost::signals2::connection setVisibilityChangeCallback( const commit_signal_t::slot_type& cb ); - virtual void onVisibilityChange (BOOL curVisibilityIn); + virtual void onVisibilityChange (bool curVisibilityIn); virtual bool addChild (LLView* view, S32 tab_group = 0); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 8a6cb683d2..aa48ae048f 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -398,18 +398,18 @@ bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash, bool forc if (it != mButtonMap.end()) { command_button = it->second; - command_button->setFlashing((BOOL)(flash),(BOOL)(force_flashing)); + command_button->setFlashing((bool)(flash),(bool)(force_flashing)); } } return (command_button != NULL); } -BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLRect button_panel_rect; mButtonPanel->localRectToOtherView(mButtonPanel->getLocalRect(), &button_panel_rect, this); - BOOL handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); + bool handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); if (handle_it_here) { @@ -443,9 +443,9 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) return handle_it_here; } -BOOL LLToolBar::isSettingChecked(const LLSD& userdata) +bool LLToolBar::isSettingChecked(const LLSD& userdata) { - BOOL retval = FALSE; + bool retval = false; const std::string setting_name = userdata.asString(); @@ -784,8 +784,8 @@ void LLToolBar::updateLayoutAsNeeded() if (!mButtons.empty()) { - mButtonPanel->setVisible(TRUE); - mButtonPanel->setMouseOpaque(TRUE); + mButtonPanel->setVisible(true); + mButtonPanel->setMouseOpaque(true); } // don't clear flag until after we've resized ourselves, to avoid laying out every frame @@ -797,13 +797,13 @@ void LLToolBar::draw() { if (mButtons.empty()) { - mButtonPanel->setVisible(FALSE); - mButtonPanel->setMouseOpaque(FALSE); + mButtonPanel->setVisible(false); + mButtonPanel->setMouseOpaque(false); } else { - mButtonPanel->setVisible(TRUE); - mButtonPanel->setMouseOpaque(TRUE); + mButtonPanel->setVisible(true); + mButtonPanel->setMouseOpaque(true); } // Update enable/disable state and highlight state for editable toolbars @@ -841,7 +841,7 @@ void LLToolBar::draw() } LLIconCtrl* caret = mCaretIcon; - caret->setVisible(FALSE); + caret->setVisible(false); if (mDragAndDropTarget && !mButtonCommands.empty()) { LLRect caret_rect = caret->getRect(); @@ -859,15 +859,15 @@ void LLToolBar::draw() mDragx+mDragGirth, mDragy-caret_rect.getHeight()/2)); } - caret->setVisible(TRUE); + caret->setVisible(true); } LLUICtrl::draw(); - caret->setVisible(FALSE); + caret->setVisible(false); mDragAndDropTarget = false; } -void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLToolBar::reshape(S32 width, S32 height, bool called_from_parent) { LLUICtrl::reshape(width, height, called_from_parent); mNeedsLayout = true; @@ -1042,23 +1042,23 @@ boost::signals2::connection LLToolBar::setButtonRemoveCallback(const button_sign return connectSignal(mButtonRemoveSignal, cb); } -BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { // If we have a drop callback, that means that we can handle the drop - BOOL handled = (mHandleDropCallback ? TRUE : FALSE); + bool handled = mHandleDropCallback != nullptr; // if drop is set, it's time to call the callback to get the operation done if (handled && drop) { - handled = mHandleDropCallback(cargo_data, x, y ,this); + handled = mHandleDropCallback(cargo_data, x, y, this); } // We accept only single tool drop on toolbars - *accept = (handled ? ACCEPT_YES_SINGLE : ACCEPT_NO); + *accept = handled ? ACCEPT_YES_SINGLE : ACCEPT_NO; // We'll use that flag to change the visual aspect of the toolbar target on draw() mDragAndDropTarget = false; @@ -1073,7 +1073,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, int orig_rank = getRankFromPosition(dragged_command); mDragRank = getRankFromPosition(x, y); // Don't DaD if we're dragging a command on itself - mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank-1) == orig_rank)) ? false : true); + mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank - 1) == orig_rank))); //LL_INFOS() << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << LL_ENDL; /* Do the following if you want to animate the button itself LLCommandId dragged_command(inv_item->getUUID()); @@ -1083,7 +1083,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } else { - handled = FALSE; + handled = false; } } @@ -1121,16 +1121,16 @@ LLToolBarButton::~LLToolBarButton() delete mIsStartingSignal; } -BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) { mMouseDownX = x; mMouseDownY = y; return LLButton::handleMouseDown(x, y, mask); } -BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) +bool LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; S32 mouse_distance_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY); if (mouse_distance_squared > DRAG_N_DROP_DISTANCE_THRESHOLD * DRAG_N_DROP_DISTANCE_THRESHOLD @@ -1141,7 +1141,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { mStartDragItemCallback(x, y, this); mIsDragged = true; - handled = TRUE; + handled = true; } else { @@ -1163,7 +1163,7 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask) // Always highlight toolbar buttons, even if they are disabled if (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this) { - mNeedsHighlight = TRUE; + mNeedsHighlight = true; } LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); @@ -1199,12 +1199,12 @@ void LLToolBarButton::onCommit() } } -void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLToolBarButton::reshape(S32 width, S32 height, bool called_from_parent) { LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent); } -void LLToolBarButton::setEnabled(BOOL enabled) +void LLToolBarButton::setEnabled(bool enabled) { if (enabled) { diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 1a9c1cdf9f..c57c979525 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -40,8 +40,8 @@ class LLToolBarButton; class LLIconCtrl; typedef boost::function<void (S32 x, S32 y, LLToolBarButton* button)> tool_startdrag_callback_t; -typedef boost::function<BOOL (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t; -typedef boost::function<BOOL (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t; +typedef boost::function<bool (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t; +typedef boost::function<bool (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t; class LLToolBarButton : public LLButton { @@ -62,11 +62,11 @@ public: LLToolBarButton(const Params& p); ~LLToolBarButton(); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleHover(S32 x, S32 y, MASK mask); + bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask); - void reshape(S32 width, S32 height, BOOL called_from_parent = true); - void setEnabled(BOOL enabled); + void reshape(S32 width, S32 height, bool called_from_parent = true); + void setEnabled(bool enabled); void setCommandId(const LLCommandId& id) { mId = id; } LLCommandId getCommandId() { return mId; } @@ -178,12 +178,12 @@ public: protected: friend class LLUICtrlFactory; - LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params), mButtonPanel(NULL) {} + LLCenterLayoutPanel(const Params& params) : LLLayoutPanel(params) {}; private: reshape_callback_t mReshapeCallback; - LLToolBarEnums::EToolBarLocation mLocationId; - LLPanel * mButtonPanel; + LLToolBarEnums::EToolBarLocation mLocationId{ LLToolBarEnums::EToolBarLocation::TOOLBAR_NONE }; + LLPanel * mButtonPanel{ nullptr }; }; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> @@ -214,9 +214,9 @@ public: // virtuals void draw(); - void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + void reshape(S32 width, S32 height, bool called_from_parent = true); + bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -270,7 +270,7 @@ private: void updateLayoutAsNeeded(); void createButtons(); void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); - BOOL isSettingChecked(const LLSD& userdata); + bool isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); void onRemoveSelectedCommand(); diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index c10b8b4830..86525c2f7e 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -71,7 +71,7 @@ void LLToolTipView::draw() LLView::draw(); } -BOOL LLToolTipView::handleHover(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleHover(S32 x, S32 y, MASK mask) { static S32 last_x = x; static S32 last_y = y; @@ -89,7 +89,7 @@ BOOL LLToolTipView::handleHover(S32 x, S32 y, MASK mask) return LLView::handleHover(x, y, mask); } -BOOL LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); @@ -98,29 +98,29 @@ BOOL LLToolTipView::handleMouseDown(S32 x, S32 y, MASK mask) // If we are handling the mouse event menu holder // won't get a chance to close menus so do this here LLMenuGL::sMenuContainer->hideMenus(); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLToolTipView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); return LLView::handleMiddleMouseDown(x, y, mask); } -BOOL LLToolTipView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLToolTipView::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLToolTipMgr::instance().blockToolTips(); return LLView::handleRightMouseDown(x, y, mask); } -BOOL LLToolTipView::handleScrollWheel( S32 x, S32 y, S32 clicks ) +bool LLToolTipView::handleScrollWheel( S32 x, S32 y, S32 clicks ) { LLToolTipMgr::instance().blockToolTips(); - return FALSE; + return false; } void LLToolTipView::drawStickyRect() @@ -325,14 +325,14 @@ void LLToolTip::snapToChildren() setShape(tooltip_rect); } -void LLToolTip::setVisible(BOOL visible) +void LLToolTip::setVisible(bool visible) { // fade out tooltip over time if (visible) { mVisibleTimer.start(); mFadeTimer.stop(); - LLPanel::setVisible(TRUE); + LLPanel::setVisible(true); } else { @@ -345,7 +345,7 @@ void LLToolTip::setVisible(BOOL visible) } } -BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask) +bool LLToolTip::handleHover(S32 x, S32 y, MASK mask) { //mInfoButton->setFlashing(true); if(mInfoButton) @@ -356,7 +356,7 @@ BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_HAND); } - return TRUE; + return true; } void LLToolTip::onMouseLeave(S32 x, S32 y, MASK mask) @@ -549,7 +549,7 @@ void LLToolTipMgr::hideToolTips() { if (mToolTip) { - mToolTip->setVisible(FALSE); + mToolTip->setVisible(false); } } diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 9ae537e0c1..8515504e3b 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -44,11 +44,11 @@ public: Params(); }; LLToolTipView(const LLToolTipView::Params&); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel( S32 x, S32 y, S32 clicks ); void drawStickyRect(); @@ -99,9 +99,9 @@ public: Params(); }; /*virtual*/ void draw(); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void setVisible(bool visible); bool isFading(); F32 getVisibleTime(); diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 3d3a7ddf4e..4af5376a8b 100644 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp @@ -61,7 +61,7 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<s bool LLTransUtil::parseLanguageStrings(const std::string& xml_filename) { LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if (!success) { diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index c3dd2eb17a..ba8fe84377 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -172,7 +172,7 @@ mHelpImpl(NULL) // Callbacks for associating controls with floater visibility: reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleInstance, _2, LLSD())); reg.add("Floater.ToggleOrBringToFront", boost::bind(&LLFloaterReg::toggleInstanceOrBringToFront, _2, LLSD())); - reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), FALSE)); + reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), false)); reg.add("Floater.ShowOrBringToFront", boost::bind(&LLFloaterReg::showInstanceOrBringToFront, _2, LLSD())); reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideInstance, _2, LLSD())); diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 471602515d..373a358544 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -77,7 +77,10 @@ enum EDragAndDropType DAD_PERSON = 17, DAD_SETTINGS = 18, DAD_MATERIAL = 19, - DAD_COUNT = 20, // number of types in this enum + DAD_GLTF = 20, + DAD_GLTF_BIN = 21, + + DAD_COUNT = 22, // number of types in this enum }; // Reasons for drags to be denied. @@ -234,7 +237,7 @@ public: private: - S32 mValue; + S32 mValue{ 0 }; }; // diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 69093393d9..52c5f72a45 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -44,7 +44,7 @@ F32 LLUICtrl::sInactiveControlTransparency = 1.0f; // Compiler optimization, generate extern template template class LLUICtrl* LLView::getChild<class LLUICtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; LLUICtrl::CallbackParam::CallbackParam() : name("name"), @@ -100,10 +100,10 @@ const LLUICtrl::Params& LLUICtrl::getDefaultParams() LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) : LLView(p), - mIsChrome(FALSE), + mIsChrome(false), mRequestsFront(p.requests_front), - mTabStop(FALSE), - mTentative(FALSE), + mTabStop(false), + mTentative(false), mViewModel(viewmodel), mControlVariable(NULL), mEnabledControlVariable(NULL), @@ -342,12 +342,12 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) { LL_DEBUGS() << "LLUICtrl::handleMouseDown calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; - BOOL handled = LLView::handleMouseDown(x,y,mask); + bool handled = LLView::handleMouseDown(x,y,mask); if (mMouseDownSignal) { @@ -362,12 +362,12 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) { LL_DEBUGS() << "LLUICtrl::handleMouseUp calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; - BOOL handled = LLView::handleMouseUp(x,y,mask); + bool handled = LLView::handleMouseUp(x,y,mask); if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-56,-56,getPathname()); } @@ -382,9 +382,9 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleRightMouseDown(x,y,mask); + bool handled = LLView::handleRightMouseDown(x,y,mask); if (mRightMouseDownSignal) { (*mRightMouseDownSignal)(this,x,y,mask); @@ -393,9 +393,9 @@ BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } //virtual -BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleRightMouseUp(x,y,mask); + bool handled = LLView::handleRightMouseUp(x,y,mask); if(mRightMouseUpSignal) { (*mRightMouseUpSignal)(this,x,y,mask); @@ -403,9 +403,9 @@ BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleDoubleClick(x, y, mask); + bool handled = LLView::handleDoubleClick(x, y, mask); if (mDoubleClickSignal) { (*mDoubleClickSignal)(this, x, y, mask); @@ -414,7 +414,7 @@ BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) } // can't tab to children of a non-tab-stop widget -BOOL LLUICtrl::canFocusChildren() const +bool LLUICtrl::canFocusChildren() const { return hasTabStop(); } @@ -439,9 +439,9 @@ void LLUICtrl::onCommit() } //virtual -BOOL LLUICtrl::isCtrl() const +bool LLUICtrl::isCtrl() const { - return TRUE; + return true; } //virtual @@ -473,7 +473,7 @@ LLViewModel* LLUICtrl::getViewModel() const } //virtual -BOOL LLUICtrl::postBuild() +bool LLUICtrl::postBuild() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // @@ -662,15 +662,15 @@ bool LLUICtrl::controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, } // virtual -BOOL LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text ) +bool LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text ) { - return FALSE; + return false; } // virtual -BOOL LLUICtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLUICtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - return FALSE; + return false; } // virtual @@ -691,12 +691,12 @@ LLCtrlScrollInterface* LLUICtrl::getScrollInterface() return NULL; } -BOOL LLUICtrl::hasFocus() const +bool LLUICtrl::hasFocus() const { return (gFocusMgr.childHasKeyboardFocus(this)); } -void LLUICtrl::setFocus(BOOL b) +void LLUICtrl::setFocus(bool b) { // focus NEVER goes to ui ctrls that are disabled! if (!getEnabled()) @@ -720,25 +720,25 @@ void LLUICtrl::setFocus(BOOL b) } // virtual -void LLUICtrl::setTabStop( BOOL b ) +void LLUICtrl::setTabStop( bool b ) { mTabStop = b; } // virtual -BOOL LLUICtrl::hasTabStop() const +bool LLUICtrl::hasTabStop() const { return mTabStop; } // virtual -BOOL LLUICtrl::acceptsTextInput() const +bool LLUICtrl::acceptsTextInput() const { - return FALSE; + return false; } //virtual -BOOL LLUICtrl::isDirty() const +bool LLUICtrl::isDirty() const { return mViewModel->isDirty(); }; @@ -761,16 +761,16 @@ void LLUICtrl::clear() } // virtual -void LLUICtrl::setIsChrome(BOOL is_chrome) +void LLUICtrl::setIsChrome(bool is_chrome) { mIsChrome = is_chrome; } // virtual -BOOL LLUICtrl::getIsChrome() const +bool LLUICtrl::getIsChrome() const { if (mIsChrome) - return TRUE; + return true; LLView* parent_ctrl = getParent(); while (parent_ctrl) @@ -781,11 +781,11 @@ BOOL LLUICtrl::getIsChrome() const parent_ctrl = parent_ctrl->getParent(); } - return FALSE; + return false; } -BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) +bool LLUICtrl::focusFirstItem(bool prefer_text_fields, bool focus_flash) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // try to select default tab group child @@ -796,14 +796,14 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); if(focus_flash) { gFocusMgr.triggerFocusFlash(); } } - return TRUE; + return true; } // search for text field first if(prefer_text_fields) @@ -816,14 +816,14 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); if(focus_flash) { gFocusMgr.triggerFocusFlash(); } } - return TRUE; + return true; } } // no text field found, or we don't care about text fields @@ -833,20 +833,20 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); if(focus_flash) { gFocusMgr.triggerFocusFlash(); } } - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) +bool LLUICtrl::focusNextItem(bool text_fields_only) { // this assumes that this method is called on the focus root. LLViewQuery query = getTabOrderQuery(); @@ -859,7 +859,7 @@ BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) return focusNext(result); } -BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only) +bool LLUICtrl::focusPrevItem(bool text_fields_only) { // this assumes that this method is called on the focus root. LLViewQuery query = getTabOrderQuery(); @@ -1011,13 +1011,13 @@ boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<b } // virtual -void LLUICtrl::setTentative(BOOL b) +void LLUICtrl::setTentative(bool b) { mTentative = b; } // virtual -BOOL LLUICtrl::getTentative() const +bool LLUICtrl::getTentative() const { return mTentative; } diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index d21e8dc1c6..c56c3c43a4 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -39,8 +39,8 @@ #include "llviewmodel.h" // *TODO move dependency to .cpp file #include "llsearchablecontrol.h" -const BOOL TAKE_FOCUS_YES = TRUE; -const BOOL TAKE_FOCUS_NO = FALSE; +const bool TAKE_FOCUS_YES = true; +const bool TAKE_FOCUS_NO = false; const S32 DROP_SHADOW_FLOATER = 5; class LLUICtrl @@ -147,27 +147,28 @@ protected: // We shouldn't ever need to set this directly //virtual void setViewModel(const LLViewModelPtr&); - virtual BOOL postBuild(); + /*virtual*/ bool postBuild() override; public: // LLView interface - /*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - /*virtual*/ BOOL isCtrl() const; - /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL canFocusChildren() const; - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool setLabelArg( const std::string& key, const LLStringExplicit& text ) override; + /*virtual*/ bool isCtrl() const override; + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask) override; + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool canFocusChildren() const override; + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask) override; // From LLFocusableElement - /*virtual*/ void setFocus( BOOL b ); - /*virtual*/ BOOL hasFocus() const; + /*virtual*/ void setFocus( bool b ) override; + /*virtual*/ bool hasFocus() const override; // New virtuals + // Return NULL by default (overrride if the class has the appropriate interface) virtual class LLCtrlSelectionInterface* getSelectionInterface(); virtual class LLCtrlListInterface* getListInterface(); @@ -187,22 +188,22 @@ public: void setFunctionName(const std::string& function_name); - virtual void setTentative(BOOL b); - virtual BOOL getTentative() const; + virtual void setTentative(bool b); + virtual bool getTentative() const; virtual void setValue(const LLSD& value); virtual LLSD getValue() const; /// When two widgets are displaying the same data (e.g. during a skin /// change), share their ViewModel. virtual void shareViewModelFrom(const LLUICtrl& other); - virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); - virtual void setIsChrome(BOOL is_chrome); + virtual bool setTextArg( const std::string& key, const LLStringExplicit& text ); + virtual void setIsChrome(bool is_chrome); - virtual BOOL acceptsTextInput() const; // Defaults to false + virtual bool acceptsTextInput() const; // Defaults to false // A control is dirty if the user has modified its value. // Editable controls should override this. - virtual BOOL isDirty() const; // Defauls to false + virtual bool isDirty() const; // Defauls to false virtual void resetDirty(); //Defaults to no-op // Call appropriate callback @@ -223,16 +224,16 @@ public: void setTransparencyType(ETypeTransparency type); ETypeTransparency getTransparencyType() const {return mTransparencyType;} - BOOL focusNextItem(BOOL text_entry_only); - BOOL focusPrevItem(BOOL text_entry_only); - BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE ); + bool focusNextItem(bool text_entry_only); + bool focusPrevItem(bool text_entry_only); + bool focusFirstItem(bool prefer_text_fields = false, bool focus_flash = true ); // Non Virtuals LLHandle<LLUICtrl> getHandle() const { return getDerivedHandle<LLUICtrl>(); } - BOOL getIsChrome() const; + bool getIsChrome() const; - void setTabStop( BOOL b ); - BOOL hasTabStop() const; + void setTabStop( bool b ); + bool hasTabStop() const; LLUICtrl* getParentUICtrl() const; @@ -267,7 +268,7 @@ public: LLSINGLETON_EMPTY_CTOR(LLTextInputFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override { - return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl *>(view)->acceptsTextInput(), TRUE); + return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl *>(view)->acceptsTextInput(), true); } }; @@ -319,14 +320,14 @@ protected: static F32 sActiveControlTransparency; static F32 sInactiveControlTransparency; - virtual void addInfo(LLSD & info); + /*virtual*/ void addInfo(LLSD & info) override; private: - BOOL mIsChrome; - BOOL mRequestsFront; - BOOL mTabStop; - BOOL mTentative; + bool mIsChrome; + bool mRequestsFront; + bool mTabStop; + bool mTentative; ETypeTransparency mTransparencyType; }; @@ -334,7 +335,7 @@ private: // Build time optimization, generate once in .cpp file #ifndef LLUICTRL_CPP extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif // LL_LLUICTRL_H diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index f3649d68a7..a2a6d661ff 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -124,7 +124,7 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid LLXMLNodePtr outputChild; if (output_node) { - outputChild = output_node->createChild("", FALSE); + outputChild = output_node->createChild("", false); } if (!instance().createFromXML(child_node, viewp, LLStringUtil::null, registry, outputChild)) diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 0cc699f59c..b9d4ff0ebb 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -79,7 +79,7 @@ public: operator LLWString() const { return getUpdatedWResult(); } bool empty() const { return getUpdatedResult().empty(); } - S32 length() const { return getUpdatedWResult().size(); } + S32 length() const { return static_cast<S32>(getUpdatedWResult().size()); } void clear(); void clearArgs() { if (mArgs) mArgs->clear(); } diff --git a/indra/llui/llundo.cpp b/indra/llui/llundo.cpp index d5ff70d31a..0928cb4417 100644 --- a/indra/llui/llundo.cpp +++ b/indra/llui/llundo.cpp @@ -72,7 +72,7 @@ LLUndoBuffer::~LLUndoBuffer() //----------------------------------------------------------------------------- // getNextAction() //----------------------------------------------------------------------------- -LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(BOOL setClusterBegin) +LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(bool setClusterBegin) { LLUndoAction *nextAction = mActions[mNextAction]; @@ -97,11 +97,11 @@ LLUndoBuffer::LLUndoAction* LLUndoBuffer::getNextAction(BOOL setClusterBegin) //----------------------------------------------------------------------------- // undoAction() //----------------------------------------------------------------------------- -BOOL LLUndoBuffer::undoAction() +bool LLUndoBuffer::undoAction() { if (!canUndo()) { - return FALSE; + return false; } S32 prevAction = (mNextAction + mNumActions - 1) % mNumActions; @@ -118,7 +118,7 @@ BOOL LLUndoBuffer::undoAction() if (mNextAction == mFirstAction) { mOperationID--; - return FALSE; + return false; } // do wrap-around of index, but avoid negative numbers for modulo operator @@ -127,17 +127,17 @@ BOOL LLUndoBuffer::undoAction() mOperationID--; - return TRUE; + return true; } //----------------------------------------------------------------------------- // redoAction() //----------------------------------------------------------------------------- -BOOL LLUndoBuffer::redoAction() +bool LLUndoBuffer::redoAction() { if (!canRedo()) { - return FALSE; + return false; } mOperationID++; @@ -146,7 +146,7 @@ BOOL LLUndoBuffer::redoAction() { if (mNextAction == mLastAction) { - return FALSE; + return false; } mActions[mNextAction]->redo(); @@ -155,7 +155,7 @@ BOOL LLUndoBuffer::redoAction() mNextAction = (mNextAction + 1) % mNumActions; } - return TRUE; + return true; } //----------------------------------------------------------------------------- diff --git a/indra/llui/llundo.h b/indra/llui/llundo.h index 19cb09e6bb..dc40702be0 100644 --- a/indra/llui/llundo.h +++ b/indra/llui/llundo.h @@ -48,11 +48,11 @@ public: LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count ); virtual ~LLUndoBuffer(); - LLUndoAction *getNextAction(BOOL setClusterBegin = TRUE); - BOOL undoAction(); - BOOL redoAction(); - BOOL canUndo() { return (mNextAction != mFirstAction); } - BOOL canRedo() { return (mNextAction != mLastAction); } + LLUndoAction *getNextAction(bool setClusterBegin = true); + bool undoAction(); + bool redoAction(); + bool canUndo() { return (mNextAction != mFirstAction); } + bool canRedo() { return (mNextAction != mLastAction); } void flushActions(); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 45afc9efee..198441804b 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -229,7 +229,7 @@ bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const label = "http://" + label; } - return (LLUrlRegistry::instance().hasUrl(label)) ? false : true; + return !LLUrlRegistry::instance().hasUrl(label); } std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const @@ -389,7 +389,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); S32 x,y,z; if (path_parts == actual_parts) @@ -401,7 +401,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const if((x>= 0 && x<= 256) && (y>= 0 && y<= 256) && (z>= 0)) { - return TRUE; + return true; } } else if (path_parts == (actual_parts-1)) @@ -413,7 +413,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const ; if((x>= 0 && x<= 256) && (y>= 0 && y<= 256)) { - return TRUE; + return true; } } else if (path_parts == (actual_parts-2)) @@ -422,11 +422,11 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLStringUtil::convertToS32(path_array[path_parts-1],x); if(x>= 0 && x<= 256) { - return TRUE; + return true; } } - return FALSE; + return false; } // @@ -454,7 +454,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 5) { // handle slurl with (X,Y,Z) coordinates @@ -1074,7 +1074,7 @@ LLUrlEntryParcel::~LLUrlEntryParcel() std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no parcel id { @@ -1165,7 +1165,7 @@ std::string LLUrlEntryPlace::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); std::string location = unescapeUrl(uri.hostName()); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 3) { // handle slurl with (X,Y,Z) coordinates @@ -1214,7 +1214,7 @@ std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelC // LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no region name { @@ -1278,7 +1278,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); std::string host = uri.hostName(); std::string label = LLTrans::getString("SLurlLabelTeleport"); if (!host.empty()) @@ -1413,7 +1413,7 @@ std::string LLUrlEntryWorldMap::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) { return url; @@ -1505,7 +1505,7 @@ LLUrlEntryEmail::LLUrlEntryEmail() std::string LLUrlEntryEmail::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - int pos = url.find("mailto:"); + auto pos = url.find("mailto:"); if (pos == std::string::npos) { diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index c878a74c5f..84ff278942 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -107,7 +107,7 @@ public: bool isWikiLinkCorrect(const std::string &url) const; - virtual bool isSLURLvalid(const std::string &url) const { return TRUE; }; + virtual bool isSLURLvalid(const std::string &url) const { return true; }; protected: std::string getIDStringFromUrl(const std::string &url) const; diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 9c3994480c..3a4ce6a72f 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -263,9 +263,9 @@ bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUr { return false; } - S32 end = start + wurl.size() - 1; + auto end = start + wurl.size() - 1; - match.setValues(start, end, match.getUrl(), + match.setValues(static_cast<U32>(start), static_cast<U32>(end), match.getUrl(), match.getLabel(), match.getQuery(), match.getTooltip(), diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index d44f39682a..1e72228fee 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -67,11 +67,11 @@ bool LLView::sDebugRectsShowNames = true; bool LLView::sDebugKeys = false; bool LLView::sDebugMouseHandling = false; std::string LLView::sMouseHandlerMessage; -BOOL LLView::sForceReshape = FALSE; +bool LLView::sForceReshape = false; std::set<LLView*> LLView::sPreviewHighlightedElements; -BOOL LLView::sHighlightingDiffs = FALSE; +bool LLView::sHighlightingDiffs = false; LLView* LLView::sPreviewClickedElement = NULL; -BOOL LLView::sDrawPreviewHighlights = FALSE; +bool LLView::sDrawPreviewHighlights = false; S32 LLView::sLastLeftXML = S32_MIN; S32 LLView::sLastBottomXML = S32_MIN; std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack; @@ -80,12 +80,12 @@ LLView::DrilldownFunc LLView::sDrilldown = boost::bind(&LLView::pointInView, _1, _2, _3, HIT_TEST_USE_BOUNDING_RECT); //#if LL_DEBUG -BOOL LLView::sIsDrawing = FALSE; +bool LLView::sIsDrawing = false; //#endif // Compiler optimization, generate extern template template class LLView* LLView::getChild<class LLView>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; static LLDefaultChildRegistry::Register<LLView> r("view"); @@ -148,7 +148,7 @@ LLView::LLView(const LLView::Params& p) mReshapeFlags(FOLLOWS_NONE), mFromXUI(p.from_xui), mIsFocusRoot(p.focus_root), - mLastVisible(FALSE), + mLastVisible(false), mHoverCursor(getCursorFromString(p.hover_cursor)), mEnabled(p.enabled), mMouseOpaque(p.mouse_opaque), @@ -172,7 +172,7 @@ LLView::~LLView() { LL_DEBUGS() << "Deleting view " << mName << " during UI draw() phase" << LL_ENDL; } -// llassert(LLView::sIsDrawing == FALSE); +// llassert(LLView::sIsDrawing == false); // llassert_always(sDepth == 0); // avoid deleting views while drawing! It can subtly break list iterators @@ -197,15 +197,15 @@ LLView::~LLView() } // virtual -BOOL LLView::isCtrl() const +bool LLView::isCtrl() const { - return FALSE; + return false; } // virtual -BOOL LLView::isPanel() const +bool LLView::isPanel() const { - return FALSE; + return false; } void LLView::setToolTip(const LLStringExplicit& msg) @@ -213,10 +213,10 @@ void LLView::setToolTip(const LLStringExplicit& msg) mToolTipMsg = msg; } -BOOL LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text) +bool LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text) { mToolTipMsg.setArg(key, text); - return TRUE; + return true; } void LLView::setToolTipArgs( const LLStringUtil::format_map_t& args ) @@ -231,7 +231,7 @@ void LLView::setRect(const LLRect& rect) updateBoundingRect(); } -void LLView::setUseBoundingRect( BOOL use_bounding_rect ) +void LLView::setUseBoundingRect( bool use_bounding_rect ) { if (mUseBoundingRect != use_bounding_rect) { @@ -240,7 +240,7 @@ void LLView::setUseBoundingRect( BOOL use_bounding_rect ) } } -BOOL LLView::getUseBoundingRect() const +bool LLView::getUseBoundingRect() const { return mUseBoundingRect; } @@ -342,11 +342,11 @@ void LLView::removeChild(LLView* child) if (child->mParentView == this) { // if we are removing an item we are currently iterating over, that would be bad - llassert(child->mInDraw == false); + llassert(!child->mInDraw); mChildList.remove( child ); child->mParentView = NULL; child_tab_order_t::iterator found = mTabOrder.find(child); - if(found != mTabOrder.end()) + if (found != mTabOrder.end()) { mTabOrder.erase(found); } @@ -358,16 +358,16 @@ void LLView::removeChild(LLView* child) updateBoundingRect(); } -BOOL LLView::isInVisibleChain() const +bool LLView::isInVisibleChain() const { - BOOL visible = TRUE; + bool visible = true; const LLView* viewp = this; while(viewp) { if (!viewp->getVisible()) { - visible = FALSE; + visible = false; break; } viewp = viewp->getParent(); @@ -376,16 +376,16 @@ BOOL LLView::isInVisibleChain() const return visible; } -BOOL LLView::isInEnabledChain() const +bool LLView::isInEnabledChain() const { - BOOL enabled = TRUE; + bool enabled = true; const LLView* viewp = this; while(viewp) { if (!viewp->getEnabled()) { - enabled = FALSE; + enabled = false; break; } viewp = viewp->getParent(); @@ -445,13 +445,13 @@ std::string LLView::getPathname(const LLView* view) } // virtual -BOOL LLView::canFocusChildren() const +bool LLView::canFocusChildren() const { - return TRUE; + return true; } //virtual -void LLView::setEnabled(BOOL enabled) +void LLView::setEnabled(bool enabled) { mEnabled = enabled; } @@ -469,9 +469,9 @@ bool LLView::isAvailable(const LLView* view) } //virtual -BOOL LLView::setLabelArg( const std::string& key, const LLStringExplicit& text ) +bool LLView::setLabelArg( const std::string& key, const LLStringExplicit& text ) { - return FALSE; + return false; } //virtual @@ -486,20 +486,20 @@ LLRect LLView::getRequiredRect() return mRect; } -BOOL LLView::focusNextRoot() +bool LLView::focusNextRoot() { LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); return LLView::focusNext(result); } -BOOL LLView::focusPrevRoot() +bool LLView::focusPrevRoot() { LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); return LLView::focusPrev(result); } // static -BOOL LLView::focusNext(LLView::child_list_t & result) +bool LLView::focusNext(LLView::child_list_t & result) { LLView::child_list_reverse_iter_t focused = result.rend(); for(LLView::child_list_reverse_iter_t iter = result.rbegin(); @@ -524,18 +524,18 @@ BOOL LLView::focusNext(LLView::child_list_t & result) if ((*next)->isCtrl() && ((LLUICtrl*)*next)->hasTabStop()) { LLUICtrl * ctrl = static_cast<LLUICtrl*>(*next); - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); gFocusMgr.triggerFocusFlash(); - return TRUE; + return true; } ++next; } - return FALSE; + return false; } // static -BOOL LLView::focusPrev(LLView::child_list_t & result) +bool LLView::focusPrev(LLView::child_list_t & result) { LLView::child_list_iter_t focused = result.end(); for(LLView::child_list_iter_t iter = result.begin(); @@ -562,15 +562,15 @@ BOOL LLView::focusPrev(LLView::child_list_t & result) LLUICtrl * ctrl = static_cast<LLUICtrl*>(*next); if (!ctrl->hasFocus()) { - ctrl->setFocus(TRUE); + ctrl->setFocus(true); ctrl->onTabInto(); gFocusMgr.triggerFocusFlash(); } - return TRUE; + return true; } ++next; } - return FALSE; + return false; } // delete all children. Override this function if you need to @@ -591,16 +591,24 @@ void LLView::deleteAllChildren() updateBoundingRect(); } -void LLView::setAllChildrenEnabled(BOOL b) +void LLView::setAllChildrenEnabled(bool b, bool recursive /*= false*/) { for (LLView* viewp : mChildList) { viewp->setEnabled(b); } + + if (recursive) + { + for (LLView* viewp : mChildList) + { + viewp->setAllChildrenEnabled(b, recursive); + } + } } // virtual -void LLView::setVisible(BOOL visible) +void LLView::setVisible(bool visible) { if ( mVisible != visible ) { @@ -618,10 +626,10 @@ void LLView::setVisible(BOOL visible) } // virtual -void LLView::onVisibilityChange ( BOOL new_visibility ) +void LLView::onVisibilityChange ( bool new_visibility ) { - BOOL old_visibility; - BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); + bool old_visibility; + bool log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); for (LLView* viewp : mChildList) { if (!viewp) @@ -674,7 +682,7 @@ void LLView::translate(S32 x, S32 y) } // virtual -BOOL LLView::canSnapTo(const LLView* other_view) +bool LLView::canSnapTo(const LLView* other_view) { return other_view != this && other_view->getVisible(); } @@ -684,7 +692,7 @@ void LLView::setSnappedTo(const LLView* snap_view) { } -BOOL LLView::handleHover(S32 x, S32 y, MASK mask) +bool LLView::handleHover(S32 x, S32 y, MASK mask) { return childrenHandleHover( x, y, mask ) != NULL; } @@ -728,7 +736,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m { for (LLView* viewp : mChildList) { - if ((viewp->*method)(c, mask, TRUE)) + if ((viewp->*method)(c, mask, true)) { if (LLView::sDebugKeys) { @@ -797,7 +805,7 @@ LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) } LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -926,9 +934,9 @@ const std::string LLView::getToolTip() const return mToolTipMsg.getString(); } -BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask) +bool LLView::handleToolTip(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; // parents provide tooltips first, which are optionally // overridden by children, in case child is mouse_opaque @@ -945,22 +953,22 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask) .sticky_rect(calcScreenRect()) .delay_time(getTooltipTimeout())); } - handled = TRUE; + handled = true; } // child tooltips will override our own LLView* child_handler = childrenHandleToolTip(x, y, mask); if (child_handler) { - handled = TRUE; + handled = true; } return handled; } -BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLView::handleKey(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getVisible() && getEnabled()) { @@ -985,14 +993,14 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) if( !handled && !called_from_parent && mParentView) { // Upward traversal - handled = mParentView->handleKey( key, mask, FALSE ); + handled = mParentView->handleKey( key, mask, false ); } return handled; } -BOOL LLView::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) +bool LLView::handleKeyUp(KEY key, MASK mask, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getVisible() && getEnabled()) { @@ -1017,28 +1025,28 @@ BOOL LLView::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) if (!handled && !called_from_parent && mParentView) { // Upward traversal - handled = mParentView->handleKeyUp(key, mask, FALSE); + handled = mParentView->handleKeyUp(key, mask, false); } return handled; } // Called from handleKey() // Handles key in this object. Checking parents and children happens in handleKey() -BOOL LLView::handleKeyHere(KEY key, MASK mask) +bool LLView::handleKeyHere(KEY key, MASK mask) { - return FALSE; + return false; } // Called from handleKey() // Handles key in this object. Checking parents and children happens in handleKey() -BOOL LLView::handleKeyUpHere(KEY key, MASK mask) +bool LLView::handleKeyUpHere(KEY key, MASK mask) { - return FALSE; + return false; } -BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) +bool LLView::handleUnicodeChar(llwchar uni_char, bool called_from_parent) { - BOOL handled = FALSE; + bool handled = false; if (getVisible() && getEnabled()) { @@ -1061,7 +1069,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) if (!handled && !called_from_parent && mParentView) { // Upward traversal - handled = mParentView->handleUnicodeChar(uni_char, FALSE); + handled = mParentView->handleUnicodeChar(uni_char, false); } if (handled) @@ -1072,7 +1080,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) return handled; } -BOOL LLView::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent) +bool LLView::handleUnicodeString(char *uni_str, bool editing, bool called_from_parent) { auto handled = FALSE; @@ -1088,17 +1096,17 @@ BOOL LLView::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_p return handled; } -BOOL LLView::handleUnicodeCharHere(llwchar uni_char ) +bool LLView::handleUnicodeCharHere(llwchar uni_char ) { - return FALSE; + return false; } -BOOL LLView::handleUnicodeStringHere(char *uni_str, bool editing) +bool LLView::handleUnicodeStringHere(char *uni_str, bool editing) { return FALSE; } -BOOL LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) @@ -1110,56 +1118,56 @@ void LLView::onMouseCaptureLost() { } -BOOL LLView::hasMouseCapture() +bool LLView::hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; } -BOOL LLView::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLView::handleMouseUp(S32 x, S32 y, MASK mask) { LLView* r = childrenHandleMouseUp( x, y, mask ); return (r!=NULL); } -BOOL LLView::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLView::handleMouseDown(S32 x, S32 y, MASK mask) { LLView* r= childrenHandleMouseDown(x, y, mask ); return (r!=NULL); } -BOOL LLView::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLView::handleDoubleClick(S32 x, S32 y, MASK mask) { return childrenHandleDoubleClick( x, y, mask ) != NULL; } -BOOL LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) { return childrenHandleScrollWheel( x, y, clicks ) != NULL; } -BOOL LLView::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLView::handleScrollHWheel(S32 x, S32 y, S32 clicks) { return childrenHandleScrollHWheel( x, y, clicks ) != NULL; } -BOOL LLView::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLView::handleRightMouseDown(S32 x, S32 y, MASK mask) { return childrenHandleRightMouseDown( x, y, mask ) != NULL; } -BOOL LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) +bool LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) { return childrenHandleRightMouseUp( x, y, mask ) != NULL; } -BOOL LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +bool LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return childrenHandleMiddleMouseDown( x, y, mask ) != NULL; } -BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +bool LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { return childrenHandleMiddleMouseUp( x, y, mask ) != NULL; } @@ -1390,7 +1398,7 @@ void LLView::drawDebugRect() LLUI::popMatrix(); } -void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_draw) +void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, bool force_draw) { if (childp && childp->getParent() == this) { @@ -1413,7 +1421,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr } -void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLView::reshape(S32 width, S32 height, bool called_from_parent) { // compute how much things changed and apply reshape logic to children S32 delta_width = width - getRect().getWidth(); @@ -1487,7 +1495,7 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) { if (mParentView) { - mParentView->reshape(mParentView->getRect().getWidth(), mParentView->getRect().getHeight(), FALSE); + mParentView->reshape(mParentView->getRect().getWidth(), mParentView->getRect().getHeight(), false); } } @@ -1602,11 +1610,11 @@ LLRect LLView::getLocalSnapRect() const return local_snap_rect; } -BOOL LLView::hasAncestor(const LLView* parentp) const +bool LLView::hasAncestor(const LLView* parentp) const { if (!parentp) { - return FALSE; + return false; } LLView* viewp = getParent(); @@ -1614,17 +1622,17 @@ BOOL LLView::hasAncestor(const LLView* parentp) const { if (viewp == parentp) { - return TRUE; + return true; } viewp = viewp->getParent(); } - return FALSE; + return false; } //----------------------------------------------------------------------------- -BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const +bool LLView::childHasKeyboardFocus( const std::string& childname ) const { LLView *focus = dynamic_cast<LLView *>(gFocusMgr.getKeyboardFocus()); @@ -1632,18 +1640,18 @@ BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const { if (focus->getName() == childname) { - return TRUE; + return true; } focus = focus->getParent(); } - return FALSE; + return false; } //----------------------------------------------------------------------------- -BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const +bool LLView::hasChild(const std::string& childname, bool recurse) const { return findChildView(childname, recurse) != NULL; } @@ -1651,12 +1659,12 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const //----------------------------------------------------------------------------- // getChildView() //----------------------------------------------------------------------------- -LLView* LLView::getChildView(const std::string& name, BOOL recurse) const +LLView* LLView::getChildView(const std::string& name, bool recurse) const { return getChild<LLView>(name, recurse); } -LLView* LLView::findChildView(const std::string& name, BOOL recurse) const +LLView* LLView::findChildView(const std::string& name, bool recurse) const { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -1685,21 +1693,21 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const return NULL; } -BOOL LLView::parentPointInView(S32 x, S32 y, EHitTestType type) const +bool LLView::parentPointInView(S32 x, S32 y, EHitTestType type) const { return (getUseBoundingRect() && type == HIT_TEST_USE_BOUNDING_RECT) ? mBoundingRect.pointInRect( x, y ) : mRect.pointInRect( x, y ); } -BOOL LLView::pointInView(S32 x, S32 y, EHitTestType type) const +bool LLView::pointInView(S32 x, S32 y, EHitTestType type) const { return (getUseBoundingRect() && type == HIT_TEST_USE_BOUNDING_RECT) ? mBoundingRect.pointInRect( x + mRect.mLeft, y + mRect.mBottom ) : mRect.localPointInRect( x, y ); } -BOOL LLView::blockMouseEvent(S32 x, S32 y) const +bool LLView::blockMouseEvent(S32 x, S32 y) const { return mMouseOpaque && pointInView(x, y, HIT_TEST_IGNORE_BOUNDING_RECT); } @@ -1828,27 +1836,27 @@ LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, S3 // Moves the view so that it is entirely inside of constraint. // If the view will not fit because it's too big, aligns with the top and left. // (Why top and left? That's where the drag bars are for floaters.) -BOOL LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels) +bool LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels) { return translateRectIntoRect(getRect(), constraint, min_overlap_pixels); } -BOOL LLView::translateRectIntoRect(const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels) +bool LLView::translateRectIntoRect(const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels) { LLCoordGL translation = getNeededTranslation(rect, constraint, min_overlap_pixels); if (translation.mX != 0 || translation.mY != 0) { translate(translation.mX, translation.mY); - return TRUE; + return true; } - return FALSE; + return false; } // move this view into "inside" but not onto "exclude" // NOTE: if this view is already contained in "inside", we ignore the "exclude" rect -BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels) +bool LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels) { LLCoordGL translation = getNeededTranslation(getRect(), inside, min_overlap_pixels); @@ -1884,9 +1892,9 @@ BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& } } - return TRUE; + return true; } - return FALSE; + return false; } @@ -1898,7 +1906,7 @@ void LLView::centerWithin(const LLRect& bounds) translate( left - getRect().mLeft, bottom - getRect().mBottom ); } -BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const +bool LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const { const LLView* cur_view = this; const LLView* root_view = NULL; @@ -1909,7 +1917,7 @@ BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, co { *other_x = x; *other_y = y; - return TRUE; + return true; } x += cur_view->getRect().mLeft; @@ -1932,16 +1940,16 @@ BOOL LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, co { *other_x = x; *other_y = y; - return TRUE; + return true; } } *other_x = x; *other_y = y; - return FALSE; + return false; } -BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const +bool LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const { LLRect cur_rect = local; const LLView* cur_view = this; @@ -1952,7 +1960,7 @@ BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLV if (cur_view == other_view) { *other = cur_rect; - return TRUE; + return true; } cur_rect.translate(cur_view->getRect().mLeft, cur_view->getRect().mBottom); @@ -1972,12 +1980,12 @@ BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLV if (cur_view == root_view) { *other = cur_rect; - return TRUE; + return true; } } *other = cur_rect; - return FALSE; + return false; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index a840498628..ad3b71505d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -61,8 +61,8 @@ const U32 FOLLOWS_TOP = 0x10; const U32 FOLLOWS_BOTTOM = 0x20; const U32 FOLLOWS_ALL = 0x33; -const BOOL MOUSE_OPAQUE = TRUE; -const BOOL NOT_MOUSE_OPAQUE = FALSE; +const bool MOUSE_OPAQUE = true; +const bool NOT_MOUSE_OPAQUE = false; const U32 GL_NAME_UI_RESERVED = 2; @@ -169,7 +169,7 @@ private: LLView(const LLView& other); public: //#if LL_DEBUG - static BOOL sIsDrawing; + static bool sIsDrawing; //#endif enum ESoundFlags { @@ -210,19 +210,19 @@ public: virtual ~LLView(); // Some UI widgets need to be added as controls. Others need to - // be added as regular view children. isCtrl should return TRUE + // be added as regular view children. isCtrl should return true // if a widget needs to be added as a ctrl - virtual BOOL isCtrl() const; + virtual bool isCtrl() const; - virtual BOOL isPanel() const; + virtual bool isPanel() const; // // MANIPULATORS // - void setMouseOpaque( BOOL b ) { mMouseOpaque = b; } - BOOL getMouseOpaque() const { return mMouseOpaque; } + void setMouseOpaque( bool b ) { mMouseOpaque = b; } + bool getMouseOpaque() const { return mMouseOpaque; } void setToolTip( const LLStringExplicit& msg ); - BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); + bool setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); void setToolTipArgs( const LLStringUtil::format_map_t& args ); virtual void setRect(const LLRect &rect); @@ -238,8 +238,8 @@ public: void setSoundFlags(U8 flags) { mSoundFlags = flags; } void setName(std::string name) { mName = name; } - void setUseBoundingRect( BOOL use_bounding_rect ); - BOOL getUseBoundingRect() const; + void setUseBoundingRect( bool use_bounding_rect ); + bool getUseBoundingRect() const; ECursorType getHoverCursor() { return mHoverCursor; } @@ -259,7 +259,7 @@ public: // remove the specified child from the view, and set it's parent to NULL. virtual void removeChild(LLView* view); - virtual BOOL postBuild() { return TRUE; } + virtual bool postBuild() { return true; } const child_tab_order_t& getTabOrder() const { return mTabOrder; } @@ -267,15 +267,15 @@ public: S32 getDefaultTabGroup() const { return mDefaultTabGroup; } S32 getLastTabGroup() { return mLastTabGroup; } - BOOL isInVisibleChain() const; - BOOL isInEnabledChain() const; + bool isInVisibleChain() const; + bool isInEnabledChain() const; - void setFocusRoot(BOOL b) { mIsFocusRoot = b; } - BOOL isFocusRoot() const { return mIsFocusRoot; } - virtual BOOL canFocusChildren() const; + void setFocusRoot(bool b) { mIsFocusRoot = b; } + bool isFocusRoot() const { return mIsFocusRoot; } + virtual bool canFocusChildren() const; - BOOL focusNextRoot(); - BOOL focusPrevRoot(); + bool focusNextRoot(); + bool focusPrevRoot(); // Normally we want the app menus to get priority on accelerated keys // However, sometimes we want to give specific views a first chance @@ -287,13 +287,13 @@ public: // children, etc. virtual void deleteAllChildren(); - void setAllChildrenEnabled(BOOL b); + void setAllChildrenEnabled(bool b, bool recursive = false); - virtual void setVisible(BOOL visible); - void setVisibleDirect(BOOL visible) { mVisible = visible; } - const BOOL& getVisible() const { return mVisible; } - virtual void setEnabled(BOOL enabled); - BOOL getEnabled() const { return mEnabled; } + virtual void setVisible(bool visible); + void setVisibleDirect(bool visible) { mVisible = visible; } + const bool& getVisible() const { return mVisible; } + virtual void setEnabled(bool enabled); + bool getEnabled() const { return mEnabled; } /// 'available' in this context means 'visible and enabled': in other /// words, can a user actually interact with this? virtual bool isAvailable() const; @@ -301,21 +301,21 @@ public: static bool isAvailable(const LLView* view); U8 getSoundFlags() const { return mSoundFlags; } - virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); + virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); - virtual void onVisibilityChange ( BOOL new_visibility ); + virtual void onVisibilityChange ( bool new_visibility ); virtual void onUpdateScrollToChild(const LLUICtrl * cntrl); - void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); } + void pushVisible(bool visible) { mLastVisible = mVisible; setVisible(visible); } void popVisible() { setVisible(mLastVisible); } - BOOL getLastVisible() const { return mLastVisible; } + bool getLastVisible() const { return mLastVisible; } U32 getFollows() const { return mReshapeFlags; } - BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; } - BOOL followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; } - BOOL followsTop() const { return mReshapeFlags & FOLLOWS_TOP; } - BOOL followsBottom() const { return mReshapeFlags & FOLLOWS_BOTTOM; } - BOOL followsAll() const { return mReshapeFlags & FOLLOWS_ALL; } + bool followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; } + bool followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; } + bool followsTop() const { return mReshapeFlags & FOLLOWS_TOP; } + bool followsBottom() const { return mReshapeFlags & FOLLOWS_BOTTOM; } + bool followsAll() const { return mReshapeFlags & FOLLOWS_ALL; } const LLRect& getRect() const { return mRect; } const LLRect& getBoundingRect() const { return mBoundingRect; } @@ -340,9 +340,9 @@ public: LLView* findNextSibling(LLView* child); S32 getChildCount() const { return (S32)mChildList.size(); } template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); } - BOOL hasAncestor(const LLView* parentp) const; - BOOL hasChild(const std::string& childname, BOOL recurse = FALSE) const; - BOOL childHasKeyboardFocus( const std::string& childname ) const; + bool hasAncestor(const LLView* parentp) const; + bool hasChild(const std::string& childname, bool recurse = false) const; + bool childHasKeyboardFocus( const std::string& childname ) const; // these iterators are used for collapsing various tree traversals into for loops typedef LLTreeDFSIter<LLView, child_list_const_iter_t> tree_iterator_t; @@ -367,27 +367,27 @@ public: // // Default behavior is to use reshape flags to resize child views - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + virtual void reshape(S32 width, S32 height, bool called_from_parent = true); virtual void translate( S32 x, S32 y ); void setOrigin( S32 x, S32 y ) { mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); } - BOOL translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); - BOOL translateRectIntoRect( const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); - BOOL translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX); + bool translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); + bool translateRectIntoRect( const LLRect& rect, const LLRect& constraint, S32 min_overlap_pixels = S32_MAX); + bool translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX); void centerWithin(const LLRect& bounds); void setShape(const LLRect& new_rect, bool by_user = false); virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0); virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0); - virtual BOOL canSnapTo(const LLView* other_view); + virtual bool canSnapTo(const LLView* other_view); virtual void setSnappedTo(const LLView* snap_view); // inherited from LLFocusableElement - /* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - /* virtual */ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); - /* virtual */ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - /* virtual */ BOOL handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent); + /* virtual */ bool handleKey(KEY key, MASK mask, bool called_from_parent); + /* virtual */ bool handleKeyUp(KEY key, MASK mask, bool called_from_parent); + /* virtual */ bool handleUnicodeChar(llwchar uni_char, bool called_from_parent); + /* virtual */ bool handleUnicodeString(char *uni_str, bool editing, bool called_from_parent); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -398,8 +398,8 @@ public: void parseFollowsFlags(const LLView::Params& params); // Some widgets, like close box buttons, don't need to be saved - BOOL getFromXUI() const { return mFromXUI; } - void setFromXUI(BOOL b) { mFromXUI = b; } + bool getFromXUI() const { return mFromXUI; } + void setFromXUI(bool b) { mFromXUI = b; } typedef enum e_hit_test_type { @@ -407,13 +407,13 @@ public: HIT_TEST_IGNORE_BOUNDING_RECT }EHitTestType; - BOOL parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; - BOOL pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; - BOOL blockMouseEvent(S32 x, S32 y) const; + bool parentPointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; + bool pointInView(S32 x, S32 y, EHitTestType type = HIT_TEST_USE_BOUNDING_RECT) const; + bool blockMouseEvent(S32 x, S32 y) const; // See LLMouseHandler virtuals for screenPointToLocal and localPointToScreen - BOOL localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const; - BOOL localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const; + bool localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const; + bool localRectToOtherView( const LLRect& local, LLRect* other, const LLView* other_view ) const; void screenRectToLocal( const LLRect& screen, LLRect* local ) const; void localRectToScreen( const LLRect& local, LLRect* screen ) const; @@ -425,21 +425,21 @@ public: // LLMouseHandler functions // Default behavior is to pass events to children - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleScrollHWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleRightMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); /*virtual*/ const std::string& getName() const; /*virtual*/ void onMouseCaptureLost(); - /*virtual*/ BOOL hasMouseCapture(); + /*virtual*/ bool hasMouseCapture(); /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; @@ -453,22 +453,22 @@ public: // static method handles NULL pointer too static std::string getPathname(const LLView*); - template <class T> T* findChild(const std::string& name, BOOL recurse = TRUE) const + template <class T> T* findChild(const std::string& name, bool recurse = true) const { LLView* child = findChildView(name, recurse); T* result = dynamic_cast<T*>(child); return result; } - template <class T> T* getChild(const std::string& name, BOOL recurse = TRUE) const; + template <class T> T* getChild(const std::string& name, bool recurse = true) const; - template <class T> T& getChildRef(const std::string& name, BOOL recurse = TRUE) const + template <class T> T& getChildRef(const std::string& name, bool recurse = true) const { return *getChild<T>(name, recurse); } - virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const; - virtual LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const; + virtual LLView* getChildView(const std::string& name, bool recurse = true) const; + virtual LLView* findChildView(const std::string& name, bool recurse = true) const; template <class T> T* getDefaultWidget(const std::string& name) const { @@ -496,9 +496,9 @@ public: //static LLFontGL::HAlign selectFontHAlign(LLXMLNodePtr node); // focuses the item in the list after the currently-focused item, wrapping if necessary - static BOOL focusNext(LLView::child_list_t & result); + static bool focusNext(LLView::child_list_t & result); // focuses the item in the list before the currently-focused item, wrapping if necessary - static BOOL focusPrev(LLView::child_list_t & result); + static bool focusPrev(LLView::child_list_t & result); // returns query for iterating over controls in tab order static const LLViewQuery & getTabOrderQuery(); @@ -515,11 +515,11 @@ public: // to be top-left based. static void setupParamsForExport(Params& p, LLView* parent); - //virtual BOOL addChildFromParam(const LLInitParam::BaseBlock& params) { return TRUE; } - virtual BOOL handleKeyHere(KEY key, MASK mask); - virtual BOOL handleKeyUpHere(KEY key, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleUnicodeStringHere(char *uni_str, bool editing); + //virtual bool addChildFromParam(const LLInitParam::BaseBlock& params) { return true; } + virtual bool handleKeyHere(KEY key, MASK mask); + virtual bool handleKeyUpHere(KEY key, MASK mask); + virtual bool handleUnicodeCharHere(llwchar uni_char); + virtual bool handleUnicodeStringHere(char *uni_str, bool editing); virtual void handleReshape(const LLRect& rect, bool by_user); virtual void dirtyRect(); @@ -541,7 +541,7 @@ public: protected: void drawDebugRect(); - void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE); + void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, bool force_draw = false); void drawChildren(); bool visibleAndContains(S32 local_x, S32 local_Y); bool visibleEnabledAndContains(S32 local_x, S32 local_y); @@ -551,7 +551,7 @@ protected: LLView* childrenHandleKeyUp(KEY key, MASK mask); LLView* childrenHandleUnicodeChar(llwchar uni_char); LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, + bool drop, EDragAndDropType type, void* data, EAcceptance* accept, @@ -583,7 +583,7 @@ private: // adapter to blur distinction between handleKey() and handleUnicodeChar() // for childrenHandleCharEvent() - BOOL handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, BOOL from_parent) + bool handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, bool from_parent) { return handleUnicodeChar(uni_char, from_parent); } @@ -592,7 +592,7 @@ private: child_list_t mChildList; // location in pixels, relative to surrounding structure, bottom,left=0,0 - BOOL mVisible; + bool mVisible; LLRect mRect; LLRect mBoundingRect; @@ -605,18 +605,18 @@ private: S32 mDefaultTabGroup; S32 mLastTabGroup; - BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application." + bool mEnabled; // Enabled means "accepts input that has an effect on the state of the application." // A disabled view, for example, may still have a scrollbar that responds to mouse events. - BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect. + bool mMouseOpaque; // Opaque views handle all mouse events that are over their rect. LLUIString mToolTipMsg; // isNull() is true if none. U8 mSoundFlags; - BOOL mFromXUI; + bool mFromXUI; - BOOL mIsFocusRoot; - BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements + bool mIsFocusRoot; + bool mUseBoundingRect; // hit test against bounding rectangle that includes all child elements - BOOL mLastVisible; + bool mLastVisible; bool mInDraw; @@ -681,12 +681,12 @@ public: static std::string sMouseHandlerMessage; static S32 sSelectID; static std::set<LLView*> sPreviewHighlightedElements; // DEV-16869 - static BOOL sHighlightingDiffs; // DEV-16869 + static bool sHighlightingDiffs; // DEV-16869 static LLView* sPreviewClickedElement; // DEV-16869 - static BOOL sDrawPreviewHighlights; + static bool sDrawPreviewHighlights; static S32 sLastLeftXML; static S32 sLastBottomXML; - static BOOL sForceReshape; + static bool sForceReshape; }; namespace LLInitParam @@ -698,7 +698,7 @@ struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<L }; } -template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) const +template <class T> T* LLView::getChild(const std::string& name, bool recurse) const { LLView* child = findChildView(name, recurse); T* result = dynamic_cast<T*>(child); @@ -733,7 +733,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co // require explicit specialization. See llbutton.cpp for an example. #ifndef LLVIEW_CPP extern template class LLView* LLView::getChild<class LLView>( - const std::string& name, BOOL recurse) const; + const std::string& name, bool recurse) const; #endif #endif //LL_LLVIEW_H diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 47cc57e42f..c1777c972c 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -63,7 +63,7 @@ LLViewBorder::Params::Params() LLViewBorder::LLViewBorder(const LLViewBorder::Params& p) : LLView(p), mTexture( NULL ), - mHasKeyboardFocus( FALSE ), + mHasKeyboardFocus( false ), mBorderWidth(p.border_thickness), mHighlightLight(p.highlight_light_color()), mHighlightDark(p.highlight_dark_color()), @@ -114,7 +114,7 @@ void LLViewBorder::draw() } else { - llassert( FALSE ); // not implemented + llassert( false ); // not implemented } } @@ -239,7 +239,7 @@ void LLViewBorder::drawTwoPixelLines() gl_line_2d(left+1, bottom+1, right-1, bottom+1); } -BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) +bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) { if (node->hasAttribute("bevel_style")) { @@ -263,8 +263,8 @@ BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel { bevel_style = LLViewBorder::BEVEL_BRIGHT; } - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h index 2ee25fff1a..be499bb534 100644 --- a/indra/llui/llviewborder.h +++ b/indra/llui/llviewborder.h @@ -66,12 +66,12 @@ protected: public: virtual void setValue(const LLSD& val) { setRect(LLRect(val)); } - virtual BOOL isCtrl() const { return FALSE; } + virtual bool isCtrl() const { return false; } // llview functionality virtual void draw(); - static BOOL getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style); + static bool getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style); void setBorderWidth(S32 width) { mBorderWidth = width; } S32 getBorderWidth() const { return mBorderWidth; } @@ -87,7 +87,7 @@ public: EStyle getStyle() const { return mStyle; } - void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; } + void setKeyboardFocusHighlight( bool b ) { mHasKeyboardFocus = b; } private: void drawOnePixelLines(); @@ -103,7 +103,7 @@ private: LLUIColor mBackgroundColor; S32 mBorderWidth; LLPointer<LLUIImage> mTexture; - BOOL mHasKeyboardFocus; + bool mHasKeyboardFocus; }; #endif // LL_LLVIEWBORDER_H diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 8154a98b85..1bf3e3c43b 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -124,7 +124,7 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo after updatemouseeventinfo - local_x|global x "<< this->local_x << " " << this->global_x << "local/global y " << this->local_y << " " << this->global_y << " mname: " << mName << " xui: " << xui << LL_ENDL; } -void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, BOOL visibility, std::string event_subtype) { +void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype) { LLSD event=LLSD::emptyMap(); diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index 8c41d306ca..9e752e8090 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -55,7 +55,7 @@ public: void logKeyEvent(KEY key, MASK mask); void logKeyUnicodeEvent(llwchar uni_char); - void logVisibilityChange(std::string xui, std::string name, BOOL visibility, std::string event_subtype); + void logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype); void clear_xui(); std::string get_xui(); diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index 8f9d05d57e..4835a60e77 100644 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp @@ -34,12 +34,12 @@ void LLQuerySorter::sort(LLView * parent, viewList_t &children) const {} filterResult_t LLLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(children.empty(), TRUE); + return filterResult_t(children.empty(), true); } filterResult_t LLRootsFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(TRUE, FALSE); + return filterResult_t(true, false); } filterResult_t LLVisibleFilter::operator() (const LLView* const view, const viewList_t & children) const @@ -58,7 +58,7 @@ filterResult_t LLTabStopFilter::operator() (const LLView* const view, const view filterResult_t LLCtrlFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(view->isCtrl(),TRUE); + return filterResult_t(view->isCtrl(),true); } // @@ -79,7 +79,7 @@ viewList_t LLViewQuery::run(LLView* view) const } viewList_t filtered_children; - filterResult_t post(TRUE, TRUE); + filterResult_t post(true, true); if(pre.second) { // run filters on children @@ -123,7 +123,7 @@ void LLViewQuery::filterChildren(LLView* parent_view, viewList_t & filtered_chil filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const { - filterResult_t result = filterResult_t(TRUE, TRUE); + filterResult_t result = filterResult_t(true, true); for(filterList_const_iter_t iter = filters.begin(); iter != filters.end(); iter++) diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index 2fc7fc476a..c03a15e8f9 100644 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -35,7 +35,7 @@ class LLView; typedef std::list<LLView *> viewList_t; -typedef std::pair<BOOL, BOOL> filterResult_t; +typedef std::pair<bool, bool> filterResult_t; // Abstract base class for all query filters. class LLQueryFilter @@ -93,7 +93,7 @@ class LLWidgetTypeFilter : public LLQueryFilter { /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(dynamic_cast<const T*>(view) != NULL, TRUE); + return filterResult_t(dynamic_cast<const T*>(view) != NULL, true); } }; diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index deb357cd9f..8166afc89b 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -165,9 +165,9 @@ LLVirtualTrackball::~LLVirtualTrackball() { } -BOOL LLVirtualTrackball::postBuild() +bool LLVirtualTrackball::postBuild() { - return TRUE; + return true; } @@ -233,7 +233,7 @@ void LLVirtualTrackball::draw() } // hide the direction labels when disabled - BOOL enabled = isInEnabledChain(); + bool enabled = isInEnabledChain(); mLabelN->setVisible(enabled); mLabelE->setVisible(enabled); mLabelS->setVisible(enabled); @@ -384,7 +384,7 @@ void LLVirtualTrackball::getAzimuthAndElevationDeg(const LLQuaternion &quat, F32 elevation *= RAD_TO_DEG; } -BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -413,7 +413,7 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { // set on click mode if (!pointInTouchCircle(x, y)) { - return TRUE; // don't drag outside the circle + return true; // don't drag outside the circle } F32 radius = mTouchArea->getRect().getWidth() / 2; @@ -453,10 +453,10 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) mPrevY = y; onCommit(); } - return TRUE; + return true; } -BOOL LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -468,7 +468,7 @@ BOOL LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) return LLView::handleMouseUp(x, y, mask); } -BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) { if (pointInTouchCircle(x, y)) { @@ -481,7 +481,7 @@ BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) return LLView::handleMouseDown(x, y, mask); } -BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (pointInTouchCircle(x, y)) { @@ -491,26 +491,26 @@ BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) return LLView::handleRightMouseDown(x, y, mask); } -BOOL LLVirtualTrackball::handleKeyHere(KEY key, MASK mask) +bool LLVirtualTrackball::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_DOWN: onRotateTopClick(); - handled = TRUE; + handled = true; break; case KEY_LEFT: onRotateRightClick(); - handled = TRUE; + handled = true; break; case KEY_UP: onRotateBottomClick(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: onRotateLeftClick(); - handled = TRUE; + handled = true; break; default: break; diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index 5eb9b548e5..61a78b2398 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -79,13 +79,13 @@ public: virtual ~LLVirtualTrackball(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleKeyHere(KEY key, MASK mask); virtual void draw(); diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 0d3819ff5c..8fd85a89a1 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -365,7 +365,7 @@ void LLXSDWriter::writeXSD(const std::string& type_name, LLXMLNodePtr node, cons // duplicate element choices LLXMLNodeList children; - mElementNode->getChildren("xs:element", children, FALSE); + mElementNode->getChildren("xs:element", children, false); for (LLXMLNodeList::iterator child_it = children.begin(); child_it != children.end(); ++child_it) { LLXMLNodePtr child_copy = child_it->second->deepCopy(); @@ -930,10 +930,10 @@ bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& s bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) { - S32 value; + bool value; LLXUIParser& self = static_cast<LLXUIParser&>(parser); bool success = self.mCurReadNode->getBoolValue(1, &value); - *((bool*)val_ptr) = (value != FALSE); + *((bool*)val_ptr) = value; return success; } @@ -1426,7 +1426,7 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl mEmptyLeafNode.push_back(false); - if( !XML_ParseBuffer(mParser, bytes_read, TRUE ) ) + if( !XML_ParseBuffer(mParser, bytes_read, true ) ) { LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL; XML_ParserFree( mParser ); diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 9fc31488a5..19bd8465b9 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -66,7 +66,7 @@ LLXYVector::Params::Params() ghost_color("ghost_color"), area_color("area_color", LLColor4::grey4), grid_color("grid_color", LLColor4::grey % 0.25f), - logarithmic("logarithmic", FALSE) + logarithmic("logarithmic", false) { } @@ -142,12 +142,12 @@ LLXYVector::~LLXYVector() { } -BOOL LLXYVector::postBuild() +bool LLXYVector::postBuild() { mLogScaleX = (2 * log(mMaxValueX)) / mTouchArea->getRect().getWidth(); mLogScaleY = (2 * log(mMaxValueY)) / mTouchArea->getRect().getHeight(); - return TRUE; + return true; } void drawArrow(S32 tailX, S32 tailY, S32 tipX, S32 tipY, LLColor4 color) @@ -275,7 +275,7 @@ void LLXYVector::update() mYEntry->setValue(mValueY); } -BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) +bool LLXYVector::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -298,10 +298,10 @@ BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { @@ -311,7 +311,7 @@ BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) if (mTouchArea->getRect().pointInRect(x, y)) { - return TRUE; + return true; } else { @@ -319,7 +319,7 @@ BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) } } -BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) { if (mTouchArea->getRect().pointInRect(x, y)) @@ -327,7 +327,7 @@ BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) gFocusMgr.setMouseCapture(this); make_ui_sound("UISndClick"); - return TRUE; + return true; } else { diff --git a/indra/llui/llxyvector.h b/indra/llui/llxyvector.h index 6bebf347e8..bc41213c13 100644 --- a/indra/llui/llxyvector.h +++ b/indra/llui/llxyvector.h @@ -59,18 +59,18 @@ public: Optional<LLUIColor> ghost_color; Optional<LLUIColor> area_color; Optional<LLUIColor> grid_color; - Optional<BOOL> logarithmic; + Optional<bool> logarithmic; Params(); }; virtual ~LLXYVector(); - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual bool handleHover(S32 x, S32 y, MASK mask); + virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual void draw(); @@ -113,7 +113,7 @@ private: LLUIColor mAreaColor; LLUIColor mGridColor; - BOOL mLogarithmic; + bool mLogarithmic; F32 mLogScaleX; F32 mLogScaleY; }; diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 729b983e79..088cdd675b 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -58,7 +58,7 @@ typedef std::map<std::string, LLControlGroup*> settings_map_t; settings_map_t LLUI::sSettingGroups; -BOOL LLControlGroup::getBOOL(const std::string& name) +bool LLControlGroup::getBOOL(const std::string& name) { return false; } |