Commit 1e965d5a authored by Erwan Tulou's avatar Erwan Tulou

skins2: optimize refresh of text control

text controls were far from being optimized
   - a notifyLayout was executed at creation of text control, leading
     to rebuilding the layout twice.
   - the init of the variable was done after the control was created
     which means still more rebuild of the layout.

This patch ensures that no rebuild is done at init since we are already in the
process of rebuilding the entire layout.
parent 4382ab9c
......@@ -207,6 +207,7 @@ void CtrlText::onUpdate( Subject<VarText> &rVariable, void* arg )
if( isVisible() )
{
displayText( m_rVariable.get() );
notifyLayout( getPosition()->getWidth(), getPosition()->getHeight() );
}
}
......@@ -219,6 +220,7 @@ void CtrlText::onUpdate( Subject<VarBool> &rVariable, void *arg )
if( isVisible() )
{
displayText( m_rVariable.get() );
notifyLayout( getPosition()->getWidth(), getPosition()->getHeight() );
}
else
{
......@@ -278,7 +280,6 @@ void CtrlText::displayText( const UString &rText )
m_pTimer->stop();
}
}
notifyLayout( getPosition()->getWidth(), getPosition()->getHeight() );
}
}
......
......@@ -722,6 +722,10 @@ void Builder::addText( const BuilderData::Text &rData )
VarText *pVar = new VarText( getIntf() );
m_pTheme->m_vars.push_back( VariablePtr( pVar ) );
// Set the text of the control
UString msg( getIntf(), rData.m_text.c_str() );
pVar->set( msg );
// Get the visibility variable
// XXX check when it is null
Interpreter *pInterpreter = Interpreter::instance( getIntf() );
......@@ -744,9 +748,6 @@ void Builder::addText( const BuilderData::Text &rData )
pLayout->addControl( pText, pos, rData.m_layer );
// Set the text of the control
UString msg( getIntf(), rData.m_text.c_str() );
pVar->set( msg );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment