Esempio n. 1
0
void gravManager::addNewSource( VideoSource* s )
{
    if ( s == NULL ) return;

    Texture t = GLUtil::getInstance()->getTexture( "border" );
    s->setTexture( t.ID, t.width, t.height );

    lockSources();

    sources->push_back( s );
    drawnObjects->push_back( s );
    s->updateName();

    // tree add needs to be done on main thread since WX accesses the tree in
    // other places (ie, not thread safe, and this could be on a separate
    // thread)
    if ( tree != NULL )
        objectsToAddToTree->push_back( (RectangleBase*)s );

    // do extra placement stuff
    // execute automatic mode layout again if it's on...
    if ( autoFocusRotate )
    {
        std::vector<RectangleBase*> tempOuterObjs = getMovableObjects();
        std::vector<RectangleBase*> tempInnerObj( tempOuterObjs.end()-1,
                                                    tempOuterObjs.end() );
        tempOuterObjs.erase( tempOuterObjs.end()-1 );

        std::map<std::string, std::vector<RectangleBase*> > data = \
            std::map<std::string, std::vector<RectangleBase*> >();
        data["inners"] = tempInnerObj;
        data["outers"] = tempOuterObjs;
        layouts->arrange( "aspectFocus", getScreenRect(), RectangleBase(),
                            data );
    }
    // ...or rearrange it as a grid if the option is set...
    else if ( gridAuto )
    {
        std::map<std::string, std::vector<RectangleBase*> > data = \
            std::map<std::string, std::vector<RectangleBase*> >();
        data["objects"] = getMovableObjects();
        layouts->arrange("grid", getScreenRect(), getEarthRect(), data);
    }
    // otherwise add to runway if we're using it & have >9 videos
    else if ( useRunway && videoListener->getSourceCount() > 9 )
        runway->add( s );
    // base case will just use placement defined in VideoListener (9 grid with
    // stacking)

    unlockSources();
}
Esempio n. 2
0
void gravManager::setWindowSize( int w, int h )
{
    windowWidth = w;
    windowHeight = h;
    GLdouble screenL, screenR, screenU, screenD;
    GLUtil* glUtil = GLUtil::getInstance();

    // reset cam to original spot in order to project from correct spot and find
    // the rectangle relative/facing to the original camera position
    Point oldCamPoint = cam->getCenter();
    cam->setCenter( origCamPoint );
    cam->doGLLookat();

    // note this still uses the old screen rect - assumes it stays on the same
    // plane, since the raytrace method ignores the rect boundaries
    Point topRight, bottomLeft;
    glUtil->screenToRectIntersect( (GLdouble)windowWidth,
                                   (GLdouble)windowHeight,
                                   getScreenRect( true ), topRight );
    glUtil->screenToRectIntersect( 0.0f, 0.0f, getScreenRect( true ),
                                    bottomLeft );

    screenL = bottomLeft.getX();
    screenR = topRight.getX();
    screenU = topRight.getY();
    screenD = bottomLeft.getY();

    cam->setCenter( oldCamPoint );
    cam->doGLLookat();

    screenRectFull.setPos( (screenL+screenR)/2.0f, (screenU+screenD)/2.0f);
    screenRectFull.setScale( screenR-screenL, screenU-screenD );

    recalculateRectSizes();

    if ( venueClientController != NULL )
    {
        venueClientController->setScale( screenRectSub.getDestWidth() * 0.9f,
                                     screenRectSub.getDestHeight() * 0.9f,
                                     true );
    }

    sessionManager->recalculateSize();
}
Esempio n. 3
0
void DockPanel::onContentsSizeChanged()
{
    if (m_dockModeData->getDockMode() == Dock::FashionMode) {
        m_appLayout->setAutoResize(true);
        m_appLayout->update();
    }
    else {
        DisplayRect rec = getScreenRect();
        m_appLayout->setAutoResize(false);

        m_appLayout->setFixedSize(rec.width - m_pluginLayout->width() - m_launcherItem->width(), m_dockModeData->getItemHeight());
    }

    emit sizeChanged();
}
Esempio n. 4
0
bool EditIsoView::eventMouseClick(const AGEvent *m)
{
  if(!mEditing)
    return CompleteIsoView::eventMouseClick(m);
  const AGSDLEvent *e=reinterpret_cast<const AGSDLEvent*>(m);
  if(e)
    {
      if(getScreenRect().contains(e->getMousePosition()))
        {
          if(e->getButton()==SDL_BUTTON_LEFT||e->getButton()==SDL_BUTTON_RIGHT)
            {
              if(mOldPoint)
              {
                Pos3D p=mOldPoint->getPosition();
		
		editMarkClicked(Pos2D(p.x,p.z),e);
		/*
                Pos3D p=mOldPoint->getPosition();
                if(mAddEntity=="")
                  editAt(p,e->getButton()==SDL_BUTTON_LEFT);
                else if(mAddEntity=="rubber")
                {
                  // getEntity and delete
                  std::vector<AntEntity *> es=getEntity(e->getMousePosition());
                  if(es.size())
                  {
                    for(std::vector<AntEntity*>::iterator i=es.begin();i!=es.end();i++)
                      getMap()->removeEntity(*i);
                  }
                }
                else if(mAddEntity=="tree")
                  getMap()->insertEntity(new AntTree(Pos2D(p.x,p.z),rand()%11));
                else if(mAddEntity=="stones")
                  getMap()->insertEntity(new AntDeco(Pos2D(p.x,p.z),rand()%2));
		else if(mAddEntity=="tower")
		  getMap()->insertEntity(new AntHouse(Pos2D(p.x,p.z),"tower2"));
		*/
              }

              update();
              return true;
            }
        }
    }
  return false;
}
Esempio n. 5
0
/*!
 * This method returns the padding to be applied between a line approaching
 * wrapped frame or image from the right. 
 * y Is the top of the line in logical units as defined relative to the
 * y position on the screen.
 * height is the height of the line.
 * If tight wrapping is set on a positioned object this number can be negative
 * which means the line can encroach into the rectangular region of the
 * image provided the region is transparent.
 */
