diff options
author | angela <angela@lindenlab.com> | 2009-11-17 16:33:49 +0800 |
---|---|---|
committer | angela <angela@lindenlab.com> | 2009-11-17 16:33:49 +0800 |
commit | 0098bf40ea73078e2164ae55a8fa2f9049d0d4e9 (patch) | |
tree | 32cac232a7bacf814be61026598605d7a683c629 /indra | |
parent | 28aa749db58b3a4095ca7e59811900767cd897b0 (diff) |
undo the changes for LLStyle params; add sizeFromFont in LLFontGL ; use font.style, font.name and font.size params for font creating
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llfontgl.cpp | 7 | ||||
-rw-r--r-- | indra/llrender/llfontgl.h | 1 | ||||
-rw-r--r-- | indra/llui/llstyle.cpp | 29 | ||||
-rw-r--r-- | indra/llui/llstyle.h | 5 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llchathistory.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llchatitemscontainerctrl.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 22 | ||||
-rw-r--r-- | indra/newview/lltoastimpanel.cpp | 10 |
11 files changed, 76 insertions, 72 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 793a526c26..9ba0cfc6b8 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -754,6 +754,13 @@ std::string LLFontGL::nameFromFont(const LLFontGL* fontp) return fontp->mFontDescriptor.getName(); } + +// static +std::string LLFontGL::sizeFromFont(const LLFontGL* fontp) +{ + return fontp->mFontDescriptor.getSize(); +} + // static std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align) { diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 5f2c86c6c1..bb7d8524e7 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -146,6 +146,7 @@ public: static U8 getStyleFromString(const std::string &style); static std::string nameFromFont(const LLFontGL* fontp); + static std::string sizeFromFont(const LLFontGL* fontp); static std::string nameFromHAlign(LLFontGL::HAlign align); static LLFontGL::HAlign hAlignFromName(const std::string& name); diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index 92c0b7c1b4..71511f69a4 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -44,10 +44,7 @@ LLStyle::Params::Params() color("color", LLColor4::black), font("font", LLFontGL::getFontMonospace()), image("image"), - link_href("href"), - italic("italic", false ), - bold("bold", false), - underline("bold", false) + link_href("href") {} @@ -58,10 +55,7 @@ LLStyle::LLStyle(const LLStyle::Params& p) mFont(p.font()), mLink(p.link_href), mDropShadow(p.drop_shadow), - mImagep(p.image()), - mItalic(p.italic()), - mBold(p.bold), - mUnderline(p.underline) + mImagep(p.image()) {} void LLStyle::setFont(const LLFontGL* font) @@ -75,25 +69,6 @@ const LLFontGL* LLStyle::getFont() const return mFont; } -const S32 LLStyle::getFontStyle() const -{ - S32 ret = 0; - if (mBold) - { - ret |= LLFontGL::BOLD; - } - if (mItalic) - { - ret |= LLFontGL::ITALIC; - } - if (mUnderline) - { - ret |= LLFontGL::UNDERLINE; - } - return ret; -} - - void LLStyle::setLinkHREF(const std::string& href) { mLink = href; diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index cc72011903..ee9ca730e9 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -51,17 +51,12 @@ public: Optional<const LLFontGL*> font; Optional<LLUIImage*> image; Optional<std::string> link_href; - Optional<bool> italic; - Optional<bool> bold; - Optional<bool> underline; Params(); }; LLStyle(const Params& p = Params()); public: const LLColor4& getColor() const { return mColor; } void setColor(const LLColor4 &color) { mColor = color; } - - const S32 getFontStyle() const; const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index d7697ac7cc..a06b7e237b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1506,8 +1506,12 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c LLStyle::Params link_params = style_params; link_params.color = match.getColor(); // apply font name from requested style_params - std::string font_name = LLFontGL::nameFromFont(style_params.font()); - link_params.underline = true; + std::string font_name = LLFontGL::nameFromFont(style_params.font()); + std::string font_size = LLFontGL::sizeFromFont(style_params.font()); + link_params.font.name(font_name); + link_params.font.size(font_name); + link_params.font.style("UNDERLINE"); + link_params.link_href = match.getUrl(); // output the text before the Url @@ -2250,7 +2254,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, - mStyle->getFontStyle(), + 0, mStyle->getShadowType(), length, rect.getWidth(), &right_x, @@ -2269,7 +2273,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele 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, - mStyle->getFontStyle(), + 0, LLFontGL::NO_SHADOW, length, rect.mRight, &right_x, @@ -2286,7 +2290,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, - mStyle->getFontStyle(), + 0, mStyle->getShadowType(), length, rect.mRight, &right_x, diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index bec8eb2666..f9c4a23f12 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -361,15 +361,17 @@ void LLChatHistory::appendWidgetMessage(const LLChat& chat, const LLStyle::Param LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); LLViewerChat::getChatColor(chat,txt_color); - LLFontGL* fontp = LLViewerChat::getChatFont(); - + LLFontGL* fontp = LLViewerChat::getChatFont(); + std::string font_name = LLFontGL::nameFromFont(fontp); + std::string font_size = LLFontGL::sizeFromFont(fontp); LLStyle::Params style_params; style_params.color(txt_color); style_params.readonly_color(txt_color); - style_params.font(fontp); - style_params.italic = input_append_params.italic; - style_params.underline = input_append_params.underline; - style_params.bold = input_append_params.bold; + style_params.font.name(font_name); + style_params.font.size(font_size); + style_params.font.style(input_append_params.font.style); + + if (mLastFromName == chat.mFromName) { diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 1cc6b2beef..b1dee46d2e 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -160,10 +160,14 @@ void LLNearbyChatToastPanel::init(LLSD& notification) LLStyle::Params style_params; style_params.color(mTextColor); - style_params.font(mFont); - - std::string str_sender; +// style_params.font(mFont); + std::string font_name = LLFontGL::nameFromFont(mFont); + std::string font_style_size = LLFontGL::sizeFromFont(mFont); + style_params.font.name(font_name); + style_params.font.size(font_style_size); + std::string str_sender; + if(gAgentID != mFromID) str_sender = mFromName; else @@ -180,12 +184,12 @@ void LLNearbyChatToastPanel::init(LLSD& notification) { if (mFromName.size() > 0) { - style_params.italic= true; + style_params.font.style = "ITALIC"; msg_text->setText(mFromName, style_params); } mText = mText.substr(3); - style_params.underline = true; + style_params.font.style = "UNDERLINE"; msg_text->addText(mText,style_params); } else diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 27df6be730..bd6936f05c 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -80,7 +80,7 @@ public: draw_rect.mRight, draw_rect.mTop, mStyle->getColor(), LLFontGL::RIGHT, LLFontGL::TOP, - mStyle->getFontStyle(), + 0, mStyle->getShadowType(), end - start, draw_rect.getWidth(), &right_x, @@ -164,7 +164,8 @@ void LLExpandableTextBox::LLTextBoxEx::showExpandText() S32 last_line = visible_lines.second - 1; LLStyle::Params expander_style = getDefaultStyle(); - expander_style.underline = true; + expander_style.font.name(LLFontGL::nameFromFont(expander_style.font)); + expander_style.font.style = "UNDERLINE"; expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor"); LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this); insertSegment(expanderp); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index dff27ee032..2c6543d6ca 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -476,27 +476,32 @@ void LLIMFloater::updateMessages() chat.mFromID = from_id; chat.mFromName = from; chat.mText = message; - - LLStyle::Params append_style_params; + //Handle IRC styled /me messages. std::string prefix = message.substr(0, 4); if (prefix == "/me " || prefix == "/me'") { - if (from.size() > 0) - { - append_style_params.italic= true; - chat.mText = from + " "; - mChatHistory->appendWidgetMessage(chat, append_style_params); - } - message = message.substr(3); LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); LLViewerChat::getChatColor(chat,txt_color); LLFontGL* fontp = LLViewerChat::getChatFont(); + std::string font_name = LLFontGL::nameFromFont(fontp); + std::string font_size = LLFontGL::sizeFromFont(fontp); + LLStyle::Params append_style_params; append_style_params.color(txt_color); append_style_params.readonly_color(txt_color); - append_style_params.font(fontp); - append_style_params.underline = true; + append_style_params.font.name(font_name); + append_style_params.font.size(font_size); + + if (from.size() > 0) + { + append_style_params.font.style = "ITALIC"; + chat.mText = from + " "; + mChatHistory->appendWidgetMessage(chat, append_style_params); + } + + message = message.substr(3); + append_style_params.font.style = "UNDERLINE"; mChatHistory->appendText(message, FALSE, append_style_params); } else diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 3af9448564..cae5c52378 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -157,25 +157,29 @@ void LLNearbyChat::addMessage(const LLChat& chat) { std::string message = chat.mText; std::string prefix = message.substr(0, 4); + if (chat.mChatStyle == CHAT_STYLE_IRC) { + LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); + LLViewerChat::getChatColor(chat,txt_color); + LLFontGL* fontp = LLViewerChat::getChatFont(); + std::string font_name = LLFontGL::nameFromFont(fontp); + std::string font_size = LLFontGL::sizeFromFont(fontp); LLStyle::Params append_style_params; + append_style_params.color(txt_color); + append_style_params.readonly_color(txt_color); + append_style_params.font.name(font_name); + append_style_params.font.size(font_size); if (chat.mFromName.size() > 0) { - append_style_params.italic= true; + append_style_params.font.style = "ITALIC"; LLChat add_chat=chat; add_chat.mText = chat.mFromName + " "; mChatHistory->appendWidgetMessage(add_chat, append_style_params); } - message = message.substr(3); - LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); - LLViewerChat::getChatColor(chat,txt_color); - LLFontGL* fontp = LLViewerChat::getChatFont(); - append_style_params.color(txt_color); - append_style_params.readonly_color(txt_color); - append_style_params.font(fontp); - append_style_params.underline = true; + message = message.substr(3); + append_style_params.font.style = "UNDERLINE"; mChatHistory->appendText(message, FALSE, append_style_params); } else diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index 3acab85bf7..d2cc6d0726 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -51,14 +51,20 @@ LLToastIMPanel::LLToastIMPanel(LLToastIMPanel::Params &p) : LLToastPanel(p.notif mReplyBtn = getChild<LLButton>("reply"); LLStyle::Params style_params; + style_params.font.name(LLFontGL::nameFromFont(style_params.font)); + style_params.font.size(LLFontGL::sizeFromFont(style_params.font)); + style_params.font.style = "UNDERLINE"; + //Handle IRC styled /me messages. std::string prefix = p.message.substr(0, 4); if (prefix == "/me " || prefix == "/me'") { mMessage->clear(); - style_params.italic = true; + + style_params.font.style ="ITALIC"; mMessage->appendText(p.from + " ", FALSE, style_params); - style_params.underline = true; + + style_params.font.style = "UNDERLINE"; mMessage->appendText(p.message.substr(3), FALSE, style_params); } else |