Rev 4061 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3614 | cbradney | 1 | /*************************************************************************** |
2 | pageitem.cpp - description |
||
3 | ------------------- |
||
4 | begin : Sat Apr 7 2001 |
||
5 | copyright : (C) 2001 by Franz Schmid |
||
6 | email : Franz.Schmid@altmuehlnet.de |
||
7 | ***************************************************************************/ |
||
8 | |||
9 | /*************************************************************************** |
||
10 | * * |
||
11 | * This program is free software; you can redistribute it and/or modify * |
||
12 | * it under the terms of the GNU General Public License as published by * |
||
13 | * the Free Software Foundation; either version 2 of the License, or * |
||
14 | * (at your option) any later version. * |
||
15 | * * |
||
16 | ***************************************************************************/ |
||
17 | |||
18 | #include "pageitem_line.h" |
||
19 | #include "pageitem_line.moc" |
||
20 | #include <qpainter.h> |
||
21 | #include <qpen.h> |
||
22 | #include <qfont.h> |
||
23 | #include <qregion.h> |
||
24 | #include <qpoint.h> |
||
25 | #include <qfileinfo.h> |
||
26 | #include <qdrawutil.h> |
||
27 | #include <qbitmap.h> |
||
28 | #include <qregexp.h> |
||
29 | #include <qmessagebox.h> |
||
30 | #include <cmath> |
||
31 | #include <cassert> |
||
32 | |||
33 | #include "mpalette.h" |
||
34 | #include "page.h" |
||
35 | #include "pageitem.h" |
||
36 | #include "prefsmanager.h" |
||
37 | #include "scpaths.h" |
||
38 | #include "scribus.h" |
||
39 | #include "scribusstructs.h" |
||
40 | #include "scribusdoc.h" |
||
41 | |||
42 | #include "undomanager.h" |
||
43 | #include "undostate.h" |
||
44 | #include "scconfig.h" |
||
45 | |||
46 | #include <ft2build.h> |
||
47 | #include FT_GLYPH_H |
||
48 | |||
49 | #include "scfontmetrics.h" |
||
50 | #include "util.h" |
||
51 | |||
52 | using namespace std; |
||
53 | |||
54 | PageItem_Line::PageItem_Line(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline) |
||
55 | : PageItem(pa, PageItem::Line, x, y, w, h, w2, fill, outline) |
||
56 | { |
||
57 | } |
||
58 | |||
59 | void PageItem_Line::DrawObj_Item(ScPainter *p) |
||
60 | { |
||
61 | if (!Doc->RePos) |
||
62 | { |
||
63 | if (NamedLStyle.isEmpty()) |
||
64 | p->drawLine(FPoint(0, 0), FPoint(Width, 0)); |
||
65 | else |
||
66 | { |
||
67 | multiLine ml = Doc->MLineStyles[NamedLStyle]; |
||
68 | QColor tmp; |
||
69 | for (int it = ml.size()-1; it > -1; it--) |
||
70 | { |
||
71 | SetFarbe(&tmp, ml[it].Color, ml[it].Shade); |
||
72 | p->setPen(tmp, ml[it].Width, |
||
73 | static_cast<PenStyle>(ml[it].Dash), |
||
74 | static_cast<PenCapStyle>(ml[it].LineEnd), |
||
75 | static_cast<PenJoinStyle>(ml[it].LineJoin)); |
||
76 | p->drawLine(FPoint(0, 0), FPoint(Width, 0)); |
||
77 | } |
||
78 | } |
||
79 | if (startArrowIndex != 0) |
||
80 | { |
||
81 | QWMatrix arrowTrans; |
||
82 | FPointArray arrow = (*Doc->arrowStyles.at(startArrowIndex-1)).points.copy(); |
||
83 | arrowTrans.translate(0, 0); |
||
84 | arrowTrans.scale(Pwidth, Pwidth); |
||
85 | arrowTrans.scale(-1,1); |
||
86 | arrow.map(arrowTrans); |
||
87 | p->setBrush(p->pen()); |
||
88 | p->setBrushOpacity(1.0 - lineTransparency()); |
||
89 | p->setLineWidth(0); |
||
90 | p->setFillMode(ScPainter::Solid); |
||
91 | p->setupPolygon(&arrow); |
||
92 | p->fillPath(); |
||
93 | } |
||
94 | if (endArrowIndex != 0) |
||
95 | { |
||
96 | QWMatrix arrowTrans; |
||
97 | FPointArray arrow = (*Doc->arrowStyles.at(endArrowIndex-1)).points.copy(); |
||
98 | arrowTrans.translate(Width, 0); |
||
99 | arrowTrans.scale(Pwidth, Pwidth); |
||
100 | arrow.map(arrowTrans); |
||
101 | p->setBrush(p->pen()); |
||
102 | p->setBrushOpacity(1.0 - lineTransparency()); |
||
103 | p->setLineWidth(0); |
||
104 | p->setFillMode(ScPainter::Solid); |
||
105 | p->setupPolygon(&arrow); |
||
106 | p->fillPath(); |
||
107 | } |
||
108 | } |
||
109 | } |
||
110 |