Rev 3955 | Rev 4430 | Go to most recent revision | Details | Compare with Previous | 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_imageframe.h" |
||
19 | #include "pageitem_imageframe.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_ImageFrame::PageItem_ImageFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline) |
||
55 | : PageItem(pa, PageItem::ImageFrame, x, y, w, h, w2, fill, outline) |
||
56 | { |
||
57 | } |
||
58 | |||
59 | void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, double sc) |
||
60 | { |
||
4084 | cbradney | 61 | if(!m_Doc->RePos) |
3614 | cbradney | 62 | { |
63 | if ((fillColor() != "None") || (GrType != 0)) |
||
64 | { |
||
65 | p->setupPolygon(&PoLine); |
||
66 | p->fillPath(); |
||
67 | } |
||
68 | if (Pfile.isEmpty()) |
||
69 | { |
||
4084 | cbradney | 70 | if ((Frame) && (m_Doc->guidesSettings.framesShown)) |
3614 | cbradney | 71 | { |
72 | p->setPen(black, 1, SolidLine, FlatCap, MiterJoin); |
||
73 | p->drawLine(FPoint(0, 0), FPoint(Width, Height)); |
||
74 | p->drawLine(FPoint(0, Height), FPoint(Width, 0)); |
||
75 | } |
||
76 | } |
||
77 | else |
||
78 | { |
||
79 | if ((!PicArt) || (!PicAvail)) |
||
80 | { |
||
4084 | cbradney | 81 | if ((Frame) && (m_Doc->guidesSettings.framesShown)) |
3614 | cbradney | 82 | { |
83 | p->setPen(red, 1, SolidLine, FlatCap, MiterJoin); |
||
84 | p->drawLine(FPoint(0, 0), FPoint(Width, Height)); |
||
85 | p->drawLine(FPoint(0, Height), FPoint(Width, 0)); |
||
86 | } |
||
87 | } |
||
88 | else |
||
89 | { |
||
3629 | fschmid | 90 | p->save(); |
3614 | cbradney | 91 | if (imageClip.size() != 0) |
92 | p->setupPolygon(&imageClip); |
||
93 | else |
||
94 | p->setupPolygon(&PoLine); |
||
95 | p->setClipPath(); |
||
96 | if (imageFlippedH()) |
||
97 | { |
||
98 | p->translate(Width * sc, 0); |
||
99 | p->scale(-1, 1); |
||
100 | } |
||
101 | if (imageFlippedV()) |
||
102 | { |
||
103 | p->translate(0, Height * sc); |
||
104 | p->scale(1, -1); |
||
105 | } |
||
106 | p->translate(LocalX*LocalScX*sc, LocalY*LocalScY*sc); |
||
107 | p->scale(LocalScX, LocalScY); |
||
108 | if (pixm.imgInfo.lowResType != 0) |
||
109 | p->scale(pixm.imgInfo.lowResScale, pixm.imgInfo.lowResScale); |
||
110 | p->drawImage(&pixm); |
||
111 | p->restore(); |
||
112 | } |
||
113 | } |
||
114 | } |
||
115 | } |
||
3627 | cbradney | 116 | |
117 | void PageItem_ImageFrame::clearContents() |
||
118 | { |
||
3955 | fschmid | 119 | effectsInUse.clear(); |
120 | PicAvail = false; |
||
3627 | cbradney | 121 | Pfile = ""; |
122 | pixm = ScImage(); |
||
123 | |||
124 | LocalScX = 1; |
||
125 | LocalScY = 1; |
||
126 | OrigW = 0; |
||
127 | OrigH = 0; |
||
128 | LocalX = 0; |
||
129 | LocalY = 0; |
||
130 | setImageFlippedH(false); |
||
131 | setImageFlippedV(false); |
||
132 | textAlignment = 0; |
||
133 | EmProfile = ""; |
||
134 | ScaleType = true; |
||
135 | AspectRatio = true; |
||
136 | setFillTransparency(0.0); |
||
137 | setLineTransparency(0.0); |
||
138 | imageClip.resize(0); |
||
139 | // emit UpdtObj(Doc->currentPage->pageNr(), ItemNr); |
||
140 | } |
||
141 |