Rev 4084 | Rev 4546 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
3614 | cbradney | 7 | /*************************************************************************** |
8 | pageitem.cpp - description |
||
9 | ------------------- |
||
10 | begin : Sat Apr 7 2001 |
||
11 | copyright : (C) 2001 by Franz Schmid |
||
12 | email : Franz.Schmid@altmuehlnet.de |
||
13 | ***************************************************************************/ |
||
14 | |||
15 | /*************************************************************************** |
||
16 | * * |
||
17 | * This program is free software; you can redistribute it and/or modify * |
||
18 | * it under the terms of the GNU General Public License as published by * |
||
19 | * the Free Software Foundation; either version 2 of the License, or * |
||
20 | * (at your option) any later version. * |
||
21 | * * |
||
22 | ***************************************************************************/ |
||
23 | |||
24 | #include "pageitem_imageframe.h" |
||
25 | #include "pageitem_imageframe.moc" |
||
26 | #include <qpainter.h> |
||
27 | #include <qpen.h> |
||
28 | #include <qfont.h> |
||
29 | #include <qregion.h> |
||
30 | #include <qpoint.h> |
||
31 | #include <qfileinfo.h> |
||
32 | #include <qdrawutil.h> |
||
33 | #include <qbitmap.h> |
||
34 | #include <qregexp.h> |
||
35 | #include <qmessagebox.h> |
||
36 | #include <cmath> |
||
37 | #include <cassert> |
||
38 | |||
39 | #include "mpalette.h" |
||
40 | #include "page.h" |
||
41 | #include "pageitem.h" |
||
42 | #include "prefsmanager.h" |
||
43 | #include "scpaths.h" |
||
44 | #include "scribus.h" |
||
45 | #include "scribusstructs.h" |
||
46 | #include "scribusdoc.h" |
||
47 | |||
48 | #include "undomanager.h" |
||
49 | #include "undostate.h" |
||
50 | #include "scconfig.h" |
||
51 | |||
52 | #include <ft2build.h> |
||
53 | #include FT_GLYPH_H |
||
54 | |||
55 | #include "scfontmetrics.h" |
||
56 | #include "util.h" |
||
57 | |||
58 | using namespace std; |
||
59 | |||
60 | PageItem_ImageFrame::PageItem_ImageFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline) |
||
61 | : PageItem(pa, PageItem::ImageFrame, x, y, w, h, w2, fill, outline) |
||
62 | { |
||
63 | } |
||
64 | |||
65 | void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, double sc) |
||
66 | { |
||
4084 | cbradney | 67 | if(!m_Doc->RePos) |
3614 | cbradney | 68 | { |
69 | if ((fillColor() != "None") || (GrType != 0)) |
||
70 | { |
||
71 | p->setupPolygon(&PoLine); |
||
72 | p->fillPath(); |
||
73 | } |
||
74 | if (Pfile.isEmpty()) |
||
75 | { |
||
4084 | cbradney | 76 | if ((Frame) && (m_Doc->guidesSettings.framesShown)) |
3614 | cbradney | 77 | { |
78 | p->setPen(black, 1, SolidLine, FlatCap, MiterJoin); |
||
79 | p->drawLine(FPoint(0, 0), FPoint(Width, Height)); |
||
80 | p->drawLine(FPoint(0, Height), FPoint(Width, 0)); |
||
81 | } |
||
82 | } |
||
83 | else |
||
84 | { |
||
85 | if ((!PicArt) || (!PicAvail)) |
||
86 | { |
||
4084 | cbradney | 87 | if ((Frame) && (m_Doc->guidesSettings.framesShown)) |
3614 | cbradney | 88 | { |
89 | p->setPen(red, 1, SolidLine, FlatCap, MiterJoin); |
||
90 | p->drawLine(FPoint(0, 0), FPoint(Width, Height)); |
||
91 | p->drawLine(FPoint(0, Height), FPoint(Width, 0)); |
||
92 | } |
||
93 | } |
||
94 | else |
||
95 | { |
||
3629 | fschmid | 96 | p->save(); |
3614 | cbradney | 97 | if (imageClip.size() != 0) |
98 | p->setupPolygon(&imageClip); |
||
99 | else |
||
100 | p->setupPolygon(&PoLine); |
||
101 | p->setClipPath(); |
||
102 | if (imageFlippedH()) |
||
103 | { |
||
104 | p->translate(Width * sc, 0); |
||
105 | p->scale(-1, 1); |
||
106 | } |
||
107 | if (imageFlippedV()) |
||
108 | { |
||
109 | p->translate(0, Height * sc); |
||
110 | p->scale(1, -1); |
||
111 | } |
||
112 | p->translate(LocalX*LocalScX*sc, LocalY*LocalScY*sc); |
||
113 | p->scale(LocalScX, LocalScY); |
||
114 | if (pixm.imgInfo.lowResType != 0) |
||
115 | p->scale(pixm.imgInfo.lowResScale, pixm.imgInfo.lowResScale); |
||
116 | p->drawImage(&pixm); |
||
117 | p->restore(); |
||
118 | } |
||
119 | } |
||
120 | } |
||
121 | } |
||
3627 | cbradney | 122 | |
123 | void PageItem_ImageFrame::clearContents() |
||
124 | { |
||
3955 | fschmid | 125 | effectsInUse.clear(); |
126 | PicAvail = false; |
||
3627 | cbradney | 127 | Pfile = ""; |
128 | pixm = ScImage(); |
||
129 | |||
130 | LocalScX = 1; |
||
131 | LocalScY = 1; |
||
132 | OrigW = 0; |
||
133 | OrigH = 0; |
||
134 | LocalX = 0; |
||
135 | LocalY = 0; |
||
136 | setImageFlippedH(false); |
||
137 | setImageFlippedV(false); |
||
138 | textAlignment = 0; |
||
139 | EmProfile = ""; |
||
140 | ScaleType = true; |
||
141 | AspectRatio = true; |
||
142 | setFillTransparency(0.0); |
||
143 | setLineTransparency(0.0); |
||
144 | imageClip.resize(0); |
||
145 | // emit UpdtObj(Doc->currentPage->pageNr(), ItemNr); |
||
146 | } |
||
147 |