Пример #1
0
void gui_screen_t::paint() {

	g_create_thread((void*) blinkCursorThread);

	int padding = 5;
	while (true) {
		auto windowBounds = window->getBounds();
		canvas->setBounds(g_rectangle(0, 0, windowBounds.width, windowBounds.height));

		auto cr = getGraphics();
		if (cr == 0) {
			g_sleep(100);
			continue;
		}

		// clear
		cairo_save(cr);
		cairo_set_source_rgba(cr, 0, 0, 0, 1);
		cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
		cairo_paint(cr);
		cairo_restore(cr);

		// relayout text
		g_text_layouter::getInstance()->layout(cr, output.c_str(), font, 14,
				g_rectangle(padding, padding, windowBounds.width - 2 * padding - 20, windowBounds.height - 2 * padding), g_text_alignment::LEFT, viewModel,
				true);

		// check which is the lowest-down-the-screen character
		int highesty = 0;
		for (g_positioned_glyph& g : viewModel->positions) {
			int ypos = g.position.y - g.glyph->y;
			if (ypos > highesty) {
				highesty = ypos;
			}
		}

		// calculate limit
		int yLimit = windowBounds.height - 60;
		int yOffset = 0;
		if (highesty > yLimit) {
			yOffset = yLimit - highesty;
		}

		// paint characters
		g_point last;
		cairo_set_source_rgba(cr, 1, 1, 1, 1);
		for (g_positioned_glyph& g : viewModel->positions) {
			last = g.position;

			cairo_save(cr);
			cairo_translate(cr, g.position.x - g.glyph->x, yOffset + g.position.y - g.glyph->y);
			cairo_glyph_path(cr, g.glyph, g.glyph_count);
			cairo_fill(cr);
			cairo_restore(cr);
		}

		// paint cursor
		if (focused) {
			if ((g_millis() - lastInput < 300) || cursorBlink) {
				cairo_save(cr);
				cairo_set_source_rgba(cr, 1, 1, 1, 1);
				cairo_rectangle(cr, last.x + 10, yOffset + last.y - 12, 8, 14);
				cairo_fill(cr);
				cairo_restore(cr);
			}
		}

		canvas->blit(g_rectangle(0, 0, bufferSize.width, bufferSize.height));

		paint_uptodate = true;
		g_atomic_block(&paint_uptodate);
	}
}
void FV_VisualDragText::drawImage(void)
{
        if(m_bNotDraggingImage)
	{ 
	  GR_Graphics::Cursor cursor = GR_Graphics::GR_CURSOR_DRAGTEXT;
	  if(isDoingCopy())
	  {
	      cursor = GR_Graphics::GR_CURSOR_COPYTEXT;
	  }
	  getGraphics()->setCursor(cursor);
	  return;
	}
	if(m_pDragImage == NULL)
	{
		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
		return;
	}
	GR_Painter painter(getGraphics());
	if( m_recOrigLeft.width > 0 || m_recOrigRight.width>0 )
	{
		UT_Rect dest;
		dest.left = m_recCurFrame.left +  m_recOrigLeft.width;
		dest.top = m_recCurFrame.top;
		dest.width = m_recCurFrame.width -  m_recOrigLeft.width;
		dest.height = m_recOrigLeft.height;
		UT_Rect src;
		src.left = m_recOrigLeft.width;
		src.top = 0;
		src.height =  m_recOrigLeft.height;
		src.width = dest.width;
		if((src.height > getGraphics()->tlu(2)) && (src.width >getGraphics()->tlu(2)) )
		{
			painter.fillRect(m_pDragImage,&src,&dest);
		}
		dest.left = m_recCurFrame.left;
		dest.top = m_recCurFrame.top + m_recOrigLeft.height ;
		dest.width = m_recCurFrame.width;
		dest.height = m_recCurFrame.height - m_recOrigLeft.height - m_recOrigRight.height;
		src.left = 0;
		src.top  = m_recOrigLeft.height ;
		src.width = m_recCurFrame.width;
		src.height = dest.height;
		if(src.height > getGraphics()->tlu(2) && src.width >getGraphics()->tlu(2) )
		{
			painter.fillRect(m_pDragImage,&src,&dest);
		}
		dest.left = m_recCurFrame.left;
		dest.top = m_recCurFrame.top + m_recCurFrame.height - m_recOrigRight.height;
		dest.width = m_recCurFrame.width - m_recOrigRight.width;
		dest.height = m_recOrigRight.height;
		src.top = m_recCurFrame.height - m_recOrigRight.height;
		src.left = 0;
		src.width = m_recCurFrame.width - m_recOrigRight.width;
		src.height = m_recOrigRight.height;
		if((src.height > getGraphics()->tlu(2)) && (src.width >getGraphics()->tlu(2)) )
		{
			painter.fillRect(m_pDragImage,&src,&dest);
		}
		return;
	}
	painter.drawImage(m_pDragImage,m_recCurFrame.left,m_recCurFrame.top);
}
Пример #3
0
void Entity::draw(sf::RenderTarget & renderTarget, sf::RenderStates renderStates) const
{
   YOBA_UNUSED(renderStates);

   const Body * body = getBody();

   for(const std::unique_ptr<Fixture> & fixture : body->getFixtureList())
   {
      if(fixture->isSensor() && !Config::get().drawSensors)
         continue;

      const sf::Texture * texture     = getGraphics()->getTexture();
      const Recti & textureRect = getGraphics()->getTextureRect();

      sf::Shader * blur = Resources::get().getShader("blur");
//      blur->setParameter("texture", *texture);
//      blur->setParameter("blur_radius", Config::get().blurLevel);
//      blur->setParameter("blur_radius", 0.011);

      switch(fixture->getShape())
      {
         case Fixture::Polygon:
         {
            const b2PolygonShape * b2shape = dynamic_cast<const b2PolygonShape *>(fixture->getB2Shape());

            sf::ConvexShape polygon(b2shape->GetVertexCount());
            for(int i = 0; i < b2shape->GetVertexCount(); i++)
            {
               Vec2f v  = Vec2f::fromB2Pos(b2shape->GetVertex(i));
               if(Config::get().pixelFix)
               {
                  v.x += (v.x >= 0 ? 0.5 : -0.5);
                  v.y += (v.y >= 0 ? 0.5 : -0.5);
               }
               polygon.setPoint(i, v);
            }

            if(!fixture->isSensor())
            {
               polygon.setTexture(texture);
               polygon.setTextureRect(textureRect);
            }
            else
            {
               polygon.setFillColor(sf::Color::Transparent);
            }

            if(Config::get().drawOutline || fixture->isSensor())
            {
               polygon.setOutlineColor(sf::Color::Black);
               polygon.setOutlineThickness(-1);
            }
            polygon.setPosition(body->getPos());
            polygon.setRotation(body->getAngle());

            renderTarget.draw(polygon);

         } break;

         case Fixture::Rectangle:
         {
            Vec2f size = fixture->getRectangleSize();
            if(Config::get().pixelFix)
            {
               size.x += size.x >= 0 ? 0.5 : -0.5;
               size.y += size.y >= 0 ? 0.5 : -0.5;
            }

            float textureScaleX = size.x / textureRect.w;
            float textureScaleY = size.y / textureRect.h;

            sf::Sprite sprite(*texture, textureRect);
            sprite.setOrigin(size.x / textureScaleX / 2.f, size.y / textureScaleY / 2.f);
            sprite.setScale(textureScaleX, textureScaleY);
            sprite.setPosition(body->getPos());
            sprite.setRotation(body->getAngle());


            renderTarget.draw(sprite);

            if(Config::get().drawOutline && getGraphics()->hasOutline())
            {
               sf::RectangleShape outline(size);
               outline.setFillColor(sf::Color::Transparent);
               outline.setOutlineColor(sf::Color::Black);
               outline.setOutlineThickness(-1);
               outline.setOrigin(size.x / 2.f, size.y / 2.f);
               outline.setPosition(body->getPos());
               outline.setRotation(body->getAngle());

               renderTarget.draw(outline);
            }

//            sf::CircleShape cs;
//            cs.setFillColor(sf::Color::Red);
//            cs.setRadius(3);
//            cs.setOrigin(3, 3);
//            cs.setPosition(yoba(body->getPos() - fixture->getRectangleSize() / 2.f,
//                                body->getPos(),
//                                body->getAngle()));
//            renderTarget.draw(cs);
         } break;

         case Fixture::Circle:
         {
            float radius = fixture->getCircleRadius();
            if(Config::get().pixelFix)
               radius += 0.5;

            float textureScaleX = radius * 2.f / textureRect.w;
            float textureScaleY = radius * 2.f / textureRect.h;

            sf::Sprite sprite(*texture, textureRect);
            sprite.setOrigin(radius / textureScaleX, radius / textureScaleY);
            sprite.setScale(textureScaleX, textureScaleY);
            sprite.setPosition(body->getPos());
            sprite.setRotation(body->getAngle());

            renderTarget.draw(sprite);
         } break;
      }
   }

   if(Config::get().drawAABB)
   {
      Rectf aabb(body->getAABB());
      sf::RectangleShape rect(aabb.getSize());
      rect.setPosition(aabb.getPos());
      rect.setFillColor(sf::Color::Transparent);
      rect.setOutlineColor(body->getB2Body()->IsAwake() ?
                              sf::Color::Red :
                              sf::Color::Blue);
      rect.setOutlineThickness(-1);
      renderTarget.draw(rect);
   }
}
Пример #4
0
 void InputField::paintText() {
     getGraphics().beginPath().setFillStyle(_color).
         text(0.0f, 0.0f, static_cast<int>(getBoundingBox().size.y / 2), "fonts/DejaVuSansMono-Bold.ttf", text()).
         fill();
 }
