Esempio n. 1
0
//---------------------------------------------------------------------------
// update running entities (init/exit/runtime change)
//---------------------------------------------------------------------------
bool Config::_updateRunning( const bool canFail )
{
    if( _state == STATE_STOPPED )
        return true;

    LBASSERT( _state == STATE_RUNNING || _state == STATE_INITIALIZING ||
              _state == STATE_EXITING );

    if( !_connectNodes() && !canFail )
        return false;

    _startNodes();
    _updateCanvases();
    const bool result = _updateNodes( canFail );
    _stopNodes();

    // Don't use visitor, it would get confused with modified child vectors
    _deleteEntities( getCanvases( ));
    _deleteEntities( getLayouts( ));
    _deleteEntities( getObservers( ));
    const Nodes& nodes = getNodes();
    for( Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i )
    {
        const Pipes& pipes = (*i)->getPipes();
        for( Pipes::const_iterator j = pipes.begin(); j != pipes.end(); ++j )
        {
            const Windows& windows = (*j)->getWindows();
            _deleteEntities( windows );
        }
    }

    return result;
}
Esempio n. 2
0
void Canvas::_switchLayout(const uint32_t oldIndex, const uint32_t newIndex)
{
    if (oldIndex == newIndex)
        return;

    const Layouts& layouts = getLayouts();
    const size_t nLayouts = layouts.size();
    Layout* oldLayout = (oldIndex >= nLayouts) ? 0 : layouts[oldIndex];
    Layout* newLayout = (newIndex >= nLayouts) ? 0 : layouts[newIndex];

    if (oldLayout)
        oldLayout->trigger(this, false);

    if (newIndex == LB_UNDEFINED_UINT32)
        return;

    Super::activateLayout(newIndex);

    if (newLayout)
        newLayout->trigger(this, true);
}
Esempio n. 3
0
//---------------------------------------------------------------------------
// init
//---------------------------------------------------------------------------
bool Config::_init( const uint128_t& initID )
{
    LBASSERT( _state == STATE_STOPPED );
    _state = STATE_INITIALIZING;
    _currentFrame  = 0;
    _finishedFrame = 0;
    _initID = initID;

    for( auto compound : _compounds )
        compound->init();

    for( auto observer : getObservers( ))
        observer->init();

    for( auto canvas : getCanvases( ))
        canvas->init();

    const auto& layouts = getLayouts();
    for( auto layout : layouts )
        for( auto view : layout->getViews( ))
            view->init();

    // any of the above entities might have been updated
    commit();

    if( !_updateRunning( false ))
        return false;

    // Needed to set up active state for first LB update
    for( CompoundsCIter i = _compounds.begin(); i != _compounds.end(); ++i )
        (*i)->update( 0 );

    // Update equalizer properties in views
    UpdateEqualizersVisitor updater;
    accept( updater );

    _needsFinish = false;
    _state = STATE_RUNNING;
    return true;
}