Exemplo n.º 1
0
/*! init client window
 *
 *  If manageClientViewports is set, then all viewports from the
 *  cluster window are duplcated to the client window.
 */
void MultiDisplayWindow::clientInit( void )
{
    bool             changed = false;
    ViewportPtr      vp,cvp;

    if(getManageClientViewports() == false ||
       getClientWindow() == NullFC)
        return;

    // check if something changed
    if(getMFPort()->size() == getClientWindow()->getMFPort()->size())
    {
        for(UInt32 v = 0 ; v < getMFPort()->size() && !changed ; v++)
        {
            vp  = getPort(v);
            cvp = getClientWindow()->getPort(v);
            if( vp->getRoot() != cvp->getRoot() ||
                vp->getLeft() != cvp->getLeft() ||
                vp->getRight() != cvp->getRight() ||
                vp->getBottom() != cvp->getBottom() ||
                vp->getTop() != cvp->getTop() ||
                vp->getBackground() != cvp->getBackground() ||
                vp->getMFForegrounds()->size() !=
                    cvp->getMFForegrounds()->size() )
                changed = true;
        }
    }
    else
    {
        changed = true;
    }

    if(changed)
    {
        beginEditCP(getClientWindow());
        // remove all viewports
        while(getClientWindow()->getMFPort()->size())
        {
            vp = getClientWindow()->getPort(0);
            getClientWindow()->subPort(0);
            subRefCP(vp);
        }
        // duplicate viewports
        for(UInt32 v=0 ; v<getMFPort()->size() ;v++)
        {
            getClientWindow()->addPort(ViewportPtr::dcast(getPort(v)->shallowCopy()));
        }
        endEditCP(getClientWindow());
    }
}
void MultiDisplayWindow::clientInit(void)
{
    bool      changed = false;
    Viewport *vp, *cvp;

    if(getManageClientViewports() == false ||
            getClientWindow         () == NULL)
    {
        return;
    }

    // check if something changed
    if(getMFPort()->size() == getClientWindow()->getMFPort()->size())
    {
        for(UInt32 v = 0 ; v < getMFPort()->size() && !changed ; v++)
        {
            vp  = getPort(v);

            cvp = getClientWindow()->getPort(v);

            if( vp->getRoot() != cvp->getRoot() ||
                    vp->getLeft() != cvp->getLeft() ||
                    vp->getRight() != cvp->getRight() ||
                    vp->getBottom() != cvp->getBottom() ||
                    vp->getTop() != cvp->getTop() ||
                    vp->getBackground() != cvp->getBackground() ||
                    vp->getMFForegrounds()->size() !=
                    cvp->getMFForegrounds()->size() )
            {
                changed = true;
            }
        }
    }
    else
    {
        changed = true;
    }

    if(changed)
    {
        // remove all viewports
#if 0
        while(getClientWindow()->getMFPort()-size())
        {
            vp = getClientWindow()->getPort(0);

            getClientWindow()->subPort(0U);
        }
#endif

        getClientWindow()->clearPorts();

        // duplicate viewports
        for(UInt32 v=0 ; v<getMFPort()->size() ; v++)
        {
            ViewportUnrecPtr pTmpPort =
                dynamic_pointer_cast<Viewport>(getPort(v)->shallowCopy());

            getClientWindow()->addPort(pTmpPort);
        }
    }
}