UT_sint32 fp_FrameContainer::getRightPad(UT_sint32 y, UT_sint32 height)
{
  fl_FrameLayout *pFL = static_cast<fl_FrameLayout *>(getSectionLayout());
  UT_sint32 pad = pFL->getBoundingSpace();
  UT_Rect * pRect = getScreenRect();
  UT_sint32 yC = pRect->top;
  if(!isTightWrapped() || !isWrappingSet())
  {
    return pad;
  }
  if(FL_FRAME_TEXTBOX_TYPE == pFL->getFrameType())
  {
    return pad;
  }
  if(pFL->getBackgroundImage() == NULL)
  {
    return pad;
  }
  UT_sint32 iRight = pFL->getBackgroundImage()->GetOffsetFromRight(getGraphics(),pad,y - yC,height);
  xxx_UT_DEBUGMSG(("Local Y %d iRight %d width %d \n",y-yC,iRight,getFullWidth()));
  return iRight;
}
Esempio n. 6
0
bool EditIsoView::eventMouseMotion(const AGEvent *m)
{
  if(!mEditing)
    CompleteIsoView::eventMouseMotion(m);
  const AGSDLEvent *e=reinterpret_cast<const AGSDLEvent*>(m);
  if(e)
    {
      if(getScreenRect().contains(e->getMousePosition()))
        {
          AVItem *closest=getClosest(e->getMousePosition());
          if(closest)
            {
              VoxelImage *i=dynamic_cast<VoxelImage*>(closest);
              if(mOldPoint)
                mOldPoint->setTexture("white_pin");
              mOldPoint=i;
              if(i)
                i->setTexture("blue_pin");
            }

        }
    }
  return IsoView::eventMouseMotion(m);
}
Esempio n. 7
0
bool CompleteIsoView::eventMouseClick(const AGEvent *m)
{
  const AGSDLEvent *e=reinterpret_cast<const AGSDLEvent*>(m);
  if(e)
    {
      if(e->getButton()==SDL_BUTTON_RIGHT)
        mSelected.clear();
      else if(getScreenRect().contains(e->getMousePosition()))
        {
          //clicked
          AGPoint p(e->getMousePosition());
          cdebug("clicked on "<<p.x<<","<<p.y);

          std::vector<AntEntity *> es=getEntity(p);
	  if(es.size())
	    clickEntities(toEntVector(es));
	  else
	    {
              IVTile t=getTile(p);
              cdebug(t.x<<","<<t.y);
	      Pos2D p2=getTilePos(t);
	      clickMap(p2);
	    }
	  /*
          if(es.size())
            {
              if(mSelected.size())
                {
                  // already something selected - so fight
                  for(std::set
                        <AVItem*>::iterator k=mSelected.begin();k!=mSelected.end();k++) // loop selected
                      {
                        AVItem *i=*k;

                        AntHero *h=dynamic_cast<AntHero*>(mEntities[i]);
                        if(isMyHero(h))
                          {
                            AntHero *otherHero=getHero(es);
                            if(otherHero)
                              h->fightHero(otherHero);
                            //h->setJob(new FightJob(*es.begin())); // FIXME: currently fighting first
                          }
                      }

                }
              else
                {
                  std::vector<AntEntity*>::iterator i=es.begin();
                  for(;i!=es.end();i++)
                    mSelected.insert(mEntitiesInv[*i]);
                }

            }
          else
            {

              IVTile t=getTile(p);
              cdebug(t.x<<","<<t.y);
	      Pos2D p2=getTilePos(t);

	      clickMap(p2);

              if(mSelected.size() && es.size()==0)
                {
                  for(std::set
                        <AVItem*>::iterator k=mSelected.begin();k!=mSelected.end();k++)
                      {
                        AVItem *i=*k;

                        AntEntity *h=mEntities[i];
                        if(isMyHero(h))
                          {
			    //                            h->goTo(1,getTilePos(t));
                            h->setJob(new MoveJob(0,getTilePos(t),0));
                          }
                      }
                }
		}*/
        }
    }
  return false;

}
FloatRect screenAvailableRect(Widget* w)
{
    return getScreenRect(w, true);
}
FloatRect screenRect(Widget* w)
{
    return getScreenRect(w, false);
}
Esempio n. 10
0
void gravManager::draw()
{
    // don't draw if either of these objects haven't been initialized yet
    if ( !earth || !input ) return;

    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    cam->animateValues();
    cam->doGLLookat();

    // audio test drawing
    /*if ( audioAvailable() )
    {
        GLUquadric* sphereQuad = gluNewQuadric();
        if ( true ) //drawCounter % 2 == 0 )
        {
            float avg = audio->getLevelAvg();
            if ( avg > 0.0001f )
                overalllevel = avg;
        }
        gluSphere( sphereQuad, overalllevel * 30.0f + 0.5f, 50, 50 );
    }*/

    // set it to update names only every 30 frames
    bool updateNames = false;
    if ( drawCounter == 0 )
    {
        updateNames = true;
        if ( audioAvailable() )
            audio->updateNames();
    }

    // polygon offset to fix z-fighting of coplanar polygons (videos)
    // disabled, since making the depth buffer read-only in some area takes
    // care of this issue
    //glEnable( GL_POLYGON_OFFSET_FILL );
    //glPolygonOffset( 0.1, 1.0 );

    //glPolygonMode( GL_FRONT, GL_FILL );
    //float pOffset = 0.1;

    std::vector<RectangleBase*>::const_iterator si;

    lockSources();

    // periodically automatically rearrange if on automatic - take last object
    // and put it in center
    if ( autoCounter == 0 && getMovableObjects().size() > 0 && autoFocusRotate )
    {
        outerObjs = getMovableObjects();
        innerObjs = std::vector<RectangleBase*>( outerObjs.begin(),
                                                    outerObjs.begin()+1 );
        outerObjs.erase( outerObjs.begin() );

        std::map<std::string, std::vector<RectangleBase*> > data = \
            std::map<std::string, std::vector<RectangleBase*> >();
        data["inners"] = innerObjs;
        data["outers"] = outerObjs;
        layouts->arrange( "aspectFocus", getScreenRect(), RectangleBase(),
                            data );

        moveToTop( innerObjs[0] );

        outerObjs.clear();
        innerObjs.clear();
    }

    // add objects to tree that need to be added - similar to delete, tree is
    // modified on the main thread (in other WX places) so
    if ( objectsToAddToTree->size() > 0 && tree != NULL )
    {
        for ( unsigned int i = 0; i < objectsToAddToTree->size(); i++ )
        {
            tree->addObject( (*objectsToAddToTree)[i] );
        }
        objectsToAddToTree->clear();
    }
    // same for remove
    if ( objectsToRemoveFromTree->size() > 0 && tree != NULL )
    {
        for ( unsigned int i = 0; i < objectsToRemoveFromTree->size(); i++ )
        {
            tree->removeObject( (*objectsToRemoveFromTree)[i] );
        }
        objectsToRemoveFromTree->clear();
    }
    // delete sources that need to be deleted - see deleteSource for the reason
    doDelayedDelete();

    // draw point on geographical position, selected ones on top (and bigger)
    for ( si = drawnObjects->begin(); si != drawnObjects->end(); si++ )
    {
        RGBAColor col = (*si)->getColor();
        glColor4f( col.R, col.G, col.B, col.A );
        if ( !(*si)->isGrouped() && !(*si)->isSelected() )
        {
            //drawCurvedEarthLine( (*si)->getLat(), (*si)->getLon(),
            //                    (*si)->getX(), (*si)->getY(), (*si)->getZ() );
            drawEarthPoint( (*si)->getLat(), (*si)->getLon(), 3.0f );
        }
    }
    for ( si = selectedObjects->begin(); si != selectedObjects->end(); si++ )
    {
        RGBAColor col = (*si)->getColor();
        glColor4f( col.R, col.G, col.B, col.A );
        if ( !(*si)->isGrouped() )
        {
            //drawCurvedEarthLine( (*si)->getLat(), (*si)->getLon(),
            //                    (*si)->getX(), (*si)->getY(), (*si)->getZ() );
            drawEarthPoint( (*si)->getLat(), (*si)->getLon(), 6.0f );
        }
    }

    earth->draw();

    // this makes the depth buffer read-only for this bit - this prevents
    // z-fighting on the videos which are coplanar
    glDepthMask( GL_FALSE );

    // iterate through all objects to be drawn, and draw
    for ( si = drawnObjects->begin(); si != drawnObjects->end(); si++ )
    {
        // do things we only want to do every X frames,
        // like updating the name
        if ( updateNames )
        {
            // only bother updating it on the tree if it actually
            // changes - to suppress "" from getting shown
            if ( (*si)->updateName() && tree )
                tree->updateObjectName( (*si) );
        }

        // only draw if not grouped - groups are responsible for
        // drawing their members
        if ( !(*si)->isGrouped() )
        {
            // set the audio effect level on the drawcounter, if audio is
            // enabled, and if it's selectable (excludes runway)
            // TODO maybe change this if meaning of selectable changes
            if ( audioAvailable() && drawCounter == 0 && (*si)->isSelectable() )
            {
                // had a really bizarre bug here - if uninitialized, would hit
                // > 0.01f check and succeed later if object was selected. what?
                float level = 0.0f;
                // if source has siteID, send that (and tell audiomanager to
                // only check siteIDs), if not, use cname if available
                if ( (*si)->getSiteID().compare("") != 0 )
                {
                    level = audio->getLevel( (*si)->getSiteID(), true, false );
                }
                else if ( (*si)->getAltName().compare("") != 0 )
                {
                    level = audio->getLevel( (*si)->getAltName(), true, true );
                }

                if ( level > 0.01f )
                {
                    innerObjs.push_back( (*si) );
                    audioFocusTrigger = true;
                }
                else
                {
                    outerObjs.push_back( (*si) );
                }
            }
            (*si)->draw();
        }
        else
        {
            // object is grouped, so group will draw it itself
        }
    }

    // do the audio focus if it triggered
    if ( audioAvailable() )
    {
        if ( audioFocusTrigger )
        {
            std::map<std::string, std::vector<RectangleBase*> > data = \
                std::map<std::string, std::vector<RectangleBase*> >();
            data["inners"] = innerObjs;
            data["outers"] = outerObjs;
            layouts->arrange( "aspectFocus", getScreenRect(), RectangleBase(),
                                data );
            audioFocusTrigger = false;
        }

        outerObjs.clear();
        innerObjs.clear();
    }

    // check runway members for potential removal if outside
    if ( intersectCounter == 0 && runway->numObjects() > 0 &&
            runway->getColor().A > 0.01f )
        runway->handleOutsideMembers();

    if ( input->haveValidMousePos() )
    {
        bool sessionMouseover = input->getMouseX() > sessionManager->getLBound()
                && input->getMouseX() < sessionManager->getRBound()
                && input->getMouseY() < sessionManager->getUBound()
                && input->getMouseY() > sessionManager->getDBound();
        if ( sessionMouseover && !sessionManager->isShown() )
        {
            sessionManager->show( true );
            moveToTop( sessionManager );
        }
        else if ( !sessionMouseover && sessionManager->isShown() )
        {
            sessionManager->show( false );
        }
    }

    unlockSources();

    // check session manager for moved session entry objects & shift if
    // necessary - this needs to be outside the lock() since a shift might
    // trigger a session disable, which may delete a video which needs to lock
    // on its own (ie, we're not doing reentrant mutexes)
    if ( intersectCounter == 0 && sessionManager->getColor().A > 0.01f )
        sessionManager->checkGUISessionShift();

    // draw the click-and-drag selection box
    if ( holdCounter > 1 && drawSelectionBox )
    {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

        // the main box
        glBegin(GL_QUADS);

        glColor4f( 0.1f, 0.2f, 1.0f, holdCounter/25.0f * 0.25f );

        glVertex3f(input->getDragStartX(), input->getDragStartY(), 0.0f);
        glVertex3f(input->getDragEndX(), input->getDragStartY(), 0.0f);
        glVertex3f(input->getDragEndX(), input->getDragEndY(), 0.0f);
        glVertex3f(input->getDragStartX(), input->getDragEndY(), 0.0f);

        glEnd();

        // the outline
        glBegin(GL_LINE_LOOP);

        glColor4f( 0.5f, 0.6f, 1.0f, holdCounter/25.0f * 0.25f );

        glVertex3f(input->getDragStartX(), input->getDragStartY(), 0.0f);
        glVertex3f(input->getDragEndX(), input->getDragStartY(), 0.0f);
        glVertex3f(input->getDragEndX(), input->getDragEndY(), 0.0f);
        glVertex3f(input->getDragStartX(), input->getDragEndY(), 0.0f);

        glEnd();

        glDisable(GL_BLEND);
    }

    // header text drawing
    if ( useHeader )
    {
        glPushMatrix();

        glEnable( GL_BLEND );
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glColor4f( 0.953f, 0.431f, 0.129f, 0.5f );
        float textXPos = screenRectFull.getLBound() + textOffset;
        float textYPos = screenRectFull.getUBound() -
                ( ( headerTextBox.Upper().Yf() - headerTextBox.Lower().Yf() )
                        * textScale ) - textOffset;
        glTranslatef( textXPos, textYPos, 0.0f );
        glScalef( textScale, textScale, textScale );
        const char* text = headerString.c_str();
        GLUtil::getInstance()->getMainFont()->Render( text );
        glDisable( GL_BLEND );

        glPopMatrix();
    }

    // graphics debug drawing
    if ( graphicsDebugView )
    {
        glPushMatrix();

        GLCanvas* canvas = GLUtil::getInstance()->getCanvas();

        long drawTime = canvas->getDrawTime();
        float color = (33.0f - (float)drawTime) / 17.0f;
        glColor4f( 1.0f, color, color, 0.8f );
        glTranslatef( 0.0f, screenRectFull.getUBound() * 0.9f, 0.0f );
        float debugScale = textScale / 2.5f;
        glScalef( debugScale, debugScale, debugScale );
        char text[100];
        sprintf( text,
                "Draw time: %3ld  Non-draw time: %3ld  Pixel count: %8ld "
                "FPS: %2.2f",
                canvas->getDrawTime(), canvas->getNonDrawTime(),
                videoListener->getPixelCount(), canvas->getFPS() );
        GLUtil::getInstance()->getMainFont()->Render( text );

        glPopMatrix();
    }

    // back to writeable z-buffer for proper earth/line rendering
    glDepthMask( GL_TRUE );

    glFlush();

    // hold counter is a bit different than the others since alpha values
    // directly depend on it, as above
    if ( !input->isLeftButtonHeld() && holdCounter > 0 )
        holdCounter-=2;
    else if ( holdCounter < 24 )
        holdCounter++;

    drawCounter = ( drawCounter + 1 ) % 30;
    intersectCounter = ( intersectCounter + 1 ) % 20;
    autoCounter = ( autoCounter + 1 ) % 900;
}
Esempio n. 11
0
void gravManager::deleteSource( std::vector<VideoSource*>::iterator si )
{
    lockSources();

    RectangleBase* temp = (RectangleBase*)(*si);
    VideoSource* s = *si;

    removeFromLists( temp );

    sources->erase( si );

    // TODO need case for runway grouping?
    if ( temp->isGrouped() )
    {
        Group* g = temp->getGroup();

        // remove object from the group, regardless of whether it's a siteID
        // group or not.
        // this should work for runways, but should be more generic, ie for
        // groups of groups? maybe in removefromlists, but careful not to
        // degroup object before it hits that siteID check above or siteIDgroups
        // will have invalid references
        g->remove( temp );

        // delete the group the object was in if this is the last object in it
        // and it's an automatically made siteID group
        // TODO probably have a better metric for determining auto-siteID groups
        if ( g->getSiteID().compare( "" ) != 0 && g->numObjects() == 0 )
        {
            // note this duplicates the deleteGroup function since that does
            // mutex locking itself, and we already did that here
            removeFromLists( (RectangleBase*)g );

            // remove the group from the list of siteIDgroups
            std::map<std::string,Group*>::iterator gi =
                    siteIDGroups->find( g->getSiteID() );
            siteIDGroups->erase( gi );

            // put off the group delete, since removing it from the tree has to
            // happen on the main thread, and can't delete it before we remove
            // it from the tree
            objectsToDelete->push_back( g );
        }
    }

    if ( gridAuto )
    {
        std::map<std::string, std::vector<RectangleBase*> > data =
            std::map<std::string, std::vector<RectangleBase*> >();
        data["objects"] = getMovableObjects();
        layouts->arrange("grid", getScreenRect(), getEarthRect(), data);
    }

    // we need to do videosource's delete somewhere else, since this function
    // might be on a second thread, which would crash since the videosource
    // delete needs to do a GL call to delete its texture and GL calls can only
    // be on the main thread
    objectsToDelete->push_back( s );

    unlockSources();
}
Esempio n. 12
0
/*!
 Draw container content
 \param pDA Draw arguments
 */
