# Conflicts:
#	indra/newview/skins/default/xui/en/floater_emoji_picker.xml
master
Ansariel 2023-07-18 11:53:23 +02:00
commit 3eaa83f4d1
9 changed files with 193 additions and 164 deletions

View File

@ -193,7 +193,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (-1 == max_chars) if (-1 == max_chars)
{ {
length = (S32)wstr.length() - begin_offset; max_chars = length = (S32)wstr.length() - begin_offset;
} }
else else
{ {
@ -254,7 +254,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL; const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;
BOOL draw_ellipses = FALSE; BOOL draw_ellipses = FALSE;
if (use_ellipses) if (use_ellipses)
{ {
@ -1090,13 +1089,20 @@ LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name)
return gl_vfont_align; return gl_vfont_align;
} }
//static //static
LLFontGL* LLFontGL::getFontEmoji() LLFontGL* LLFontGL::getFontEmoji()
{ {
static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Large", 0)); static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Large", 0));
return fontp;; return fontp;;
} }
//static
LLFontGL* LLFontGL::getFontEmojiHuge()
{
static LLFontGL* fontp = getFont(LLFontDescriptor("Emoji", "Huge", 0));
return fontp;;
}
//static //static
LLFontGL* LLFontGL::getFontMonospace() LLFontGL* LLFontGL::getFontMonospace()
{ {

View File

@ -195,6 +195,7 @@ public:
static void setFontDisplay(BOOL flag) { sDisplayFont = flag; } static void setFontDisplay(BOOL flag) { sDisplayFont = flag; }
static LLFontGL* getFontEmoji(); static LLFontGL* getFontEmoji();
static LLFontGL* getFontEmojiHuge();
static LLFontGL* getFontMonospace(); static LLFontGL* getFontMonospace();
static LLFontGL* getFontSansSerifSmall(); static LLFontGL* getFontSansSerifSmall();
static LLFontGL* getFontSansSerif(); static LLFontGL* getFontSansSerif();

View File

@ -89,6 +89,7 @@ LLLineEditor::Params::Params()
background_image_disabled("background_image_disabled"), background_image_disabled("background_image_disabled"),
background_image_focused("background_image_focused"), background_image_focused("background_image_focused"),
bg_image_always_focused("bg_image_always_focused", false), bg_image_always_focused("bg_image_always_focused", false),
show_label_focused("show_label_focused", false),
select_on_focus("select_on_focus", false), select_on_focus("select_on_focus", false),
revert_on_esc("revert_on_esc", true), revert_on_esc("revert_on_esc", true),
spellcheck("spellcheck", false), spellcheck("spellcheck", false),
@ -152,6 +153,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mBgImageDisabled( p.background_image_disabled ), mBgImageDisabled( p.background_image_disabled ),
mBgImageFocused( p.background_image_focused ), mBgImageFocused( p.background_image_focused ),
mShowImageFocused( p.bg_image_always_focused ), mShowImageFocused( p.bg_image_always_focused ),
mShowLabelFocused( p.show_label_focused ),
mUseBgColor(p.use_bg_color), mUseBgColor(p.use_bg_color),
mHaveHistory(FALSE), mHaveHistory(FALSE),
mReplaceNewlinesWithSpaces( TRUE ), mReplaceNewlinesWithSpaces( TRUE ),
@ -2151,7 +2153,7 @@ void LLLineEditor::draw()
//draw label if no text is provided //draw label if no text is provided
//but we should draw it in a different color //but we should draw it in a different color
//to give indication that it is not text you typed in //to give indication that it is not text you typed in
if (0 == mText.length() && mReadOnly) if (0 == mText.length() && (mReadOnly || mShowLabelFocused))
{ {
mGLFont->render(mLabel.getWString(), 0, mGLFont->render(mLabel.getWString(), 0,
mTextLeftEdge, (F32)text_bottom, mTextLeftEdge, (F32)text_bottom,

View File

@ -91,6 +91,7 @@ public:
commit_on_focus_lost, commit_on_focus_lost,
ignore_tab, ignore_tab,
bg_image_always_focused, bg_image_always_focused,
show_label_focused,
is_password, is_password,
use_bg_color; use_bg_color;
@ -412,6 +413,7 @@ protected:
BOOL mReadOnly; BOOL mReadOnly;
BOOL mShowImageFocused; BOOL mShowImageFocused;
BOOL mShowLabelFocused;
bool mUseBgColor; bool mUseBgColor;

View File

@ -48,63 +48,18 @@ namespace {
// Floater state related variables // Floater state related variables
static U32 sSelectedGroupIndex = 0; static U32 sSelectedGroupIndex = 0;
static std::string sSearchPattern; static std::string sFilterPattern;
static std::list<llwchar> sRecentlyUsed; static std::list<llwchar> sRecentlyUsed;
static std::list<std::pair<llwchar, U32>> sFrequentlyUsed; static std::list<std::pair<llwchar, U32>> sFrequentlyUsed;
// State file related values // State file related values
static std::string sStateFileName; static std::string sStateFileName;
static const std::string sKeySelectedGroupIndex("SelectedGroupIndex"); static const std::string sKeySelectedGroupIndex("SelectedGroupIndex");
static const std::string sKeySearchPattern("SearchPattern"); static const std::string sKeyFilterPattern("FilterPattern");
static const std::string sKeyRecentlyUsed("RecentlyUsed"); static const std::string sKeyRecentlyUsed("RecentlyUsed");
static const std::string sKeyFrequentlyUsed("FrequentlyUsed"); static const std::string sKeyFrequentlyUsed("FrequentlyUsed");
} }
class LLEmojiScrollListItem : public LLScrollListItem
{
public:
LLEmojiScrollListItem(const llwchar emoji, const LLScrollListItem::Params& params)
: LLScrollListItem(params)
, mEmoji(emoji)
{
}
llwchar getEmoji() const { return mEmoji; }
virtual void draw(const LLRect& rect,
const LLColor4& fg_color,
const LLColor4& hover_color, // highlight/hover selection of whole item or cell
const LLColor4& select_color, // highlight/hover selection of whole item or cell
const LLColor4& highlight_color, // highlights contents of cells (ex: text)
S32 column_padding) override
{
LLScrollListItem::draw(rect, fg_color, hover_color, select_color, highlight_color, column_padding);
LLWString wstr(1, mEmoji);
S32 width = getColumn(0)->getWidth();
F32 x = rect.mLeft + width / 2;
F32 y = rect.getCenterY();
LLFontGL::getFontEmoji()->render(
wstr, // wstr
0, // begin_offset
x, // x
y, // y
LLColor4::white, // color
LLFontGL::HCENTER, // halign
LLFontGL::VCENTER, // valign
LLFontGL::NORMAL, // style
LLFontGL::DROP_SHADOW_SOFT, // shadow
1, // max_chars
S32_MAX, // max_pixels
nullptr, // right_x
false, // use_ellipses
true); // use_color
}
private:
llwchar mEmoji;
};
class LLEmojiGridRow : public LLScrollingPanel class LLEmojiGridRow : public LLScrollingPanel
{ {
public: public:
@ -137,7 +92,7 @@ public:
F32 x = 4; // padding-left F32 x = 4; // padding-left
F32 y = getRect().getHeight() / 2; F32 y = getRect().getHeight() / 2;
LLFontGL::getFontSansSerifBold()->render( LLFontGL::getFontSansSerif()->render(
mText, // wstr mText, // wstr
0, // begin_offset 0, // begin_offset
x, // x x, // x
@ -168,10 +123,8 @@ public:
, const LLEmojiDescriptor* descr , const LLEmojiDescriptor* descr
, std::string category) , std::string category)
: LLScrollingPanel(panel_params) : LLScrollingPanel(panel_params)
, mEmoji(descr->Character) , mDescr(descr)
, mText(LLWString(1, mEmoji)) , mText(LLWString(1, descr->Character))
, mDescr(descr->getShortCodes())
, mCategory(category)
{ {
} }
@ -200,16 +153,106 @@ public:
virtual void updatePanel(BOOL allow_modify) override {} virtual void updatePanel(BOOL allow_modify) override {}
llwchar getEmoji() const { return mEmoji; } const LLEmojiDescriptor* getDescr() const { return mDescr; }
llwchar getEmoji() const { return mDescr->Character; }
LLWString getText() const { return mText; } LLWString getText() const { return mText; }
std::string getDescr() const { return mDescr; }
std::string getCategory() const { return mCategory; }
private: private:
const llwchar mEmoji; const LLEmojiDescriptor* mDescr;
const LLWString mText; const LLWString mText;
const std::string mDescr; };
const std::string mCategory;
class LLEmojiPreviewPanel : public LLPanel
{
public:
LLEmojiPreviewPanel()
: LLPanel()
{
}
void setEmoji(const LLEmojiDescriptor* descr)
{
mDescr = descr;
if (!mDescr)
return;
mEmojiText = LLWString(1, descr->Character);
}
virtual void draw() override
{
LLPanel::draw();
if (!mDescr)
return;
S32 clientHeight = getRect().getHeight();
S32 clientWidth = getRect().getWidth();
S32 iconWidth = clientHeight;
F32 centerX = 0.5f * iconWidth;
F32 centerY = 0.5f * clientHeight;
drawIcon(centerX, centerY, iconWidth);
static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f);
LLColor4 textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor);
S32 max_pixels = clientWidth - iconWidth;
size_t count = mDescr->ShortCodes.size();
if (count == 1)
{
drawName(mDescr->ShortCodes.front(), iconWidth, centerY, max_pixels, textColor);
}
else if (count > 1)
{
F32 quarterY = 0.5f * centerY;
drawName(mDescr->ShortCodes.front(), iconWidth, centerY + quarterY, max_pixels, textColor);
drawName(*++mDescr->ShortCodes.begin(), iconWidth, quarterY, max_pixels, textColor);
}
}
protected:
void drawIcon(F32 x, F32 y, S32 max_pixels)
{
LLFontGL::getFontEmojiHuge()->render(
mEmojiText, // wstr
0, // begin_offset
x, // x
y, // y
LLColor4::white, // color
LLFontGL::HCENTER, // halign
LLFontGL::VCENTER, // valign
LLFontGL::NORMAL, // style
LLFontGL::DROP_SHADOW_SOFT, // shadow
1, // max_chars
max_pixels, // max_pixels
nullptr, // right_x
false, // use_ellipses
true); // use_color
}
void drawName(std::string name, F32 x, F32 y, S32 max_pixels, LLColor4& color)
{
LLFontGL::getFontEmoji()->renderUTF8(
name, // wstr
0, // begin_offset
x, // x
y, // y
color, // color
LLFontGL::LEFT, // halign
LLFontGL::VCENTER, // valign
LLFontGL::NORMAL, // style
LLFontGL::DROP_SHADOW_SOFT, // shadow
-1, // max_chars
max_pixels, // max_pixels
nullptr, // right_x
true, // use_ellipses
false); // use_color
}
private:
const LLEmojiDescriptor* mDescr { nullptr };
LLWString mEmojiText;
}; };
LLFloaterEmojiPicker* LLFloaterEmojiPicker::getInstance() LLFloaterEmojiPicker* LLFloaterEmojiPicker::getInstance()
@ -244,19 +287,17 @@ LLFloaterEmojiPicker::LLFloaterEmojiPicker(const LLSD& key)
BOOL LLFloaterEmojiPicker::postBuild() BOOL LLFloaterEmojiPicker::postBuild()
{ {
// Should be initialized first // Should be initialized first
mPreviewEmoji = getChild<LLButton>("PreviewEmoji"); mPreview = new LLEmojiPreviewPanel();
mPreviewEmoji->setClickedCallback([this](LLUICtrl*, const LLSD&) { onPreviewEmojiClick(); }); mPreview->setVisible(FALSE);
addChild(mPreview);
mDescription = getChild<LLTextBox>("Description");
mDescription->setVisible(FALSE);
mGroups = getChild<LLPanel>("Groups"); mGroups = getChild<LLPanel>("Groups");
mBadge = getChild<LLPanel>("Badge"); mBadge = getChild<LLPanel>("Badge");
mSearch = getChild<LLLineEditor>("Search"); mFilter = getChild<LLLineEditor>("Filter");
mSearch->setKeystrokeCallback([this](LLLineEditor*, void*) { onSearchKeystroke(); }, NULL); mFilter->setKeystrokeCallback([this](LLLineEditor*, void*) { onSearchKeystroke(); }, NULL);
mSearch->setFont(LLViewerChat::getChatFont()); mFilter->setFont(LLViewerChat::getChatFont());
mSearch->setText(sSearchPattern); mFilter->setText(sFilterPattern);
mEmojiScroll = getChild<LLScrollContainer>("EmojiGridContainer"); mEmojiScroll = getChild<LLScrollContainer>("EmojiGridContainer");
mEmojiScroll->setMouseEnterCallback([this](LLUICtrl*, const LLSD&) { onGridMouseEnter(); }); mEmojiScroll->setMouseEnterCallback([this](LLUICtrl*, const LLSD&) { onGridMouseEnter(); });
@ -274,6 +315,16 @@ void LLFloaterEmojiPicker::dirtyRect()
{ {
super::dirtyRect(); super::dirtyRect();
if (!mFilter)
return;
const S32 PADDING = 4;
LLRect rect(PADDING, mFilter->getRect().mTop, getRect().getWidth() - PADDING * 2, PADDING);
if (mPreview->getRect() != rect)
{
mPreview->setRect(rect);
}
if (mEmojiScroll && mEmojiScroll->getRect().getWidth() != mRecentGridWidth) if (mEmojiScroll && mEmojiScroll->getRect().getWidth() != mRecentGridWidth)
{ {
moveGroups(); moveGroups();
@ -374,7 +425,7 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize)
mHoveredIcon = nullptr; mHoveredIcon = nullptr;
mEmojiGrid->clearPanels(); mEmojiGrid->clearPanels();
mPreviewEmoji->setLabel(LLUIString()); mPreview->setEmoji(nullptr);
if (mEmojiGrid->getRect().getWidth() != clientWidth) if (mEmojiGrid->getRect().getWidth() != clientWidth)
{ {
@ -395,17 +446,16 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize)
LLPanel::Params icon_params; LLPanel::Params icon_params;
LLRect icon_rect(0, iconSize, iconSize, 0); LLRect icon_rect(0, iconSize, iconSize, 0);
static const LLColor4 bgcolors[] = static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f);
{ LLColor4 bgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", defaultColor);
LLColor4(0.8f, 0.6f, 0.8f, 1.0f),
LLColor4(0.8f, 0.8f, 0.4f, 1.0f),
LLColor4(0.6f, 0.6f, 0.8f, 1.0f),
LLColor4(0.4f, 0.7f, 0.4f, 1.0f),
LLColor4(0.5f, 0.7f, 0.9f, 1.0f),
LLColor4(0.7f, 0.8f, 0.2f, 1.0f)
};
static constexpr U32 bgcolorCount = sizeof(bgcolors) / sizeof(*bgcolors); auto matchesPattern = [](const LLEmojiDescriptor* descr) -> bool
{
for (const std::string& shortCode : descr->ShortCodes)
if (shortCode.find(sFilterPattern) != std::string::npos)
return true;
return false;
};
auto listCategory = [&](std::string category, const std::vector<const LLEmojiDescriptor*>& emojis, int maxRows = 0) auto listCategory = [&](std::string category, const std::vector<const LLEmojiDescriptor*>& emojis, int maxRows = 0)
{ {
@ -418,9 +468,10 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize)
{ {
LLStringUtil::capitalize(category); LLStringUtil::capitalize(category);
} }
for (const LLEmojiDescriptor* descr : emojis) for (const LLEmojiDescriptor* descr : emojis)
{ {
if (sSearchPattern.empty() || matchesPattern(descr)) if (sFilterPattern.empty() || matchesPattern(descr))
{ {
// Place a category title if needed // Place a category title if needed
if (showDivider) if (showDivider)
@ -443,8 +494,9 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize)
LLEmojiGridIcon* icon = new LLEmojiGridIcon(icon_params, descr, mixedFolder ? LLStringUtil::capitalize(descr->Category) : category); LLEmojiGridIcon* icon = new LLEmojiGridIcon(icon_params, descr, mixedFolder ? LLStringUtil::capitalize(descr->Category) : category);
icon->setMouseEnterCallback([this](LLUICtrl* ctrl, const LLSD&) { onEmojiMouseEnter(ctrl); }); icon->setMouseEnterCallback([this](LLUICtrl* ctrl, const LLSD&) { onEmojiMouseEnter(ctrl); });
icon->setMouseLeaveCallback([this](LLUICtrl* ctrl, const LLSD&) { onEmojiMouseLeave(ctrl); }); icon->setMouseLeaveCallback([this](LLUICtrl* ctrl, const LLSD&) { onEmojiMouseLeave(ctrl); });
icon->setMouseUpCallback([this](LLUICtrl* ctrl, S32, S32, MASK mask) { onEmojiMouseClick(ctrl, mask); }); icon->setMouseDownCallback([this](LLUICtrl* ctrl, S32, S32, MASK) { onEmojiMouseDown(ctrl); });
icon->setBackgroundColor(bgcolors[iconIndex % bgcolorCount]); icon->setMouseUpCallback([this](LLUICtrl* ctrl, S32, S32, MASK) { onEmojiMouseUp(ctrl); });
icon->setBackgroundColor(bgColor);
icon->setBackgroundOpaque(1); icon->setBackgroundOpaque(1);
icon->setRect(icon_rect); icon->setRect(icon_rect);
row->mList->addPanel(icon, true); row->mList->addPanel(icon, true);
@ -511,14 +563,6 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize)
} }
} }
bool LLFloaterEmojiPicker::matchesPattern(const LLEmojiDescriptor* descr)
{
for (const std::string& shortCode : descr->ShortCodes)
if (shortCode.find(sSearchPattern) != std::string::npos)
return true;
return false;
}
void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl) void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl)
{ {
if (LLButton* button = dynamic_cast<LLButton*>(ctrl)) if (LLButton* button = dynamic_cast<LLButton*>(ctrl))
@ -541,7 +585,7 @@ void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl)
rect.mRight = button->getRect().mRight; rect.mRight = button->getRect().mRight;
mBadge->setRect(rect); mBadge->setRect(rect);
mSearch->setFocus(TRUE); mFilter->setFocus(TRUE);
fillEmojis(); fillEmojis();
} }
@ -549,34 +593,22 @@ void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl)
void LLFloaterEmojiPicker::onSearchKeystroke() void LLFloaterEmojiPicker::onSearchKeystroke()
{ {
sSearchPattern = mSearch->getText(); sFilterPattern = mFilter->getText();
fillEmojis(); fillEmojis();
} }
void LLFloaterEmojiPicker::onPreviewEmojiClick()
{
if (mEmojiPickCallback)
{
if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(mHoveredIcon))
{
mEmojiPickCallback(icon->getEmoji());
}
}
}
void LLFloaterEmojiPicker::onGridMouseEnter() void LLFloaterEmojiPicker::onGridMouseEnter()
{ {
mSearch->setVisible(FALSE); mFilter->setVisible(FALSE);
mDescription->setText(LLStringExplicit(""), LLStyle::Params()); mPreview->setEmoji(nullptr);
mDescription->setVisible(TRUE); mPreview->setVisible(TRUE);
} }
void LLFloaterEmojiPicker::onGridMouseLeave() void LLFloaterEmojiPicker::onGridMouseLeave()
{ {
mDescription->setVisible(FALSE); mPreview->setVisible(FALSE);
mDescription->setText(LLStringExplicit(""), LLStyle::Params()); mFilter->setVisible(TRUE);
mSearch->setVisible(TRUE); mFilter->setFocus(TRUE);
mSearch->setFocus(TRUE);
} }
void LLFloaterEmojiPicker::onGroupButtonMouseEnter(LLUICtrl* ctrl) void LLFloaterEmojiPicker::onGroupButtonMouseEnter(LLUICtrl* ctrl)
@ -621,18 +653,29 @@ void LLFloaterEmojiPicker::onEmojiMouseLeave(LLUICtrl* ctrl)
} }
} }
void LLFloaterEmojiPicker::onEmojiMouseClick(LLUICtrl* ctrl, MASK mask) void LLFloaterEmojiPicker::onEmojiMouseDown(LLUICtrl* ctrl)
{ {
if (getSoundFlags() & MOUSE_DOWN)
{
make_ui_sound("UISndClick");
}
}
void LLFloaterEmojiPicker::onEmojiMouseUp(LLUICtrl* ctrl)
{
if (getSoundFlags() & MOUSE_UP)
{
make_ui_sound("UISndClickRelease");
}
if (mEmojiPickCallback) if (mEmojiPickCallback)
{ {
if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(ctrl)) if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(ctrl))
{ {
onEmojiUsed(icon->getEmoji()); onEmojiUsed(icon->getEmoji());
mPreviewEmoji->handleAnyMouseClick(0, 0, 0, EMouseClickType::CLICK_LEFT, TRUE); if (mEmojiPickCallback)
mPreviewEmoji->handleAnyMouseClick(0, 0, 0, EMouseClickType::CLICK_LEFT, FALSE);
if (!(mask & 4))
{ {
closeFloater(); mEmojiPickCallback(icon->getEmoji());
} }
} }
} }
@ -643,13 +686,7 @@ void LLFloaterEmojiPicker::selectGridIcon(LLUICtrl* ctrl)
if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(ctrl)) if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(ctrl))
{ {
icon->setBackgroundVisible(TRUE); icon->setBackgroundVisible(TRUE);
mPreview->setEmoji(icon->getDescr());
LLUIString text;
text.insert(0, icon->getText());
mPreviewEmoji->setLabel(text);
std::string descr = icon->getDescr() + "\n" + icon->getCategory();
mDescription->setText(LLStringExplicit(descr), LLStyle::Params());
} }
} }
@ -658,8 +695,7 @@ void LLFloaterEmojiPicker::unselectGridIcon(LLUICtrl* ctrl)
if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(ctrl)) if (LLEmojiGridIcon* icon = dynamic_cast<LLEmojiGridIcon*>(ctrl))
{ {
icon->setBackgroundVisible(FALSE); icon->setBackgroundVisible(FALSE);
mPreviewEmoji->setLabel(LLUIString()); mPreview->setEmoji(nullptr);
mDescription->setText(LLStringExplicit(""), LLStyle::Params());
} }
} }
@ -754,7 +790,7 @@ void LLFloaterEmojiPicker::loadState()
sSelectedGroupIndex = state[sKeySelectedGroupIndex].asInteger(); sSelectedGroupIndex = state[sKeySelectedGroupIndex].asInteger();
sSearchPattern = state[sKeySearchPattern].asString(); sFilterPattern = state[sKeyFilterPattern].asString();
// Load and parse sRecentlyUsed // Load and parse sRecentlyUsed
std::string recentlyUsed = state[sKeyRecentlyUsed]; std::string recentlyUsed = state[sKeyRecentlyUsed];
@ -826,9 +862,9 @@ void LLFloaterEmojiPicker::saveState()
state[sKeySelectedGroupIndex] = (int)sSelectedGroupIndex; state[sKeySelectedGroupIndex] = (int)sSelectedGroupIndex;
} }
if (!sSearchPattern.empty()) if (!sFilterPattern.empty())
{ {
state[sKeySearchPattern] = sSearchPattern; state[sKeyFilterPattern] = sFilterPattern;
} }
if (!sRecentlyUsed.empty()) if (!sRecentlyUsed.empty())

