aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui')
-rw-r--r--linden/indra/llui/llcombobox.cpp25
-rw-r--r--linden/indra/llui/llcombobox.h4
-rw-r--r--linden/indra/llui/lllineeditor.cpp20
-rw-r--r--linden/indra/llui/lllineeditor.h1
-rw-r--r--linden/indra/llui/llresmgr.cpp6
-rw-r--r--linden/indra/llui/llresmgr.h3
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp28
-rw-r--r--linden/indra/llui/llscrolllistctrl.h3
-rw-r--r--linden/indra/llui/llstyle.cpp8
9 files changed, 79 insertions, 19 deletions
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp
index be34325..a93dc9b 100644
--- a/linden/indra/llui/llcombobox.cpp
+++ b/linden/indra/llui/llcombobox.cpp
@@ -43,6 +43,7 @@
43 43
44// newview includes 44// newview includes
45#include "llbutton.h" 45#include "llbutton.h"
46#include "llfont.h"
46#include "llkeyboard.h" 47#include "llkeyboard.h"
47#include "llscrolllistctrl.h" 48#include "llscrolllistctrl.h"
48#include "llwindow.h" 49#include "llwindow.h"
@@ -60,7 +61,7 @@ S32 MAX_COMBO_WIDTH = 500;
60 61
61static LLRegisterWidget<LLComboBox> r1("combo_box"); 62static LLRegisterWidget<LLComboBox> r1("combo_box");
62 63
63LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, 64LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, const LLFontGL* font,
64 void (*commit_callback)(LLUICtrl*,void*), 65 void (*commit_callback)(LLUICtrl*,void*),
65 void *callback_userdata 66 void *callback_userdata
66 ) 67 )
@@ -76,6 +77,15 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
76 mTextEntryCallback( NULL ), 77 mTextEntryCallback( NULL ),
77 mLabel(label) 78 mLabel(label)
78{ 79{
80 if (font)
81 {
82 mGLFont = font;
83 }
84 else
85 {
86 mGLFont = LLFontGL::getFontSansSerifSmall();
87 }
88
79 // Always use text box 89 // Always use text box
80 // Text label button 90 // Text label button
81 mButton = new LLButton(mLabel, 91 mButton = new LLButton(mLabel,
@@ -89,14 +99,14 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
89 mButton->setScaleImage(TRUE); 99 mButton->setScaleImage(TRUE);
90 100
91 mButton->setMouseDownCallback(onButtonDown); 101 mButton->setMouseDownCallback(onButtonDown);
92 mButton->setFont(LLFontGL::getFontSansSerifSmall()); 102 mButton->setFont(mGLFont);
93 mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); 103 mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
94 mButton->setHAlign( LLFontGL::LEFT ); 104 mButton->setHAlign( LLFontGL::LEFT );
95 mButton->setRightHPad(2); 105 mButton->setRightHPad(2);
96 addChild(mButton); 106 addChild(mButton);
97 107
98 // disallow multiple selection 108 // disallow multiple selection
99 mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), 109 mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), mGLFont,
100 &LLComboBox::onItemSelected, this, FALSE); 110 &LLComboBox::onItemSelected, this, FALSE);
101 mList->setVisible(FALSE); 111 mList->setVisible(FALSE);
102 mList->setBgWriteableColor( LLColor4(1,1,1,1) ); 112 mList->setBgWriteableColor( LLColor4(1,1,1,1) );
@@ -167,11 +177,14 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
167 S32 max_chars = 20; 177 S32 max_chars = 20;
168 node->getAttributeS32("max_chars", max_chars); 178 node->getAttributeS32("max_chars", max_chars);
169 179
180 LLFontGL* font = LLView::selectFont(node);
181
170 LLUICtrlCallback callback = NULL; 182 LLUICtrlCallback callback = NULL;
171 183
172 LLComboBox* combo_box = new LLComboBox(name, 184 LLComboBox* combo_box = new LLComboBox(name,
173 rect, 185 rect,
174 label, 186 label,
187 font,
175 callback, 188 callback,
176 NULL); 189 NULL);
177 combo_box->setAllowTextEntry(allow_text_entry, max_chars); 190 combo_box->setAllowTextEntry(allow_text_entry, max_chars);
@@ -540,7 +553,7 @@ void LLComboBox::updateLayout()
540 mTextEntry = new LLLineEditor(std::string("combo_text_entry"), 553 mTextEntry = new LLLineEditor(std::string("combo_text_entry"),
541 text_entry_rect, 554 text_entry_rect,
542 LLStringUtil::null, 555 LLStringUtil::null,
543 LLFontGL::getFontSansSerifSmall(), 556 mGLFont,
544 mMaxChars, 557 mMaxChars,
545 onTextCommit, 558 onTextCommit,
546 onTextEntry, 559 onTextEntry,
@@ -1153,7 +1166,7 @@ LLFlyoutButton::LLFlyoutButton(
1153 const std::string& label, 1166 const std::string& label,
1154 void (*commit_callback)(LLUICtrl*, void*) , 1167 void (*commit_callback)(LLUICtrl*, void*) ,
1155 void *callback_userdata) 1168 void *callback_userdata)
1156: LLComboBox(name, rect, LLStringUtil::null, commit_callback, callback_userdata), 1169: LLComboBox(name, rect, LLStringUtil::null, NULL, commit_callback, callback_userdata),
1157 mToggleState(FALSE), 1170 mToggleState(FALSE),
1158 mActionButton(NULL) 1171 mActionButton(NULL)
1159{ 1172{
@@ -1214,6 +1227,8 @@ LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const
1214 } 1227 }
1215 } 1228 }
1216 1229
1230 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont));
1231
1217 return node; 1232 return node;
1218} 1233}
1219 1234
diff --git a/linden/indra/llui/llcombobox.h b/linden/indra/llui/llcombobox.h
index 95ad17a..596f659 100644
--- a/linden/indra/llui/llcombobox.h
+++ b/linden/indra/llui/llcombobox.h
@@ -67,7 +67,8 @@ public:
67 LLComboBox( 67 LLComboBox(
68 const std::string& name, 68 const std::string& name,
69 const LLRect &rect, 69 const LLRect &rect,
70 const std::string& label, 70 const std::string& label,
71 const LLFontGL* font = NULL,
71 void (*commit_callback)(LLUICtrl*, void*) = NULL, 72 void (*commit_callback)(LLUICtrl*, void*) = NULL,
72 void *callback_userdata = NULL 73 void *callback_userdata = NULL
73 ); 74 );
@@ -190,6 +191,7 @@ protected:
190 EPreferredPosition mListPosition; 191 EPreferredPosition mListPosition;
191 LLPointer<LLUIImage> mArrowImage; 192 LLPointer<LLUIImage> mArrowImage;
192 std::string mLabel; 193 std::string mLabel;
194 const LLFontGL* mGLFont;
193 195
194private: 196private:
195 S32 mButtonPadding; 197 S32 mButtonPadding;
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index 76b8927..a21ad5d 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -2696,7 +2696,6 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
2696 return rv; 2696 return rv;
2697} 2697}
2698 2698
2699
2700// static 2699// static
2701BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str) 2700BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
2702{ 2701{
@@ -2721,6 +2720,25 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
2721} 2720}
2722 2721
2723// static 2722// static
2723BOOL LLLineEditor::prevalidatePrintableSpace(const LLWString &str)
2724{
2725 BOOL rv = TRUE;
2726 S32 len = str.length();
2727 if(len == 0) return rv;
2728 while(len--)
2729 {
2730 if( !(LLStringOps::isAlnum((char)str[len]) ||
2731 LLStringOps::isPunct((char)str[len]) ||
2732 ' ' == str[len]) )
2733 {
2734 rv = FALSE;
2735 break;
2736 }
2737 }
2738 return rv;
2739}
2740
2741// static
2724BOOL LLLineEditor::prevalidateASCII(const LLWString &str) 2742BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
2725{ 2743{
2726 BOOL rv = TRUE; 2744 BOOL rv = TRUE;
diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h
index d217859..43ce869 100644
--- a/linden/indra/llui/lllineeditor.h
+++ b/linden/indra/llui/lllineeditor.h
@@ -253,6 +253,7 @@ public:
253 static BOOL prevalidateAlphaNumSpace(const LLWString &str ); 253 static BOOL prevalidateAlphaNumSpace(const LLWString &str );
254 static BOOL prevalidatePrintableNotPipe(const LLWString &str); 254 static BOOL prevalidatePrintableNotPipe(const LLWString &str);
255 static BOOL prevalidatePrintableNoSpace(const LLWString &str); 255 static BOOL prevalidatePrintableNoSpace(const LLWString &str);
256 static BOOL prevalidatePrintableSpace(const LLWString &str);
256 static BOOL prevalidateASCII(const LLWString &str); 257 static BOOL prevalidateASCII(const LLWString &str);
257 258
258 static BOOL postvalidateFloat(const std::string &str); 259 static BOOL postvalidateFloat(const std::string &str);
diff --git a/linden/indra/llui/llresmgr.cpp b/linden/indra/llui/llresmgr.cpp
index 32d3d1f..22610ca 100644
--- a/linden/indra/llui/llresmgr.cpp
+++ b/linden/indra/llui/llresmgr.cpp
@@ -58,7 +58,8 @@ LLResMgr::LLResMgr()
58 mUSAFonts[ LLFONT_OCRA ] = LLFontGL::getFontMonospace(); 58 mUSAFonts[ LLFONT_OCRA ] = LLFontGL::getFontMonospace();
59 mUSAFonts[ LLFONT_SANSSERIF ] = LLFontGL::getFontSansSerif(); 59 mUSAFonts[ LLFONT_SANSSERIF ] = LLFontGL::getFontSansSerif();
60 mUSAFonts[ LLFONT_SANSSERIF_SMALL ] = LLFontGL::getFontSansSerifSmall(); 60 mUSAFonts[ LLFONT_SANSSERIF_SMALL ] = LLFontGL::getFontSansSerifSmall();
61 mUSAFonts[ LLFONT_SANSSERIF_BIG ] = LLFontGL::getFontSansSerifBig(); 61 mUSAFonts[ LLFONT_SANSSERIF_BIGGER ]= LLFontGL::getFontSansSerifBigger();
62 mUSAFonts[ LLFONT_SANSSERIF_LARGE ] = LLFontGL::getFontSansSerifLarge();
62 mUSAFonts[ LLFONT_SMALL ] = LLFontGL::getFontMonospace(); 63 mUSAFonts[ LLFONT_SMALL ] = LLFontGL::getFontMonospace();
63/* 64/*
64 // USA Strings 65 // USA Strings
@@ -421,7 +422,8 @@ const std::string LLFONT_ID_NAMES[] =
421 std::string("OCRA"), 422 std::string("OCRA"),
422 std::string("SANSSERIF"), 423 std::string("SANSSERIF"),
423 std::string("SANSSERIF_SMALL"), 424 std::string("SANSSERIF_SMALL"),
424 std::string("SANSSERIF_BIG"), 425 std::string("SANSSERIF_BIGGER"),
426 std::string("SANSSERIF_LARGE"),
425 std::string("SMALL"), 427 std::string("SMALL"),
426}; 428};
427 429
diff --git a/linden/indra/llui/llresmgr.h b/linden/indra/llui/llresmgr.h
index d54505c..3008244 100644
--- a/linden/indra/llui/llresmgr.h
+++ b/linden/indra/llui/llresmgr.h
@@ -51,7 +51,8 @@ enum LLFONT_ID
51 LLFONT_OCRA, 51 LLFONT_OCRA,
52 LLFONT_SANSSERIF, 52 LLFONT_SANSSERIF,
53 LLFONT_SANSSERIF_SMALL, 53 LLFONT_SANSSERIF_SMALL,
54 LLFONT_SANSSERIF_BIG, 54 LLFONT_SANSSERIF_BIGGER,
55 LLFONT_SANSSERIF_LARGE,
55 LLFONT_SMALL, 56 LLFONT_SMALL,
56 LLFONT_COUNT // Number of values in this enum. Keep at end. 57 LLFONT_COUNT // Number of values in this enum. Keep at end.
57}; 58};
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index 1248a9a..1b93abf 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -570,7 +570,7 @@ void LLScrollListItemSeparator::draw(const LLRect& rect, const LLColor4& fg_colo
570// LLScrollListCtrl 570// LLScrollListCtrl
571//--------------------------------------------------------------------------- 571//---------------------------------------------------------------------------
572 572
573LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect, 573LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect, const LLFontGL* font,
574 void (*commit_callback)(LLUICtrl* ctrl, void* userdata), 574 void (*commit_callback)(LLUICtrl* ctrl, void* userdata),
575 void* callback_user_data, 575 void* callback_user_data,
576 BOOL allow_multiple_selection, 576 BOOL allow_multiple_selection,
@@ -619,6 +619,15 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
619 mOriginalSelection(-1), 619 mOriginalSelection(-1),
620 mDrewSelected(FALSE) 620 mDrewSelected(FALSE)
621{ 621{
622 if (font)
623 {
624 mGLFont = font;
625 }
626 else
627 {
628 mGLFont = LLFontGL::getFontSansSerifSmall();
629 }
630
622 mItemListRect.setOriginAndSize( 631 mItemListRect.setOriginAndSize(
623 mBorderThickness, 632 mBorderThickness,
624 mBorderThickness, 633 mBorderThickness,
@@ -987,14 +996,14 @@ void LLScrollListCtrl::calcColumnWidths()
987 column->setWidth(new_width); 996 column->setWidth(new_width);
988 997
989 // update max content width for this column, by looking at all items 998 // update max content width for this column, by looking at all items
990 column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0; 999 column->mMaxContentWidth = column->mHeader ? mGLFont->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0;
991 item_list::iterator iter; 1000 item_list::iterator iter;
992 for (iter = mItemList.begin(); iter != mItemList.end(); iter++) 1001 for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
993 { 1002 {
994 LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex); 1003 LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex);
995 if (!cellp) continue; 1004 if (!cellp) continue;
996 1005
997 column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth); 1006 column->mMaxContentWidth = llmax(mGLFont->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth);
998 } 1007 }
999 1008
1000 max_item_width += column->mMaxContentWidth; 1009 max_item_width += column->mMaxContentWidth;
@@ -1642,7 +1651,7 @@ LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_te
1642 if (getItemCount() < mMaxItemCount) 1651 if (getItemCount() < mMaxItemCount)
1643 { 1652 {
1644 item = new LLScrollListItem( enabled, NULL, id ); 1653 item = new LLScrollListItem( enabled, NULL, id );
1645 item->addColumn(item_text, LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF_SMALL), column_width); 1654 item->addColumn(item_text, mGLFont, column_width);
1646 addItem( item, pos ); 1655 addItem( item, pos );
1647 } 1656 }
1648 return item; 1657 return item;
@@ -2900,6 +2909,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac
2900 LLScrollListCtrl* scroll_list = new LLScrollListCtrl( 2909 LLScrollListCtrl* scroll_list = new LLScrollListCtrl(
2901 name, 2910 name,
2902 rect, 2911 rect,
2912 NULL,
2903 callback, 2913 callback,
2904 NULL, 2914 NULL,
2905 multi_select, 2915 multi_select,
@@ -3374,7 +3384,11 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3374 const LLFontGL *font = LLResMgr::getInstance()->getRes(fontname); 3384 const LLFontGL *font = LLResMgr::getInstance()->getRes(fontname);
3375 if (!font) 3385 if (!font)
3376 { 3386 {
3377 font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); 3387 font = mGLFont;
3388 if (!font)
3389 {
3390 font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
3391 }
3378 } 3392 }
3379 U8 font_style = LLFontGL::getStyleFromString(fontstyle); 3393 U8 font_style = LLFontGL::getStyleFromString(fontstyle);
3380 3394
@@ -3446,7 +3460,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3446 if (new_item->getColumn(column_idx) == NULL) 3460 if (new_item->getColumn(column_idx) == NULL)
3447 { 3461 {
3448 LLScrollListColumn* column_ptr = &column_it->second; 3462 LLScrollListColumn* column_ptr = &column_it->second;
3449 new_item->setColumn(column_idx, new LLScrollListText(LLStringUtil::null, LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->getWidth(), LLFontGL::NORMAL)); 3463 new_item->setColumn(column_idx, new LLScrollListText(LLStringUtil::null, mGLFont, column_ptr->getWidth(), LLFontGL::NORMAL));
3450 } 3464 }
3451 } 3465 }
3452 3466
@@ -3466,7 +3480,7 @@ LLScrollListItem* LLScrollListCtrl::addSimpleElement(const std::string& value, E
3466 3480
3467 LLScrollListItem *new_item = new LLScrollListItem(entry_id); 3481 LLScrollListItem *new_item = new LLScrollListItem(entry_id);
3468 3482
3469 const LLFontGL *font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); 3483 const LLFontGL *font = mGLFont;
3470 3484
3471 new_item->addColumn(value, font, getRect().getWidth()); 3485 new_item->addColumn(value, font, getRect().getWidth());
3472 3486
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h
index 4be7ff7..1b7105f 100644
--- a/linden/indra/llui/llscrolllistctrl.h
+++ b/linden/indra/llui/llscrolllistctrl.h
@@ -353,6 +353,7 @@ public:
353 LLScrollListCtrl( 353 LLScrollListCtrl(
354 const std::string& name, 354 const std::string& name,
355 const LLRect& rect, 355 const LLRect& rect,
356 const LLFontGL* font,
356 void (*commit_callback)(LLUICtrl*, void*), 357 void (*commit_callback)(LLUICtrl*, void*),
357 void* callback_userdata, 358 void* callback_userdata,
358 BOOL allow_multiple_selection, 359 BOOL allow_multiple_selection,
@@ -694,6 +695,8 @@ private:
694 695
695 // HACK: Did we draw one selected item this frame? 696 // HACK: Did we draw one selected item this frame?
696 BOOL mDrewSelected; 697 BOOL mDrewSelected;
698
699 const LLFontGL* mGLFont;
697}; // end class LLScrollListCtrl 700}; // end class LLScrollListCtrl
698 701
699 702
diff --git a/linden/indra/llui/llstyle.cpp b/linden/indra/llui/llstyle.cpp
index a716cbb..61a025e 100644
--- a/linden/indra/llui/llstyle.cpp
+++ b/linden/indra/llui/llstyle.cpp
@@ -128,9 +128,13 @@ void LLStyle::setFontName(const std::string& fontname)
128 { 128 {
129 mFontID = LLFONT_SMALL; 129 mFontID = LLFONT_SMALL;
130 } 130 }
131 else if ((fontname_lc == "sansserifbig")) 131 else if ((fontname_lc == "sansserifbigger"))
132 { 132 {
133 mFontID = LLFONT_SANSSERIF_BIG; 133 mFontID = LLFONT_SANSSERIF_BIGGER;
134 }
135 else if ((fontname_lc == "sansserifhuge"))
136 {
137 mFontID = LLFONT_SANSSERIF_LARGE;
134 } 138 }
135 else if (fontname_lc == "small") 139 else if (fontname_lc == "small")
136 { 140 {