Beispiel #1
0
void ArcItem::updateTextPath() {
	QPainterPath path;
	if((_endItem && _startItem->collidesWithItem(_endItem)) ||
	   (!_endItem && _startItem->contains(_end)))
		return;
	QPointF start(0,0),
			point = _end - pos();

	//The arrow line and reverse liune
	QLineF line(start, point);
	QLineF revline(point, start);

	//Make some text
	if(this->weight() != 1){
		QFont font;
		font.setPointSizeF(6);
		path.addText(QPointF(0,0), font, QString::number(this->weight()));
		//Move it into some reasonable position
		path.translate(-path.boundingRect().width()/2, -3);
		QTransform rotation;
		qreal angle = line.angle();
		if(angle > 90 && angle < 270)
			angle = 180 - angle;
		else
			angle = 360 - angle;
		rotation.rotate(angle);

		path = rotation.map(path);
		path.translate(point/2);
	}
	_cachedTextPath = path;
}
Beispiel #2
0
void  dispmsg(
              union both_scr  *posptr,
              int  msgno)
/**********************************************************************/
/*                                                                    */
/* Display a message on the message line and optionally ring the      */
/* bell.  Error messages starting with ! ring the bell.               */
/*                                                                    */
/**********************************************************************/
/*                                                                    */
/* This is ZEDIT source material.                                     */
/*                                                                    */
/* ZEDIT Source Materials are intellectual property                   */
/*     (c) Copyright 1987,2001 by Clyde Thomas Zuber.                 */
/*                                                                    */
/**********************************************************************/
{
extern unsigned int  graphic;
extern char  msgtext[MSGMAX][80];

int  ln;


if (!posptr)
    return;

if (msgtext[msgno][0] == '!')
#ifdef OS2
    DosBeep(500, 75);
#else
    printf("%c", BELL);
#endif

if (graphic & CGA)
    ln = 0;
else
    ln = 24;

dsp8lin(posptr, &msgtext[msgno][0], ln);
revline(posptr, ln);
if (graphic & XGA)
    xga8514(posptr, ln, RDSPLIN);

} /* end dispmsg */
Beispiel #3
0
void ArcItem::updateArrowPath(){
	QPainterPath path;
	if((_endItem && _startItem->primaryShape().intersects(_endItem->primaryShape())) ||
	   (!_endItem && _startItem->primaryShape().contains(_end))){
	   _cachedArrowPath = path;
		return;
	}
	QPointF start(0,0),
			point = _end - pos();

	//The arrow line and reverse liune
	QLineF revline(point, start);

	//Compute various points
	QLineF s = revline.normalVector();
	s.setAngle(revline.angle() - 45);
	s.setLength(ARROW_SIZE);
	QPointF side1 = s.p2();
	s = revline.normalVector();
	s.setAngle(revline.angle() + 45);
	s.setLength(ARROW_SIZE);
	QPointF side2 = s.p2();

	s = QLineF(side1, side2);
	QPointF head = point;
	s.intersect(revline, &head);

	path.moveTo(start);
	path.lineTo(head);
	path.lineTo(side1);
	path.lineTo(point);
	path.lineTo(side2);
	path.lineTo(head);

	_cachedArrowPath = path;
}