Widget text upper case option, change gimp plugin mode to executable

This commit is contained in:
Henrique Santiago 2012-08-05 15:26:08 -03:00
parent 14085a525b
commit e78edad4c6
6 changed files with 16 additions and 8 deletions

View File

@ -5,7 +5,7 @@ MainWindow
@onEnter: EnterGame.doLogin()
@onEscape: EnterGame.hide()
Label
MenuLabel
!text: tr('Account name')
anchors.left: parent.left
anchors.top: parent.top
@ -18,7 +18,7 @@ MainWindow
anchors.top: prev.bottom
margin-top: 2
Label
MenuLabel
!text: tr('Password')
anchors.left: prev.left
anchors.top: prev.bottom
@ -32,7 +32,7 @@ MainWindow
anchors.top: prev.bottom
margin-top: 2
Label
MenuLabel
id: serverLabel
!text: tr('Server')
anchors.left: prev.left
@ -48,7 +48,7 @@ MainWindow
anchors.top: serverLabel.bottom
margin-top: 2
Label
MenuLabel
id: protocolLabel
!text: tr('Protocol')
anchors.left: parent.left
@ -65,7 +65,7 @@ MainWindow
margin-top: 2
width: 90
Label
MenuLabel
id: portLabel
!text: tr('Port')
anchors.right: parent.right

View File

@ -17,6 +17,8 @@ FlatLabel < UILabel
$disabled:
color: #aaaaaa88
MenuLabel < Label
GameLabel < UILabel
font: verdana-11px-antialised
color: #bbbbbb

View File

@ -43,7 +43,6 @@ TopPanel < Panel
image-repeated: true
focusable: false
TopPanel
id: topMenu
anchors.top: parent.top

View File

@ -467,17 +467,19 @@ protected:
Point m_textOffset;
stdext::boolean<false> m_textWrap;
stdext::boolean<false> m_textAutoResize;
stdext::boolean<false> m_textOnlyUpperCase;
BitmapFontPtr m_font;
public:
void resizeToText() { setSize(getTextSize()); }
void clearText() { setText(""); }
void setText(const std::string& text);
void setText(std::string text);
void setTextAlign(Fw::AlignmentFlag align) { m_textAlign = align; updateText(); }
void setTextOffset(const Point& offset) { m_textOffset = offset; updateText(); }
void setTextWrap(bool textWrap) { m_textWrap = textWrap; updateText(); }
void setTextAutoResize(bool textAutoResize) { m_textAutoResize = textAutoResize; updateText(); }
void setTextOnlyUpperCase(bool textOnlyUpperCase) { m_textOnlyUpperCase = textOnlyUpperCase; setText(m_text); }
void setFont(const std::string& fontName);
std::string getText() { return m_text; }

View File

@ -69,6 +69,8 @@ void UIWidget::parseTextStyle(const OTMLNodePtr& styleNode)
setTextWrap(node->value<bool>());
else if(node->tag() == "text-auto-resize")
setTextAutoResize(node->value<bool>());
else if(node->tag() == "text-only-upper-case")
setTextOnlyUpperCase(node->value<bool>());
else if(node->tag() == "font")
setFont(node->value());
}
@ -103,8 +105,11 @@ void UIWidget::onFontChange(const std::string& font)
callLuaField("onFontChange", font);
}
void UIWidget::setText(const std::string& text)
void UIWidget::setText(std::string text)
{
if(m_textOnlyUpperCase)
std::transform(text.begin(), text.end(), text.begin(), toupper);
if(m_text == text)
return;

0
tools/gimp-bitmap-generator/generate_bitmap_font.py Normal file → Executable file
View File