Пример #5
0
Pathfinding::Route Pathfinding::getPath(Entity* entity, const Vector3& goal) {
    stringstream prettyInfo;

    Vector3 start = entity->getPosition();

    double a  = phantom::Util::getTime();
    _layer.cleanPathfinding();

    Route route;

    if(_showDebug) {
        cout << endl<< endl<< endl<< endl;
    }

    if(_visualize) {
        getGraphics().clear();
    }

    // Goal space uses a "strict" heuristic. EG: we don't want to walk into a tree.
    Space* goalSpace  = _layer.getSpaceAtUsingHeuristic(goal, entity);

    // There is no "space" available at the destination. The entity probably wants
    // to walk into a tree. Returns an empty route.
    if(goalSpace == nullptr) {
        if(_showDebug) {
            cout << "Goal vector is not a space." << endl;
        }
        return route;
    }

    // Start space, first try using a strict heuristic. EG: If we start near a tree
    // we don't want to walk into that tree.
    Space* startSpace = _layer.getSpaceAtUsingHeuristic(start, entity);

    // Ok, did we find a start space with the strict heuristic? If not, it probably
    // means that our entity is stuck in a tree. Proceed with a less strict
    // heuristic. In most cases this will let the entity "leave" the solid object
    // that it's currently stuck on.
    if(startSpace == nullptr) {
        startSpace = _layer.getSpaceAtUsingHeuristic(start);
    }

    // Ok, we really can't walk anywhere. This is a rather odd case. Most likely
    // the user tried to walk outside of the BSP tree, or you've just found a bug
    // in the BSP tree.
    if(startSpace == nullptr) {
        if(_showDebug) {
            cout << "Start vector is not a space." << endl;
        }
        route.push_back(Vector3(goal));
        return route;
    }

    if(_showDebug) {
        cout << "Starting at: " << startSpace->getArea().toString();
        cout << "Ending at  : " << goalSpace->getArea().toString();
    }

    if(_visualize) {
        Box3& m = startSpace->getArea();

        getGraphics().beginPath().setFillStyle(Color(0, 0, 127, 20))
                .rect(m.origin.x+4, m.origin.y+4, m.size.x-8, m.size.y-8)
                .fill();

        Box3& n = goalSpace->getArea();
        getGraphics().beginPath().setFillStyle(Color(0, 0, 127, 20))
               .rect(n.origin.x+4, n.origin.y+4, n.size.x-8, n.size.y-8)
               .fill();
    }

    priority_queue<Space*, vector<Space*>, CompareShapesAstar> open;

    startSpace->isInOpenList = true;
    open.push(startSpace);

    if(_showBasicDebug) {
        prettyInfo << "Pathfinding overhead: " << std::fixed << (phantom::Util::getTime() - a) << " seconds. ";
    }

    int spacesScanned = 0;
    const double startTime  = phantom::Util::getTime();


    int timeout = 0;
    while(true) {
        if(open.empty()) {
            if(_showBasicDebug || _showDebug) {
                cout << "      Open list empty." << endl;
                double now = phantom::Util::getTime();

                if(_showBasicDebug) {
                    prettyInfo << "No route found, scanned "<< spacesScanned << " Tile(s) in " << std::fixed << (now - startTime) << " seconds.";
                }

            }

            break;
        }

        if(timeout++ > 10000) {
            cout << "      I give up after " << timeout << " tries. " << endl;
            double now = phantom::Util::getTime();
            cout << "A* scanned " << spacesScanned << " Tile(s) in " << std::fixed << (now - startTime) << " seconds. " << endl;

            break;
        }

        Space* current = open.top();
        open.pop();

        if(_visualize) {
            //cout << "  - Testing: " << current->getArea().toString();
            drawRect(current, Color(0, 127, 127, 10));
        }

        if(current == goalSpace) {
            if(_showDebug) {
                cout << "    **** found! This is a good sign. " << endl;
            }
            unfoldRoute(route, current, startSpace, entity);


            if(!route.empty()) {
                route.pop_front();

                Vector3 lastpos = goal - entity->getBoundingBox().size * 0.5;

                // Replace the last way-point with our mouse click coordinates:
                if(route.empty()) {
                    route.push_back(lastpos);
                } else {
                    route.back() = lastpos;
                }
            }


            double now = phantom::Util::getTime();

            if(_showBasicDebug) {
                prettyInfo << "Found route, A* scanned " << spacesScanned << " Tile(s) in " << std::fixed << (now - startTime) << " seconds. Waypoint(s): " << route.size() << ".";
            }

            break;
        }

        vector<Space*>& neighbours = _layer.getNeighbours(current, entity);

        if(_showDebug && neighbours.empty()) {
            cout << "      No neighbours found." << endl;
        }

        for(size_t i = 0; i < neighbours.size(); ++i) {
            Space* testing = neighbours[i];

            if(!testing->isInOpenList) {
                spacesScanned++;
                testing->astarParent  = current;
                testing->isInOpenList = true;
                testing->g = current->g + Services::settings()->pathfinding_g_cost;
                testing->h = calculateHeuristic(goalSpace, testing);
                testing->h = testing->h * testing->h;
                open.push(testing);
            }
        }
    }

    if(_showBasicDebug) {
        //cout << prettyInfo.str() << endl;
        Console::log(prettyInfo.str());
    }

    return route;
}
Пример #6
0
UT_sint32 GR_MathManager::getAscent(UT_sint32 uid)
{
	SmartPtr<libxml2_MathView>  pMathView = m_vecMathView.getNthItem(uid);
	BoundingBox box = pMathView->getBoundingBox();
	UT_DEBUGMSG(("GetAscent New rendering context %p Graphics %p Device resolution %d \n",m_pAbiContext,getGraphics(),getGraphics()->getDeviceResolution()));
	return m_pAbiContext->toAbiLayoutUnits(box.height);
}
Пример #7
0
PrefsDialog::PrefsDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, Strings::get( 168 ),
          AWindow::CENTER | AWindow::ISMODAL | AWindow::ADJUSTSIZE,
          0, 0, 500, 365 )
{
  char *namestr = "PrefsDialog";
  name = new char[strlen(namestr)+1];
  strcpy( name, namestr );

  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight*2 - 20,
      interSpace = fontHeight + fontHeight / 2;

  prevUseBigFont = AGraphics::useBigFont;

  Notebook *notebook =
	  new Notebook( this, 0, 50, getClientWidth(), getClientHeight() - 50, 
		              Color::BKGR, 0 );

	asciiDialog = new AsciiDialog( notebook, notebook );
	ascii2Dialog = new Ascii2Dialog( notebook, notebook );
	hexDialog = new HexDialog( notebook, notebook );
	editorDialog = new EditorDialog( notebook, notebook );
	displayDialog = new DisplayDialog( notebook, notebook );
	miscDialog = new MiscDialog( notebook, notebook );

	notebook->add( editorDialog, Strings::get(188) );
	notebook->add( displayDialog, Strings::get(190) );
	notebook->add( asciiDialog, Strings::get(166) );
	notebook->add( ascii2Dialog, Strings::get(209) );
	notebook->add( hexDialog, Strings::get(179) );
	notebook->add( miscDialog, Strings::get(196) );

  OKButton = new Button( this, Strings::get(8), AWindow::ISDEFAULT|ISTABSTOP,
                             10, 10, 70, 30 );
  OKButton->setYMove( FOLLOW );

  cancelButton = new Button( this, Strings::get(9), ISTABSTOP, 90, 10, 70, 30 );
  cancelButton->setYMove( FOLLOW );

	setControlsVisible();
  notebook->setTab( 0 );

  OKButton->addButtonListener( this );
  cancelButton->addButtonListener( this );

  adjustForFontSize();

  // Save/restore window position

  initSize();

  int x = getX(), y = getY(), width = getWidth(), height = getHeight();
  WinProperties::retrieveProperty( name, x, y, width, height );

  setSize( width, height );
  center( x, y );
  setPos( x, y );
}
/*!
 * This method creates an image from the current selection. It sets
 * the drag rectangle, the initial offsets and the initial positions 
 * of the cursor.
 */