View File

@ -59,18 +59,16 @@ private:
void moveGroups(); void moveGroups();
void fillEmojis(bool fromResize = false); void fillEmojis(bool fromResize = false);
bool matchesPattern(const LLEmojiDescriptor* descr);
void onGroupButtonClick(LLUICtrl* ctrl); void onGroupButtonClick(LLUICtrl* ctrl);
void onSearchKeystroke(); void onSearchKeystroke();
void onPreviewEmojiClick();
void onGridMouseEnter(); void onGridMouseEnter();
void onGridMouseLeave(); void onGridMouseLeave();
void onGroupButtonMouseEnter(LLUICtrl* ctrl); void onGroupButtonMouseEnter(LLUICtrl* ctrl);
void onGroupButtonMouseLeave(LLUICtrl* ctrl); void onGroupButtonMouseLeave(LLUICtrl* ctrl);
void onEmojiMouseEnter(LLUICtrl* ctrl); void onEmojiMouseEnter(LLUICtrl* ctrl);
void onEmojiMouseLeave(LLUICtrl* ctrl); void onEmojiMouseLeave(LLUICtrl* ctrl);
void onEmojiMouseClick(LLUICtrl* ctrl, MASK mask); void onEmojiMouseDown(LLUICtrl* ctrl);
void onEmojiMouseUp(LLUICtrl* ctrl);
void selectGridIcon(LLUICtrl* ctrl); void selectGridIcon(LLUICtrl* ctrl);
void unselectGridIcon(LLUICtrl* ctrl); void unselectGridIcon(LLUICtrl* ctrl);
@ -83,11 +81,10 @@ private:
class LLPanel* mGroups { nullptr }; class LLPanel* mGroups { nullptr };
class LLPanel* mBadge { nullptr }; class LLPanel* mBadge { nullptr };
class LLLineEditor* mSearch { nullptr }; class LLLineEditor* mFilter { nullptr };
class LLScrollContainer* mEmojiScroll { nullptr }; class LLScrollContainer* mEmojiScroll { nullptr };
class LLScrollingPanelList* mEmojiGrid { nullptr }; class LLScrollingPanelList* mEmojiGrid { nullptr };
class LLButton* mPreviewEmoji { nullptr }; class LLEmojiPreviewPanel* mPreview { nullptr };
class LLTextBox* mDescription { nullptr };
pick_callback_t mEmojiPickCallback; pick_callback_t mEmojiPickCallback;
close_callback_t mFloaterCloseCallback; close_callback_t mFloaterCloseCallback;

