Source Code (Use browser search to find items of interest.)

Class Index

killustrator'Arrow (./koffice/killustrator/share/Arrow.h:35)

class Arrow {
public:
  Arrow (long aid, int npts, const QCOORD* pts, bool fillIt = true);
  ~Arrow ();

  long arrowID () const;
  QPixmap& leftPixmap ();
  QPixmap& rightPixmap ();
  void draw (QPainter& p, const Coord& c, const QColor& color, 
	     float width, float angle);

  Rect boundingBox (const Coord& c, float width, float angle);
  int length ();

  static void install (Arrow* arrow);
  static Arrow* getArrow (long id);
  static QIntDictIterator<Arrow> getArrows ();

private:
  static void initialize ();

  long id;
  QPixmap *lpreview, *rpreview;
  QPointArray points;
  bool fill;

  static QIntDict<Arrow> arrows;
};

killustrator'Arrow::Arrow() (./koffice/killustrator/share/Arrow.cc:50)

Arrow::Arrow (long aid, int npts, const QCOORD* pts, bool fillIt) : 
  points (npts, pts) {
  id = aid;
  lpreview = 0L;
  rpreview = 0L;
  fill = fillIt;
}


killustrator'Arrow::~Arrow() (./koffice/killustrator/share/Arrow.cc:58)

Arrow::~Arrow () {
  if (lpreview)
    delete lpreview;
  if (rpreview)
    delete rpreview;
}


killustrator'Arrow::arrowID() (./koffice/killustrator/share/Arrow.cc:65)

long Arrow::arrowID () const {
  return id;
}


killustrator'Arrow::leftPixmap() (./koffice/killustrator/share/Arrow.cc:69)

QPixmap& Arrow::leftPixmap () {
  if (lpreview == 0L) {
    lpreview = new QPixmap (50, 20);
    lpreview->fill ();
    QPainter p;
    p.begin (lpreview);
    p.scale (2, 2);
    p.drawLine (5, 5, 35, 5);
    //    draw (p, Coord (10, 5), black, 1, 180);
    draw (p, Coord (5, 5), QT_PRFX::black, 1, 180);
    p.end ();
  }
  return *lpreview;
}


killustrator'Arrow::rightPixmap() (./koffice/killustrator/share/Arrow.cc:84)

QPixmap& Arrow::rightPixmap () {
  if (rpreview == 0L) {
    rpreview = new QPixmap (50, 20);
    rpreview->fill ();
    QPainter p;
    p.begin (rpreview);
    p.scale (2, 2);
    //    p.drawLine (0, 5, 10, 5);
    //    draw (p, Coord (10, 5), black, 1, 0);
    p.drawLine (0, 5, 20, 5);
    draw (p, Coord (20, 5), QT_PRFX::black, 1, 0);
    p.end ();
  }
  return *rpreview;
}


killustrator'Arrow::draw() (./koffice/killustrator/share/Arrow.cc:100)

void Arrow::draw (QPainter& p, const Coord& c, const QColor& color,
		  float width, float angle) {
  p.save ();
  p.translate (c.x (), c.y ());
  p.rotate (angle);
  if (width == 0)
    width = 1.0;
  p.scale (width, width);
  //p.scale (1.0, width);
  if (fill)
    p.setBrush (color);
  else
    p.setBrush (QT_PRFX::white);
  p.setPen (color);
  p.drawPolygon (points);
  p.restore ();
}


killustrator'Arrow::boundingBox() (./koffice/killustrator/share/Arrow.cc:118)

Rect Arrow::boundingBox (const Coord& c, float width, float angle) {
  Rect box, r;

  QPoint p = points.at (0);
  r.left (p.x ());
  r.top (p.y ());
  r.right (p.x ());
  r.bottom (p.y ());

  for (unsigned int i = 1; i < points.size (); i++) {
    p = points.at (i);

    r.left (QMIN(p.x (), r.left ()));
    r.top (QMIN(p.y (), r.top ()));
    r.right (QMAX(p.x (), r.right ()));
    r.bottom (QMAX(p.y (), r.bottom ()));
  }

  QWMatrix m;
  if (width == 0)
    width = 1.0;
  m.translate (c.x (), c.y ());
  m.rotate (angle);
  m.scale (width, width);
  box = r.transform (m);
  return box;
}


killustrator'Arrow::install() (./koffice/killustrator/share/Arrow.cc:146)

void Arrow::install (Arrow* arrow) {
  arrows.insert (arrow->arrowID (), arrow);
}


killustrator'Arrow::getArrow() (./koffice/killustrator/share/Arrow.cc:150)

Arrow* Arrow::getArrow (long id) {
  if (arrows.isEmpty ())
    Arrow::initialize ();
  return arrows.find (id);
}


killustrator'Arrow::getArrows() (./koffice/killustrator/share/Arrow.cc:156)

QIntDictIterator<Arrow> Arrow::getArrows () {
  if (arrows.isEmpty ())
    Arrow::initialize ();
  
  return QIntDictIterator<Arrow> (arrows);
}


killustrator'Arrow::length() (./koffice/killustrator/share/Arrow.cc:163)

int Arrow::length () {
  return points.point(0).x();
}


killustrator'Arrow::initialize() (./koffice/killustrator/share/Arrow.cc:167)

void Arrow::initialize () {
  // initialize system arrows
  Arrow::install (new Arrow (1, 4, sysArrow_1));
  Arrow::install (new Arrow (2, 4, sysArrow_5));
  Arrow::install (new Arrow (3, 4, sysArrow_2));
  Arrow::install (new Arrow (4, 4, sysArrow_3));
  Arrow::install (new Arrow (5, 5, sysArrow_4));
  Arrow::install (new Arrow (6, 4, sysArrow_6));
  Arrow::install (new Arrow (7, 9, sysArrow_7));  
  Arrow::install (new Arrow (8, 4, sysArrow_1, false));
  Arrow::install (new Arrow (9, 4, sysArrow_5, false));
  Arrow::install (new Arrow (10, 4, sysArrow_2, false));  
  Arrow::install (new Arrow (11, 4, sysArrow_3, false));
  Arrow::install (new Arrow (12, 5, sysArrow_4, false));  
  Arrow::install (new Arrow (13, 4, sysArrow_6, false));
}