void FV_VisualDragText::getImageFromSelection(UT_sint32 x, UT_sint32 y)
{
//
// OK first work out the locations in the document of the anchor and point
//	
	PT_DocPosition posLow = 0;
	PT_DocPosition posHigh = 0;

	fp_Run * pRunLow = NULL;
	UT_sint32 xLow, yLow,xHigh,yHigh;
	UT_uint32 heightCaret;
	UT_sint32 xCaret2, yCaret2;
	bool bDirection = false;
	bool bEOL = false;
	fp_Page * pPageLow = NULL;
	fp_Page * pPageHigh = NULL;
	if(m_pView->getSelectionMode() < 	FV_SelectionMode_Multiple)
	{
		if(m_pView->getSelectionAnchor() < m_pView->getPoint())
		{
			posLow = m_pView->getSelectionAnchor();
			posHigh = m_pView->getPoint();
		}
		else
		{
			posLow = m_pView->getPoint();
			posHigh = m_pView->getSelectionAnchor();
		}
	}
	else
	{
		UT_sint32 num = m_pView->getNumSelections();
		PD_DocumentRange * pR = m_pView->getNthSelection(0);
		posLow = pR->m_pos1+1;
		fl_BlockLayout * pBlock = NULL;

		bDirection =  false;
		bEOL = false;

		m_pView->_findPositionCoords(posLow, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, &pBlock, &pRunLow);
		while(pBlock->isEmbeddedType())
		{
			posLow++;
			m_pView->_findPositionCoords(posLow, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, &pBlock, &pRunLow);
		}
		fl_ContainerLayout * pCL = pBlock->myContainingLayout();
		UT_return_if_fail(pCL->getContainerType() == FL_CONTAINER_CELL);
		fp_CellContainer * pCCon = static_cast<fp_CellContainer *>(pCL->getFirstContainer());
		UT_return_if_fail(pCCon);
		UT_Rect * pRect = pCCon->getScreenRect();
		xLow = pRect->left;
		yLow = pRect->top;
		m_recCurFrame.left = xLow;
		m_recCurFrame.top = yLow;
		delete pRect;
//
// Now the other end of the column
//
	    pR = m_pView->getNthSelection(num-1);
		posHigh = pR->m_pos1+1;
		m_pView->_findPositionCoords(posHigh, bEOL, xHigh, yHigh, xCaret2, yCaret2, heightCaret, bDirection, &pBlock, &pRunLow);
		while(pBlock->isEmbeddedType())
		{
			posHigh++;
			m_pView->_findPositionCoords(posHigh, bEOL, xHigh, yHigh, xCaret2, yCaret2, heightCaret, bDirection, &pBlock, &pRunLow);
		}
		pCL = pBlock->myContainingLayout();
		UT_return_if_fail(pCL->getContainerType() == FL_CONTAINER_CELL);
		pCCon = static_cast<fp_CellContainer *>(pCL->getFirstContainer());
		UT_return_if_fail(pCCon);
		pRect = pCCon->getScreenRect();
		xHigh = pRect->left+ pRect->width;
		yHigh = pRect->top + pRect->height;
		delete pRect;
		m_recCurFrame.width = xHigh - xLow;
		m_recCurFrame.height = yHigh - yLow;
		m_recOrigLeft.width = 0;
		m_recOrigLeft.height = 0;
		m_recOrigLeft.left = 0;
		m_recOrigLeft.top = 0;
		m_recOrigRight.width = 0;
		m_recOrigRight.height = 0;
		m_recOrigRight.left = 0;
		m_recOrigRight.top = 0;
		m_iLastX = x;
		m_iLastY = y;
		m_iInitialOffX = x - m_recCurFrame.left;
		m_iInitialOffY = y - m_recCurFrame.top;
		GR_Painter painter(getGraphics());
		m_pDragImage = painter.genImageFromRectangle(m_recCurFrame);
		return;
	}
	fp_Run * pRunLow2 = NULL;
	m_pView->_findPositionCoords(posLow+1, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunLow2);
	UT_return_if_fail( pRunLow2 );
	fl_BlockLayout * pBLow2 = pRunLow2->getBlock();
	m_pView->_findPositionCoords(posLow, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunLow);
	UT_return_if_fail( pRunLow );
	fl_BlockLayout * pBLow1 = pRunLow->getBlock();
	bool bUseNext = false;
	bool bIsTable = false;
	if(m_pView->getDocument()->isTableAtPos(posLow))
	{
	    posLow += 2;
	    bIsTable = true;
	}
	fl_TableLayout * pTabLow = m_pView->getTableAtPos(posLow+1);
	fl_TableLayout * pTabHigh = m_pView->getTableAtPos(posHigh);
	if(bIsTable && (pTabLow != pTabHigh))
	{
	    posLow -= 2;
	}
	if(pBLow2 != pBLow1)
	{
		pRunLow = pRunLow2;
		bUseNext = true;
	}
	fp_Line * pLineLow = pRunLow->getLine();
	fp_Run * pRunHigh = NULL;
	m_pView->_findPositionCoords(posHigh, bEOL, xHigh, yHigh, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunHigh);
	fp_Line * pLineHigh = pRunHigh->getLine();
	pPageLow = pLineLow->getPage();
	pPageHigh = pLineHigh->getPage();
	//
	// Decide if the selection is fully on screen and all on the same page.
	//
	bool bOffscreen = false;
	if(pPageLow != pPageHigh)
	{
	     bOffscreen = true;
	}
	if(!bOffscreen && ((yLow <0) || (yHigh >  m_pView->getWindowHeight())))
	{
	     bOffscreen = true;
	}
	if(!bOffscreen && ((xLow <0) || (xHigh <0) || (xLow >  m_pView->getWindowWidth()) ||(xLow >  m_pView->getWindowWidth())))
	{
	     bOffscreen = true;
	}
	if(bOffscreen)
	{
	     m_bNotDraggingImage = true;
	     m_recCurFrame.left = x - 1;
	     m_recCurFrame.top = y - 1;
	     m_recCurFrame.width = 2;
	     m_recCurFrame.height = 2;
	     m_iInitialOffX = 1;
	     m_iInitialOffY = 1;
	     m_iLastX = x;
	     m_iLastY = y;
	     m_recOrigLeft.width = 2;
	     m_recOrigLeft.height = 2;
	     m_recOrigLeft.left = x-1;
	     m_recOrigLeft.top = y-1;
	     GR_Graphics::Cursor cursor = GR_Graphics::GR_CURSOR_DRAGTEXT;
	     if(isDoingCopy())
	     {
	       cursor = GR_Graphics::GR_CURSOR_COPYTEXT;
	     }
	     getGraphics()->setCursor(cursor);
	     return;
	}
	m_bNotDraggingImage = false;
//
// OK deal with the nice case of the selection just on the single line
//
	bool bDoBroken = true;
	if(pLineLow == pLineHigh)
	{
//
// Grab that first charcter!
//
	        if(!bUseNext)
		{
		    m_pView->_findPositionCoords(posLow, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunLow2);
		}
		else
		{
		    m_pView->_findPositionCoords(posLow+1, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunLow2);
		}
		UT_sint32 xx,yy;
		pLineLow->getScreenOffsets(pRunLow,xx,yy);
		m_recCurFrame.left = xLow < xHigh ? xLow : xHigh;
		m_recCurFrame.width = xHigh > xLow ? xHigh - xLow : xLow - xHigh;
		m_recCurFrame.top = yy;
		m_recCurFrame.height = pLineLow->getHeight();
		m_recOrigLeft.width = 0;
		m_recOrigLeft.height = 0;
		m_recOrigLeft.left = 0;
		m_recOrigLeft.top = 0;
		m_recOrigRight.width = 0;
		m_recOrigRight.height = 0;
		m_recOrigRight.left = 0;
		m_recOrigRight.top = 0;
		bDoBroken = false;
	}
	if ( bDoBroken && (pTabLow != NULL) && (pTabHigh == pTabLow))
	{
	    //
	    // Look to see if we have a rectangular table selection
	    //
	    UT_sint32 nExtra = 1;
	    if(m_pView->getDocument()->isTableAtPos(posLow+nExtra))
	    {
	      nExtra++;
	    }
	    if(m_pView->getDocument()->isCellAtPos(posLow+nExtra))
	    {
	      nExtra++;
	    }
	    if(m_pView->getDocument()->isBlockAtPos(posLow+nExtra))
	    {
	      nExtra++;
	    }
	    fp_CellContainer * pCellConLow = m_pView->getCellAtPos(posLow+nExtra);
	    if(pCellConLow == NULL)
	      goto do_broken;
	    fl_CellLayout * pCellLow = static_cast<fl_CellLayout *>(pCellConLow->getSectionLayout());
	    if(m_pView->getDocument()->isEndTableAtPos(posHigh-1))
	    {
		posHigh--;
	    }
	    fp_CellContainer * pCellConHigh = m_pView->getCellAtPos(posHigh);
	    if(pCellConHigh == NULL)
	      goto do_broken;
	    fl_CellLayout * pCellHigh = static_cast<fl_CellLayout *>(pCellConHigh->getSectionLayout());
	    if((pCellLow->getPosition(true) >= (posLow -1)) &&
	       ((pCellHigh->getPosition(true) + pCellHigh->getLength()-1) <= (posHigh + 1) ))
	    {
	      UT_sint32 numCols = static_cast<fp_TableContainer *>(pCellConLow->getContainer())->getNumCols();
	      if(((pCellConLow->getLeftAttach() == 0) && 
		  (pCellConHigh->getRightAttach() == numCols)) || 
		 (pCellConLow->getTopAttach() == pCellConHigh->getTopAttach()))
	      {
		//
		// OK the low and high cells are fully selected.
		//
		  UT_DEBUGMSG(("Fully selected low and high positions \n"));
//
// Grab that first charcter!
//
	          if(!bUseNext)
		  {
		      m_pView->_findPositionCoords(posLow, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunLow2);
		  }
		  else
		  {
		      m_pView->_findPositionCoords(posLow+1, bEOL, xLow, yLow, xCaret2, yCaret2, heightCaret, bDirection, NULL, &pRunLow2);
		  }
		  if((pCellConLow->getLeftAttach() == 0) && 
		     (pCellConHigh->getRightAttach() == numCols))
		  {
		      m_bSelectedRow = true;
		  }
		  UT_Rect * pLow = pCellConLow->getScreenRect();
		  UT_Rect * pHigh = pCellConHigh->getScreenRect();
		  UT_return_if_fail(pLow);
		  UT_return_if_fail(pHigh);
		  m_recCurFrame.left = pLow->left;
		  m_recCurFrame.width = pHigh->left + pHigh->width - pLow->left;
		  m_recCurFrame.top = pLow->top;
		  m_recCurFrame.height = pHigh->top + pHigh->height - pLow->top;
		  DELETEP(pLow);
		  DELETEP(pHigh);
		  m_recOrigLeft.width = 0;
		  m_recOrigLeft.height = 0;
		  m_recOrigLeft.left = 0;
		  m_recOrigLeft.top = 0;
		  m_recOrigRight.width = 0;
		  m_recOrigRight.height = 0;
		  m_recOrigRight.left = 0;
		  m_recOrigRight.top = 0;
		  bDoBroken = false;
	      }
	    }
	}
 do_broken:	if(bDoBroken)
	{
//
// low and high are on different rows. First get top, left
//
//
		UT_sint32 xx,yy;
		fp_Run * pRun = pLineLow->getFirstRun();
		pLineLow->getScreenOffsets(pRun,xx,yy);
		xx -= pRun->getX();
		xx -= pLineLow->getX();
		m_recOrigLeft.left = xx < xLow ? xx : xLow;
		m_recOrigLeft.width = xLow > xx ? xLow - xx : xx - xLow;
		m_recOrigLeft.top = yy;
		m_recOrigLeft.height = pLineLow->getHeight();
		m_recCurFrame.left = xx < xLow ? xx : xLow;
		m_recCurFrame.top = yy;
		fp_Line * pNext = pLineLow;
		UT_sint32 width = 0;
		while(pNext && (pNext != pLineHigh))
		{
			pRun = pNext->getFirstRun();
			pNext->getScreenOffsets(pRun,xx,yy);
			xx += pNext->getMaxWidth();
			if(xx > width)
			{
				width = xx;
			}
			fp_ContainerObject * pCon = pNext->getNext();
			if(pCon)
			{
				pNext = static_cast<fp_Line *>(pCon);
			}
			else
			{
				fl_BlockLayout * pBL = pNext->getBlock();
				pBL = pBL->getNextBlockInDocument();
				if(pBL)
				{
					pNext = static_cast<fp_Line *>(pBL->getFirstContainer());
				}
				else
				{ 
					pNext = NULL;
				}
			}
		}
		if(pNext == NULL)
		{
			UT_DEBUGMSG(("Last line of selection not found! \n"));
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			return;
		}
		pRun = pLineHigh->getFirstRun();
		pLineHigh->getScreenOffsets(pRun,xx,yy);
		yy += pLineHigh->getHeight();
		m_recCurFrame.width = width > m_recCurFrame.left ? width - m_recCurFrame.left : m_recCurFrame.left - width;
		m_recCurFrame.height = yy - m_recCurFrame.top;
		if(m_recCurFrame.top + m_recCurFrame.height > m_pView->getWindowHeight())
		{
			m_recCurFrame.height = m_pView->getWindowHeight() - m_recCurFrame.top;
		}
		fl_DocSectionLayout * pDSL = pRun->getBlock()->getDocSectionLayout();
		if(pDSL == NULL)
		{
			UT_DEBUGMSG(("No DocSectionLayout \n"));
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			return;
		}
			
		if(m_recCurFrame.width > pDSL->getActualColumnWidth())
		{
			m_recCurFrame.width = pDSL->getActualColumnWidth();
		}
		m_recOrigRight.left = xHigh > xLow ? xHigh : xLow;
		m_recOrigRight.width = m_recCurFrame.left + m_recCurFrame.width > xHigh ?
			m_recCurFrame.left + m_recCurFrame.width - xHigh : xHigh - (m_recCurFrame.left + m_recCurFrame.width);
		m_recOrigRight.top = yy - pLineHigh->getHeight();
		m_recOrigRight.height = pLineHigh->getHeight();

	}
	m_iLastX = x;
	m_iLastY = y;
	m_iInitialOffX = x - m_recCurFrame.left;
	m_iInitialOffY = y - m_recCurFrame.top;
	GR_Painter painter(getGraphics());
	UT_RGBColor black(0,0,0);
	UT_RGBColor trans(0,0,0,true);
	m_pDragImage = painter.genImageFromRectangle(m_recCurFrame);
}
Пример #9
0
AsciiDialog::AsciiDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;
  int editBoxInterSpace = editBoxHeight + fontHeight / 3;

	int top = yStart;

  yStart -= fontHeight * 2 + fontHeight / 2;

	int top2 = yStart;

	Label *lbl = new Label( this, Label::LEFT, Strings::get(129), 20,
                    yStart, 50, labelHeight );

	fontCombo = new SComboBox( this, ISTABSTOP|SComboBox::STATIC, 20, yStart,
                            240, editBoxHeight, 100 );

  int comboHeight = fontCombo->getEditBoxHeight();
  yStart -= comboHeight + comboHeight / 2;
  fontCombo->setPos( fontCombo->getX(), yStart);
  //lbl->setSize( lbl->getWidth(), comboHeight);
  //lbl->setPos( lbl->getX(), yStart);

	yStart = top2;

	lbl = new Label( this, Label::LEFT, Strings::get(130), 270,
                    yStart, 50, labelHeight );

  yStart -= comboHeight + comboHeight / 2;

	sizeCombo = new SComboBox( this, ISTABSTOP|NUMERIC, 270, yStart,
                            	      80, editBoxHeight, 100 );
  sizeCombo->setMaxLength( 5 );
  yStart -= fontHeight*2;

  fixedWidthOnlyCheck  = new CheckBox( this, Strings::get(131),
                                       ISTABSTOP, 20, yStart, 150,
                                       fontHeight*2 );

  bitmapFontsCheck  = new CheckBox( this, Strings::get(167),
                                    ISTABSTOP, 190, yStart, 150,
                                    fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(128), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 2 + 15;

	lbl = new Label( this, Label::RIGHT, Strings::get(171), 20,
                    yStart, 90, labelHeight );

	textItemCombo = new SComboBox( this, ISTABSTOP|SComboBox::STATIC, 120, yStart,
                            	      width - 380, editBoxHeight, 100 );

  yStart -= interSpace;

  fgButton = new RadioButton( this, Strings::get(169),
                              NEWGROUP | ISTABSTOP, 20, yStart, 100,
                              interSpace );

  bgButton = new RadioButton( this, Strings::get(170),
                              INGROUP, 130, yStart, 100,
                              interSpace );


  yStart -= fontHeight/4 + 60;

	colorSet = new ValueSet( this, ISTABSTOP, 20, yStart, width - 280, fontHeight * 3.5, 10, 2, ValueSet::RGBCOLOR );

	yStart -= fontHeight;

  gBox = new GroupBox( this, Strings::get(128), 0, 10, yStart, width-260, top - yStart );

	colors[0] = Color::BLACK;
	colors[1] = Color::GRAY;
	colors[2] = Color::DARKRED;
	colors[3] = Color::BROWN;
	colors[4] = Color::DARKGREEN;
	colors[5] = Color::DARKCYAN;
	colors[6] = Color::DARKBLUE;
	colors[7] = Color::DARKPINK;
	colors[8] = Color::LIGHT;
	colors[9] = Color::SHADOW;
	colors[10] = Color::WHITE;
	colors[11] = Color::LIGHTGRAY;
	colors[12] = Color::RED;
	colors[13] = Color::YELLOW;
	colors[14] = Color::GREEN;
	colors[15] = Color::CYAN;
	colors[16] = Color::BLUE;
	colors[17] = Color::PINK;
	colors[18] = Color::BKGR;
	colors[19] = Color::DEFAULT;

	for( int yy = 0; yy < 2; yy++ )
		for( int xx = 0; xx < 10; xx++ )
			colorSet->setColor( xx, yy, colors[yy*10+xx] );

	colorSet->setVisible(TRUE);

	fontPreviewWindow = new FontPreviewWindow( this, width - 220, (top-10-70) / 2, 200, 70 );
  fontPreviewWindow->setWMove( FOLLOW );
  fontPreviewWindow->setHMove( FOLLOW );

	if( Settings::asciiFont == NULL )
	{
		Settings::asciiFont = new char[strlen(Graphics::getEditorFontName())+1];
		strcpy( Settings::asciiFont, Graphics::getEditorFontName());
		Settings::asciiFontSizeP = Graphics::getEditorFontSize();
	}

	fontPreviewWindow->selectFont( getGraphics()->getFontFromName( Settings::asciiFont, 0 ), 
	                               -1, -1, Settings::asciiFontSizeP );

	// Fill in fonts

	char numstr[30];
	int i;

	FontList *fonts = getGraphics()->getFonts();

	for( i = 0; i < fonts->fonts; i++ )
		if( (Settings::asciiFixedWidthOnly && fonts->font[i].monoSpaced) || 
				!Settings::asciiFixedWidthOnly  )
			fontCombo->addItem( fonts->font[i].name );

	fontCombo->addSelectionListener(this);

  if( Settings::asciiFontSizeP != -1 )
		sprintf( numstr, "%d", Settings::asciiFontSizeP );
	else
		sprintf( numstr, "%dx%d", Settings::asciiFontSizeX, 
             Settings::asciiFontSizeY );

	sizeCombo->addSelectionListener(this);

	if( Settings::asciiFixedWidthOnly )
		fixedWidthOnlyCheck->check(TRUE);	

	textItemCombo->addItem( Strings::get( 172 ) );
	textItemCombo->addItem( Strings::get( 173 ) );
	textItemCombo->addItem( Strings::get( 174 ) );
  textItemCombo->addItem( Strings::get( 214 ) );
  textItemCombo->addItem( Strings::get( 215 ) );
  textItemCombo->setText( Strings::get( 172 ) );

	textItemCombo->addSelectionListener( this );

	fontCombo->setText( Settings::asciiFont  );

	textFg = Settings::textFg;
	textBg = Settings::textBg;
	markFg = Settings::markFg;
	markBg = Settings::markBg;
	hiliteFg = Settings::hiliteFg;
	hiliteBg = Settings::hiliteBg;
	markerFg = Settings::markerFg;
	markerBg = Settings::markerBg;
	leftMarginFg = Settings::leftMarginFg;
	leftMarginBg = Settings::leftMarginBg;

  currentColorSet = -1;
  currentCp = 0;

  setColor( textFg );

	fgButton->check(TRUE);

	sizeCombo->setText( numstr );

  fontCombo->setFocus();

	fixedWidthOnlyCheck->addButtonListener(this);
	bitmapFontsCheck->addButtonListener(this);
	fgButton->addButtonListener(this);
	bgButton->addButtonListener(this);
	colorSet->addSelectionListener( this );
	
	updateControlPos( NULL );

	setControlsVisible();		
}
Пример #10
0
HexDialog::HexDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;
  int editBoxInterSpace = editBoxHeight + fontHeight / 3,
      labelHeight = fontHeight + fontHeight / 3;

	int top = yStart;

  yStart -= fontHeight * 2 + fontHeight / 2;

	int top2 = yStart;

	Label *lbl = new Label( this, Label::LEFT, Strings::get(129), 20,
                    yStart, 50, labelHeight );

	fontCombo = new SComboBox( this, ISTABSTOP|SComboBox::STATIC, 20, yStart,
                            240, editBoxHeight, 100 );

  int comboHeight = fontCombo->getEditBoxHeight();
  yStart -= comboHeight + comboHeight / 2;
  fontCombo->setPos( fontCombo->getX(), yStart);

	yStart = top2;

	lbl = new Label( this, Label::LEFT, Strings::get(130), 270,
                    yStart, 50, labelHeight );

  yStart -= comboHeight + comboHeight / 2;

	sizeCombo = new SComboBox( this, ISTABSTOP|NUMERIC, 270, yStart,
                            	      80, editBoxHeight, 100 );
  sizeCombo->setMaxLength( 5 );

  yStart -= fontHeight*2;

  bitmapFontsCheck = new CheckBox( this, Strings::get(167),
                                   ISTABSTOP, 20, yStart, 150,
                                   fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(128), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

	fontPreviewWindow = new FontPreviewWindow( this, width - 220, (top-10-70) / 2, 200, 70 );
  fontPreviewWindow->setWMove( FOLLOW );
  fontPreviewWindow->setHMove( FOLLOW );

	if( Settings::hexFont == NULL )
	{
		Settings::hexFont = new char[strlen(Graphics::getHexEditorFontName())+1];
		strcpy( Settings::hexFont, Graphics::getHexEditorFontName());
		Settings::hexFontSizeP = Graphics::getHexEditorFontSize();
	}

	fontPreviewWindow->selectFont( getGraphics()->getFontFromName( Settings::hexFont, 0 ), 
	                               -1, -1, Settings::hexFontSizeP );


  yStart -= fontHeight * 3;

  numericInfoCheck = new CheckBox( this, Strings::get(231), ISTABSTOP, 20, yStart, 150, fontHeight * 2 );

  yStart -= interSpace;

  linesHexCheck = new CheckBox( this, Strings::get(246), ISTABSTOP, 20, yStart, width-280, fontHeight * 2 );

  yStart -= interSpace;

  hideAscii32Check = new CheckBox( this, Strings::get(254), ISTABSTOP, 20, yStart, width-280, fontHeight * 2 );

	yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(232), 0, 10, yStart, width-260, top - yStart );

	// Fill in fonts

	char numstr[30];
	int i;

	FontList *fonts = getGraphics()->getFonts();

	for( i = 0; i < fonts->fonts; i++ )
		if( fonts->font[i].monoSpaced )
			fontCombo->addItem( fonts->font[i].name );

	fontCombo->addSelectionListener(this);

  if( Settings::hexFontSizeP != -1 )
		sprintf( numstr, "%d", Settings::hexFontSizeP );
	else
		sprintf( numstr, "%dx%d", Settings::hexFontSizeX, 
             Settings::hexFontSizeY );

	sizeCombo->addSelectionListener(this);

	fontCombo->setText( Settings::hexFont  );

	sizeCombo->setText( numstr );

  fontCombo->setFocus();

  numericInfoCheck->check( Settings::showBytesInfo );
  linesHexCheck->check( Settings::linesInHex );
  hideAscii32Check->check( Settings::hideAscii32 );

	bitmapFontsCheck->addButtonListener(this);

	updateControlPos( NULL );

	setControlsVisible();		
}
Пример #11
0
MiscDialog::MiscDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;

	int top = yStart;

	yStart -= fontHeight * 3;

  backupFilesCheck  = new CheckBox( this, Strings::get(198),
                                         NEWGROUP|ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  useSystemFileDialogCheck  = new CheckBox( this, Strings::get(204),
                                         INGROUP, 180, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

  useBigFontCheck  = new CheckBox( this, Strings::get(207),
                                         INGROUP, 20, yStart, 150,
                                         fontHeight*2 );

  autoCloseFrameWindowCheck  = new CheckBox( this, Strings::get(216),
                                         INGROUP, 180, yStart, 170,
                                         fontHeight*2 );

  yStart -= interSpace;

  showCommandBarCheck  = new CheckBox( this, Strings::get(220),
                                         INGROUP, 20, yStart, 150,
                                         fontHeight*2 );

  reuseExistingBufferCheck = new CheckBox( this, Strings::get(233),
                                         INGROUP, 180, yStart, 170,
                                         fontHeight*2 );

  yStart -= interSpace;

  showToolbarCheck = new CheckBox( this, Strings::get(253),
                                         INGROUP, 20, yStart, 170,
                                         fontHeight*2 );

  yStart -= interSpace;

  queryUnicodeCheck  = new CheckBox( this, Strings::get(240),
                                         INGROUP, 20, yStart, 250,
                                         fontHeight*2 );
  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(186), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

  autoSaveCheck  = new CheckBox( this, Strings::get(200),
                                         ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(201), 20,
                   yStart, 150, labelHeight );

	autosaveDelayEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                               	    130, editBoxHeight );
	
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(199), 0, 
  										 10, yStart,
                       320, top - yStart );

	char str[100];

	if( Settings::backupFiles )
		backupFilesCheck->check( TRUE );

	if( Settings::autoSave )
		autoSaveCheck->check( TRUE );

	if( Settings::useSystemFileDialog )
		useSystemFileDialogCheck->check( TRUE );

  if( Settings::autoCloseFrameWindow )
		autoCloseFrameWindowCheck->check( TRUE );

  if( Settings::reuseExistingBuffer )
		reuseExistingBufferCheck->check( TRUE );

  if( Settings::showCommandBar )
    showCommandBarCheck->check( TRUE );
    
  if( Settings::showToolbar )
		showToolbarCheck->check( TRUE );

 	queryUnicodeCheck->check( Settings::queryIfUnicode );

	if( AGraphics::useBigFont )
		useBigFontCheck->check( TRUE );

	sprintf( str, "%d", Settings::autosaveDelay );
	autosaveDelayEntry->setText( str );

	backupFilesCheck->setFocus();

	setControlsVisible();
}
Пример #12
0
DisplayDialog::DisplayDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2,
      labelHeight = fontHeight + fontHeight / 3;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;

	int top = yStart;

	yStart -= fontHeight * 3;

  syntaxHighlightCheck  = new CheckBox( this, Strings::get(192),
                                         ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  showSectionsCheck  = new CheckBox( this, Strings::get(248),
                                     ISTABSTOP, 180, yStart, 150,
                                     fontHeight*2 );

  yStart -= interSpace;

  autogenSectionsCheck  = new CheckBox( this, Strings::get(249),
                                         ISTABSTOP, 20, yStart, 250,
                                         fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(191), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

  showRightMarginCheck  = new CheckBox( this, Strings::get(194),
                                         ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  yStart -= interSpace;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(195), 20,
                   yStart, 150, labelHeight );

	rightMarginEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                               	    130, editBoxHeight );
	
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(187), 0, 
  										 10, yStart,
                       320, top - yStart );

	char str[100];

	if( Settings::syntaxHighlight )
		syntaxHighlightCheck->check( TRUE );

	if( Settings::showRightMargin )
		showRightMarginCheck->check( TRUE );

	if( Settings::showSectionBrowser )
		showSectionsCheck->check( TRUE );

	if( Settings::autogenerateSections )
		autogenSectionsCheck->check( TRUE );

	sprintf( str, "%d", Settings::rightMargin );
	rightMarginEntry->setText( str );

	syntaxHighlightCheck->setFocus();

	setControlsVisible();		
}
Пример #13
0
void FV_Base::_doMouseDrag(UT_sint32 x, UT_sint32 y, UT_sint32& dx, UT_sint32& dy, UT_Rect& expX, UT_Rect& expY)
{
	if(!m_bFirstDragDone)
	{
		m_iFirstEverX = x;
		m_iFirstEverY = y;
	}
	m_bFirstDragDone = true;
	UT_sint32 diffx = 0;
	UT_sint32 diffy = 0;
	UT_sint32 iext = getGraphics()->tlu(3);
	m_xLastMouse = x;
	m_yLastMouse = y;
	switch (getDragWhat())
	{
	case FV_DragTopLeftCorner:
		diffx = m_recCurFrame.left - x;
		diffy = m_recCurFrame.top - y;
		m_recCurFrame.left -= diffx;
		m_recCurFrame.top -= diffy;
		dx = -diffx;
		dy = -diffy;
		m_recCurFrame.width += diffx;
		m_recCurFrame.height += diffy;
		if(diffx < 0)
		{
			expX.left = m_recCurFrame.left + diffx -iext;
			expX.width = -diffx + iext;
			if(diffy > 0)
			{
				expX.top -=  diffy + iext;
				expX.height += diffy + 2*iext;
			}
			else
			{
				expX.top -=  iext;
				expX.height += (-diffy + 2*iext);
			}
		}
		if(diffy < 0)
		{
			expY.top = m_recCurFrame.top + diffy - iext;
			expY.height = -diffy + 2*iext;
		}
		if(m_recCurFrame.width < 0)
		{
			m_recCurFrame.left = x;
			m_recCurFrame.width = -m_recCurFrame.width;
			setDragWhat( FV_DragTopRightCorner );
		}
		if(m_recCurFrame.height < 0)
		{
			m_recCurFrame.top = y;
			m_recCurFrame.height = -m_recCurFrame.height;
			setDragWhat( FV_DragBotLeftCorner );
		}
		break;
	case FV_DragTopRightCorner:
		diffx = m_recCurFrame.left + m_recCurFrame.width - x;
		diffy = m_recCurFrame.top - y;
		m_recCurFrame.top -= diffy;
		dy = -diffy;
		m_recCurFrame.width -= diffx;
		m_recCurFrame.height += diffy;
		if(diffx > 0)
		{
			expX.left = m_recCurFrame.left + m_recCurFrame.width;
			expX.width = diffx + iext;
			if(diffy > 0)
			{
				expX.top -=  iext;
				expX.height += diffy + 2*iext;
			}
			else
			{
				expX.top -=  iext;
				expX.height += (-diffy + 2*iext);
			}
		}
		if(diffy < 0)
		{
			expY.top = m_recCurFrame.top + diffy - iext;
			expY.height = -diffy + iext;
		}
		if(m_recCurFrame.width < 0)
		{
			m_recCurFrame.left = x;
			m_recCurFrame.width = -m_recCurFrame.width;
			setDragWhat( FV_DragTopLeftCorner );
		}
		if(m_recCurFrame.height < 0)
		{
			m_recCurFrame.top = y;
			m_recCurFrame.height = -m_recCurFrame.height;
			setDragWhat( FV_DragBotRightCorner );
		}
		break;
	case FV_DragBotLeftCorner:
		diffx = m_recCurFrame.left - x;
		diffy = m_recCurFrame.top + m_recCurFrame.height - y;
		m_recCurFrame.left -= diffx;
		dx = -diffx;
		m_recCurFrame.width += diffx;
		m_recCurFrame.height -= diffy;
		if(diffx < 0)
		{
			expX.left = m_recCurFrame.left + diffx -iext;
			expX.width = -diffx + iext;
			if(diffy > 0)
			{
				expX.top -=  diffy + iext;
				expX.height += diffy + 2*iext;
			}
			else
			{
				expX.top -=  iext;
				expX.height += (-diffy + 2*iext);
			}
		}
		if(diffy > 0)
		{
			expY.top = m_recCurFrame.top + m_recCurFrame.height - iext;
			expY.height = diffy + 2*iext;
		}
		if(m_recCurFrame.width < 0)
		{
			m_recCurFrame.left = x;
			m_recCurFrame.width = -m_recCurFrame.width;
			setDragWhat( FV_DragBotRightCorner );
		}
		if(m_recCurFrame.height < 0)
		{
			m_recCurFrame.top = y;
			m_recCurFrame.height = -m_recCurFrame.height;
			setDragWhat( FV_DragTopLeftCorner );
		}
		break;
	case FV_DragBotRightCorner:
		diffx = m_recCurFrame.left + m_recCurFrame.width - x;
		diffy = m_recCurFrame.top + m_recCurFrame.height - y;
		m_recCurFrame.width -= diffx;
		m_recCurFrame.height -= diffy;
		if(diffx > 0)
		{
			expX.left = m_recCurFrame.left + m_recCurFrame.width;
			expX.width = diffx + iext;
			if(diffy > 0)
			{
				expX.top -=  iext;
				expX.height += diffy + 2*iext;
			}
			else
			{
				expX.top -=  iext;
				expX.height += (-diffy + 2*iext);
			}
		}
		if(diffy > 0)
		{
			expY.top = m_recCurFrame.top + m_recCurFrame.height;
			expY.height = diffy + iext;
		}
		if(m_recCurFrame.width < 0)
		{
			m_recCurFrame.left = x;
			m_recCurFrame.width = -m_recCurFrame.width;
			setDragWhat( FV_DragBotLeftCorner );
		}
		if(m_recCurFrame.height < 0)
		{
			m_recCurFrame.top = y;
			m_recCurFrame.height = -m_recCurFrame.height;
			setDragWhat( FV_DragTopRightCorner );
		}
		break;
	case FV_DragLeftEdge:
		diffx = m_recCurFrame.left - x;
		m_recCurFrame.left -= diffx;
		dx = -diffx;
		m_recCurFrame.width += diffx;
		if(diffx < 0)
		{
			expX.left = m_recCurFrame.left + diffx - iext;
			expX.width = -diffx + iext;
			expX.top -=  iext;
			expX.height += 2*iext;
		}
		if(m_recCurFrame.width < 0)
		{
			m_recCurFrame.left = x;
			m_recCurFrame.width = -m_recCurFrame.width;
			setDragWhat( FV_DragRightEdge );
		}
		break;
	case FV_DragRightEdge:
		diffx = m_recCurFrame.left + m_recCurFrame.width - x;
		m_recCurFrame.width -= diffx;
		if(diffx > 0)
		{
			expX.left = m_recCurFrame.left + m_recCurFrame.width;
			expX.width = diffx + iext;
			expX.top -=  iext;
			expX.height += 2*iext;
		}
		if(m_recCurFrame.width < 0)
		{
			m_recCurFrame.left = x;
			m_recCurFrame.width = -m_recCurFrame.width;
			setDragWhat( FV_DragLeftEdge );
		}
		break;
	case FV_DragTopEdge:
		diffy = m_recCurFrame.top - y;
		m_recCurFrame.top -= diffy;
		dy = -diffy;
		m_recCurFrame.height += diffy;
		if(diffy < 0)
		{
			expY.top = m_recCurFrame.top + diffy - iext;
			expY.height = -diffy + iext;
			expY.left -= iext;
			expY.width += 2*iext;
		}
		if(m_recCurFrame.height < 0)
		{
			m_recCurFrame.top = y;
			m_recCurFrame.height = -m_recCurFrame.height;
			setDragWhat( FV_DragBotEdge );
		}
		break;
	case FV_DragBotEdge:
		diffy = m_recCurFrame.top + m_recCurFrame.height - y;
		m_recCurFrame.height -= diffy;
		if(diffy > 0)
		{
			expY.top = m_recCurFrame.top + m_recCurFrame.height;
			expY.height = diffy + iext;
			expY.left -= iext;
			expY.width += 2*iext;
			xxx_UT_DEBUGMSG(("expY.top %d expY.height %d \n",expY.top,expY.height));
		}
		if(m_recCurFrame.height < 0)
		{
			m_recCurFrame.top = y;
			m_recCurFrame.height = -m_recCurFrame.height;
			setDragWhat( FV_DragTopEdge );
		}
		break;
	default:
		break;
	}
}
void FV_VisualDragText::_mouseDrag(UT_sint32 x, UT_sint32 y)
{
 	  //
	  // Don't try to drag the entire document.
	  //
  if(!m_bDoingCopy && (m_pView->isSelectAll() && !m_pView->isHdrFtrEdit())&&(m_iVisualDragMode != FV_VisualDrag_DRAGGING))
	 {
	     setMode(FV_VisualDrag_NOT_ACTIVE);
	     return;
	 }

        if(m_iVisualDragMode == FV_VisualDrag_NOT_ACTIVE)
        {
	  m_iInitialOffX = x;
	  m_iInitialOffY = y;
	  m_iVisualDragMode = FV_VisualDrag_WAIT_FOR_MOUSE_DRAG;
	  UT_DEBUGMSG(("Initial call for drag -1\n"));
	  return;
	}
	if((m_iInitialOffX == 0) && (m_iInitialOffY == 0))
	{
	  m_iInitialOffX = x;
	  m_iInitialOffY = y;
	  m_iVisualDragMode = FV_VisualDrag_WAIT_FOR_MOUSE_DRAG;
	  UT_DEBUGMSG(("Initial call for drag -2 \n"));
	}
	if(m_iVisualDragMode == FV_VisualDrag_WAIT_FOR_MOUSE_DRAG)
	{
          double diff = sqrt((static_cast<double>(x) - static_cast<double>(m_iInitialOffX))*(static_cast<double>(x) - static_cast<double>(m_iInitialOffX)) +
                              (static_cast<double>(y) - static_cast<double>(m_iInitialOffY))*(static_cast<double>(y) - static_cast<double>(m_iInitialOffY)));
          if(diff < static_cast<double>(getGraphics()->tlu(MIN_DRAG_PIXELS)))
          {
	    UT_DEBUGMSG(("Not yet dragged enough.%f \n", diff));
            //
            // Have to drag 4 pixels before initiating the drag
            //
            return;
          }
	  else
	  {
	    m_iVisualDragMode = FV_VisualDrag_START_DRAGGING;
	    XAP_Frame * pFrame = static_cast<XAP_Frame*>(m_pView->getParentData());
	    if (pFrame)
	      pFrame->dragText();
	  }
        }
	if((m_iVisualDragMode != FV_VisualDrag_DRAGGING) && (m_iVisualDragMode != FV_VisualDrag_WAIT_FOR_MOUSE_DRAG) && !m_bDoingCopy)
	{
//
// Haven't started the drag yet so create our image and cut the text.
//
		m_pView->getDocument()->beginUserAtomicGlob();
		mouseCut(m_iInitialOffX,m_iInitialOffY);
		m_bTextCut = true;

	}
	clearCursor();
	if(m_iVisualDragMode == FV_VisualDrag_START_DRAGGING)
	{
	  reposOffsets(x,y);
	}
	m_iVisualDragMode = FV_VisualDrag_DRAGGING;
	xxx_UT_DEBUGMSG(("x = %d y = %d width \n",x,y));
	bool bScrollDown = false;
	bool bScrollUp = false;
	bool bScrollLeft = false;
	bool bScrollRight = false;
	m_xLastMouse = x;
	m_yLastMouse = y;
	if(y<=0)
	{
		bScrollUp = true;
	}
	else if( y >= m_pView->getWindowHeight())
	{
		bScrollDown = true;
	}
	if(x <= 0)
	{
		bScrollLeft = true;
	}
	else if(x >= m_pView->getWindowWidth())
	{
		bScrollRight = true;
	}
	if(bScrollDown || bScrollUp || bScrollLeft || bScrollRight)
	{
		if(m_pAutoScrollTimer != NULL)
		{
			return;
		}
		m_pAutoScrollTimer = UT_Timer::static_constructor(_autoScroll, this);
		m_pAutoScrollTimer->set(AUTO_SCROLL_MSECS);
		m_pAutoScrollTimer->start();
		return;
	}
	UT_sint32 dx = 0;
	UT_sint32 dy = 0;
	UT_Rect expX(0,m_recCurFrame.top,0,m_recCurFrame.height);
	UT_Rect expY(m_recCurFrame.left,0,m_recCurFrame.width,0);
	UT_sint32 iext = getGraphics()->tlu(3);
	dx = x - m_iLastX;
	dy = y - m_iLastY;
	m_recCurFrame.left += dx;
	m_recCurFrame.top += dy;
	m_recOrigLeft.left += dx;
	m_recOrigLeft.top += dy;
	m_recOrigRight.left += dx;
	m_recOrigRight.top += dy;
	if(dx < 0)
	{
		expX.left = m_recCurFrame.left+m_recCurFrame.width -iext;
		expX.width = -dx + 2*iext;
		if(dy > 0)
		{
			expX.top -=  iext;
			expX.height += dy + 2*iext;
		}
		else
		{
			expX.top -=  iext;
			expX.height += (-dy + 2*iext);
		}
	}
	else
	{
		expX.left = m_recCurFrame.left - dx - iext;
		expX.width = dx + 2*iext;
		if(dy > 0)
		{
			expX.top -=  iext;
			expX.height += dy + 2*iext;
		}
		else
		{
			expX.top -= iext;
			expX.height += (-dy + 2*iext);
		}
	}
	expY.left -= iext;
	expY.width += 2*iext;
	if(dy < 0)
	{
		expY.top = m_recCurFrame.top + m_recCurFrame.height -iext;
		expY.height = -dy + 2*iext;
	}
	else
	{
		expY.top = m_recCurFrame.top - dy - iext;
		expY.height = dy + 2*iext;
	}

	if(!m_bNotDraggingImage && (expX.width > 0))
	{
		getGraphics()->setClipRect(&expX);
		if(m_bSelectedRow)

		{
		      m_pView->setSelectionMode(FV_SelectionMode_NONE);
		}
		m_pView->updateScreen(false);
		if(m_bSelectedRow)
		{
		      m_pView->setSelectionMode(FV_SelectionMode_TableRow);
		}

	}
	if(!m_bNotDraggingImage && (expY.height > 0))
	{
	  xxx_UT_DEBUGMSG(("expY left %d top %d width %d height %d \n",expY.left,expY.top,expY.width,expY.height));
		getGraphics()->setClipRect(&expY);
		if(m_bSelectedRow)
		{
		      m_pView->setSelectionMode(FV_SelectionMode_NONE);
		}
		m_pView->updateScreen(false);
		if(m_bSelectedRow)
		{
		      m_pView->setSelectionMode(FV_SelectionMode_TableRow);
		}

	}
	if(!m_bNotDraggingImage && (expX.height > 0))
	{
	  xxx_UT_DEBUGMSG(("expY left %d top %d width %d height %d \n",expX.left,expX.top,expX.width,expX.height));
		getGraphics()->setClipRect(&expX);
		if(m_bSelectedRow)
		{
		      m_pView->setSelectionMode(FV_SelectionMode_NONE);
		}
		m_pView->updateScreen(false);
		if(m_bSelectedRow)
		{
		      m_pView->setSelectionMode(FV_SelectionMode_TableRow);
		}

	}
	if(!m_bNotDraggingImage)
	{
	        getGraphics()->setClipRect(NULL);
		drawImage();
		if(m_recOrigLeft.width > 0)
		{
		     getGraphics()->setClipRect(&m_recOrigLeft);
		     m_pView->updateScreen(false);
		}
		if(m_recOrigRight.width > 0)
		{
		     getGraphics()->setClipRect(&m_recOrigRight);
		     m_pView->updateScreen(false);
		}
	}
	m_iLastX = x;
	m_iLastY = y;
	getGraphics()->setClipRect(NULL);
	PT_DocPosition posAtXY = getPosFromXY(x,y);
	m_pView->_setPoint(posAtXY);
	xxx_UT_DEBUGMSG(("Point at visual drag set to %d \n",m_pView->getPoint()));
//	m_pView->_fixInsertionPointCoords();
	drawCursor(posAtXY);
}
Пример #15
0
void HexDialog::actionPerformed( ASelectionEvent *selectionEvent )
{
	BOOL updatePreview = FALSE;
  if( selectionEvent->getSource() == fontCombo )
  {
    char *font = ((SComboBox *)selectionEvent->getSource())->getEditText();

		// Find the font in the fontlist

		FontList *fonts = getGraphics()->getFonts();
	
		for( int i = 0; i < fonts->fonts; i++ )
		{
			if( !strcmp( fonts->font[i].name, font ) )
			{
				SComboBox *sizesCombo;

				if( selectionEvent->getSource() == fontCombo )
					sizesCombo = sizeCombo;

				sizesCombo->clearItems();

				char sizeText[30];
		
				if( fonts->font[i].sizes > 0 )
				{
					int xRes = fonts->font[i].size[0].devX, 
					      yRes = fonts->font[i].size[0].devY;
					for( int s = 0; s < fonts->font[i].sizes; s++ )
					{
						if( xRes != fonts->font[i].size[s].devX ||
						    yRes != fonts->font[i].size[s].devY ) break;
						sprintf( sizeText, "%dx%d", fonts->font[i].size[s].X, fonts->font[i].size[s].Y );
						sizesCombo->addItem( sizeText );
					}
				}
				else
				{
				  int s;
					for( s = 8; s <= 12; s++ )
					{
						sprintf( sizeText, "%d", s );
						sizesCombo->addItem( sizeText );
					}
					for( s = 14; s <= 24; s += 2 )
					{
						sprintf( sizeText, "%d", s );
						sizesCombo->addItem( sizeText );
					}
				}
				sizesCombo->getItem( 0, 30, sizeText );
				sizesCombo->setText( sizeText );
				updatePreview = TRUE;
			}
		}
	}
	else
	if( selectionEvent->getSource() == sizeCombo )
		updatePreview = TRUE;

	if( updatePreview )
	{
		int size = -1, X = -1, Y = -1;
    
    char fontSize[10];
    sizeCombo->getSelectedItem( 5, fontSize );

    if( !strchr( fontSize, 'x' ) )
			size = atoi(fontSize);
    else
			// Bitmapped font
			sscanf( fontSize, "%dx%d", &X, &Y );

		fontPreviewWindow->selectFont(getGraphics()->getFontFromName(fontCombo->getEditText(), 0 ),
		                               X, Y, size );	
		fontPreviewWindow->repaint(NULL);
	}
}
/*!
 * This method is called at the commencement of a visual drag. If the offsets
 * to the caret are too big, this method will adjust them and shift the image
 * of the dragged text to a comfortable distance fromthe caret.
 * Returns true if the offsets are shifted.
 * UT_sint32 x pos of the caret
 * UT_sint32 y pos of  the caret 
 */