View File

@ -140,11 +140,12 @@ BOOL LLFloaterIMNearbyChat::postBuild()
mInputEditor->setKeystrokeCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxKeystroke, this)); mInputEditor->setKeystrokeCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxKeystroke, this));
mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusLost, this)); mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusLost, this));
mInputEditor->setFocusReceivedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusReceived, this)); mInputEditor->setFocusReceivedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxFocusReceived, this));
mInputEditor->setLabel(LLTrans::getString("NearbyChatTitle")); std::string nearbyChatTitle(LLTrans::getString("NearbyChatTitle"));
mInputEditor->setLabel(nearbyChatTitle);
// Title must be defined BEFORE call to addConversationListItem() because // Title must be defined BEFORE call to addConversationListItem() because
// it is used to show the item's name in the conversations list // it is used to show the item's name in the conversations list
setTitle(LLTrans::getString("NearbyChatTitle")); setTitle(nearbyChatTitle);
// obsolete, but may be needed for backward compatibility? // obsolete, but may be needed for backward compatibility?
gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", LLControlVariable::PERSIST_NONDFT); gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", LLControlVariable::PERSIST_NONDFT);

View File

@ -2,5 +2,5 @@
<floater name="emojipicker" title="Emoji auswählen"> <floater name="emojipicker" title="Emoji auswählen">
<floater.string name="title_for_recently_used" value="Zuletzt verwendet"/> <floater.string name="title_for_recently_used" value="Zuletzt verwendet"/>
<floater.string name="title_for_frequently_used" value="Häufig verwendet"/> <floater.string name="title_for_frequently_used" value="Häufig verwendet"/>
<line_editor name="Search" label="Nach Emoji suchen"/> <line_editor name="Filter" label="Nach Emoji filtern"/>
</floater> </floater>

