DEV-44614 ugly/broken font and formatting used for IM toast emotes

fix bug, also fix some comments/typos/enumparams in this code area.
master
Tofu Linden 2009-12-23 11:29:13 -08:00
parent e3211c4ac1
commit 183c991402
3 changed files with 39 additions and 32 deletions

View File

@ -135,7 +135,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
S32 scaled_max_pixels = max_pixels == S32_MAX ? S32_MAX : llceil((F32)max_pixels * sScaleX);
// determine which style flags need to be added programmatically by striping off the
// determine which style flags need to be added programmatically by stripping off the
// style bits that are drawn by the underlying Freetype font
U8 style_to_add = (style | mFontDescriptor.getStyle()) & ~mFontFreetype->getStyle();

View File

@ -842,7 +842,7 @@ BOOL LLTextBase::handleMouseUp(S32 x, S32 y, MASK mask)
{
// Did we just click on a link?
if (cur_segment->getStyle()
&& cur_segment->getStyle()->isLink())
&& cur_segment->getStyle()->isLink())
{
// *TODO: send URL here?
mURLClickSignal(this, LLSD() );
@ -1477,7 +1477,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
}
}
void LLTextBase::setText(const LLStringExplicit &utf8str ,const LLStyle::Params& input_params)
void LLTextBase::setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params)
{
// clear out the existing text and segments
getViewModel()->setDisplay(LLWStringUtil::null);
@ -2320,14 +2320,14 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
S32 end = llmin( selection_start, seg_end );
S32 length = end - start;
font->render(text, start,
rect.mLeft, rect.mTop,
color,
LLFontGL::LEFT, LLFontGL::TOP,
0,
mStyle->getShadowType(),
length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
rect.mLeft, rect.mTop,
color,
LLFontGL::LEFT, LLFontGL::TOP,
LLFontGL::NORMAL,
mStyle->getShadowType(),
length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
}
rect.mLeft = (S32)ceil(right_x);
@ -2339,14 +2339,14 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
S32 length = end - start;
font->render(text, start,
rect.mLeft, rect.mTop,
LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
LLFontGL::LEFT, LLFontGL::TOP,
0,
LLFontGL::NO_SHADOW,
length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
rect.mLeft, rect.mTop,
LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
LLFontGL::LEFT, LLFontGL::TOP,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
}
rect.mLeft = (S32)ceil(right_x);
if( selection_end < seg_end )
@ -2356,14 +2356,14 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
S32 end = seg_end;
S32 length = end - start;
font->render(text, start,
rect.mLeft, rect.mTop,
color,
LLFontGL::LEFT, LLFontGL::TOP,
0,
mStyle->getShadowType(),
length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
rect.mLeft, rect.mTop,
color,
LLFontGL::LEFT, LLFontGL::TOP,
LLFontGL::NORMAL,
mStyle->getShadowType(),
length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
}
return right_x;
}

View File

@ -35,13 +35,14 @@
#include "llnotifications.h"
#include "llinstantmessage.h"
#include "llviewerchat.h"
const S32 LLToastIMPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 6;
//--------------------------------------------------------------------------
LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notification),
mAvatar(NULL), mUserName(NULL),
mTime(NULL), mMessage(NULL)
mAvatar(NULL), mUserName(NULL),
mTime(NULL), mMessage(NULL)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_instant_message.xml");
@ -52,8 +53,11 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif
mMessage = getChild<LLTextBox>("message");
LLStyle::Params style_params;
style_params.font.name(LLFontGL::nameFromFont(style_params.font));
style_params.font.size(LLFontGL::sizeFromFont(style_params.font));
LLFontGL* fontp = LLViewerChat::getChatFont();
std::string font_name = LLFontGL::nameFromFont(fontp);
std::string font_size = LLFontGL::sizeFromFont(fontp);
style_params.font.name(font_name);
style_params.font.size(font_size);
style_params.font.style = "UNDERLINE";
//Handle IRC styled /me messages.
@ -63,13 +67,16 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif
mMessage->clear();
style_params.font.style ="ITALIC";
mMessage->appendText(p.from + " ", FALSE, style_params);
mMessage->appendText(p.from, FALSE, style_params);
style_params.font.style = "ITALIC";
mMessage->appendText(p.message.substr(3), FALSE, style_params);
}
else
{
mMessage->setValue(p.message);
}
mUserName->setValue(p.from);
mTime->setValue(p.time);
mSessionID = p.session_id;