void fp_FrameContainer::draw(dg_DrawArgs* pDA)
{
	FV_View * pView = getView();
	UT_return_if_fail( pView);
	
	xxx_UT_DEBUGMSG(("FrameContainer %x called, page %x \n",this,getPage()));
	if(getPage() == NULL)
	{
	     getSectionLayout()->format();
	     getSectionLayout()->setNeedsReformat(getSectionLayout());
	     if(getPage() == NULL)
	     {
			 return;
	     }
	}
	if(pView)
	{
		if(pView->getFrameEdit()->getFrameEditMode() == FV_FrameEdit_DRAG_EXISTING)
		{
			if((pView->getFrameEdit()->getFrameContainer() == this))
			{
				return;
			}
		}
	}
//
// Only draw the lines in the clipping region.
//
/*
	[Somewhere down here is where the logic to only draw the region of the frame which
	is within the complement of the union of all higher frames needs to be. We need to
	draw the applicable region of the rectangle we're on, then unify it with (if
	applicable) the higher union.] <-- Possibly obsolete comment, not sure.
	I think I might have landed on an alternative solution involving more rearranging
	of the storage of the FrameContainers, based on their z-index.  Not sure how far
	I got with that or if it worked either.  See also abi bug 7664 and the original
	discussions about defining the undefinedness of layered frame behaviour.
*/

	if(m_bOverWrote)
	{
		pDA->bDirtyRunsOnly = false;
	}
	dg_DrawArgs da = *pDA;
	GR_Graphics * pG = da.pG;
	UT_return_if_fail( pG);

	UT_sint32 x = pDA->xoff - m_iXpad;
	UT_sint32 y = pDA->yoff - m_iYpad;
	getPage()->expandDamageRect(x,y,getFullWidth(),getFullHeight());
	if(!pDA->bDirtyRunsOnly || m_bNeverDrawn)
	{
		if(m_bNeverDrawn)
		{
			pDA->bDirtyRunsOnly= false;
		} 
		UT_sint32 srcX,srcY;
		getSectionLayout()->checkGraphicTick(pG);
		srcX = -m_iXpad;
		srcY = -m_iYpad;
		//
		// Only fill to the bottom of the viewed page.
		//
		UT_sint32 iFullHeight = getFullHeight();
		fl_DocSectionLayout * pDSL = getDocSectionLayout();
		UT_sint32 iMaxHeight = 0;
		if(!pG->queryProperties(GR_Graphics::DGP_PAPER) && (pView->getViewMode() != VIEW_PRINT))
		{
		        iMaxHeight = pDSL->getActualColumnHeight();
		}
		else
		{
		        iMaxHeight = getPage()->getHeight();
		}
		UT_sint32 iBot = getFullY()+iFullHeight;
		if(iBot > iMaxHeight)
		{
		        iFullHeight = iFullHeight - (iBot-iMaxHeight);
		}
		getFillType()->Fill(pG,srcX,srcY,x,y,getFullWidth(),iFullHeight);
		m_bNeverDrawn = false;
	}
	UT_uint32 count = countCons();
	UT_DEBUGMSG(("Number of containers in frame %d \n",count));
	const UT_Rect * pPrevRect = pDA->pG->getClipRect();
	UT_Rect * pRect = getScreenRect();
	UT_Rect newRect;
	bool bRemoveRectAfter = false;
	bool bSetOrigClip = false;
	bool bSkip = false;
	if((pPrevRect == NULL) && pG->queryProperties(GR_Graphics::DGP_SCREEN))
	{
		pDA->pG->setClipRect(pRect);
		UT_DEBUGMSG(("Clip bottom is %d \n",pRect->top + pRect->height));
		bRemoveRectAfter = true;
	}
	else if(pPrevRect && !pRect->intersectsRect(pPrevRect))
	{
		bSkip = true;
		xxx_UT_DEBUGMSG(("External Clip bottom is %d \n",pRect->top + pRect->height));
	}
	else if(pPrevRect)
	{
		newRect.top = UT_MAX(pPrevRect->top,pRect->top);
		UT_sint32 iBotPrev = pPrevRect->height + pPrevRect->top;
		UT_sint32 iBot = pRect->height + pRect->top;
		newRect.height = UT_MIN(iBotPrev,iBot) - newRect.top;
		newRect.width = pPrevRect->width;
		newRect.left = pPrevRect->left;
		if((newRect.height > 0) && pDA->pG->queryProperties(GR_Graphics::DGP_SCREEN))
		{
			pDA->pG->setClipRect(&newRect);
			bSetOrigClip = true;
		}
		else
		{
			bSkip = true;
		}
	}
	if(!bSkip)
	{
		for (UT_uint32 i = 0; i<count; i++)
		{
			fp_ContainerObject* pContainer = static_cast<fp_ContainerObject*>(getNthCon(i));
			da.xoff = pDA->xoff + pContainer->getX();
			da.yoff = pDA->yoff + pContainer->getY();
			pContainer->draw(&da);
		}
	}
	m_bNeverDrawn = false;
	m_bOverWrote = false;
	if(bRemoveRectAfter)
	{
		pDA->pG->setClipRect(NULL);
	}
	if(bSetOrigClip)
	{
		pDA->pG->setClipRect(pPrevRect);
	}
	delete pRect;
	drawBoundaries(pDA);
}
Esempio n. 13
0
/*!
 * Returns true if the supplied screen rectangle overlaps with frame
 * container. This method takes account of transparening and tight wrapping.
 */