bool FV_VisualDragText::reposOffsets(UT_sint32 x, UT_sint32 y)
{
  UT_sint32 dx = 0;
  UT_sint32 dy = 0;
  bool bAdjustX = false;
  bool bAdjustY = false;
  UT_sint32 iext = getGraphics()->tlu(3);
  dx = x - m_recCurFrame.left - m_recOrigLeft.width;
  dy = y - m_recCurFrame.top;
  UT_DEBUGMSG((" repos dx = %d \n",dx));
  UT_DEBUGMSG((" repos dy = %d \n",dy));
  UT_Rect expX(0,m_recCurFrame.top,0,m_recCurFrame.height);
  UT_Rect expY(m_recCurFrame.left,0,m_recCurFrame.width,0);
  if(abs(dx) > getGraphics()->tlu(40))
  {
    bAdjustX = true;
    dx -= getGraphics()->tlu(20);
    m_iInitialOffX -= dx;
    expX.set(0,m_recCurFrame.top,0,m_recCurFrame.height);
    m_recCurFrame.left += dx;
    m_recOrigLeft.left += dx;
    m_recOrigRight.left += dx;
  }
  if(dy > getGraphics()->tlu(40))
  {
    bAdjustY = true;
    dy -= getGraphics()->tlu(20);
    m_iInitialOffY -= dy;
    expY.set(m_recCurFrame.left,0,m_recCurFrame.width,0);
    m_recCurFrame.top += dy;
    m_recOrigLeft.top += dy;
    m_recOrigRight.top += dy;
  }

  if(bAdjustX && dx < 0)
  {
    expX.left = m_recCurFrame.left+m_recCurFrame.width -iext;
    expX.width = -dx + 2*iext;
    if(dy > 0)
    {
        expX.top -=  iext;
	expX.height += dy + 2*iext;
    }
    else
    {
	expX.top -=  iext;
	expX.height += (-dy + 2*iext);
    }
  }
  else if(bAdjustX)
  {
      expX.left = m_recCurFrame.left - dx - iext;
      expX.width = dx + 2*iext;
      if(dy > 0)
      {
	  expX.top -=  iext;
	  expX.height += dy + 2*iext;
      }
      else
      {
	  expX.top -= iext;
	  expX.height += (-dy + 2*iext);
      }
  }
  expY.left -= iext;
  expY.width += 2*iext;
  if(bAdjustY && dy < 0)
  {
        expY.top = m_recCurFrame.top + m_recCurFrame.height -iext;
	expY.height = -dy + 2*iext;
  }
  else if(bAdjustY)
  {
        expY.top = m_recCurFrame.top - dy - iext;
	expY.height = dy + 2*iext;
  }

  if(bAdjustX && expX.width > 0)
  {
      getGraphics()->setClipRect(&expX);
      m_pView->updateScreen(false);
  }
  if(bAdjustY && (expY.height > 0))
  {
      getGraphics()->setClipRect(&expY);
      m_pView->updateScreen(false);
  }
  if(bAdjustX || bAdjustY)
  {
      getGraphics()->setClipRect(NULL);
      drawImage();
      if(m_recOrigLeft.width > 0)
      {
	  getGraphics()->setClipRect(&m_recOrigLeft);
	  m_pView->updateScreen(false);
      }
      if(m_recOrigRight.width > 0)
      {
	  getGraphics()->setClipRect(&m_recOrigRight);
	  m_pView->updateScreen(false);
      }
      return true;
  }
  return false;
}
Пример #17
0
EditorDialog::EditorDialog( Window *frame, Window *parent ) :
  Dialog( frame, parent, "",
          NOTITLE,
          0, 0, frame->getClientWidth(), frame->getClientHeight() - Notebook::getTabInset() )
{
  getGraphics()->setDialogFont();

  int margin = 10, fontHeight = Graphics::dialogDesignFontHeight,
      yStart = getClientHeight() - fontHeight,
      interSpace = fontHeight + fontHeight / 2;

  int editBoxHeight = EntryField::getInset() * 2 + fontHeight + 2;
  int editBoxInterSpace = editBoxHeight + fontHeight / 3,
      labelHeight = fontHeight + fontHeight / 3;

	int top = yStart;

	yStart -= fontHeight * 3;

  persistentBlocksCheck  = new CheckBox( this, Strings::get(180),
                                         NEWGROUP|ISTABSTOP, 20, yStart, 150,
                                         fontHeight*2 );

  useTabCheck  = new CheckBox( this, Strings::get(202),
                                         INGROUP, 180, yStart, 100,
                                         fontHeight*2 );

	yStart -= interSpace;

  optimalFillCheck  = new CheckBox( this, Strings::get(203),
                                         INGROUP, 20, yStart, 150,
                                         fontHeight*2 );

  virtualSpaceCheck  = new CheckBox( this, Strings::get(230),
                                         INGROUP, 180, yStart, 150,
                                         fontHeight*2 );

  yStart -= fontHeight / 2;

  GroupBox *gBox = new GroupBox( this, Strings::get(186), 0, 10, yStart,
                                 360, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

	Label *lbl = new Label( this, Label::RIGHT, Strings::get(181), 20,
                   yStart, 150, labelHeight );

	tabSizeEntry = new EntryField( this, ISTABSTOP|NEWGROUP|BORDER|NUMERIC, 180, yStart,
                               	    50, editBoxHeight );
	
  yStart -= editBoxInterSpace;

	lbl = new Label( this, Label::RIGHT, Strings::get(183), 20,
                   yStart, 150, labelHeight );

	delimEntry = new EntryField( this, ISTABSTOP|BORDER, 180, yStart,
                               	    130, editBoxHeight );
	
  yStart -= editBoxInterSpace;

	lbl = new Label( this, Label::RIGHT, Strings::get(182), 20,
                   yStart, 150, labelHeight );

	maxUndoSizeEntry = new EntryField( this, ISTABSTOP|BORDER|NUMERIC, 180, yStart,
                               	    50, editBoxHeight );
	
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(187), 0, 
  										 10, yStart,
                       320, top - yStart );

  yStart -= fontHeight / 2;

  top = yStart;

  yStart -= fontHeight * 3;

  CRLFButton = new RadioButton( this, Strings::get(184),
                                            NEWGROUP|ISTABSTOP, 20, yStart, 70,
                                            fontHeight*2 );

  LFButton = new RadioButton( this, Strings::get(185),
                                            0, 100, yStart, 70,
                                            fontHeight*2 );
  yStart -= fontHeight / 2;

  gBox = new GroupBox( this, Strings::get(189), 0, 
  										 10, yStart,
                       180, top - yStart );

	char str[100];

	if( Settings::persistentBlocks )
		persistentBlocksCheck->check( TRUE );

	if( Settings::useTab )
		useTabCheck->check( TRUE );

	if( Settings::optimalFill )
		optimalFillCheck->check( TRUE );

	if( Settings::virtualSpace )
		virtualSpaceCheck->check( TRUE );

	sprintf( str, "%d", Settings::tabSize );
	tabSizeEntry->setText( str );

	char *delim = new char[strlen(Settings::standardDelim) * 2 + 1];

	int len = 0;

	for( int i = 0; i < strlen( Settings::standardDelim ); i++ )
	{
		if( Settings::standardDelim[i] == 0x9 )
		{
			delim[len++] = '\\';
			delim[len++] = 't';
		}
		else
		if( Settings::standardDelim[i] == '\\' )
		{
			delim[len++] = '\\';
			delim[len++] = '\\';
		}
		else
			delim[len++] = Settings::standardDelim[i];
	}

	delim[len] = 0;

	delimEntry->setText( delim );

	delete delim;

	sprintf( str, "%d", Settings::maxUndoSize / 1024 );
	maxUndoSizeEntry->setText( str );

	if( Settings::CRLF )
		CRLFButton->check(TRUE);
	else
		LFButton->check(TRUE);

	persistentBlocksCheck->setFocus();

	setControlsVisible();		
}
Пример #18
0
	Size Editable::getPrefSize() const {
		gsize_t pad = getTheme().getTextPadding();
		return Size(DEF_WIDTH + pad * 2,getGraphics()->getFont().getSize().height + pad * 2);
	}