View File

@ -13,42 +13,26 @@
<floater.string name="title_for_recently_used" value="Recently used"/> <floater.string name="title_for_recently_used" value="Recently used"/>
<floater.string name="title_for_frequently_used" value="Frequently used"/> <floater.string name="title_for_frequently_used" value="Frequently used"/>
<line_editor <line_editor
name="Search" name="Filter"
label="Type to search" label="Start typing to filter"
layout="bottomleft" layout="bottomleft"
follows="bottom|left|right" follows="bottom|left|right"
text_tentative_color="TextFgTentativeColor" text_tentative_color="TextFgTentativeColor"
show_label_focused="true"
max_length_bytes="63" max_length_bytes="63"
text_pad_right="5"
text_pad_left="5"
bottom="5" bottom="5"
left="34" left="10"
height="29" height="29"
width="212" /> width="230" />
<text
name="Description"
layout="bottomleft"
follows="bottom|left|right"
font="SansSerifMedium"
bottom="5"
left="42"
height="29"
width="200" />
<button
name="PreviewEmoji"
layout="bottomleft"
follows="bottom|left"
font="EmojiHuge"
use_font_color="true"
bottom="5"
left="2"
height="29"
width="29" />
<scroll_container <scroll_container
name="EmojiGridContainer" name="EmojiGridContainer"
layout="topleft" layout="topleft"
follows="all" follows="all"
top="25" top="25"
left="0" left="0"
height="339" height="334"
width="250"> width="250">
<scrolling_panel_list <scrolling_panel_list
name="EmojiGrid" name="EmojiGrid"