bool fp_FrameContainer::overlapsRect(UT_Rect & rec)
{
     UT_Rect * pMyFrameRec = getScreenRect();
     fl_FrameLayout * pFL = static_cast<fl_FrameLayout *>(getSectionLayout());
     UT_sint32 iextra = pFL->getBoundingSpace() -2;
     pMyFrameRec->left -= iextra;
     pMyFrameRec->top -= iextra;
     pMyFrameRec->width += 2*iextra;
     pMyFrameRec->height += 2*iextra;
     xxx_UT_DEBUGMSG(("look at rec.left %d top %d width %d  \n",rec.left,rec.top,rec.width));
     if(rec.intersectsRect(pMyFrameRec))
     {
         if(!isTightWrapped())
	 {
	      delete pMyFrameRec;
	      return true;
	 }
	 UT_sint32 iTweak = getGraphics()->tlu(2);
	 pMyFrameRec->left += iextra + iTweak;
	 pMyFrameRec->top += iextra + iTweak;
	 pMyFrameRec->width -= (2*iextra + 2*iTweak);
	 pMyFrameRec->height -= (2*iextra + 2*iTweak);

	 UT_sint32 y = rec.top - pMyFrameRec->top;
	 UT_sint32 h = rec.height;
	 if(pFL->getBackgroundImage() == NULL)
	 {
	      delete pMyFrameRec;
	      return true;
	 }
	 UT_sint32 pad = pFL->getBoundingSpace();
	 UT_sint32 iLeft = pFL->getBackgroundImage()->GetOffsetFromLeft(getGraphics(),pad,y,h);
	 xxx_UT_DEBUGMSG(("iLeft projection %d \n",iLeft));
	 if(iLeft < -getWidth())
	 {
	   //
	   // Pure transparent.
	   //
	   xxx_UT_DEBUGMSG(("Overlaps pure transparent line top %d line height %d image top %d \n",rec.top,rec.height,y));
	      delete pMyFrameRec;
	      return false;
	 }
	 xxx_UT_DEBUGMSG(("iLeft in overlapRect %d Y %d \n",iLeft,y));
	 if(rec.left < pMyFrameRec->left)
	 {
              pMyFrameRec->left -= iLeft;
	      xxx_UT_DEBUGMSG(("Moves Image left border by %d to %d \n",-iLeft,pMyFrameRec->left));
	 }
	 else
	 {
	      UT_sint32 iRight = pFL->getBackgroundImage()->GetOffsetFromRight(getGraphics(),pad,y,h);
              pMyFrameRec->width += iRight;
	      xxx_UT_DEBUGMSG(("Reduce Image width by %d to %d \n",iRight,pMyFrameRec->width));
	 }
	 if(rec.intersectsRect(pMyFrameRec))
	 {
	   xxx_UT_DEBUGMSG(("Frame Still overlaps \n"));
	   delete pMyFrameRec;
	   return true;
	 }
	 xxx_UT_DEBUGMSG(("Tight Frame no longer overlaps \n"));
	 xxx_UT_DEBUGMSG(("Line Top %d Height %d left %d width %d \n",rec.top,rec.height,rec.left,rec.width));
	 xxx_UT_DEBUGMSG(("Image Top %d Height %d left %d width %d \n",pMyFrameRec->top,pMyFrameRec->height,pMyFrameRec->left,pMyFrameRec->width));
	 xxx_UT_DEBUGMSG(("Relative Top of line %d \n",y));
     }
     delete pMyFrameRec;
     return false;
}