Пример #19
0
void fp_EmbedRun::_draw(dg_DrawArgs* pDA)
{
	GR_Graphics *pG = pDA->pG;
#if 0
	UT_DEBUGMSG(("Draw with class %x \n",pG));
	UT_DEBUGMSG(("Contents of fp EmbedRun \n %s \n",m_sEmbedML.utf8_str()));
#endif
	FV_View* pView = _getView();
	UT_return_if_fail(pView);

	// need to draw to the full height of line to join with line above.
	UT_sint32 xoff= 0, yoff=0, DA_xoff = pDA->xoff;

	getLine()->getScreenOffsets(this, xoff, yoff);

	// need to clear full height of line, in case we had a selection

	UT_sint32 iFillHeight = getLine()->getHeight();
	UT_sint32 iFillTop = pDA->yoff - getLine()->getAscent();

	UT_uint32 iSelAnchor = pView->getSelectionAnchor();
	UT_uint32 iPoint = pView->getPoint();

	UT_uint32 iSel1 = UT_MIN(iSelAnchor, iPoint);
	UT_uint32 iSel2 = UT_MAX(iSelAnchor, iPoint);

	UT_ASSERT(iSel1 <= iSel2);

	UT_uint32 iRunBase = getBlock()->getPosition() + getOffsetFirstVis();

	// Fill with background, then redraw.

	UT_sint32 iLineHeight = getLine()->getHeight();
	bool bIsSelected = false;
	if ( !pG->queryProperties(GR_Graphics::DGP_PAPER) && 
	    (isInSelectedTOC() || (iSel1 <= iRunBase && iSel2 > iRunBase))
		)
	{
	  // Need the painter lock to be released at the end of this block
	        GR_Painter painter(pG);
		painter.fillRect(_getView()->getColorSelBackground(), /*pDA->xoff*/DA_xoff, iFillTop, getWidth(), iFillHeight);
		bIsSelected = true;

		getEmbedManager()->setColor(m_iEmbedUID,_getView()->getColorSelForeground());

	}
	else
	{
		Fill(getGraphics(),pDA->xoff, pDA->yoff - getAscent(), getWidth()+getGraphics()->tlu(1), iLineHeight+getGraphics()->tlu(1));
		getEmbedManager()->setColor(m_iEmbedUID,getFGColor());
	}

	UT_Rect rec;
	rec.left = pDA->xoff;
	rec.top = pDA->yoff;
	rec.height = getHeight();
	rec.width = getWidth();
	if(getEmbedManager()->isDefault())
	{
	  rec.top -= _getLayoutPropFromObject("ascent");
	}
	UT_DEBUGMSG(("Draw Embed object top %d \n",rec.top));
	getEmbedManager()->render(m_iEmbedUID,rec);
	if(m_bNeedsSnapshot && !getEmbedManager()->isDefault() && getGraphics()->queryProperties(GR_Graphics::DGP_SCREEN)  )
	{
	  UT_Rect myrec = rec;
	  myrec.top -= getAscent();
	  if(!bIsSelected)
	  {
	    getEmbedManager()->makeSnapShot(m_iEmbedUID,myrec);
	    m_bNeedsSnapshot = false;
	  }
	}
	if(bIsSelected)
	{
	  UT_Rect myrec = rec;
	  if(!getEmbedManager()->isDefault())
	  {
	    myrec.top -= getAscent();
	  }
	  _drawResizeBox(myrec);
	}
}
Пример #20
0
void GR_MathManager::initialize(void)
{
	XAP_App *pApp = XAP_App::getApp();

	// load the gtkmathview settings and operator dictionaries from the private user directory, ...
	UT_UTF8String userConfDir(pApp->getUserPrivateDirectory());
	UT_UTF8String userDictDir(pApp->getUserPrivateDirectory());
	UT_UTF8String userCombiningDictDir(pApp->getUserPrivateDirectory());
	UT_UTF8String userLocalDictDir(pApp->getUserPrivateDirectory());
#if defined(WIN32)
	userConfDir += "\\math\\gtkmathview.conf.xml";
	userDictDir += "\\math\\dictionary.xml";
	userCombiningDictDir += "\\math\\dictionary-combining.xml";
	userLocalDictDir += "\\math\\dictionary-local.xml";
#else
	userConfDir += "/math/gtkmathview.conf.xml";
	userDictDir += "/math/dictionary.xml";
	userCombiningDictDir += "/math/dictionary-combining.xml";
	userLocalDictDir += "/math/dictionary-local.xml";
#endif

	// ... or from the (common) AbiSuite directory
	UT_UTF8String libConfDir(pApp->getAbiSuiteLibDir());
	UT_UTF8String libDictDir(pApp->getAbiSuiteLibDir());
	UT_UTF8String libCombiningDictDir(pApp->getAbiSuiteLibDir());
	UT_UTF8String libLocalDictDir(pApp->getAbiSuiteLibDir());
#if defined(WIN32)	 
	libConfDir += "\\math\\gtkmathview.conf.xml";
	libDictDir += "\\math\\dictionary.xml";
	libCombiningDictDir += "\\math\\dictionary-combining.xml";
	libLocalDictDir += "\\math\\dictionary-local.xml";
#else
	libConfDir += "/math/gtkmathview.conf.xml";
	libDictDir += "/math/dictionary.xml";
	libCombiningDictDir += "/math/dictionary-combining.xml";
	libLocalDictDir += "/math/dictionary-local.xml";
#endif

	// add the configuration paths
 
#ifdef TOOLKIT_COCOA
	if (const char * resources = getenv("ABIWORD_COCOA_BUNDLED_RESOURCES"))
	{
		UT_UTF8String bundleConfDir(resources);
		bundleConfDir += "/gtkmathview/gtkmathview.conf.xml";
		Configuration::addConfigurationPath(bundleConfDir.utf8_str());
	}
#endif
	Configuration::addConfigurationPath( libConfDir.utf8_str() );
	Configuration::addConfigurationPath( userConfDir.utf8_str() );

	SmartPtr<AbstractLogger> logger = Logger::create();
	m_pLogger = logger;
	SmartPtr<Configuration> configuration = initConfiguration<libxml2_MathView>(logger, getenv("GTKMATHVIEWCONF"));
	logger->setLogLevel(LOG_INFO);
	 
	// add the dictionary paths

#ifdef TOOLKIT_COCOA
	if (const char * resources = getenv("ABIWORD_COCOA_BUNDLED_RESOURCES"))
	{
		UT_UTF8String bundleDictDir(resources);
		UT_UTF8String bundleCombiningDictDir(resources);
		UT_UTF8String bundleLocalDictDir(resources);

		bundleDictDir += "/gtkmathview/dictionary.xml";
		bundleCombiningDictDir += "/gtkmathview/dictionary-combining.xml";
		bundleLocalDictDir += "/gtkmathview/dictionary-local.xml";

		configuration->add("dictionary/path", bundleDictDir.utf8_str());
		configuration->add("dictionary/path", bundleCombiningDictDir.utf8_str());
		configuration->add("dictionary/path", bundleLocalDictDir.utf8_str());
	}
#endif
	configuration->add("dictionary/path", libDictDir.utf8_str());
	configuration->add("dictionary/path", libCombiningDictDir.utf8_str());
	configuration->add("dictionary/path", libLocalDictDir.utf8_str());

	configuration->add("dictionary/path", userDictDir.utf8_str());
	configuration->add("dictionary/path", userCombiningDictDir.utf8_str());
	configuration->add("dictionary/path", userLocalDictDir.utf8_str());

	SmartPtr<GR_Abi_MathGraphicDevice> mathGraphicDevice 
			= GR_Abi_MathGraphicDevice::create(logger, configuration, getGraphics());
	m_pMathGraphicDevice = mathGraphicDevice;
	m_pAbiContext = new GR_Abi_RenderingContext(getGraphics());
	UT_DEBUGMSG(("MAthView New rendering context %p Graphics %p \n",m_pAbiContext,getGraphics()));
	m_pOperatorDictionary = initOperatorDictionary<libxml2_MathView>(logger, configuration);
}
Пример #21
0
void fp_EmbedRun::_lookupProperties(const PP_AttrProp * pSpanAP,
									const PP_AttrProp * /*pBlockAP*/,
									const PP_AttrProp * /*pSectionAP*/,
									GR_Graphics * pG)
{
	UT_return_if_fail(pSpanAP != NULL);

	UT_DEBUGMSG(("fp_EmbedRun _lookupProperties span %p \n",pSpanAP));
	m_pSpanAP = pSpanAP;
	m_bNeedsSnapshot = true;
	pSpanAP->getAttribute("dataid", m_pszDataID);
	const gchar * pszEmbedType = NULL;
	pSpanAP->getProperty("embed-type", pszEmbedType);
	UT_ASSERT(pszEmbedType);
	UT_DEBUGMSG(("Embed Type %s \n",pszEmbedType));
	bool bFontChanged = false;

// Load this into EmbedView

	// LUCA: chunk of code moved up here from the bottom of the method
	// 'cause we need to retrieve the font-size
	const PP_AttrProp * pBlockAP = NULL;
	const PP_AttrProp * pSectionAP = NULL;
	FL_DocLayout * pLayout = getBlock()->getDocLayout();
	if(pG == NULL && pLayout->isQuickPrint() )
	{
	     pG = getGraphics();
	     if((m_iEmbedUID >= 0) && getEmbedManager())
	     {
		 getEmbedManager()->releaseEmbedView(m_iEmbedUID);
		 m_iEmbedUID = -1;
	     }
	     m_iEmbedUID = -1;
	}
	
	getBlockAP(pBlockAP);

	const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG);
	if(pLayout->isQuickPrint() && pG->queryProperties(GR_Graphics::DGP_PAPER))

	{
	     if(m_iEmbedUID >= 0 )
	     {
		 getEmbedManager()->releaseEmbedView(m_iEmbedUID);
		 m_iEmbedUID = -1;
	     }
	     m_iEmbedUID = - 1;
	     m_pEmbedManager = m_pDocLayout->getQuickPrintEmbedManager(pszEmbedType);
	}
	else
	{
	    m_pEmbedManager = m_pDocLayout->getEmbedManager(pszEmbedType);
	}
	if (pFont != _getFont())
	{
		_setFont(pFont);
		bFontChanged = true;
	}
	if(pG == NULL)
	  pG = getGraphics();
	m_iPointHeight = pG->getFontAscent(pFont) + pG->getFontDescent(pFont);
	const char* pszSize = PP_evalProperty("font-size",pSpanAP,pBlockAP,pSectionAP,
					      getBlock()->getDocument(), true);

	// LUCA: It is fundamental to do this before the EmbedView object
	// gets destroyed to avoid resuscitating it

	UT_sint32 iWidth,iAscent,iDescent=0;
	if(m_iEmbedUID < 0)
	{
	  PD_Document * pDoc = getBlock()->getDocument();
	  m_iEmbedUID = getEmbedManager()->makeEmbedView(pDoc,m_iIndexAP,m_pszDataID);
	  UT_DEBUGMSG((" EmbedRun %p UID is %d \n",this,m_iEmbedUID));
	  getEmbedManager()->initializeEmbedView(m_iEmbedUID);
	  getEmbedManager()->setRun (m_iEmbedUID, this);
	  getEmbedManager()->loadEmbedData(m_iEmbedUID);
	}
	getEmbedManager()->setDefaultFontSize(m_iEmbedUID,atoi(pszSize));
	if (bFontChanged)
		bFontChanged = getEmbedManager()->setFont(m_iEmbedUID,pFont);
	if(getEmbedManager()->isDefault())
	{
	  iWidth = _getLayoutPropFromObject("width");
	  iAscent = _getLayoutPropFromObject("ascent");
	  iDescent = _getLayoutPropFromObject("descent");
	}
	else
	{
	  const char * pszHeight = NULL;
	  bool bFoundHeight = pSpanAP->getProperty("height", pszHeight) && !bFontChanged;
	  const char * pszWidth = NULL;
	  bool bFoundWidth = pSpanAP->getProperty("width", pszWidth) && !bFontChanged;
	  const char * pszAscent = NULL;
	  bool bFoundAscent = pSpanAP->getProperty("ascent", pszAscent);

	  if(!bFoundWidth || pszWidth == NULL)
	  {
	      iWidth = getEmbedManager()->getWidth(m_iEmbedUID);
	  }
	  else
	  {
	      iWidth = UT_convertToLogicalUnits(pszWidth);
	      if(iWidth <= 0)
	      {
			  iWidth = getEmbedManager()->getWidth(m_iEmbedUID);
	      }
	  }
	  if(!bFoundHeight || pszHeight == NULL || !bFoundAscent || pszAscent == NULL)
	  {
	      iAscent = getEmbedManager()->getAscent(m_iEmbedUID);
		  iDescent = getEmbedManager()->getDescent(m_iEmbedUID);
	  }
	  else
	  {
	      iAscent = UT_convertToLogicalUnits(pszAscent);
	      if(iAscent <= 0)
	      {
			  iAscent = getEmbedManager()->getAscent(m_iEmbedUID);
			  iDescent = getEmbedManager()->getDescent(m_iEmbedUID);
	      }
		  else
		  {
			  UT_sint32 iHeight = UT_convertToLogicalUnits(pszHeight);
			  const char * pszDescent = NULL;
			  bool bFoundDescent = pSpanAP->getProperty("descent", pszDescent);
			  if (bFoundDescent && pszDescent != NULL && iHeight >= 0)
			  {
				  iDescent = UT_convertToLogicalUnits(pszDescent);
				  if (iHeight != iAscent + iDescent)
					  iAscent = iHeight * iAscent / (iAscent + iDescent);
			  }
			  iDescent = (iHeight >= iAscent)? iHeight - iAscent: 0;
		  }
	  }
	}
	UT_DEBUGMSG(("Width = %d Ascent = %d Descent = %d \n",iWidth,iAscent,iDescent)); 

	fl_DocSectionLayout * pDSL = getBlock()->getDocSectionLayout();
	fp_Page * p = NULL;
	if(pDSL->getFirstContainer())
	{
		p = pDSL->getFirstContainer()->getPage();
	}
	else
	{
		p = pDSL->getDocLayout()->getNthPage(0);
	}
	UT_sint32 maxW = p->getWidth() - UT_convertToLogicalUnits("0.1in"); 
	UT_sint32 maxH = p->getHeight() - UT_convertToLogicalUnits("0.1in");
	maxW -= pDSL->getLeftMargin() + pDSL->getRightMargin();
	maxH -= pDSL->getTopMargin() + pDSL->getBottomMargin();
	markAsDirty();
	if(getLine())
	{
		getLine()->setNeedsRedraw();
	}
	if(iAscent < 0)
	{
	  iAscent = 0;
	}
	if(iDescent < 0)
	{
	  iDescent = 0;
	}
	_setAscent(iAscent);
	_setDescent(iDescent);
	_setWidth(iWidth);
	_setHeight(iAscent+iDescent);
	_updatePropValuesIfNeeded();
}
Пример #22
0
void Entity::update()
{
//   getBody()->onUpdate();
   getGraphics()->update();
}
Пример #23
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;
}
Пример #24
0
    void InputField::paint() {
        getGraphics().clear();

        Box3 *bb = &this->getBoundingBox();
        getGraphics().beginPath().rect(0.0f, 0.0f, bb->size.x, bb->size.y, false).fill();
    }
