diff options
Diffstat (limited to 'indra/newview/llfloateremojipicker.cpp')
-rw-r--r-- | indra/newview/llfloateremojipicker.cpp | 201 |
1 files changed, 100 insertions, 101 deletions
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index c9d14c45f8..9e69e3d6f9 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -39,9 +39,9 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsdserialize.h" -#include "lltextbox.h" +#include "lltextbox.h" #include "lltrans.h" -#include "llviewerchat.h" +#include "llviewerchat.h" namespace { // The following variables and constants are used for storing the floater state @@ -80,7 +80,7 @@ public: addChild(mList); } - virtual void updatePanel(BOOL allow_modify) override {} + virtual void updatePanel(bool allow_modify) override {} public: LLScrollingPanelList* mList; @@ -100,21 +100,21 @@ public: LLScrollingPanel::draw(); F32 x = 4; // padding-left - F32 y = getRect().getHeight() / 2; + F32 y = (F32)(getRect().getHeight() / 2); LLFontGL::getFontSansSerif()->render( - mText, // wstr - 0, // begin_offset - x, // x - y, // y - LLColor4::white, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - mText.size()); // max_chars + mText, // wstr + 0, // begin_offset + x, // x + y, // y + LLColor4::white, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(mText.size())); // max_chars } - virtual void updatePanel(BOOL allow_modify) override {} + virtual void updatePanel(bool allow_modify) override {} private: const LLWString mText; @@ -136,8 +136,8 @@ public: { LLScrollingPanel::draw(); - F32 x = getRect().getWidth() / 2; - F32 y = getRect().getHeight() / 2; + F32 x = (F32)(getRect().getWidth() / 2); + F32 y = (F32)(getRect().getHeight() / 2); LLFontGL::getFontEmojiLarge()->render( mChar, // wstr 0, // begin_offset @@ -151,7 +151,7 @@ public: 1); // max_chars } - virtual void updatePanel(BOOL allow_modify) override {} + virtual void updatePanel(bool allow_modify) override {} const LLEmojiSearchResult& getData() const { return mData; } const LLWString& getChar() const { return mChar; } @@ -205,7 +205,7 @@ public: static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f); LLColor4 textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor); S32 max_pixels = clientWidth - iconWidth; - drawName(iconWidth, centerY, max_pixels, textColor); + drawName((F32)iconWidth, centerY, max_pixels, textColor); } protected: @@ -228,23 +228,23 @@ protected: void drawName(F32 x, F32 y, S32 max_pixels, LLColor4& color) { F32 x0 = x; - F32 x1 = max_pixels; + F32 x1 = (F32)max_pixels; LLFontGL* font = LLFontGL::getFontEmojiLarge(); if (mBegin) { std::string text = mTitle.substr(0, mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + (S32)x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -253,17 +253,17 @@ protected: { std::string text = mTitle.substr(mBegin, mEnd - mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - LLColor4::yellow6, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + LLColor4::yellow6, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + (S32)x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -272,17 +272,17 @@ protected: { std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + (S32)x1); // max_pixels } } @@ -298,14 +298,14 @@ LLFloaterEmojiPicker::LLFloaterEmojiPicker(const LLSD& key) : super(key) { // This floater should hover on top of our dependent (with the dependent having the focus) - setFocusStealsFrontmost(FALSE); - setBackgroundVisible(FALSE); - setAutoFocus(FALSE); + setFocusStealsFrontmost(false); + setBackgroundVisible(false); + setAutoFocus(false); loadState(); } -BOOL LLFloaterEmojiPicker::postBuild() +bool LLFloaterEmojiPicker::postBuild() { mGroups = getChild<LLPanel>("Groups"); mBadge = getChild<LLPanel>("Badge"); @@ -314,7 +314,7 @@ BOOL LLFloaterEmojiPicker::postBuild() mDummy = getChild<LLTextBox>("Dummy"); mPreview = new LLEmojiPreviewPanel(); - mPreview->setVisible(FALSE); + mPreview->setVisible(false); addChild(mPreview); return LLFloater::postBuild(); @@ -329,7 +329,7 @@ void LLFloaterEmojiPicker::onOpen(const LLSD& key) initialize(); - gFloaterView->adjustToFitScreen(this, FALSE); + gFloaterView->adjustToFitScreen(this, false); } void LLFloaterEmojiPicker::onClose(bool app_quitting) @@ -382,7 +382,7 @@ void LLFloaterEmojiPicker::initialize() return; } - mGroups->setVisible(FALSE); + mGroups->setVisible(false); mFocusedIconRow = -1; mFocusedIconCol = -1; mFocusedIcon = nullptr; @@ -407,17 +407,17 @@ void LLFloaterEmojiPicker::initialize() return; } - mGroups->setVisible(TRUE); + mGroups->setVisible(true); mPreview->setIcon(nullptr); showPreview(true); mSelectedGroupIndex = groupIndex == ALL_EMOJIS_GROUP_INDEX ? 0 : - (1 + std::distance(mFilteredEmojiGroups.begin(), + static_cast<U32>((1 + std::distance(mFilteredEmojiGroups.begin(), std::find(mFilteredEmojiGroups.begin(), mFilteredEmojiGroups.end(), groupIndex))) % - (1 + mFilteredEmojiGroups.size()); + (1 + mFilteredEmojiGroups.size())); - mGroupButtons[mSelectedGroupIndex]->setToggleState(TRUE); - mGroupButtons[mSelectedGroupIndex]->setUseFontColor(TRUE); + mGroupButtons[mSelectedGroupIndex]->setToggleState(true); + mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); fillEmojis(); } @@ -559,9 +559,9 @@ void LLFloaterEmojiPicker::createGroupButton(LLButton::Params& params, const LLR button->setMouseLeaveCallback([this](LLUICtrl* ctrl, const LLSD&) { onGroupButtonMouseLeave(ctrl); }); button->setRect(rect); - button->setTabStop(FALSE); + button->setTabStop(false); button->setLabel(LLUIString(LLWString(1, emoji))); - button->setUseFontColor(FALSE); + button->setUseFontColor(false); mGroupButtons.push_back(button); mGroups->addChild(button); @@ -598,13 +598,13 @@ void LLFloaterEmojiPicker::selectEmojiGroup(U32 index) if (mSelectedGroupIndex < mGroupButtons.size()) { - mGroupButtons[mSelectedGroupIndex]->setUseFontColor(FALSE); - mGroupButtons[mSelectedGroupIndex]->setToggleState(FALSE); + mGroupButtons[mSelectedGroupIndex]->setUseFontColor(false); + mGroupButtons[mSelectedGroupIndex]->setToggleState(false); } mSelectedGroupIndex = index; - mGroupButtons[mSelectedGroupIndex]->setToggleState(TRUE); - mGroupButtons[mSelectedGroupIndex]->setUseFontColor(TRUE); + mGroupButtons[mSelectedGroupIndex]->setToggleState(true); + mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); LLButton* button = mGroupButtons[mSelectedGroupIndex]; LLRect rect = mBadge->getRect(); @@ -658,7 +658,7 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize) LLScrollingPanelList::Params row_list_params; row_list_params.rect = row_panel_params.rect; - row_list_params.is_horizontal = TRUE; + row_list_params.is_horizontal = true; row_list_params.padding = 0; row_list_params.spacing = icon_spacing; @@ -799,9 +799,8 @@ void LLFloaterEmojiPicker::createEmojiIcon(const LLEmojiSearchResult& emoji, void LLFloaterEmojiPicker::showPreview(bool show) { - //mPreview->setIcon(nullptr); - mDummy->setVisible(show ? FALSE : TRUE); - mPreview->setVisible(show ? TRUE : FALSE); + mDummy->setVisible(!show); + mPreview->setVisible(show); } void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl) @@ -815,7 +814,7 @@ void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl) if (it == mGroupButtons.end()) return; - selectEmojiGroup(it - mGroupButtons.begin()); + selectEmojiGroup((U32)(it - mGroupButtons.begin())); } } @@ -823,7 +822,7 @@ void LLFloaterEmojiPicker::onGroupButtonMouseEnter(LLUICtrl* ctrl) { if (LLButton* button = dynamic_cast<LLButton*>(ctrl)) { - button->setUseFontColor(TRUE); + button->setUseFontColor(true); } } @@ -897,7 +896,7 @@ void LLFloaterEmojiPicker::onEmojiMouseUp(LLUICtrl* ctrl) onCommit(); - if (!mHint.empty() || !(gKeyboard->currentMask(TRUE) & MASK_SHIFT)) + if (!mHint.empty() || !(gKeyboard->currentMask(true) & MASK_SHIFT)) { hideFloater(); } @@ -941,15 +940,15 @@ bool LLFloaterEmojiPicker::moveFocusedIconUp() bool LLFloaterEmojiPicker::moveFocusedIconDown() { - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); if (row && row->mList->getPanelList().size() > mFocusedIconCol) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -977,7 +976,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconPrev() if (row && row->mList->getPanelList().size()) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconCol = row->mList->getPanelList().size() - 1; + mFocusedIconCol = static_cast<S32>(row->mList->getPanelList().size()) - 1; mFocusedIconRow = i; selectFocusedIcon(); return true; @@ -994,7 +993,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() LLScrollingPanel* panel = mEmojiGrid->getPanelList()[mFocusedIconRow]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); - S32 colCount = row ? row->mList->getPanelList().size() : 0; + S32 colCount = row ? static_cast<S32>(row->mList->getPanelList().size()) : 0; if (mFocusedIconCol < colCount - 1) { mFocusedIconCol++; @@ -1002,8 +1001,8 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() return true; } - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); @@ -1011,7 +1010,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); mFocusedIconCol = 0; - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -1022,18 +1021,18 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() void LLFloaterEmojiPicker::selectGridIcon(LLEmojiGridIcon* icon) { - icon->setBackgroundVisible(TRUE); + icon->setBackgroundVisible(true); mPreview->setIcon(icon); } void LLFloaterEmojiPicker::unselectGridIcon(LLEmojiGridIcon* icon) { - icon->setBackgroundVisible(FALSE); + icon->setBackgroundVisible(false); mPreview->setIcon(nullptr); } // virtual -BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent) +bool LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, bool called_from_parent) { if (mask == MASK_NONE) { @@ -1041,19 +1040,19 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent { case KEY_UP: moveFocusedIconUp(); - return TRUE; + return true; case KEY_DOWN: moveFocusedIconDown(); - return TRUE; + return true; case KEY_LEFT: moveFocusedIconPrev(); - return TRUE; + return true; case KEY_RIGHT: moveFocusedIconNext(); - return TRUE; + return true; case KEY_ESCAPE: hideFloater(); - return TRUE; + return true; } } @@ -1062,11 +1061,11 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent switch (key) { case KEY_LEFT: - selectEmojiGroup((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size()); - return TRUE; + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size())); + return true; case KEY_RIGHT: - selectEmojiGroup((mSelectedGroupIndex + 1) % mGroupButtons.size()); - return TRUE; + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + 1) % mGroupButtons.size())); + return true; } } @@ -1080,7 +1079,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent onEmojiMouseUp(mFocusedIcon); } mRecentReturnPressedMs = time; - return TRUE; + return true; } if (mHint.empty()) @@ -1096,7 +1095,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent mFilterPattern += (char)key; initialize(); } - return TRUE; + return true; } else if (key == KEY_BACKSPACE) { @@ -1109,7 +1108,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent } initialize(); } - return TRUE; + return true; } } |