summaryrefslogtreecommitdiff
path: root/indra/newview/llfloateremojipicker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloateremojipicker.cpp')
-rw-r--r--indra/newview/llfloateremojipicker.cpp212
1 files changed, 106 insertions, 106 deletions
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp
index 78b94d1b0c..d38f53eed6 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
@@ -81,7 +81,7 @@ public:
addChild(mList);
}
- virtual void updatePanel(BOOL allow_modify) override {}
+ virtual void updatePanel(bool allow_modify) override {}
public:
LLScrollingPanelList* mList;
@@ -103,19 +103,19 @@ public:
F32 x = 4; // padding-left
F32 y = 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;
@@ -152,7 +152,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; }
@@ -235,17 +235,17 @@ protected:
{
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
+ x1); // max_pixels
F32 dx = font->getWidthF32(text);
x0 += dx;
x1 -= dx;
@@ -254,17 +254,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
+ x1); // max_pixels
F32 dx = font->getWidthF32(text);
x0 += dx;
x1 -= dx;
@@ -273,17 +273,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
+ x1); // max_pixels
}
}
@@ -299,14 +299,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");
@@ -315,7 +315,7 @@ BOOL LLFloaterEmojiPicker::postBuild()
mDummy = getChild<LLTextBox>("Dummy");
mPreview = new LLEmojiPreviewPanel();
- mPreview->setVisible(FALSE);
+ mPreview->setVisible(false);
addChild(mPreview);
return LLFloater::postBuild();
@@ -330,7 +330,7 @@ void LLFloaterEmojiPicker::onOpen(const LLSD& key)
initialize();
- gFloaterView->adjustToFitScreen(this, FALSE);
+ gFloaterView->adjustToFitScreen(this, false);
}
void LLFloaterEmojiPicker::onClose(bool app_quitting)
@@ -383,7 +383,7 @@ void LLFloaterEmojiPicker::initialize()
return;
}
- mGroups->setVisible(FALSE);
+ mGroups->setVisible(false);
mFocusedIconRow = -1;
mFocusedIconCol = -1;
mFocusedIcon = nullptr;
@@ -408,17 +408,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();
}
@@ -499,13 +499,13 @@ void LLFloaterEmojiPicker::fillCategoryRecentlyUsed(std::map<std::string, std::v
{
for (const std::string& shortcode : e2d->second->ShortCodes)
{
- if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
- {
- emojis.emplace_back(emoji, shortcode, begin, end);
- }
+ if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
+ {
+ emojis.emplace_back(emoji, shortcode, begin, end);
}
}
}
+ }
if (emojis.empty())
return;
}
@@ -533,13 +533,13 @@ void LLFloaterEmojiPicker::fillCategoryFrequentlyUsed(std::map<std::string, std:
{
for (const std::string& shortcode : e2d->second->ShortCodes)
{
- if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
- {
- emojis.emplace_back(emoji.first, shortcode, begin, end);
- }
+ if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
+ {
+ emojis.emplace_back(emoji.first, shortcode, begin, end);
}
}
}
+ }
if (emojis.empty())
return;
}
@@ -571,13 +571,13 @@ void LLFloaterEmojiPicker::fillGroupEmojis(std::map<std::string, std::vector<LLE
{
for (const std::string& shortcode : descr->ShortCodes)
{
- if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
- {
- emojis.emplace_back(descr->Character, shortcode, begin, end);
- }
+ if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
+ {
+ emojis.emplace_back(descr->Character, shortcode, begin, end);
}
}
}
+ }
if (emojis.empty())
continue;
}
@@ -594,9 +594,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);
@@ -633,13 +633,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();
@@ -693,7 +693,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;
@@ -850,8 +850,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)
@@ -873,7 +873,7 @@ void LLFloaterEmojiPicker::onGroupButtonMouseEnter(LLUICtrl* ctrl)
{
if (LLButton* button = dynamic_cast<LLButton*>(ctrl))
{
- button->setUseFontColor(TRUE);
+ button->setUseFontColor(true);
}
}
@@ -947,7 +947,7 @@ void LLFloaterEmojiPicker::onEmojiMouseUp(LLUICtrl* ctrl)
onCommit();
- if (!mHint.empty() || !(gKeyboard->currentMask(TRUE) & MASK_SHIFT))
+ if (!mHint.empty() || !(gKeyboard->currentMask(true) & MASK_SHIFT))
{
hideFloater();
}
@@ -991,15 +991,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;
}
@@ -1027,7 +1027,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;
@@ -1044,7 +1044,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++;
@@ -1052,8 +1052,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);
@@ -1061,7 +1061,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext()
{
mEmojiScroll->scrollToShowRect(row->getBoundingRect());
mFocusedIconCol = 0;
- mFocusedIconRow = i;
+ mFocusedIconRow = static_cast<S32>(i);
selectFocusedIcon();
return true;
}
@@ -1072,18 +1072,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)
{
@@ -1091,19 +1091,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;
}
}
@@ -1112,11 +1112,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;
}
}
@@ -1130,7 +1130,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent
onEmojiMouseUp(mFocusedIcon);
}
mRecentReturnPressedMs = time;
- return TRUE;
+ return true;
}
if (mHint.empty())
@@ -1146,7 +1146,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)
{
@@ -1159,7 +1159,7 @@ BOOL LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, BOOL called_from_parent
}
initialize();
}
- return TRUE;
+ return true;
}
}