CHANGED: #1471 some simple bugfixes, like missing properties, misspelled properties, widget not updating when changed, etc.

This commit is contained in:
dfighter1985 2012-08-07 22:35:08 +02:00
parent ff66cd284b
commit 7c551870c8
5 changed files with 52 additions and 24 deletions

View file

@ -56,6 +56,7 @@ namespace NLGUI
std::string getProperty( const std::string &name ) const; std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value ); void setProperty( const std::string &name, const std::string &value );
bool setTextProperty( const std::string &name, const std::string &value );
void parseTextOptions (xmlNodePtr cur); void parseTextOptions (xmlNodePtr cur);
bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }

View file

@ -102,6 +102,11 @@ namespace NLGUI
return toString( _WMin ); return toString( _WMin );
} }
else else
if( name == "hardtext" )
{
return _ViewText->getText().toString();
}
else
if( name == "text_y" ) if( name == "text_y" )
{ {
return toString( _TextY ); return toString( _TextY );
@ -244,6 +249,12 @@ namespace NLGUI
return; return;
} }
else else
if( name == "hardtext" )
{
_ViewText->setText( value );
return;
}
else
if( name == "text_y" ) if( name == "text_y" )
{ {
sint32 i; sint32 i;

View file

@ -304,13 +304,21 @@ namespace NLGUI
} }
void CViewText::setProperty( const std::string &name, const std::string &value ) void CViewText::setProperty( const std::string &name, const std::string &value )
{
if( setTextProperty( name, value ) )
invalidateContent();
else
CViewBase::setProperty( name, value );
}
bool CViewText::setTextProperty( const std::string &name, const std::string &value )
{ {
if( name == "color" ) if( name == "color" )
{ {
CRGBA c; CRGBA c;
if( fromString( value, c ) ) if( fromString( value, c ) )
_Color = c; _Color = c;
return; return true;
} }
else else
if( name == "global_color" ) if( name == "global_color" )
@ -318,7 +326,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_ModulateGlobalColor = b; _ModulateGlobalColor = b;
return; return true;
} }
else else
if( name == "fontsize" ) if( name == "fontsize" )
@ -326,7 +334,7 @@ namespace NLGUI
sint i; sint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_FontSize = i + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32(); _FontSize = i + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
return; return true;
} }
else else
if( name == "shadow" ) if( name == "shadow" )
@ -334,7 +342,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_Shadow = b; _Shadow = b;
return; return true;
} }
else else
if( name == "shadow_color" ) if( name == "shadow_color" )
@ -342,7 +350,7 @@ namespace NLGUI
CRGBA c; CRGBA c;
if( fromString( value, c ) ) if( fromString( value, c ) )
_ShadowColor = c; _ShadowColor = c;
return; return true;
} }
else else
if( name == "multi_line" ) if( name == "multi_line" )
@ -350,7 +358,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_MultiLine = b; _MultiLine = b;
return; return true;
} }
else else
if( name == "justification" ) if( name == "justification" )
@ -364,7 +372,7 @@ namespace NLGUI
if( value == "justified" ) if( value == "justified" )
_TextMode = Justified; _TextMode = Justified;
return; return true;
} }
else else
if( name == "line_maxw" ) if( name == "line_maxw" )
@ -372,7 +380,7 @@ namespace NLGUI
sint32 i; sint32 i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_LineMaxW = i; _LineMaxW = i;
return; return true;
} }
else else
if( name == "multi_line_space" ) if( name == "multi_line_space" )
@ -380,7 +388,7 @@ namespace NLGUI
sint i; sint i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_MultiLineSpace = i; _MultiLineSpace = i;
return; return true;
} }
else else
if( name == "multi_line_maxw_only" ) if( name == "multi_line_maxw_only" )
@ -388,7 +396,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_MultiLineMaxWOnly = b; _MultiLineMaxWOnly = b;
return; return true;
} }
else else
if( name == "multi_max_line" ) if( name == "multi_max_line" )
@ -396,7 +404,7 @@ namespace NLGUI
uint32 i; uint32 i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_MultiMaxLine = i; _MultiMaxLine = i;
return; return true;
} }
else else
if( name == "underlined" ) if( name == "underlined" )
@ -404,7 +412,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_Underlined = b; _Underlined = b;
return; return true;
} }
else else
if( name == "case_mode" ) if( name == "case_mode" )
@ -412,7 +420,7 @@ namespace NLGUI
uint32 i; uint32 i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_CaseMode = (TCaseMode)i; _CaseMode = (TCaseMode)i;
return; return true;
} }
else else
if( name == "over_extend_view_text" ) if( name == "over_extend_view_text" )
@ -420,7 +428,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_OverExtendViewText = b; _OverExtendViewText = b;
return; return true;
} }
else else
if( name == "over_extend_parent_rect" ) if( name == "over_extend_parent_rect" )
@ -428,7 +436,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_OverExtendViewTextUseParentRect = b; _OverExtendViewTextUseParentRect = b;
return; return true;
} }
else else
if( name == "auto_clamp" ) if( name == "auto_clamp" )
@ -436,7 +444,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_AutoClamp = b; _AutoClamp = b;
return; return true;
} }
else else
if( name == "clamp_right" ) if( name == "clamp_right" )
@ -444,7 +452,7 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_ClampRight = b; _ClampRight = b;
return; return true;
} }
else else
if( name == "auto_clamp_offset" ) if( name == "auto_clamp_offset" )
@ -452,7 +460,7 @@ namespace NLGUI
uint8 i; uint8 i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_AutoClampOffset = i; _AutoClampOffset = i;
return; return true;
} }
else else
if( name == "continuous_update" ) if( name == "continuous_update" )
@ -460,22 +468,30 @@ namespace NLGUI
bool b; bool b;
if( fromString( value, b ) ) if( fromString( value, b ) )
_ContinuousUpdate = b; _ContinuousUpdate = b;
return; return true;
} }
else else
if( name == "hardtext" ) if( name == "hardtext" )
{ {
_Text = value; _Text = value;
return; setCase( _Text, _CaseMode );
invalidateContent();
return true;
} }
else else
if( name == "hardtext_format" ) if( name == "hardtext_format" )
{ {
_HardtextFormat = value; _HardtextFormat = value;
return;
if( _MultiLine )
setTextFormatTaged( _HardtextFormat );
else
setSingleLineTextFormatTaged( _HardtextFormat );
return true;
} }
else else
CViewBase::setProperty( name, value ); return false;
} }
// *************************************************************************** // ***************************************************************************

View file

@ -109,7 +109,7 @@
<default>params</default> <default>params</default>
</property> </property>
<property> <property>
<name>win_proprity</name> <name>win_priority</name>
<type>int</type> <type>int</type>
<default>3</default> <default>3</default>
</property> </property>

View file

@ -2,7 +2,7 @@
<header> <header>
<name>ViewText</name> <name>ViewText</name>
<guiname>CViewText</guiname> <guiname>CViewText</guiname>
<ancestor>CtrlBase</ancestor> <ancestor>InterfaceElement</ancestor>
<description></description> <description></description>
<abstract>false</abstract> <abstract>false</abstract>
<icon></icon> <icon></icon>