/*!
 * x and y is the location in the document windows of the mouse in logical
 * units.
 */
void FV_VisualDragText::mouseRelease(UT_sint32 x, UT_sint32 y)
{
        if(m_pAutoScrollTimer != NULL)
	{
		m_pAutoScrollTimer->stop();
		DELETEP(m_pAutoScrollTimer);
	}
	m_bDoingCopy = false;
	m_bNotDraggingImage = false;
	m_bSelectedRow = false;
	clearCursor();
	if(m_iVisualDragMode != FV_VisualDrag_DRAGGING)
	{
//
// we didn't actually drag anything. Just release the selection.
//
		m_pView->warpInsPtToXY(x, y,true);
		return;
	}
	
	FV_ViewDoubleBuffering dblBuffObj(m_pView, true, true);
	dblBuffObj.beginDoubleBuffering();

	PT_DocPosition posAtXY = getPosFromXY(x,y);
	m_pView->setPoint(posAtXY);
	fl_BlockLayout * pCurB = m_pView->getCurrentBlock();
	if(pCurB)
	{
	    fl_ContainerLayout * pCL = pCurB->myContainingLayout();
	    if(pCL && pCL->getContainerType() == FL_CONTAINER_SHADOW)
	    {
	         m_pView->setHdrFtrEdit(static_cast<fl_HdrFtrShadow *>(pCL));
	    }
	}
	getGraphics()->setClipRect(&m_recCurFrame);
	m_pView->updateScreen(false);
	getGraphics()->setClipRect(NULL);
	m_iVisualDragMode = FV_VisualDrag_NOT_ACTIVE;
	m_pView->getMouseContext(x,y);
	m_iInitialOffX = 0;
	m_iInitialOffY = 0;
	PT_DocPosition oldPoint = m_pView->getPoint();
	if(oldPoint < 2)
	{
	  oldPoint = 2;
	}
	bool bInFrame = m_pView->isInFrame(oldPoint);

	bool bPasteTableCol = (m_pView->getPrevSelectionMode() == FV_SelectionMode_TableColumn);
	if(!bPasteTableCol)
	  {
	    m_pView->pasteFromLocalTo(m_pView->getPoint());
	  }
	else
	  {
	    m_pView->cmdPaste();
	  }

	dblBuffObj.endDoubleBuffering();
	
	m_bSelectedRow = false;
	PT_DocPosition newPoint = m_pView->getPoint();
	DELETEP(m_pDragImage);
	if(m_bTextCut)
	  {
	    m_pView->getDocument()->endUserAtomicGlob(); // End the big undo block
	  }
	if(m_pView->getDocument()->isEndFootnoteAtPos(newPoint))
	  {
	    newPoint++;
	  }
	bool bFinalFrame = m_pView->isInFrame(newPoint) && !m_pView->getDocument()->isFrameAtPos(newPoint);
	bool bDoSelect = true;
	if(bInFrame && !bFinalFrame)
	  {
	    bDoSelect = false;
	  }

	if(bDoSelect)
	  {
	    if(!bPasteTableCol)
	      {
		m_pView->cmdSelect(oldPoint,newPoint);
	      }
	    else
	      {
		m_pView->cmdSelectColumn(newPoint);
	      }
	  }
	m_bTextCut = false;
}
Пример #26
0
void fp_AnnotationContainer::layout(void)
{
	_setMaxContainerHeight(0);
	UT_sint32 iY = 0, iPrevY = 0;
	iY= 0;
	fl_DocSectionLayout * pDSL = getDocSectionLayout();
	UT_sint32 iMaxFootHeight = 0;
	iMaxFootHeight = pDSL->getActualColumnHeight();
	iMaxFootHeight -= getGraphics()->tlu(20)*3;
	UT_uint32 iCountContainers = countCons();
	fp_Container *pContainer, *pPrevContainer = NULL;
	for (UT_uint32 i=0; i < iCountContainers; i++)
	{
		pContainer = static_cast<fp_Container*>(getNthCon(i));
//
// This is to speedup redraws.
//
		if(pContainer->getHeight() > _getMaxContainerHeight())
			_setMaxContainerHeight(pContainer->getHeight());

		if(pContainer->getY() != iY)
		{
			pContainer->clearScreen();
		}
			
		pContainer->setY(iY);

		UT_sint32 iContainerHeight = pContainer->getHeight();
		UT_sint32 iContainerMarginAfter = pContainer->getMarginAfter();

		iY += iContainerHeight;
		iY += iContainerMarginAfter;
		//iY +=  0.5;
		if(iY > iMaxFootHeight)
		{
			iY = iMaxFootHeight;
		}
		else
		{
			if (pPrevContainer)
			{
				pPrevContainer->setAssignedScreenHeight(iY - iPrevY);
			}
		}
		pPrevContainer = pContainer;
		iPrevY = iY;
	}

	// Correct height position of the last line
	if (pPrevContainer)
	{
		pPrevContainer->setAssignedScreenHeight(iY - iPrevY + 1);
	}

	if (getHeight() == iY)
	{
		return;
	}

	setHeight(iY);
//	UT_ASSERT(pPage);
	fp_Page * pPage = getPage();
	if(pPage)
	{
		pPage->annotationHeightChanged();
	}
}
Пример #27
0
void CreditsMenu::paint() {
    getGraphics().clear().beginPath().setFillStyle(Colors::WHITE).image("images/menu/bgcredits.png", 0.0f, 0.0f, getPhantomGame()->getViewPort().x, getPhantomGame()->getViewPort().y).fill();

    for(MenuButton *button : _buttons)
        button->paint();
}