Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 16728 → Rev 16729

/trunk/Scribus/scribus/page.cpp
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: page.h
===================================================================
--- page.h (revision 16728)
+++ page.h (nonexistent)
@@ -1,117 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-/***************************************************************************
- page.h - description
- -------------------
- begin : Sat Apr 7 2001
- copyright : (C) 2001 by Franz Schmid
- email : Franz.Schmid@altmuehlnet.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef PAGE_H
-#define PAGE_H
-
-#include <utility>
-
-#include <QList>
-
-#include "scribusapi.h"
-#include "undostate.h"
-#include "scribusstructs.h"
-#include "guidemanagercore.h"
-
-class PageItem;
-class QString;
-class UndoManager;
-class UndoState;
-class ScribusDoc;
-
-
-/**
- *@author Franz Schmid
- */
-class SCRIBUS_API Page : public UndoObject, public SingleObservable<Page>
-{
-public:
- Page(const double x, const double y, const double b, const double h);
- ~Page();
- double xOffset() const { return m_xOffset; }
- double yOffset() const { return m_yOffset; }
- double width() const { return m_width; }
- double height() const { return m_height; }
- double initialWidth() const { return m_initialWidth; }
- double initialHeight() const { return m_initialHeight; }
- int orientation() const { return m_orientation; }
- void setXOffset(const double);
- void setYOffset(const double);
- void setWidth(const double);
- void setHeight(const double);
- void setInitialWidth(const double);
- void setInitialHeight(const double);
- void setOrientation(int);
- void copySizingProperties(Page *sourcePage, const MarginStruct& pageMargins);
- MarginStruct Margins;
- MarginStruct initialMargins;
- /** Nummer der Seite */
- int LeftPg;
- //! Name of the master page that this page uses
- QString MPageNam;
-
- QString m_pageSize;
- int marginPreset;
- ScribusDoc* doc() const { return m_Doc; }
- void setDocument(ScribusDoc* doc);
- int pageNr() const { return m_pageNr; }
- void setPageNr(int pageNr);
- const QString& pageSectionNumber() const { return m_pageSectionNumber; }
- void setPageSectionNumber(const QString&);
- //! Return the page's name
- const QString& pageName() const {return m_PageName;};
- void setPageName(const QString& newName);
- void restore(UndoState* state, bool isUndo);
-
- /*! \brief As a bit of a dirty hack, we declare this mutable so it can be altered
- even while the object is `const'. That's normally only for internal
- implementation, but in this case it at least lets us guarantee the rest
- of the object is unchanged in (eg) pdflib. This should be replaced with
- proper access methods later. */
- mutable QList<PageItem*> FromMaster;
- //! \brief Guides lists and basic operations
- GuideManagerCore guides;
-
-protected:
- UndoManager * const undoManager;
- void restorePageItemCreation(ItemState<PageItem*> *state, bool isUndo);
- void restorePageItemDeletion(ItemState< QList<PageItem*> > *state, bool isUndo);
- void restorePageItemConversion(ItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo);
-
- double m_xOffset;
- double m_yOffset;
- double m_width;
- double m_height;
- double m_initialWidth;
- double m_initialHeight;
- int m_pageNr;
- int m_orientation;
- //! Name of this page, currently only allowed to be used by a master page
- QString m_PageName;
- ScribusDoc* m_Doc;
- QString m_pageSectionNumber;
-};
-
-Q_DECLARE_METATYPE(Page*);
-
-#endif
/page.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: documentchecker.cpp
===================================================================
--- documentchecker.cpp (revision 16728)
+++ documentchecker.cpp (revision 16729)
@@ -23,7 +23,7 @@
#include "commonstrings.h"
#include "documentchecker.h"
-#include "page.h"
+#include "scpage.h"
#include "pageitem.h"
#include "pdf_analyzer.h"
#include "sccolor.h"
@@ -143,6 +143,21 @@
}
}
}
+ else if (currItem->GrType == 12)
+ {
+ for (int grow = 0; grow < currItem->meshGradientPatches.count(); grow++)
+ {
+ meshGradientPatch patch = currItem->meshGradientPatches[grow];
+ if (currItem->meshGradientPatches[grow].TL.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ if (currItem->meshGradientPatches[grow].TR.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ if (currItem->meshGradientPatches[grow].BR.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ if (currItem->meshGradientPatches[grow].BL.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ }
+ }
else
{
QList<VColorStop*> colorStops = currItem->fill_gradient.colorStops();
@@ -412,6 +427,21 @@
}
}
}
+ else if (currItem->GrType == 12)
+ {
+ for (int grow = 0; grow < currItem->meshGradientPatches.count(); grow++)
+ {
+ meshGradientPatch patch = currItem->meshGradientPatches[grow];
+ if (currItem->meshGradientPatches[grow].TL.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ if (currItem->meshGradientPatches[grow].TR.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ if (currItem->meshGradientPatches[grow].BR.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ if (currItem->meshGradientPatches[grow].BL.transparency != 1.0)
+ itemError.insert(Transparency, 0);
+ }
+ }
else
{
QList<VColorStop*> colorStops = currItem->fill_gradient.colorStops();
/trunk/Scribus/scribus/fileloader.cpp
26,7 → 26,7
#include "ui/fontreplacedialog.h"
#include "hyphenator.h"
#include "ui/missing.h"
#include "page.h"
#include "scpage.h"
#include "pluginmanager.h"
#include "plugins/formatidlist.h"
#include "pagestructs.h"
88,11 → 88,13
int s = fmt.indexOf("(");
int e = fmt.lastIndexOf(")");
QString f = fmt.mid(s+1, e-s-1);
#ifndef HAVE_POPPLER
if (f.contains("pdf")) // for removing PDF from the list
{
ind = a;
continue;
}
#endif
fmtString += f + " ";
}
fmtString += ");;";
/trunk/Scribus/scribus/scpage.h
0,0 → 1,117
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
page.h - description
-------------------
begin : Sat Apr 7 2001
copyright : (C) 2001 by Franz Schmid
email : Franz.Schmid@altmuehlnet.de
***************************************************************************/
 
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
#ifndef SCPAGE_H
#define SCPAGE_H
 
#include <utility>
 
#include <QList>
 
#include "scribusapi.h"
#include "undostate.h"
#include "scribusstructs.h"
#include "guidemanagercore.h"
 
class PageItem;
class QString;
class UndoManager;
class UndoState;
class ScribusDoc;
 
 
/**
*@author Franz Schmid
*/
class SCRIBUS_API ScPage : public UndoObject, public SingleObservable<ScPage>
{
public:
ScPage(const double x, const double y, const double b, const double h);
~ScPage();
double xOffset() const { return m_xOffset; }
double yOffset() const { return m_yOffset; }
double width() const { return m_width; }
double height() const { return m_height; }
double initialWidth() const { return m_initialWidth; }
double initialHeight() const { return m_initialHeight; }
int orientation() const { return m_orientation; }
void setXOffset(const double);
void setYOffset(const double);
void setWidth(const double);
void setHeight(const double);
void setInitialWidth(const double);
void setInitialHeight(const double);
void setOrientation(int);
void copySizingProperties(ScPage *sourcePage, const MarginStruct& pageMargins);
MarginStruct Margins;
MarginStruct initialMargins;
/** Nummer der Seite */
int LeftPg;
//! Name of the master page that this page uses
QString MPageNam;
 
QString m_pageSize;
int marginPreset;
ScribusDoc* doc() const { return m_Doc; }
void setDocument(ScribusDoc* doc);
int pageNr() const { return m_pageNr; }
void setPageNr(int pageNr);
const QString& pageSectionNumber() const { return m_pageSectionNumber; }
void setPageSectionNumber(const QString&);
//! Return the page's name
const QString& pageName() const {return m_PageName;};
void setPageName(const QString& newName);
void restore(UndoState* state, bool isUndo);
 
/*! \brief As a bit of a dirty hack, we declare this mutable so it can be altered
even while the object is `const'. That's normally only for internal
implementation, but in this case it at least lets us guarantee the rest
of the object is unchanged in (eg) pdflib. This should be replaced with
proper access methods later. */
mutable QList<PageItem*> FromMaster;
//! \brief Guides lists and basic operations
GuideManagerCore guides;
 
protected:
UndoManager * const undoManager;
void restorePageItemCreation(ScItemState<PageItem*> *state, bool isUndo);
void restorePageItemDeletion(ScItemState< QList<PageItem*> > *state, bool isUndo);
void restorePageItemConversion(ScItemState<std::pair<PageItem*, PageItem*> >*state, bool isUndo);
double m_xOffset;
double m_yOffset;
double m_width;
double m_height;
double m_initialWidth;
double m_initialHeight;
int m_pageNr;
int m_orientation;
//! Name of this page, currently only allowed to be used by a master page
QString m_PageName;
ScribusDoc* m_Doc;
QString m_pageSectionNumber;
};
 
Q_DECLARE_METATYPE(ScPage*);
 
#endif
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: pdflib_core.cpp
===================================================================
--- pdflib_core.cpp (revision 16728)
+++ pdflib_core.cpp (revision 16729)
@@ -62,7 +62,7 @@
#include "cmsettings.h"
#include "commonstrings.h"
#include "ui/multiprogressdialog.h"
-#include "page.h"
+#include "scpage.h"
#include "pageitem.h"
#include "pageitem_textframe.h"
#include "pageitem_group.h"
@@ -1888,7 +1888,7 @@
return true;
}
-bool PDFLibCore::PDF_TemplatePage(const Page* pag, bool )
+bool PDFLibCore::PDF_TemplatePage(const ScPage* pag, bool )
{
QString tmp, tmpOut;
ActPageP = pag;
@@ -2578,12 +2578,15 @@
PutDoc("/BBox [ "+FToStr(-bleedLeft)+" "+FToStr(-Options.bleeds.Bottom)+" "+FToStr(maxBoxX)+" "+FToStr(maxBoxY)+" ]\n");
// PutDoc("/BBox [ 0 0 "+FToStr(ActPageP->width())+" "+FToStr(ActPageP->height())+" ]\n");
PutDoc("/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]\n");
- if (Seite.ImgObjects.count() != 0)
+ if ((Seite.ImgObjects.count() != 0) || (Seite.XObjects.count() != 0))
{
PutDoc("/XObject <<\n");
QMap<QString,int>::Iterator it;
for (it = Seite.ImgObjects.begin(); it != Seite.ImgObjects.end(); ++it)
PutDoc("/"+it.key()+" "+QString::number(it.value())+" 0 R\n");
+ QMap<QString,int>::Iterator iti;
+ for (iti = Seite.XObjects.begin(); iti != Seite.XObjects.end(); ++iti)
+ PutDoc("/"+iti.key()+" "+QString::number(iti.value())+" 0 R\n");
PutDoc(">>\n");
}
if (Seite.FObjects.count() != 0)
@@ -2642,7 +2645,7 @@
if (Options.Compress)
PutDoc("\n/Filter /FlateDecode");
PutDoc(" >>\nstream\n"+EncStream(Content, templateObject)+"\nendstream\nendobj\n");
- int pIndex = doc.MasterPages.indexOf((Page* const) pag) + 1;
+ int pIndex = doc.MasterPages.indexOf((ScPage* const) pag) + 1;
QString name = QString("master_page_obj_%1_%2").arg(pIndex).arg(ite->ItemNr);
Seite.XObjects[name] = templateObject;
}
@@ -2654,7 +2657,7 @@
return true;
}
-void PDFLibCore::PDF_Begin_Page(const Page* pag, QPixmap pm)
+void PDFLibCore::PDF_Begin_Page(const ScPage* pag, QPixmap pm)
{
QString tmp;
ActPageP = pag;
@@ -3104,7 +3107,7 @@
}
-bool PDFLibCore::PDF_ProcessPage(const Page* pag, uint PNr, bool clip)
+bool PDFLibCore::PDF_ProcessPage(const ScPage* pag, uint PNr, bool clip)
{
ActPageP = pag;
ScLayer ll;
@@ -3163,7 +3166,7 @@
return true;
}
-bool PDFLibCore::PDF_ProcessMasterElements(const ScLayer& layer, const Page* pag, uint PNr)
+bool PDFLibCore::PDF_ProcessMasterElements(const ScLayer& layer, const ScPage* pag, uint PNr)
{
PageItem* ite;
QString output;
@@ -3173,8 +3176,8 @@
return true;
if (doc.MasterItems.count() <= 0)
return true;
- const Page* mPage = doc.MasterPages.at(doc.MasterNames[doc.DocPages.at(PNr)->MPageNam]);
- int mPageIndex = doc.MasterPages.indexOf((Page* const) mPage) + 1;
+ const ScPage* mPage = doc.MasterPages.at(doc.MasterNames[doc.DocPages.at(PNr)->MPageNam]);
+ int mPageIndex = doc.MasterPages.indexOf((ScPage* const) mPage) + 1;
if (!Options.MirrorH)
PutPage("1 0 0 1 0 0 cm\n");
@@ -3238,7 +3241,7 @@
return true;
}
-bool PDFLibCore::PDF_ProcessPageElements(const ScLayer& layer, const Page* pag, uint PNr)
+bool PDFLibCore::PDF_ProcessPageElements(const ScLayer& layer, const ScPage* pag, uint PNr)
{
PageItem* ite;
QString output;
@@ -3429,7 +3432,7 @@
return retString;
}
-QString PDFLibCore::PDF_ProcessTableItem(PageItem* ite, const Page* pag)
+QString PDFLibCore::PDF_ProcessTableItem(PageItem* ite, const ScPage* pag)
{
if ((ite->lineColor() == CommonStrings::None) || (ite->lineWidth() == 0.0))
return "";
@@ -3524,7 +3527,7 @@
return tmp;
}
-bool PDFLibCore::PDF_ProcessItem(QString& output, PageItem* ite, const Page* pag, uint PNr, bool embedded, bool pattern)
+bool PDFLibCore::PDF_ProcessItem(QString& output, PageItem* ite, const ScPage* pag, uint PNr, bool embedded, bool pattern)
{
QString tmp(""), tmpOut;
if (ite->isGroup())
@@ -4326,7 +4329,7 @@
return true;
}
-QString PDFLibCore::HandleBrushPattern(PageItem* ite, QPainterPath &path, const Page* pag, uint PNr)
+QString PDFLibCore::HandleBrushPattern(PageItem* ite, QPainterPath &path, const ScPage* pag, uint PNr)
{
QString tmp;
tmp = "";
@@ -4726,7 +4729,7 @@
}
// Return a PDF substring representing a PageItem's text
-QString PDFLibCore::setTextSt(PageItem *ite, uint PNr, const Page* pag)
+QString PDFLibCore::setTextSt(PageItem *ite, uint PNr, const ScPage* pag)
{
int tabCc = 0;
int savedOwnPage = ite->OwnPage;
@@ -4952,7 +4955,7 @@
return tmp;
}
-bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const ScText *hl, const ParagraphStyle& pstyle, const Page* pag)
+bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag)
{
#ifndef NLS_PROTO
QString output;
@@ -5780,7 +5783,7 @@
return tmp;
}
-void PDFLibCore::getBleeds(const Page* page, double &left, double &right)
+void PDFLibCore::getBleeds(const ScPage* page, double &left, double &right)
{
MarginStruct values;
doc.getBleeds(page, Options.bleeds, values);
@@ -5788,7 +5791,7 @@
right = values.Right;
}
-void PDFLibCore::getBleeds(const Page* page, double &left, double &right, double &bottom, double& top)
+void PDFLibCore::getBleeds(const ScPage* page, double &left, double &right, double &bottom, double& top)
{
MarginStruct values;
doc.getBleeds(page, Options.bleeds, values);
@@ -5973,6 +5976,17 @@
PutDoc("/"+it3p.key()+" "+QString::number(it3p.value())+" 0 R\n");
PutDoc(">>\n");
}
+ if ((Seite.ImgObjects.count() != 0) || (Seite.XObjects.count() != 0))
+ {
+ PutDoc("/XObject <<\n");
+ QMap<QString,int>::Iterator it;
+ for (it = Seite.ImgObjects.begin(); it != Seite.ImgObjects.end(); ++it)
+ PutDoc("/"+it.key()+" "+QString::number(it.value())+" 0 R\n");
+ QMap<QString,int>::Iterator iti;
+ for (iti = Seite.XObjects.begin(); iti != Seite.XObjects.end(); ++iti)
+ PutDoc("/"+iti.key()+" "+QString::number(iti.value())+" 0 R\n");
+ PutDoc(">>\n");
+ }
PutDoc(">>\n");
QString stre = "q\n";
if (currItem->isGroup())
@@ -6292,12 +6306,15 @@
PutDoc("/XStep "+FToStr(pat->width)+"\n");
PutDoc("/YStep "+FToStr(pat->height)+"\n");
PutDoc("/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]\n");
- if (Seite.ImgObjects.count() != 0)
+ if ((Seite.ImgObjects.count() != 0) || (Seite.XObjects.count() != 0))
{
PutDoc("/XObject <<\n");
QMap<QString,int>::Iterator it;
for (it = Seite.ImgObjects.begin(); it != Seite.ImgObjects.end(); ++it)
PutDoc("/"+it.key()+" "+QString::number(it.value())+" 0 R\n");
+ QMap<QString,int>::Iterator iti;
+ for (iti = Seite.XObjects.begin(); iti != Seite.XObjects.end(); ++iti)
+ PutDoc("/"+iti.key()+" "+QString::number(iti.value())+" 0 R\n");
PutDoc(">>\n");
}
if (Seite.FObjects.count() != 0)
@@ -6700,6 +6717,315 @@
return true;
}
+bool PDFLibCore::PDF_PatchMeshGradientFill(QString& output, PageItem *c)
+{
+ QList<double> StopVec;
+ QList<double> TransVec;
+ QStringList Gcolors;
+ QStringList colorNames;
+ QList<int> colorShades;
+ QStringList spotColorSet;
+ bool spotMode = false;
+ bool transparencyFound = false;
+ StopVec.clear();
+ TransVec.clear();
+ Gcolors.clear();
+ colorNames.clear();
+ colorShades.clear();
+ for (int col = 0; col < c->meshGradientPatches.count(); col++)
+ {
+ meshGradientPatch patch = c->meshGradientPatches[col];
+ meshPoint mp1 = patch.TL;
+ colorNames.append(mp1.colorName);
+ colorShades.append(mp1.shade);
+ TransVec.append(mp1.transparency);
+ if (mp1.transparency != 1.0)
+ transparencyFound = true;
+ if (spotMap.contains(mp1.colorName))
+ {
+ if (!spotColorSet.contains(mp1.colorName))
+ spotColorSet.append(mp1.colorName);
+ }
+ Gcolors.append(SetGradientColor(mp1.colorName, mp1.shade));
+ meshPoint mp2 = patch.TR;
+ colorNames.append(mp2.colorName);
+ colorShades.append(mp2.shade);
+ TransVec.append(mp2.transparency);
+ if (mp2.transparency != 1.0)
+ transparencyFound = true;
+ if (spotMap.contains(mp2.colorName))
+ {
+ if (!spotColorSet.contains(mp2.colorName))
+ spotColorSet.append(mp2.colorName);
+ }
+ Gcolors.append(SetGradientColor(mp2.colorName, mp2.shade));
+ meshPoint mp3 = patch.BR;
+ colorNames.append(mp3.colorName);
+ colorShades.append(mp3.shade);
+ TransVec.append(mp3.transparency);
+ if (mp3.transparency != 1.0)
+ transparencyFound = true;
+ if (spotMap.contains(mp3.colorName))
+ {
+ if (!spotColorSet.contains(mp3.colorName))
+ spotColorSet.append(mp3.colorName);
+ }
+ Gcolors.append(SetGradientColor(mp3.colorName, mp3.shade));
+ meshPoint mp4 = patch.BL;
+ colorNames.append(mp4.colorName);
+ colorShades.append(mp4.shade);
+ TransVec.append(mp4.transparency);
+ if (mp4.transparency != 1.0)
+ transparencyFound = true;
+ if (spotMap.contains(mp4.colorName))
+ {
+ if (!spotColorSet.contains(mp4.colorName))
+ spotColorSet.append(mp4.colorName);
+ }
+ Gcolors.append(SetGradientColor(mp4.colorName, mp4.shade));
+ }
+ QString TRes("");
+ if (((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)) && (transparencyFound))
+ {
+ uint shadeObjectT = newObject();
+ StartObj(shadeObjectT);
+ PutDoc("<<\n");
+ PutDoc("/ShadingType 6\n");
+ PutDoc("/ColorSpace /DeviceGray\n");
+ PutDoc("/BitsPerCoordinate 32\n");
+ PutDoc("/BitsPerComponent 16\n");
+ PutDoc("/BitsPerFlag 8\n");
+ QByteArray vertStreamT;
+ QDataStream vst(&vertStreamT, QIODevice::WriteOnly);
+ vst.setByteOrder(QDataStream::BigEndian);
+ quint8 flg = 0;
+ for (int col = 0; col < c->meshGradientPatches.count(); col++)
+ {
+ meshGradientPatch patch = c->meshGradientPatches[col];
+ meshPoint mp1 = patch.TL;
+ meshPoint mp2 = patch.TR;
+ meshPoint mp3 = patch.BR;
+ meshPoint mp4 = patch.BL;
+ int colInd1 = 4 * col;
+ int colInd2 = 4 * col + 1;
+ int colInd3 = 4 * col + 2;
+ int colInd4 = 4 * col + 3;
+ vst << flg;
+ vst << encode32dVal(mp4.gridPoint.x()) << encode32dVal(-mp4.gridPoint.y()) << encode32dVal(mp4.controlTop.x()) << encode32dVal(-mp4.controlTop.y()) << encode32dVal(mp1.controlBottom.x()) << encode32dVal(-mp1.controlBottom.y());
+ vst << encode32dVal(mp1.gridPoint.x()) << encode32dVal(-mp1.gridPoint.y()) << encode32dVal(mp1.controlRight.x()) << encode32dVal(-mp1.controlRight.y()) << encode32dVal(mp2.controlLeft.x()) << encode32dVal(-mp2.controlLeft.y());
+ vst << encode32dVal(mp2.gridPoint.x()) << encode32dVal(-mp2.gridPoint.y()) << encode32dVal(mp2.controlBottom.x()) << encode32dVal(-mp2.controlBottom.y()) << encode32dVal(mp3.controlTop.x()) << encode32dVal(-mp3.controlTop.y());
+ vst << encode32dVal(mp3.gridPoint.x()) << encode32dVal(-mp3.gridPoint.y()) << encode32dVal(mp3.controlLeft.x()) << encode32dVal(-mp3.controlLeft.y()) << encode32dVal(mp4.controlRight.x()) << encode32dVal(-mp4.controlRight.y());
+ encodeColor(vst, colorNames[colInd4], colorShades[colInd4], spotColorSet, spotMode);
+ encodeColor(vst, colorNames[colInd1], colorShades[colInd1], spotColorSet, spotMode);
+ encodeColor(vst, colorNames[colInd2], colorShades[colInd2], spotColorSet, spotMode);
+ encodeColor(vst, colorNames[colInd3], colorShades[colInd3], spotColorSet, spotMode);
+ }
+ PutDoc("/Decode [-40000 40000 -40000 40000 0 1]\n");
+ QString dat = "";
+ for (int vd = 0; vd < vertStreamT.count(); vd++)
+ {
+ dat += vertStreamT[vd];
+ }
+ if (Options.Compress)
+ dat = CompressStr(&dat);
+ PutDoc("/Length "+QString::number(dat.length())+"\n");
+ if (Options.Compress)
+ PutDoc("/Filter /FlateDecode\n");
+ PutDoc(">>\nstream\n"+EncStream(dat, shadeObjectT)+"\nendstream\nendobj\n");
+ uint patObject = newObject();
+ StartObj(patObject);
+ PutDoc("<<\n/Type /Pattern\n");
+ PutDoc("/PatternType 2\n");
+ PutDoc("/Shading "+QString::number(shadeObjectT)+" 0 R\n");
+ PutDoc(">>\nendobj\n");
+ Patterns.insert("Pattern"+QString::number(patObject), patObject);
+ uint formObject = newObject();
+ StartObj(formObject);
+ PutDoc("<<\n/Type /XObject\n/Subtype /Form\n");
+ PutDoc("/FormType 1\n");
+ PutDoc("/Group << /S /Transparency /CS /DeviceGray >>\n");
+ double lw = c->lineWidth();
+ PutDoc("/BBox ["+FToStr(-lw / 2.0)+" "+FToStr(lw / 2.0)+" "+FToStr(c->width()+lw)+" "+FToStr(-(c->height()+lw))+" ]\n");
+ PutDoc("/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]\n");
+ if (Patterns.count() != 0)
+ {
+ PutDoc("/Pattern << \n");
+ QMap<QString,int>::Iterator it3p;
+ for (it3p = Patterns.begin(); it3p != Patterns.end(); ++it3p)
+ PutDoc("/"+it3p.key()+" "+QString::number(it3p.value())+" 0 R\n");
+ PutDoc(">>\n");
+ }
+ PutDoc(">>\n");
+ QString stre = "q\n"+SetClipPath(c)+"h\n";
+ stre += FToStr(fabs(c->lineWidth()))+" w\n";
+ stre += "/Pattern cs\n";
+ stre += "/Pattern"+QString::number(patObject)+" scn\nf*\n";
+ stre += "Q\n";
+ if (Options.Compress)
+ stre = CompressStr(&stre);
+ PutDoc("/Length "+QString::number(stre.length())+"\n");
+ if (Options.Compress)
+ PutDoc("/Filter /FlateDecode\n");
+ PutDoc(">>\nstream\n"+EncStream(stre, formObject)+"\nendstream\nendobj\n");
+ Seite.XObjects[ResNam+QString::number(ResCount)] = formObject;
+ ResCount++;
+ QString GXName = ResNam+QString::number(ResCount);
+ ResCount++;
+ Transpar[GXName] = writeGState("/SMask << /S /Luminosity /G "+QString::number(formObject)+" 0 R >>\n/BM /Normal\n");
+ TRes = GXName;
+ }
+ QString entx = "";
+ uint spotObject = 0;
+ uint shadeObject = newObject();
+ StartObj(shadeObject);
+ PutDoc("<<\n");
+ PutDoc("/ShadingType 6\n");
+ if (Options.UseRGB)
+ {
+ PutDoc("/ColorSpace /DeviceRGB\n");
+ entx = "0 1 0 1 0 1";
+ }
+ else if (Options.isGrayscale)
+ {
+ PutDoc("/ColorSpace /DeviceGray\n");
+ entx = "0 1";
+ }
+ else if ((doc.HasCMS) && (Options.UseProfiles))
+ {
+ PutDoc("/ColorSpace "+ICCProfiles[Options.SolidProf].ICCArray+"\n");
+ entx = "0 1 0 1 0 1";
+ }
+ else
+ {
+ entx = "0 1 0 1 0 1 0 1";
+ if ((Options.UseSpotColors) && ((spotColorSet.count() > 0) && (spotColorSet.count() < 28)))
+ {
+ spotObject = newObject();
+ PutDoc("/ColorSpace [ /DeviceN [ /Cyan /Magenta /Yellow /Black");
+ for (int sc = 0; sc < spotColorSet.count(); sc++)
+ {
+ PutDoc(" /"+spotColorSet.at(sc).simplified().replace("#", "#23").replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "#20" ));
+ entx += " 0 1";
+ }
+ PutDoc(" ]\n");
+ PutDoc("/DeviceCMYK\n");
+ PutDoc(QString::number(spotObject)+" 0 R\n");
+ PutDoc("]\n");
+ spotMode = true;
+ }
+ else
+ PutDoc("/ColorSpace /DeviceCMYK\n");
+ }
+ PutDoc("/BitsPerCoordinate 32\n");
+ PutDoc("/BitsPerComponent 16\n");
+ PutDoc("/BitsPerFlag 8\n");
+ QByteArray vertStream;
+ QDataStream vs(&vertStream, QIODevice::WriteOnly);
+ vs.setByteOrder(QDataStream::BigEndian);
+ quint8 flg = 0;
+ for (int col = 0; col < c->meshGradientPatches.count(); col++)
+ {
+ meshGradientPatch patch = c->meshGradientPatches[col];
+ meshPoint mp1 = patch.TL;
+ meshPoint mp2 = patch.TR;
+ meshPoint mp3 = patch.BR;
+ meshPoint mp4 = patch.BL;
+ int colInd1 = 4 * col;
+ int colInd2 = 4 * col + 1;
+ int colInd3 = 4 * col + 2;
+ int colInd4 = 4 * col + 3;
+ vs << flg;
+ vs << encode32dVal(mp4.gridPoint.x()) << encode32dVal(-mp4.gridPoint.y()) << encode32dVal(mp4.controlTop.x()) << encode32dVal(-mp4.controlTop.y()) << encode32dVal(mp1.controlBottom.x()) << encode32dVal(-mp1.controlBottom.y());
+ vs << encode32dVal(mp1.gridPoint.x()) << encode32dVal(-mp1.gridPoint.y()) << encode32dVal(mp1.controlRight.x()) << encode32dVal(-mp1.controlRight.y()) << encode32dVal(mp2.controlLeft.x()) << encode32dVal(-mp2.controlLeft.y());
+ vs << encode32dVal(mp2.gridPoint.x()) << encode32dVal(-mp2.gridPoint.y()) << encode32dVal(mp2.controlBottom.x()) << encode32dVal(-mp2.controlBottom.y()) << encode32dVal(mp3.controlTop.x()) << encode32dVal(-mp3.controlTop.y());
+ vs << encode32dVal(mp3.gridPoint.x()) << encode32dVal(-mp3.gridPoint.y()) << encode32dVal(mp3.controlLeft.x()) << encode32dVal(-mp3.controlLeft.y()) << encode32dVal(mp4.controlRight.x()) << encode32dVal(-mp4.controlRight.y());
+ encodeColor(vs, colorNames[colInd4], colorShades[colInd4], spotColorSet, spotMode);
+ encodeColor(vs, colorNames[colInd1], colorShades[colInd1], spotColorSet, spotMode);
+ encodeColor(vs, colorNames[colInd2], colorShades[colInd2], spotColorSet, spotMode);
+ encodeColor(vs, colorNames[colInd3], colorShades[colInd3], spotColorSet, spotMode);
+ }
+ PutDoc("/Decode [-40000 40000 -40000 40000 "+entx+"]\n");
+ QString dat = "";
+ for (int vd = 0; vd < vertStream.count(); vd++)
+ {
+ dat += vertStream[vd];
+ }
+ if (Options.Compress)
+ dat = CompressStr(&dat);
+ PutDoc("/Length "+QString::number(dat.length())+"\n");
+ if (Options.Compress)
+ PutDoc("/Filter /FlateDecode\n");
+ PutDoc(">>\nstream\n"+EncStream(dat, shadeObject)+"\nendstream\nendobj\n");
+ uint patObject = newObject();
+ StartObj(patObject);
+ PutDoc("<<\n/Type /Pattern\n");
+ PutDoc("/PatternType 2\n");
+ QTransform mpa;
+ if (inPattern == 0)
+ {
+ if (groupStackPos.count() != 0)
+ {
+ mpa.translate(c->xPos() - groupStackPos.top().x(), groupStackPos.top().y() - c->gYpos);
+ mpa.rotate(-c->rotation());
+ }
+ else
+ {
+ mpa.translate(c->xPos() - ActPageP->xOffset(), ActPageP->height() - (c->yPos() - ActPageP->yOffset()));
+ mpa.rotate(-c->rotation());
+ }
+ }
+ PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
+ PutDoc("/Shading "+QString::number(shadeObject)+" 0 R\n");
+ PutDoc(">>\nendobj\n");
+ Patterns.insert("Pattern"+QString::number(patObject), patObject);
+ if (spotMode)
+ {
+ QString colorDesc;
+ StartObj(spotObject);
+ PutDoc("<<\n/FunctionType 4\n");
+ PutDoc("/Domain [0 1 0 1 0 1 0 1");
+ for (int sc = 0; sc < spotColorSet.count(); sc++)
+ {
+ PutDoc(" 0 1");
+ }
+ PutDoc("]\n");
+ colorDesc = "{\n";
+ int maxSp = spotColorSet.count() - 1;
+ for (int sc = 0; sc < spotColorSet.count(); sc++)
+ {
+ int cc = 0;
+ int mc = 0;
+ int yc = 0;
+ int kc = 0;
+ CMYKColor cmykValues;
+ ScColorEngine::getCMYKValues(doc.PageColors[spotColorSet.at(maxSp - sc)], &doc, cmykValues);
+ cmykValues.getValues(cc, mc, yc, kc);
+ if (sc == 0)
+ colorDesc += "dup "+FToStr(static_cast<double>(cc) / 255.0)+" mul ";
+ else
+ colorDesc += QString::number(sc*4 + 1)+" -1 roll dup "+FToStr(static_cast<double>(cc) / 255.0)+" mul ";
+ colorDesc += "exch dup "+FToStr(static_cast<double>(mc) / 255.0)+" mul ";
+ colorDesc += "exch dup "+FToStr(static_cast<double>(yc) / 255.0)+" mul ";
+ colorDesc += "exch "+FToStr(static_cast<double>(kc) / 255.0)+" mul\n";
+ }
+ for (int sc = 0; sc < spotColorSet.count(); sc++)
+ {
+ colorDesc += "8 -1 roll 5 -1 roll add 7 -1 roll 5 -1 roll add 6 -1 roll 5 -1 roll add 5 -1 roll 5 -1 roll add\n";
+ }
+ colorDesc += "}\n";
+ PutDoc("/Range [0 1 0 1 0 1 0 1]\n");
+ PutDoc("/Length "+QString::number(colorDesc.length()+1)+"\n");
+ PutDoc(">>\nstream\n"+EncStream(colorDesc, spotObject)+"\nendstream\nendobj\n");
+ }
+ QString tmp;
+ if (((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)) && (transparencyFound))
+ tmp += "/"+TRes+" gs\n";
+ tmp += "/Pattern cs\n";
+ tmp += "/Pattern"+QString::number(patObject)+" scn\n";
+ output = tmp;
+ return true;
+}
+
bool PDFLibCore::PDF_DiamondGradientFill(QString& output, PageItem *c)
{
QList<double> StopVec;
@@ -7473,6 +7799,8 @@
return PDF_DiamondGradientFill(output, currItem);
else if (GType == 11)
return PDF_MeshGradientFill(output, currItem);
+ else if (GType == 12)
+ return PDF_PatchMeshGradientFill(output, currItem);
StartX = currItem->GrStartX;
StartY = currItem->GrStartY;
EndX = currItem->GrEndX;
@@ -8547,12 +8875,15 @@
PutDoc("<<\n/Type /XObject\n/Subtype /Form\n");
PutDoc("/BBox [ 0 0 "+FToStr(w)+" "+FToStr(h)+" ]\n");
PutDoc("/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]\n");
- if (Seite.ImgObjects.count() != 0)
+ if ((Seite.ImgObjects.count() != 0) || (Seite.XObjects.count() != 0))
{
PutDoc("/XObject <<\n");
QMap<QString,int>::Iterator it;
for (it = Seite.ImgObjects.begin(); it != Seite.ImgObjects.end(); ++it)
PutDoc("/"+it.key()+" "+QString::number(it.value())+" 0 R\n");
+ QMap<QString,int>::Iterator iti;
+ for (iti = Seite.XObjects.begin(); iti != Seite.XObjects.end(); ++iti)
+ PutDoc("/"+iti.key()+" "+QString::number(iti.value())+" 0 R\n");
PutDoc(">>\n");
}
if (Seite.FObjects.count() != 0)
@@ -9696,7 +10027,7 @@
QString action = ip->Action;
if (action.isEmpty())
{
- const Page* page = doc.DocPages.at(ip->PageObject->OwnPage);
+ const ScPage* page = doc.DocPages.at(ip->PageObject->OwnPage);
double actionPos = page->height() - (ip->PageObject->yPos() - page->yOffset());
action = QString("/XYZ 0 %1 0").arg(actionPos);
}
/trunk/Scribus/scribus/mesh.cpp
62,3 → 62,12
controlLeft = gr.point(3);
controlRight = gr.point(4);
}
 
void meshPoint::resetTo(FPoint p)
{
gridPoint = p;
controlLeft = gridPoint;
controlRight = gridPoint;
controlTop = gridPoint;
controlBottom = gridPoint;
}
/trunk/Scribus/scribus/pslib.h
41,7 → 41,7
class ScText;
#endif
 
class Page;
class ScPage;
class ScribusDoc;
class PageItem;
class MultiProgressDialog;
81,7 → 81,7
virtual bool PS_set_file(QString fn);
virtual void PS_set_Info(QString art, QString was);
virtual bool PS_begin_doc(ScribusDoc *doc, double x, double y, double breite, double hoehe, int numpage, bool doDev, bool sep, bool farb, bool ic, bool gcr);
virtual void PS_begin_page(Page* pg, MarginStruct* Ma, bool Clipping);
virtual void PS_begin_page(ScPage* pg, MarginStruct* Ma, bool Clipping);
virtual void PS_end_page();
virtual void PS_curve(double x1, double y1, double x2, double y2, double x3, double y3);
virtual void PS_moveto(double x, double y);
120,26 → 120,27
virtual void PS_TemplateStart(QString Name);
virtual void PS_TemplateEnd();
virtual void PS_UseTemplate(QString Name);
virtual bool ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded = false, bool useTemplate = false);
virtual void ProcessPage(ScribusDoc* Doc, Page* a, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual bool ProcessMasterPageLayer(ScribusDoc* Doc, Page* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual bool ProcessPageLayer(ScribusDoc* Doc, Page* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual bool ProcessItem(ScribusDoc* Doc, ScPage* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded = false, bool useTemplate = false);
virtual void ProcessPage(ScribusDoc* Doc, ScPage* a, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual bool ProcessMasterPageLayer(ScribusDoc* Doc, ScPage* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual bool ProcessPageLayer(ScribusDoc* Doc, ScPage* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual void drawArrow(PageItem *ite, QTransform &arrowTrans, int arrowIndex, bool gcr);
virtual void putColor(const QString& color, double shade, bool fill);
virtual void putColorNoDraw(const QString& color, double shade, bool gcr);
virtual void GetBleeds(Page* page, double& left, double& right);
virtual void GetBleeds(Page* page, double& left, double& right, double& bottom, double& top);
virtual void GetBleeds(ScPage* page, double& left, double& right);
virtual void GetBleeds(ScPage* page, double& left, double& right, double& bottom, double& top);
virtual void SetClipPath(FPointArray *c, bool poly = true);
virtual void HandleBrushPattern(PageItem *c, QPainterPath &path, Page* a, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master);
virtual void HandleBrushPattern(PageItem *c, QPainterPath &path, ScPage* a, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master);
virtual void HandleStrokePattern(PageItem *c);
virtual void HandleMeshGradient(PageItem* c, bool gcr);
virtual void HandlePatchMeshGradient(PageItem* c, bool gcr);
virtual void HandleDiamondGradient(PageItem* c, bool gcr);
virtual void HandleTensorGradient(PageItem* c, bool gcr);
virtual void HandleGradientFillStroke(PageItem *c, bool gcr, bool stroke = true, bool forArrow = false);
virtual void SetColor(const QString& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
virtual void SetColor(const ScColor& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, Page* pg, bool sep, bool farb, bool ic, bool master);
virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint a, uint d, ScText *hl, const ParagraphStyle& pstyle, Page* pg, bool sep, bool farb, bool ic, bool master);
virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, ScPage* pg, bool sep, bool farb, bool ic, bool master);
virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint a, uint d, ScText *hl, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master);
bool psExport;
 
private:
204,7 → 205,7
bool usingGUI;
bool abortExport;
PrintOptions Options;
Page* ActPage;
ScPage* ActPage;
 
protected slots:
void cancelRequested();
/trunk/Scribus/scribus/pageitem_symbol.cpp
27,7 → 27,7
#include <QApplication>
 
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_symbol.h"
#include "prefsmanager.h"
90,7 → 90,9
p->setMaskMode(0);
else
{
p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX, patternMaskScaleY, patternMaskOffsetX + xPos(), patternMaskOffsetY + yPos(), patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
double scw = Width / groupWidth;
double sch = Height / groupHeight;
p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
if (maskType() == 3)
p->setMaskMode(2);
else
/trunk/Scribus/scribus/pageitem_regularpolygon.cpp
27,7 → 27,7
#include <cmath>
#include <cassert>
 
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_regularpolygon.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
574,7 → 574,7
double xposOrig = currItem->xPos();
double yposOrig = currItem->yPos();
 
ItemState<QPair<FPointArray, FPointArray> > *state = NULL;
ScItemState<QPair<FPointArray, FPointArray> > *state = NULL;
state = m_doc->nodeEdit.finishTransaction1(currItem);
xposOrig = currItem->xPos();
/trunk/Scribus/scribus/pageitem_line.cpp
24,7 → 24,7
#include <cmath>
#include <cassert>
 
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_line.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/pdflib_core.h
24,7 → 24,7
class BookMItem;
class BookMView;
class ScribusDoc;
class Page;
class ScPage;
class PDFOptions;
class PrefsContext;
class MultiProgressDialog;
82,12 → 82,12
};
 
bool PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, QMap<QString, QMap<uint, FPointArray> > DocFonts, BookMView* vi);
void PDF_Begin_Page(const Page* pag, QPixmap pm = 0);
void PDF_Begin_Page(const ScPage* pag, QPixmap pm = 0);
void PDF_End_Page(int physPage);
bool PDF_TemplatePage(const Page* pag, bool clip = false);
bool PDF_ProcessPage(const Page* pag, uint PNr, bool clip = false);
bool PDF_ProcessMasterElements(const ScLayer& layer, const Page* page, uint PNr);
bool PDF_ProcessPageElements(const ScLayer& layer, const Page* page, uint PNr);
bool PDF_TemplatePage(const ScPage* pag, bool clip = false);
bool PDF_ProcessPage(const ScPage* pag, uint PNr, bool clip = false);
bool PDF_ProcessMasterElements(const ScLayer& layer, const ScPage* page, uint PNr);
bool PDF_ProcessPageElements(const ScLayer& layer, const ScPage* page, uint PNr);
bool PDF_End_Doc(const QString& PrintPr = "", const QString& Name = "", int Components = 0);
bool closeAndCleanup();
 
123,10 → 123,10
QString putColor(const QString& color, double Shade, bool fill);
QString putColorUncached(const QString& color, int Shade, bool fill);
QString Write_TransparencyGroup(double trans, int blend, QString &data, PageItem *controlItem = 0);
QString setTextSt(PageItem *ite, uint PNr, const Page* pag);
bool setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const ScText * hl, const ParagraphStyle& pstyle, const Page* pag);
void getBleeds(const Page* page, double &left, double &right);
void getBleeds(const Page* page, double &left, double &right, double &bottom, double& top);
QString setTextSt(PageItem *ite, uint PNr, const ScPage* pag);
bool setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const ScText * hl, const ParagraphStyle& pstyle, const ScPage* pag);
void getBleeds(const ScPage* page, double &left, double &right);
void getBleeds(const ScPage* page, double &left, double &right, double &bottom, double& top);
 
// Provide a couple of PutDoc implementations to ease transition away from
// QString abuse and to provide fast paths for constant strings.
148,9 → 148,9
QByteArray ComputeMD5(const QString& in);
QByteArray ComputeRC4Key(int ObjNum);
 
bool PDF_ProcessItem(QString& output, PageItem* ite, const Page* pag, uint PNr, bool embedded = false, bool pattern = false);
QString PDF_ProcessTableItem(PageItem* ite, const Page* pag);
QString HandleBrushPattern(PageItem* ite, QPainterPath &path, const Page* pag, uint PNr);
bool PDF_ProcessItem(QString& output, PageItem* ite, const ScPage* pag, uint PNr, bool embedded = false, bool pattern = false);
QString PDF_ProcessTableItem(PageItem* ite, const ScPage* pag);
QString HandleBrushPattern(PageItem* ite, QPainterPath &path, const ScPage* pag, uint PNr);
QString drawArrow(PageItem *ite, QTransform &arrowTrans, int arrowIndex);
void PDF_Bookmark(PageItem *currItem, double ypos);
bool PDF_PatternFillStroke(QString& output, PageItem *currItem, int kind = 0, bool forArrow = false);
158,6 → 158,7
quint16 encode16dVal(double val);
void encodeColor(QDataStream &vs, QString colName, int colShade, QStringList &spotColorSet, bool spotMode);
bool PDF_MeshGradientFill(QString& output, PageItem *currItem);
bool PDF_PatchMeshGradientFill(QString& output, PageItem *c);
bool PDF_DiamondGradientFill(QString& output, PageItem *currItem);
bool PDF_TensorGradientFill(QString& output, PageItem *currItem);
bool PDF_GradientFillStroke(QString& output, PageItem *currItem, bool stroke = false, bool forArrow = false);
183,7 → 184,7
QString Content;
QString ErrorMessage;
ScribusDoc & doc;
const Page * ActPageP;
const ScPage * ActPageP;
const PDFOptions & Options;
BookMView* Bvie;
QFile Spool;
/trunk/Scribus/scribus/scribusdoc.cpp
44,7 → 44,6
#include "filewatcher.h"
#include "ui/guidemanager.h"
#include "hyphenator.h"
#include "page.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
#include "pageitem_latexframe.h"
73,6 → 72,7
#include "scclocale.h"
#include "scpainter.h"
#include "sclimits.h"
#include "scpage.h"
#include "scraction.h"
#include "scribus.h"
#include "scribusXml.h"
87,7 → 87,6
#include "ui/storyeditor.h"
#include "text/nlsconfig.h"
#include "undomanager.h"
#include "undostate.h"
#include "units.h"
#include "util.h"
#include "util_icon.h"
102,7 → 101,7
This class forwards change events for pages and pageitems to
the region occupied by this page or pageitem.
*/
class DocUpdater : public Observer<Page*>, public Observer<PageItem*>
class DocUpdater : public Observer<ScPage*>, public Observer<PageItem*>
{
ScribusDoc* doc;
int m_updateEnabled;
135,7 → 134,7
}
}
void changed(Page* pg, bool /*doLayout*/)
void changed(ScPage* pg, bool /*doLayout*/)
{
QRectF pagebox(pg->xOffset(), pg->yOffset(), pg->width(), pg->height());
doc->invalidateRegion(pagebox);
1840,10 → 1839,10
}
 
 
Page* ScribusDoc::addPage(const int pageIndex, const QString& masterPageName, const bool addAutoFrame)
ScPage* ScribusDoc::addPage(const int pageIndex, const QString& masterPageName, const bool addAutoFrame)
{
assert(masterPageMode()==false);
Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(docPrefsData.docSetupPrefs.pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
ScPage* addedPage = new ScPage(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(docPrefsData.docSetupPrefs.pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
assert(addedPage!=NULL);
addedPage->setDocument(this);
addedPage->Margins.Top = docPrefsData.docSetupPrefs.margins.Top;
1871,11 → 1870,11
}
 
 
Page* ScribusDoc::addMasterPage(const int pageNumber, const QString& pageName)
ScPage* ScribusDoc::addMasterPage(const int pageNumber, const QString& pageName)
{
//CB We dont create master pages (yet) with a pageCount based location
//Page* addedPage = new Page(ScratchLeft, MasterPages.count()*(pageHeight+ScratchBottom+ScratchTop)+ScratchTop, pageWidth, pageHeight);
Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
ScPage* addedPage = new ScPage(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
assert(addedPage!=NULL);
addedPage->setDocument(this);
addedPage->Margins = docPrefsData.docSetupPrefs.margins;
1907,7 → 1906,7
Q_ASSERT(MasterPages.at(number)->pageName()==oldPageName);
MasterPages.at(number)->setPageName(newPageName);
//Update any pages that were linking to our old name
Page* docPage=NULL;
ScPage* docPage=NULL;
for (int i=0; i < DocPages.count(); ++i )
{
docPage=DocPages[i];
1933,7 → 1932,7
assert(masterPageMode());
assert( Pages->count() > 1 && Pages->count() > pageNumber );
setCurrentPage(Pages->at(0));
Page* page = Pages->takeAt(pageNumber);
ScPage* page = Pages->takeAt(pageNumber);
QString oldPageName(page->pageName());
delete page;
// remove the master page from the master page name list
1966,8 → 1965,8
{
uint pageIndex = 0;
QMap<QString,int>::Iterator it = MasterNames.begin();
QListIterator<Page *> dpIt(DocPages);
Page* docPage=NULL;
QListIterator<ScPage *> dpIt(DocPages);
ScPage* docPage=NULL;
while(dpIt.hasNext())
//for (Page* docPage = currentDoc->DocPages.first(); docPage; docPage = currentDoc->DocPages.next() )
{
2013,7 → 2012,7
assert( Pages->count() > 1 && Pages->count() > pageNumber );
//#5561: If we are going to delete the first page, do not set the current page to it
setCurrentPage(Pages->at(pageNumber!=0?0:1));
Page* page = Pages->takeAt(pageNumber);
ScPage* page = Pages->takeAt(pageNumber);
delete page;
changed();
}
2021,7 → 2020,7
 
void ScribusDoc::movePage(const int from, const int to, const int ziel, const int art)
{
QList<Page*> Buf;
QList<ScPage*> Buf;
int zz = ziel;
Buf.clear();
for (int a = from; a < to; ++a)
2054,7 → 2053,7
{
if (!automaticTextFrames)
return -1;
Page *addToPage=DocPages.at(pageNumber);
ScPage *addToPage=DocPages.at(pageNumber);
if ((!masterPageMode()) && (usesAutomaticTextFrames()))// && (!isLoading()))
{
int z = itemAdd(PageItem::TextFrame, PageItem::Unspecified,
3727,10 → 3726,10
// mna = CommonStrings::masterPageNormal;
// if (!MasterNames.contains(mna))
// mna = CommonStrings::masterPageNormal;
Page* Ap = DocPages.at(pageNumber);
ScPage* Ap = DocPages.at(pageNumber);
Ap->MPageNam = pageName;
const int MpNr = MasterNames[pageName];
Page* Mp = MasterPages.at(MpNr);
ScPage* Mp = MasterPages.at(MpNr);
PageItem *currItem;
 
// for (currItem = Ap->FromMaster.first(); currItem; currItem = Ap->FromMaster.next())
4049,12 → 4048,12
if (masterPageMode())
return false;
int GrMax = GroupCounter;
Page* sourcePage = Pages->at(pageNumber);
ScPage* sourcePage = Pages->at(pageNumber);
int nr = MasterPages.count();
Page* targetPage=addMasterPage(nr, masterPageName);
ScPage* targetPage=addMasterPage(nr, masterPageName);
assert(targetPage!=NULL);
//Backup currentpage, and dont use sourcepage here as we might convert a non current page
Page* oldCurrentPage = currentPage();
ScPage* oldCurrentPage = currentPage();
//Must set current page for pasteitem to work properly
setLoading(true);
targetPage->copySizingProperties(sourcePage, sourcePage->Margins);
4080,7 → 4079,7
{
if (!sourcePage->MPageNam.isEmpty() && MasterNames.contains(sourcePage->MPageNam))
{
Page* pageMaster=NULL;
ScPage* pageMaster=NULL;
for (int i=0; i < MasterPages.count(); ++i )
{
pageMaster=MasterPages[i];
4245,7 → 4244,7
itemAddDetails(itemType, frameType, newItem->ItemNr);
if (UndoManager::undoEnabled())
{
ItemState<PageItem*> *is = new ItemState<PageItem*>("Create PageItem");
ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
is->set("CREATE_ITEM", "create_item");
is->setItem(newItem);
//Undo target rests with the Page for object specific undo
4290,7 → 4289,7
}
else
parsePagesString(iafData.pageList, &pageNs, DocPages.count());
Page* oldCurrentPage = currentPage();
ScPage* oldCurrentPage = currentPage();
int z=-2;
PageItem *prevItem=0; //Previous item for text frame linking
if (iafData.linkToExistingFrame && iafData.linkToExistingFramePtr!=NULL &&
4302,7 → 4301,7
Um::InsertFrame, "", Um::ICreate));
for (uint i=0;i<pageNs.size();++i)
{
Page* targetPage=Pages->at(pageNs[i]-1);
ScPage* targetPage=Pages->at(pageNs[i]-1);
//We need this for the itemAdd, FIXME later
setCurrentPage(targetPage);
4705,7 → 4704,7
}
else
{
Page* Seite;
ScPage* Seite;
uint docPageCount=Pages->count();
MarginStruct pageBleeds;
for (uint a = 0; a < docPageCount; ++a)
4849,7 → 4848,7
void ScribusDoc::fixItemPageOwner()
{
int pageNr;
Page* page;
ScPage* page;
PageItem* currItem;
MarginStruct pageBleeds;
 
4910,7 → 4909,7
currentXPos += (docPrefsData.docSetupPrefs.pageWidth+docPrefsData.displayPrefs.pageGapHorizontal) * counter;
 
lastYPos = Pages->at(0)->initialHeight();
Page* Seite;
ScPage* Seite;
uint docPageCount=Pages->count();
for (uint a = 0; a < docPageCount; ++a)
{
5068,12 → 5067,12
qCritical() << "Attempting to get bleeds for non-existant page";
}
 
void ScribusDoc::getBleeds(const Page* page, MarginStruct& bleedData)
void ScribusDoc::getBleeds(const ScPage* page, MarginStruct& bleedData)
{
getBleeds(page, docPrefsData.docSetupPrefs.bleeds, bleedData);
}
 
void ScribusDoc::getBleeds(const Page* page, const MarginStruct& baseValues, MarginStruct& bleedData)
void ScribusDoc::getBleeds(const ScPage* page, const MarginStruct& baseValues, MarginStruct& bleedData)
{
bleedData.Bottom = baseValues.Bottom;
bleedData.Top = baseValues.Top;
5300,7 → 5299,7
//Create the undo action for the new item
if (UndoManager::undoEnabled())
{
ItemState<std::pair<PageItem*, PageItem*> > *is = new ItemState<std::pair<PageItem*, PageItem*> >("Convert Item");
ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >("Convert Item");
is->set("CONVERT_ITEM", "convert_item");
is->setItem(std::pair<PageItem*, PageItem*>(oldItem, newItem));
//Undo target rests with the Page for object specific undo
5367,7 → 5366,7
{
ScPattern pa = docPatterns[symbolName];
currentEditedSymbol = symbolName;
Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, pa.width, pa.height);
ScPage* addedPage = new ScPage(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, pa.width, pa.height);
addedPage->setDocument(this);
addedPage->Margins.Top = 0;
addedPage->Margins.Bottom = 0;
5399,7 → 5398,7
else
{
PageItem* currItem = Items->at(0);
Page* addedPage = TempPages.at(0);
ScPage* addedPage = TempPages.at(0);
if (Items->count() > 1)
{
if ((!currItem->isGroup()) && (Items->count() > 1))
5688,8 → 5687,8
//CB Should we really be disabling auto text frames here?
bool autoText = usesAutomaticTextFrames();
setUsesAutomaticTextFrames(false);
Page* from = DocPages.at(pageNumberToCopy);
Page* lastDest = NULL;
ScPage* from = DocPages.at(pageNumberToCopy);
ScPage* lastDest = NULL;
 
uint oldItems = Items->count();
QList<QString> itemBuffer;
5735,7 → 5734,7
--destLocation;
else if (whereToInsert==2)
destLocation=DocPages.count();
Page* destination = new Page(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(docPrefsData.docSetupPrefs.pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
ScPage* destination = new ScPage(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(docPrefsData.docSetupPrefs.pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
destination->setDocument(this);
destination->setPageNr(destLocation);
lastDest = destination;
5823,13 → 5822,13
int setcol=pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns;
if (setcol==1)
{
Page* pageToAdjust=DocPages.at(pageIndex);
ScPage* pageToAdjust=DocPages.at(pageIndex);
pageToAdjust->Margins.Left = pageToAdjust->initialMargins.Left;
pageToAdjust->Margins.Right = pageToAdjust->initialMargins.Right;
return;
}
 
Page* pageToAdjust=DocPages.at(pageIndex);
ScPage* pageToAdjust=DocPages.at(pageIndex);
PageLocation pageLoc=locationOfPage(pageIndex);
if (pageLoc==LeftPage) //Left hand page
{
8880,7 → 8879,7
// OLD_FRAME_TYPE - original frame type
// NEW_FRAME_TYPE - change of frame type
// binary QPair<FPointArray, FPointArray> - .first original shape, .second new shape
ItemState<QPair<FPointArray,FPointArray> > *is = new ItemState<QPair<FPointArray,FPointArray> >(Um::ChangeShapeType, "", Um::IBorder);
ScItemState<QPair<FPointArray,FPointArray> > *is = new ScItemState<QPair<FPointArray,FPointArray> >(Um::ChangeShapeType, "", Um::IBorder);
is->set("CHANGE_SHAPE_TYPE", "change_shape_type");
is->set("OLD_FRAME_TYPE", item->FrameType);
is->set("NEW_FRAME_TYPE", frameType);
9089,7 → 9088,7
}
if (UndoManager::undoEnabled() && (selectedItemCount > 0) && !forceDeletion)
{
ItemState< QList<PageItem*> > *is = new ItemState< QList<PageItem*> >(Um::Delete + " " + currItem->getUName(), "", Um::IDelete);
ScItemState< QList<PageItem*> > *is = new ScItemState< QList<PageItem*> >(Um::Delete + " " + currItem->getUName(), "", Um::IDelete);
is->setItem(delItems);
is->set("DELETE_ITEM", "delete_item");
undoManager->action(Pages->at(0), is, currItem->getUPixmap());
11012,13 → 11011,13
}
 
 
Page* ScribusDoc::currentPage()
ScPage* ScribusDoc::currentPage()
{
return m_currentPage;
}
 
 
void ScribusDoc::setCurrentPage(Page *newPage)
void ScribusDoc::setCurrentPage(ScPage *newPage)
{
if (newPage==NULL)
return;
11203,8 → 11202,8
updatePic();
// this messy part is for the undo action
ItemState<QPair<ScImageEffectList, ScImageEffectList> > *state =
new ItemState<QPair<ScImageEffectList, ScImageEffectList> >(
ScItemState<QPair<ScImageEffectList, ScImageEffectList> > *state =
new ScItemState<QPair<ScImageEffectList, ScImageEffectList> >(
Um::ImageEffects, "", currItem->getUPixmap());
state->set("APPLY_IMAGE_EFFECTS", "apply_image_effects");
state->setItem(QPair<ScImageEffectList, ScImageEffectList>(oldEffects, currItem->effectsInUse));
11300,7 → 11299,7
}
else if (setcol == 2)
{
Page *lp = addMasterPage(0, CommonStrings::trMasterPageNormalLeft);
ScPage *lp = addMasterPage(0, CommonStrings::trMasterPageNormalLeft);
lp->LeftPg = 1;
lp->Margins.Left = lp->initialMargins.Right;
lp->Margins.Right = lp->initialMargins.Left;
11311,7 → 11310,7
}
else if ((setcol == 3) || (setcol == 4))
{
Page *lp = addMasterPage(0, CommonStrings::trMasterPageNormalLeft);
ScPage *lp = addMasterPage(0, CommonStrings::trMasterPageNormalLeft);
lp->LeftPg = 1;
lp->Margins.Left = lp->initialMargins.Right;
lp->Margins.Right = lp->initialMargins.Left;
11363,11 → 11362,11
}
 
 
void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, Page* refPage)
void ScribusDoc::getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage)
{
*GxM = -1;
*GyM = -1;
Page* page = (refPage == NULL) ? currentPage() : refPage;
ScPage* page = (refPage == NULL) ? currentPage() : refPage;
QMap<double, uint> tmpGuidesSel;
Guides tmpGuides = page->guides.horizontals(GuideManagerCore::Standard);
Guides::iterator it;
11431,7 → 11430,7
double xout, yout;
if (pg == -1)
return;
Page* page = Pages->at(pg);
ScPage* page = Pages->at(pg);
int GxM, GyM;
//FIXME: stop using m_View
11486,7 → 11485,7
int pg = OnPage(*x, *y);
if (pg == -1)
return ret;
Page* page = Pages->at(pg);
ScPage* page = Pages->at(pg);
int GxM, GyM;
 
// if ((SnapGuides) && (m_SnapCounter > 1))
12878,8 → 12877,8
if (*oldClip != newClip)
{
QString name = Doc->nodeEdit.isContourLine ? Um::EditContour : Um::EditShape;
ItemState<QPair<FPointArray, FPointArray> > *state =
new ItemState<QPair<FPointArray, FPointArray> >(name);
ScItemState<QPair<FPointArray, FPointArray> > *state =
new ScItemState<QPair<FPointArray, FPointArray> >(name);
state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
state->setItem(QPair<FPointArray, FPointArray>(*oldClip, newClip));
12904,11 → 12903,11
/**
first part: create a new UndoState or cancel the current transaction
*/
ItemState<QPair<FPointArray, FPointArray> >* NodeEditContext::finishTransaction1(PageItem* currItem)
ScItemState<QPair<FPointArray, FPointArray> >* NodeEditContext::finishTransaction1(PageItem* currItem)
{
ScribusDoc* Doc = currItem->doc();
UndoManager* undoManager = UndoManager::instance();
ItemState<QPair<FPointArray, FPointArray> >* state = NULL;
ScItemState<QPair<FPointArray, FPointArray> >* state = NULL;
if (nodeTransaction) // is there the old clip stored for the undo action
{
12916,7 → 12915,7
if (*oldClip != newClip)
{
QString name = Doc->nodeEdit.isContourLine ? Um::EditContour : Um::EditShape;
state = new ItemState<QPair<FPointArray, FPointArray> >(name);
state = new ScItemState<QPair<FPointArray, FPointArray> >(name);
state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
state->setItem(QPair<FPointArray, FPointArray>(*oldClip, newClip));
12937,7 → 12936,7
/**
second part: take the UndoState returned from finishTransaction1() and commit it
*/
void NodeEditContext::finishTransaction2(PageItem* currItem, ItemState<QPair<FPointArray, FPointArray> >* state)
void NodeEditContext::finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state)
{
UndoManager* undoManager = UndoManager::instance();
13170,8 → 13169,8
FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
if (*oldClip != newClip)
{
ItemState<QPair<FPointArray, FPointArray> > *state =
new ItemState<QPair<FPointArray, FPointArray> >(Um::ResetControlPoint, "",
ScItemState<QPair<FPointArray, FPointArray> > *state =
new ScItemState<QPair<FPointArray, FPointArray> >(Um::ResetControlPoint, "",
currItem->getUPixmap());
state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
13268,8 → 13267,8
FPointArray newClip(Doc->nodeEdit.isContourLine ? currItem->ContourLine : currItem->PoLine);
if (*oldClip != newClip)
{
ItemState<QPair<FPointArray, FPointArray> > *state =
new ItemState<QPair<FPointArray, FPointArray> >(Um::ResetControlPoints, "",
ScItemState<QPair<FPointArray, FPointArray> > *state =
new ScItemState<QPair<FPointArray, FPointArray> >(Um::ResetControlPoints, "",
currItem->getUPixmap());
state->set("EDIT_SHAPE_OR_CONTOUR", "edit_shape_or_contour");
state->set("IS_CONTOUR", Doc->nodeEdit.isContourLine);
13549,7 → 13548,7
{
for (int p = 0; p < Pages->count(); ++p)
{
Page *pp = Pages->at(p);
ScPage *pp = Pages->at(p);
if (resizePages)
{
pp->setInitialWidth(pageWidth());
13571,7 → 13570,7
//check if *pp's margins are the same as the *mp's current margins
//apply new margins if same
const int masterPageNumber = MasterNames[pp->MPageNam];
const Page* mp = MasterPages.at(masterPageNumber);
const ScPage* mp = MasterPages.at(masterPageNumber);
if (pp->initialMargins.Left == mp->initialMargins.Left &&
pp->initialMargins.Right == mp->initialMargins.Right &&
pp->initialMargins.Top == mp->initialMargins.Top &&
13584,7 → 13583,7
}
for (int p = 0; p < MasterPages.count(); ++p)
{
Page *pp = MasterPages.at(p);
ScPage *pp = MasterPages.at(p);
if (resizeMasterPages)
{
pp->setInitialWidth(pageWidth());
/trunk/Scribus/scribus/scpageoutput_ps2.cpp
9,7 → 9,7
 
#include "commonstrings.h"
#include "fonts/scfontmetrics.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "scimage.h"
#include "scpageoutput_ps2.h"
49,7 → 49,7
}
}
 
void ScPageOutput_Ps2::drawPage(Page* page)
void ScPageOutput_Ps2::drawPage(ScPage* page)
{
// Get page position
int clipx = static_cast<int>(page->xOffset());
/trunk/Scribus/scribus/fonts/scfontmetrics.cpp
15,7 → 15,7
 
#include "fpoint.h"
#include "fpointarray.h"
#include "page.h"
#include "scpage.h"
#include "scfontmetrics.h"
#include "scfonts.h"
#include "scpainter.h"
/trunk/Scribus/scribus/scribusview.h
71,7 → 71,7
class CanvasGesture;
class Hruler;
class Vruler;
class Page;
class ScPage;
class RulerMover;
class PageItem;
class PageSelector;
172,7 → 172,7
void updatesOn(bool on);
//CB This MUST now be called AFTER a call to doc->addPage or doc->addMasterPage as it
//does NOT create a page anymore.
Page* addPage(int nr, bool mov = true);
ScPage* addPage(int nr, bool mov = true);
 
void reformPages(bool moveObjects = true);
void updateLayerMenu();
/trunk/Scribus/scribus/canvasgesture_rulermove.cpp
27,7 → 27,7
 
void RulerGesture::drawControls(QPainter* p)
{
Page* page = m_doc->currentPage();
ScPage* page = m_doc->currentPage();
if (m_haveGuide)
page = m_doc->Pages->at(m_page);
QColor color(m_doc->guidesPrefs().guideColor);
/trunk/Scribus/scribus/scdocoutput.h
11,7 → 11,7
 
#include "scribusapi.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "scpainterexbase.h"
#include "scpageoutput.h"
 
/trunk/Scribus/scribus/pageitem_spiral.cpp
28,7 → 28,7
#include <cassert>
 
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_spiral.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/pageitem_polyline.cpp
27,7 → 27,7
#include <cmath>
#include <cassert>
 
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_polyline.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/pageitem_group.cpp
27,7 → 27,7
#include <QApplication>
 
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "pageitem_group.h"
#include "prefsmanager.h"
#include "scpainter.h"
139,7 → 139,9
p->setMaskMode(0);
else
{
p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX, patternMaskScaleY, patternMaskOffsetX + xPos(), patternMaskOffsetY + yPos(), patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
double scw = Width / groupWidth;
double sch = Height / groupHeight;
p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
if (maskType() == 3)
p->setMaskMode(2);
else
/trunk/Scribus/scribus/scribusXml.cpp
31,7 → 31,7
#include <cstdlib>
 
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_latexframe.h"
#ifdef HAVE_OSG
/trunk/Scribus/scribus/canvas.h
38,7 → 38,7
#include "pageitempointer.h"
 
 
class Page;
class ScPage;
class PageItem;
class ScLayer;
class ScPainter;
187,7 → 187,7
int previewVisual() const { return m_viewMode.previewVisual; }
void setPreviewVisual(int mode);
void DrawMasterItems(ScPainter *painter, Page *page, ScLayer& layer, QRect clip);
void DrawMasterItems(ScPainter *painter, ScPage *page, ScLayer& layer, QRect clip);
void DrawPageItems(ScPainter *painter, ScLayer& layer, QRect clip);
virtual void paintEvent ( QPaintEvent * p );
void displayXYHUD(QPoint m);
201,7 → 201,7
void setupEditHRuler(PageItem * item, bool forceAndReset = false);
private:
void DrawPageMarks(ScPainter *p, Page* page, QRect clip);
void DrawPageMarks(ScPainter *p, ScPage* page, QRect clip);
void drawLinkFrameLine(ScPainter* painter, FPoint &start, FPoint &end);
void PaintSizeRect(QRect neu);
void PaintSizeRect(QPolygon neu);
/trunk/Scribus/scribus/scdocoutput_ps2.cpp
10,7 → 10,7
#include "scribuscore.h"
#include "commonstrings.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
 
using namespace std;
 
/trunk/Scribus/scribus/guidemanagercore.cpp
9,7 → 9,7
#include <QTabWidget>
#include "guidemanagercore.h"
#include "scpainter.h"
#include "page.h"
#include "scpage.h"
#include "fpoint.h"
#include "undomanager.h"
#include "undostate.h"
38,7 → 38,7
horizontalAutoG.clear();
}
 
GuideManagerCore::GuideManagerCore(Page *parentPage):
GuideManagerCore::GuideManagerCore(ScPage *parentPage):
undoManager(UndoManager::instance()),
m_page(parentPage),
m_horizontalAutoGap(0.0),
58,7 → 58,7
{
}
 
void GuideManagerCore::setPage(Page *p)
void GuideManagerCore::setPage(ScPage *p)
{
m_page = p;
}
236,7 → 236,7
return -1.0; // just for compiler warning
}
 
Guides GuideManagerCore::getAutoHorizontals(Page* page)
Guides GuideManagerCore::getAutoHorizontals(ScPage* page)
{
Guides guides;
double rowSize;
286,7 → 286,7
return guides;
}
 
Guides GuideManagerCore::getAutoVerticals(Page* page)
Guides GuideManagerCore::getAutoVerticals(ScPage* page)
{
Guides guides;
double columnSize;
690,7 → 690,7
}
 
 
void GuideManagerIO::readVerticalGuides(const QString guideString, Page *page, GuideManagerCore::GuideType type, bool useOldGuides)
void GuideManagerIO::readVerticalGuides(const QString guideString, ScPage *page, GuideManagerCore::GuideType type, bool useOldGuides)
{
QStringList gVal(guideString.split(' ', QString::SkipEmptyParts));
for (QStringList::Iterator it = gVal.begin(); it != gVal.end(); ++it )
699,7 → 699,7
page->guides.addVertical(ScCLocale::toDoubleC((*it)), type);
}
 
void GuideManagerIO::readHorizontalGuides(const QString guideString, Page *page, GuideManagerCore::GuideType type, bool useOldGuides)
void GuideManagerIO::readHorizontalGuides(const QString guideString, ScPage *page, GuideManagerCore::GuideType type, bool useOldGuides)
{
QStringList gVal(guideString.split(' ', QString::SkipEmptyParts));
for (QStringList::Iterator it = gVal.begin(); it != gVal.end(); ++it )
708,7 → 708,7
page->guides.addHorizontal(ScCLocale::toDoubleC((*it)), type);
}
 
QString GuideManagerIO::writeHorizontalGuides(Page *page, GuideManagerCore::GuideType type)
QString GuideManagerIO::writeHorizontalGuides(ScPage *page, GuideManagerCore::GuideType type)
{
Guides::iterator it;
QString retval;
722,7 → 722,7
return retval;
}
 
QString GuideManagerIO::writeVerticalGuides(Page *page, GuideManagerCore::GuideType type)
QString GuideManagerIO::writeVerticalGuides(ScPage *page, GuideManagerCore::GuideType type)
{
Guides::iterator it;
QString retval;
736,12 → 736,12
return retval;
}
 
QString GuideManagerIO::writeSelection(Page *page)
QString GuideManagerIO::writeSelection(ScPage *page)
{
return QString("%1 %2 %3 %4").arg(page->guides.gx).arg(page->guides.gy).arg(page->guides.gw).arg(page->guides.gh);
}
 
void GuideManagerIO::readSelection(const QString guideString, Page *page)
void GuideManagerIO::readSelection(const QString guideString, ScPage *page)
{
// TODO: examine this check in 134vs.134qt4 - PV
if (guideString.isNull() || guideString.isEmpty())
/trunk/Scribus/scribus/canvas.cpp
23,7 → 23,7
 
#include "canvas.h"
#include "canvasmode.h"
#include "page.h"
#include "scpage.h"
#include "pageitem_textframe.h"
#include "pageitem_group.h"
#include "prefsmanager.h"
416,7 → 416,7
// look for masterpage items first
if (allowMasterItems && !m_doc->masterPageMode() && m_doc->currentPage()->FromMaster.count() != 0)
{
Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[m_doc->currentPage()->MPageNam]);
ScPage* Mp = m_doc->MasterPages.at(m_doc->MasterNames[m_doc->currentPage()->MPageNam]);
// if itemAbove is given, we expect to find it among the masterpage items of this page
int currNr = itemAbove? m_doc->currentPage()->FromMaster.indexOf(itemAbove)-1 : m_doc->currentPage()->FromMaster.count()-1;
if (currNr < 0)
1305,7 → 1305,7
/**
draws masterpage items of a specific layer
*/
void Canvas::DrawMasterItems(ScPainter *painter, Page *page, ScLayer& layer, QRect clip)
void Canvas::DrawMasterItems(ScPainter *painter, ScPage *page, ScLayer& layer, QRect clip)
{
if ((m_viewMode.previewMode) && (!layer.isPrintable))
return;
1323,7 → 1323,7
qRound(clip.width() / m_viewMode.scale + 0.5), qRound(clip.height() / m_viewMode.scale + 0.5));
 
PageItem *currItem;
Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
ScPage* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
uint layerCount = m_doc->layerCount();
if ((layerCount > 1) && ((layer.blendMode != 0) || (layer.transparency != 1.0)) && (!layer.outlineMode))
painter->beginLayer(layer.transparency, layer.blendMode);
1622,7 → 1622,7
painter->setAntialiasing(false);
// painter->beginLayer(1.0, 0);
painter->setPen(Qt::black, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
Page *actPg;
ScPage *actPg;
MarginStruct pageBleeds;
for (int a = 0; a < static_cast<int>(docPagesCount); ++a)
{
1663,7 → 1663,7
painter->setAntialiasing(true);
}
painter->setFillMode(ScPainter::Solid);
Page *actPg;
ScPage *actPg;
MarginStruct pageBleeds;
for (int a = 0; a < static_cast<int>(docPagesCount); ++a)
{
1721,7 → 1721,7
PoLine->resize(0);
uint docPagesCount=m_doc->Pages->count();
bool first = true;
Page *actPg;
ScPage *actPg;
for (int a = 0; a < static_cast<int>(docPagesCount); ++a)
{
if (!first)
1747,7 → 1747,7
void Canvas::drawGuides(ScPainter* painter, int clipx, int clipy, int clipw, int cliph)
{
uint docPagesCount=m_doc->Pages->count();
Page *actPg;
ScPage *actPg;
for (uint a = 0; a < docPagesCount; ++a)
{
actPg = m_doc->Pages->at(a);
1766,7 → 1766,7
/**
draws guides, margins, grid and baseline grid
*/
void Canvas::DrawPageMarks(ScPainter *p, Page *page, QRect clip)
void Canvas::DrawPageMarks(ScPainter *p, ScPage *page, QRect clip)
{
p->save();
p->setAntialiasing(false);
/trunk/Scribus/scribus/pageitem_pathtext.cpp
29,7 → 29,7
 
#include <cassert>
 
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "prefsmanager.h"
#include "scpaths.h"
/trunk/Scribus/scribus/scdocoutput.cpp
1,40 → 1,40
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
 
#include "scdocoutput.h"
using namespace std;
 
bool ScDocOutput::makeOutput(ScribusDoc* doc, vector<int>& pageNumbers)
{
bool done = true;
Page* page;
 
begin();
 
for (uint index = 0; index < pageNumbers.size(); index++)
{
page = doc->Pages->at( pageNumbers[index] - 1 );
ScPageOutput* outputComponent = createPageOutputComponent(index + 1);
if (outputComponent != NULL)
{
outputComponent->begin();
outputComponent->drawPage(page);
outputComponent->end();
delete outputComponent;
}
else
{
done = false;
break;
}
}
 
end();
 
return done;
}
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
 
#include "scdocoutput.h"
using namespace std;
 
bool ScDocOutput::makeOutput(ScribusDoc* doc, vector<int>& pageNumbers)
{
bool done = true;
ScPage* page;
 
begin();
 
for (uint index = 0; index < pageNumbers.size(); index++)
{
page = doc->Pages->at( pageNumbers[index] - 1 );
ScPageOutput* outputComponent = createPageOutputComponent(index + 1);
if (outputComponent != NULL)
{
outputComponent->begin();
outputComponent->drawPage(page);
outputComponent->end();
delete outputComponent;
}
else
{
done = false;
break;
}
}
 
end();
 
return done;
}
/trunk/Scribus/scribus/scpageoutput.h
17,7 → 17,7
 
class CharStyle;
struct GlyphLayout;
class Page;
class ScPage;
class PageItem;
class PageItem_ImageFrame;
class PageItem_Line;
59,8 → 59,8
virtual void fillPath( PageItem* item, ScPainterExBase* painter, const QRect& clip );
virtual void strokePath( PageItem* item, ScPainterExBase* painter, const QRect& clip );
 
virtual void drawMasterItems( ScPainterExBase *painter, Page *page, ScLayer& layer, const QRect& clip);
virtual void drawPageItems( ScPainterExBase *painter, Page *page, ScLayer& layer, const QRect& clip);
virtual void drawMasterItems( ScPainterExBase *painter, ScPage *page, ScLayer& layer, const QRect& clip);
virtual void drawPageItems( ScPainterExBase *painter, ScPage *page, ScLayer& layer, const QRect& clip);
 
virtual void drawItem( PageItem* item, ScPainterExBase* painter, const QRect& clip );
virtual void drawItem_Pre( PageItem* item, ScPainterExBase* painter );
78,7 → 78,7
virtual void drawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, const QRect& clip );
 
virtual void drawArrow(ScPainterExBase* painter, PageItem* item, QTransform &arrowTrans, int arrowIndex);
virtual void drawMarks( Page* page, ScPainterExBase* painter, const MarksOptions& options );
virtual void drawMarks( ScPage* page, ScPainterExBase* painter, const MarksOptions& options );
virtual void drawBoxMarks( ScPainterExBase* painter, const QRectF& box, const QRectF& bleedBox, double offset );
virtual void drawRegistrationCross( ScPainterExBase* painter );
 
90,8 → 90,8
ScPageOutput(ScribusDoc* doc, bool reloadImages = false, int resolution = 72, bool useProfiles = false);
 
virtual void begin(void) {};
virtual void drawPage( Page* page ) {};
virtual void drawPage( Page* page, ScPainterExBase* painter);
virtual void drawPage( ScPage* page ) {};
virtual void drawPage( ScPage* page, ScPainterExBase* painter);
virtual void end(void) {};
 
void setMarksOptions(const MarksOptions& opt) { m_marksOptions = opt; }
/trunk/Scribus/scribus/pageitem.h
401,6 → 401,7
int GrCol2Shade;
int GrCol3Shade;
int GrCol4Shade;
QList<meshGradientPatch> meshGradientPatches;
QList<QList<meshPoint> > meshGradientArray;
int selectedMeshPointX;
int selectedMeshPointY;
/trunk/Scribus/scribus/undostate.h
283,12 → 283,12
/*** ItemState ***************************************************************************/
 
template<class C>
class ItemState : public SimpleState
class ScItemState : public SimpleState
{
public:
ItemState(const QString& name, const QString& description = 0, QPixmap* pixmap = 0)
ScItemState(const QString& name, const QString& description = 0, QPixmap* pixmap = 0)
: SimpleState(name, description, pixmap) {}
~ItemState() {}
~ScItemState() {}
void setItem(const C &c) { item_ = c; }
C getItem() const { return item_; }
private:
/trunk/Scribus/scribus/scpageoutput.cpp
13,7 → 13,7
 
#include "cmsettings.h"
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
#include "pageitem_line.h"
81,7 → 81,7
return value;
}
 
void ScPageOutput::drawPage( Page* page, ScPainterExBase* painter)
void ScPageOutput::drawPage( ScPage* page, ScPainterExBase* painter)
{
int clipx = static_cast<int>(page->xOffset());
int clipy = static_cast<int>(page->yOffset());
99,7 → 99,7
drawMarks(page, painter, m_marksOptions);
}
 
void ScPageOutput::drawMasterItems(ScPainterExBase *painter, Page *page, ScLayer& layer, const QRect& clip)
void ScPageOutput::drawMasterItems(ScPainterExBase *painter, ScPage *page, ScLayer& layer, const QRect& clip)
{
PageItem* currItem;
if (page->MPageNam.isEmpty())
108,7 → 108,7
return;
if (!layer.isViewable || !layer.isPrintable)
return;
Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
ScPage* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
uint pageFromMasterCount = page->FromMaster.count();
for (uint a = 0; a < pageFromMasterCount; ++a)
{
203,7 → 203,7
}
}
 
void ScPageOutput::drawPageItems(ScPainterExBase *painter, Page *page, ScLayer& layer, const QRect& clip)
void ScPageOutput::drawPageItems(ScPainterExBase *painter, ScPage *page, ScLayer& layer, const QRect& clip)
{
PageItem *currItem;
if (m_doc->Items->count() <= 0)
1371,7 → 1371,7
}
}
 
void ScPageOutput::drawMarks( Page* page, ScPainterExBase* painter, const MarksOptions& options )
void ScPageOutput::drawMarks( ScPage* page, ScPainterExBase* painter, const MarksOptions& options )
{
double markOffs = options.markOffset;
double bleedLeft = 0.0, bleedRight = 0.0;
/trunk/Scribus/scribus/scpainter.cpp
623,6 → 623,16
gradPatchP4 = p4;
}
 
void ScPainter::setMeshGradient(FPoint p1, FPoint p2, FPoint p3, FPoint p4, QList<meshGradientPatch> meshPatches)
{
fill_gradient.setType(VGradient::freemesh);
meshGradientPatches = meshPatches;
gradPatchP1 = p1;
gradPatchP2 = p2;
gradPatchP3 = p3;
gradPatchP4 = p4;
}
 
void ScPainter::fillTextPath()
{
drawVPath( 0 );
1312,6 → 1322,102
cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
#endif
}
else if (fill_gradient.type() == VGradient::freemesh)
{
// #ifdef HAVE_PRIVATE_CAIRO
#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
double p3x = gradPatchP3.x();
double p3y = gradPatchP3.y();
img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
cr = cairo_create(img);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_set_tolerance(cr, 0.5 );
double r, g, b, a;
mpat = cairo_pattern_create_mesh();
for (int col = 0; col < meshGradientPatches.count(); col++)
{
meshGradientPatch patch = meshGradientPatches[col];
meshPoint mp1 = patch.TL;
meshPoint mp2 = patch.TR;
meshPoint mp3 = patch.BR;
meshPoint mp4 = patch.BL;
cairo_pattern_mesh_begin_patch(mpat);
cairo_pattern_mesh_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
cairo_pattern_mesh_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
cairo_pattern_mesh_curve_to(mpat, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
cairo_pattern_mesh_curve_to(mpat, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
cairo_pattern_mesh_curve_to(mpat, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
mp1.color.getRgbF(&r, &g, &b, &a);
cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
mp2.color.getRgbF(&r, &g, &b, &a);
cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
mp3.color.getRgbF(&r, &g, &b, &a);
cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
mp4.color.getRgbF(&r, &g, &b, &a);
cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
cairo_pattern_mesh_end_patch(mpat);
}
cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
cairo_set_source(cr, mpat);
cairo_paint_with_alpha(cr, 1.0);
pat = cairo_pattern_create_for_surface(img);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
#else
double p3x = gradPatchP3.x();
double p3y = gradPatchP3.y();
img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
cr = cairo_create(img);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_set_tolerance(cr, 0.5 );
double r, g, b, a;
for (int col = 0; col < meshGradientPatches.count(); col++)
{
meshPoint mp1 = patch.TL;
meshPoint mp2 = patch.TR;
meshPoint mp3 = patch.BR;
meshPoint mp4 = patch.BL;
cairo_new_path( cr );
cairo_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
cairo_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
cairo_curve_to(mpat, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
cairo_curve_to(mpat, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
cairo_curve_to(mpat, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
cairo_close_path( cr );
double acr = 0.0;
double acg = 0.0;
double acb = 0.0;
double aca = 0.0;
mp1.color.getRgbF(&r, &g, &b, &a);
acr += r;
acg += g;
acb += b;
aca += a;
mp2.color.getRgbF(&r, &g, &b, &a);
acr += r;
acg += g;
acb += b;
aca += a;
mp3.color.getRgbF(&r, &g, &b, &a);
acr += r;
acg += g;
acb += b;
aca += a;
mp4.color.getRgbF(&r, &g, &b, &a);
acr += r;
acg += g;
acb += b;
aca += a;
cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
cairo_fill(cr);
}
pat = cairo_pattern_create_for_surface(img);
cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
#endif
}
else
{
bool isFirst = true;
1394,7 → 1500,7
cairo_pattern_destroy (pat);
// #ifdef HAVE_PRIVATE_CAIRO
#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
if ((fill_gradient.type() == VGradient::fourcolor) || (fill_gradient.type() == VGradient::diamond) || (fill_gradient.type() == VGradient::mesh))
if ((fill_gradient.type() == VGradient::fourcolor) || (fill_gradient.type() == VGradient::diamond) || (fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
{
cairo_surface_destroy(img);
cairo_pattern_destroy(mpat);
1401,7 → 1507,7
cairo_destroy( cr );
}
#else
if (fill_gradient.type() == VGradient::mesh)
if ((fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
{
cairo_surface_destroy(img);
cairo_destroy( cr );
/trunk/Scribus/scribus/pageitem.cpp
41,7 → 41,7
#include "colorblind.h"
#include "commonstrings.h"
#include "ui/guidemanager.h"
#include "page.h"
#include "scpage.h"
#include "pageitem_textframe.h"
#include "pageitem_latexframe.h"
#include "prefsmanager.h"
113,6 → 113,7
GrCol2Shade(other.GrCol2Shade),
GrCol3Shade(other.GrCol3Shade),
GrCol4Shade(other.GrCol4Shade),
meshGradientPatches(other.meshGradientPatches),
meshGradientArray(other.meshGradientArray),
selectedMeshPointX(other.selectedMeshPointX),
selectedMeshPointY(other.selectedMeshPointY),
414,6 → 415,7
GrCol2Shade = 100;
GrCol3Shade = 100;
GrCol4Shade = 100;
meshGradientPatches.clear();
meshGradientArray.clear();
selectedMeshPointX = -1;
selectedMeshPointY = -1;
1163,7 → 1165,7
}
if (UndoManager::undoEnabled())
{
ItemState<std::pair<PageItem*, PageItem*> > *is = new ItemState<std::pair<PageItem*, PageItem*> >(UndoManager::LinkTextFrame);
ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >(UndoManager::LinkTextFrame);
is->set("LINK_TEXT_FRAME", "linkTextFrame");
is->setItem(std::pair<PageItem*, PageItem*>(this, NextBox));
undoManager->action(this, is);
1214,7 → 1216,7
NextBox = NULL;
if (UndoManager::undoEnabled())
{
ItemState<std::pair<PageItem*, PageItem*> > *is = new ItemState<std::pair<PageItem*, PageItem*> >(UndoManager::UnlinkTextFrame);
ScItemState<std::pair<PageItem*, PageItem*> > *is = new ScItemState<std::pair<PageItem*, PageItem*> >(UndoManager::UnlinkTextFrame);
is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame");
is->setItem(std::pair<PageItem*, PageItem*>(this, undoNextBox));
undoManager->action(this, is);
1487,6 → 1489,10
p->setFillMode(ScPainter::Gradient);
p->setMeshGradient(FPoint(0, 0), FPoint(width(), 0), FPoint(width(), height()), FPoint(0, height()), meshGradientArray);
break;
case 12:
p->setFillMode(ScPainter::Gradient);
p->setMeshGradient(FPoint(0, 0), FPoint(width(), 0), FPoint(width(), height()), FPoint(0, height()), meshGradientPatches);
break;
}
}
}
4016,7 → 4022,7
SimpleState *ss = dynamic_cast<SimpleState*>(state);
bool oldMPMode=m_Doc->masterPageMode();
m_Doc->setMasterPageMode(!OnMasterPage.isEmpty());
Page *oldCurrentPage = m_Doc->currentPage();
ScPage *oldCurrentPage = m_Doc->currentPage();
if (!OnMasterPage.isEmpty())
{
oldCurrentPage = m_Doc->currentPage();
4469,7 → 4475,7
}
else
{
ItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ItemState<std::pair<PageItem*, PageItem*> >*>(state);
ScItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(state);
asTextFrame()->link(is->getItem().second->asTextFrame());
}
}
4480,7 → 4486,7
return;
if (isUndo)
{
ItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ItemState<std::pair<PageItem*, PageItem*> >*>(state);
ScItemState<std::pair<PageItem*, PageItem*> > *is = dynamic_cast<ScItemState<std::pair<PageItem*, PageItem*> >*>(state);
asTextFrame()->link(is->getItem().second->asTextFrame());
}
else
4522,7 → 4528,7
 
void PageItem::restoreContourLine(SimpleState *state, bool isUndo)
{
ItemState<FPointArray> *is = dynamic_cast<ItemState<FPointArray>*>(state);
ScItemState<FPointArray> *is = dynamic_cast<ScItemState<FPointArray>*>(state);
if (is)
{
if (isUndo)
4540,7 → 4546,7
// OLD_FRAME_TYPE - original frame type
// NEW_FRAME_TYPE - change of frame type
// binary QPair<FPointArray, FPointArray> - .first original shape, .second new shape
ItemState<QPair<FPointArray,FPointArray> > *is = dynamic_cast<ItemState<QPair<FPointArray,FPointArray> >*>(state);
ScItemState<QPair<FPointArray,FPointArray> > *is = dynamic_cast<ScItemState<QPair<FPointArray,FPointArray> >*>(state);
if (is)
{
if (isUndo)
4582,8 → 4588,8
 
void PageItem::restoreShapeContour(UndoState *state, bool isUndo)
{
ItemState<QPair<FPointArray,FPointArray> > *istate =
dynamic_cast<ItemState<QPair<FPointArray,FPointArray> >*>(state);
ScItemState<QPair<FPointArray,FPointArray> > *istate =
dynamic_cast<ScItemState<QPair<FPointArray,FPointArray> >*>(state);
if (istate)
{
FPointArray oldClip = istate->getItem().first;
4621,8 → 4627,8
 
void PageItem::restoreImageEffects(UndoState *state, bool isUndo)
{
ItemState<QPair<ScImageEffectList, ScImageEffectList> > *istate =
dynamic_cast<ItemState<QPair<ScImageEffectList,ScImageEffectList> >*>(state);
ScItemState<QPair<ScImageEffectList, ScImageEffectList> > *istate =
dynamic_cast<ScItemState<QPair<ScImageEffectList,ScImageEffectList> >*>(state);
if (istate)
{
if (isUndo)
4781,7 → 4787,21
meshGradientArray[grow][gcol].colorName = *it;
}
}
 
for (int col = 0; col < meshGradientPatches.count(); col++)
{
it = newNames.colors().find(meshGradientPatches[col].TL.colorName);
if (it != newNames.colors().end())
meshGradientPatches[col].TL.colorName = *it;
it = newNames.colors().find(meshGradientPatches[col].TR.colorName);
if (it != newNames.colors().end())
meshGradientPatches[col].TR.colorName = *it;
it = newNames.colors().find(meshGradientPatches[col].BL.colorName);
if (it != newNames.colors().end())
meshGradientPatches[col].BL.colorName = *it;
it = newNames.colors().find(meshGradientPatches[col].BR.colorName);
if (it != newNames.colors().end())
meshGradientPatches[col].BR.colorName = *it;
}
cstops = stroke_gradient.colorStops();
for (uint cst = 0; cst < stroke_gradient.Stops(); ++cst)
{
4994,6 → 5014,16
}
}
}
else if (GrType == 12)
{
for (int col = 0; col < meshGradientPatches.count(); col++)
{
lists.collectColor(meshGradientPatches[col].TL.colorName);
lists.collectColor(meshGradientPatches[col].TR.colorName);
lists.collectColor(meshGradientPatches[col].BL.colorName);
lists.collectColor(meshGradientPatches[col].BR.colorName);
}
}
if (GrTypeStroke == 0)
lists.collectColor(lineColor());
else if (GrTypeStroke < 8)
6493,6 → 6523,13
meshGradientArray[grow][gcol].transform(ma);
}
}
for (int col = 0; col < meshGradientPatches.count(); col++)
{
meshGradientPatches[col].TL.transform(ma);
meshGradientPatches[col].TR.transform(ma);
meshGradientPatches[col].BL.transform(ma);
meshGradientPatches[col].BR.transform(ma);
}
GrStartX = gr.point(0).x();
GrStartY = gr.point(0).y();
GrEndX = gr.point(1).x();
6587,6 → 6624,13
meshGradientArray[grow][gcol].transform(ma);
}
}
for (int col = 0; col < meshGradientPatches.count(); col++)
{
meshGradientPatches[col].TL.transform(ma);
meshGradientPatches[col].TR.transform(ma);
meshGradientPatches[col].BL.transform(ma);
meshGradientPatches[col].BR.transform(ma);
}
GrStartX = gr.point(0).x();
GrStartY = gr.point(0).y();
GrEndX = gr.point(1).x();
/trunk/Scribus/scribus/scribusdoc.h
41,7 → 41,7
#include "colormgmt/sccolormgmtengine.h"
#include "documentinformation.h"
#include "observable.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pagestructs.h"
#include "prefsstructs.h"
49,6 → 49,7
#include "sclayer.h"
#include "styles/styleset.h"
#include "undoobject.h"
#include "undostate.h"
#include "updatemanager.h"
#include "usertaskstructs.h"
 
57,7 → 58,7
 
class DocUpdater;
class UndoManager;
class UndoState;
// class UndoState;
class PDFOptions;
class Hyphenator;
class Selection;
100,8 → 101,8
void resetControl(PageItem* currItem);
FPointArray beginTransaction(PageItem* currItem);
void finishTransaction(PageItem* currItem);
ItemState<QPair<FPointArray, FPointArray> >* finishTransaction1(PageItem* currItem);
void finishTransaction2(PageItem* currItem, ItemState<QPair<FPointArray, FPointArray> >* state);
ScItemState<QPair<FPointArray, FPointArray> >* finishTransaction1(PageItem* currItem);
void finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state);
void moveClipPoint(PageItem *currItem, FPoint ip);
};
 
142,7 → 143,7
UpdateManager* updateManager() { return &m_updateManager; }
MassObservable<PageItem*> * itemsChanged() { return &m_itemsChanged; }
MassObservable<Page*> * pagesChanged() { return &m_pagesChanged; }
MassObservable<ScPage*> * pagesChanged() { return &m_pagesChanged; }
MassObservable<QRectF> * regionsChanged() { return &m_regionsChanged; }
void invalidateAll();
230,10 → 231,10
 
// Add, delete and move pages
Page* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
ScPage* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
void deletePage(const int);
//! @brief Add a master page with this function, do not use addPage
Page* addMasterPage(const int, const QString&);
ScPage* addMasterPage(const int, const QString&);
void deleteMasterPage(const int);
//! @brief Rebuild master name list
void rebuildMasterNames(void);
794,8 → 795,8
double getXOffsetForPage(const int);
double getYOffsetForPage(const int);
void getBleeds(int pageNumber, MarginStruct& bleedData);
void getBleeds(const Page* page, MarginStruct& bleedData);
void getBleeds(const Page* page, const MarginStruct& baseValues, MarginStruct& bleedData);
void getBleeds(const ScPage* page, MarginStruct& bleedData);
void getBleeds(const ScPage* page, const MarginStruct& baseValues, MarginStruct& bleedData);
/**
* @brief Item type conversion functions
989,10 → 990,10
void changed();
/*! \brief Get pointer to the current page
\retval Page* current page object */
Page* currentPage();
ScPage* currentPage();
/*! \brief Set new current page
\param newPage New current page */
void setCurrentPage(Page *newPage);
void setCurrentPage(ScPage *newPage);
bool hasGUI() const {return m_hasGUI;}
/*! \brief Apply grid to a QPoint, from ScribusView */
QPoint ApplyGrid(const QPoint& in);
1001,7 → 1002,7
/*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); }
//! \brief Get the closest guide to the given point
void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, Page* refPage = NULL);
void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
//! \brief Snap an item to the guides
void SnapToGuides(PageItem *currItem);
bool ApplyGuides(double *x, double *y);
1071,13 → 1072,13
double rulerXoffset;
double rulerYoffset;
/** \brief List of Pages */
QList<Page*>* Pages;
QList<ScPage*>* Pages;
/** \brief List of Master Pages */
QList<Page*> MasterPages;
QList<ScPage*> MasterPages;
/** \brief List of Document Pages */
QList<Page*> DocPages;
QList<ScPage*> DocPages;
/** \brief List for temporary Pages */
QList<Page*> TempPages;
QList<ScPage*> TempPages;
/** \brief Mapping Master Page Name to Master Page numbers */
QMap<QString,int> MasterNames;
/** \brief List of Objects */
1181,7 → 1182,7
struct OpenNodesList
{
int type;
Page *page;
ScPage *page;
PageItem *item;
};
QList<OpenNodesList> OpenNodes;
1201,10 → 1202,10
UndoTransaction* m_itemCreationTransaction;
UndoTransaction* m_alignTransaction;
 
Page* m_currentPage;
ScPage* m_currentPage;
UpdateManager m_updateManager;
MassObservable<PageItem*> m_itemsChanged;
MassObservable<Page*> m_pagesChanged;
MassObservable<ScPage*> m_pagesChanged;
MassObservable<QRectF> m_regionsChanged;
DocUpdater* m_docUpdater;
/trunk/Scribus/scribus/scribusview.cpp
79,7 → 79,7
#include "commonstrings.h"
#include "filewatcher.h"
#include "hyphenator.h"
#include "page.h"
#include "scpage.h"
#include "pageitem_imageframe.h"
#include "pageitem_line.h"
#include "pageitem_pathtext.h"
1026,7 → 1026,7
for (int i = 0; i < Doc->m_Selection->count(); ++i)
{
PageItem* newItem = Doc->m_Selection->itemAt(i);
ItemState<PageItem*> *is = new ItemState<PageItem*>("Create PageItem");
ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
is->set("CREATE_ITEM", "create_item");
is->setItem(newItem);
//Undo target rests with the Page for object specific undo
2281,9 → 2281,9
 
//CB This MUST now be called AFTER a call to doc->addPage or doc->addMasterPage as it
//does NOT create a page anymore.
Page* ScribusView::addPage(int nr, bool mov)
ScPage* ScribusView::addPage(int nr, bool mov)
{
Page* fe=Doc->Pages->at(nr);
ScPage* fe=Doc->Pages->at(nr);
Q_ASSERT(fe!=0);
if (fe==0)
return 0;
2764,7 → 2764,7
double cx = Doc->minCanvasCoordinate.x();
double cy = Doc->minCanvasCoordinate.y();
Doc->minCanvasCoordinate = FPoint(0, 0);
Page* act = Doc->currentPage();
ScPage* act = Doc->currentPage();
bool mMode = Doc->masterPageMode();
Doc->setMasterPageMode(true);
Doc->setCurrentPage(Doc->MasterPages.at(Nr));
2840,7 → 2840,7
m_canvas->setScale(sc);
m_canvas->m_viewMode.previewMode = true;
m_canvas->m_viewMode.forceRedraw = true;
Page* act = Doc->currentPage();
ScPage* act = Doc->currentPage();
bool mMode = Doc->masterPageMode();
Doc->setMasterPageMode(false);
Doc->setLoading(true);
2859,7 → 2859,7
painter->setZoomFactor(m_canvas->scale());
 
QList<QPair<PageItem*, int> > changedList;
Page* page = Doc->DocPages.at(Nr);
ScPage* page = Doc->DocPages.at(Nr);
PageItem* currItem;
if (page->FromMaster.count() != 0)
{
/trunk/Scribus/scribus/pageitem_textframe.cpp
35,7 → 35,7
#include "commonstrings.h"
#include "ui/guidemanager.h"
#include "hyphenator.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_textframe.h"
#include "prefsmanager.h"
125,8 → 125,8
{
int LayerLev = m_Doc->layerLevelFromID(LayerID);
uint docItemsCount=m_Doc->Items->count();
Page* Mp=0;
Page* Dp=0;
ScPage* Mp=0;
ScPage* Dp=0;
PageItem* docItem=0;
int LayerLevItem;
if (!OnMasterPage.isEmpty())
/trunk/Scribus/scribus/vgradientex.h
88,7 → 88,8
radial = 1,
fourcolor = 2,
diamond = 3,
mesh = 4
mesh = 4,
freemesh = 5
};
 
enum RepeatMethod
/trunk/Scribus/scribus/ui/nodeeditpalette.cpp
8,7 → 8,7
#include <QEvent>
 
#include "nodeeditpalette.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "scribusview.h"
#include "selection.h"
530,7 → 530,7
PageItem *currItem = doc->m_Selection->itemAt(0);
if (UndoManager::undoEnabled())
{
ItemState<FPointArray> *is = new ItemState<FPointArray>(Um::ResetContourLine, "",Um::IBorder);
ScItemState<FPointArray> *is = new ScItemState<FPointArray>(Um::ResetContourLine, "",Um::IBorder);
is->set("RESET_CONTOUR", "reset_contour");
is->setItem(doc->m_Selection->itemAt(0)->ContourLine);
UndoManager::instance()->action(currItem, is);
/trunk/Scribus/scribus/ui/propertiespalette_utils.h
33,7 → 33,7
#include "scribusapi.h"
#include "scrspinbox.h"
#include "pageitem.h"
#include "page.h"
#include "scpage.h"
#include "linkbutton.h"
#include "linecombo.h"
#include "sclistboxpixmap.h"
/trunk/Scribus/scribus/ui/multiprogressdialog.h
94,6 → 94,12
*/
bool setLabel(const QString &barName, const QString & newLabel);
/**
* Sets a user defined progress bar to a busy bar
* @param barName
* @return Success
*/
bool setBusyIndicator(const QString &barName);
/**
* Set the total steps for a user defined progress bar
* @param barName
* @param totalSteps
/trunk/Scribus/scribus/ui/checkDocument.cpp
23,7 → 23,7
#include "sccombobox.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "prefsmanager.h"
#include "documentchecker.h"
#include "util_icon.h"
/trunk/Scribus/scribus/ui/symbolpalette.cpp
40,9 → 40,31
setResizeMode(QListView::Adjust);
setSelectionMode(QAbstractItemView::SingleSelection);
setContextMenuPolicy(Qt::CustomContextMenu);
delegate = new ScListWidgetDelegate(this, this);
setItemDelegate(delegate);
setIconSize(QSize(48, 48));
connect(this, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleContextMenu(QPoint)));
}
 
void SymbolView::HandleContextMenu(QPoint)
{
QMenu *pmenu = new QMenu();
QAction* viewAct;
viewAct = pmenu->addAction( tr("Display Icons only"));
viewAct->setCheckable(true);
viewAct->setChecked(delegate->iconOnly());
connect(viewAct, SIGNAL(triggered()), this, SLOT(changeDisplay()));
pmenu->exec(QCursor::pos());
delete pmenu;
}
 
void SymbolView::changeDisplay()
{
reset();
delegate->setIconOnly(!delegate->iconOnly());
repaint();
}
 
void SymbolView::dragEnterEvent(QDragEnterEvent *e)
{
if (e->source() == this)
71,6 → 93,41
e->ignore();
}
 
bool SymbolView::viewportEvent(QEvent *event)
{
if (event != NULL)
{
if (event->type() == QEvent::ToolTip)
{
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
QListWidgetItem* it = itemAt(helpEvent->pos());
if (it != NULL)
{
event->accept();
QString tipText = it->text();
QToolTip::showText(helpEvent->globalPos(), tipText, this);
return true;
}
}
else if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton)
return true;
}
else if (event->type() == QEvent::MouseButtonRelease)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::RightButton)
{
emit customContextMenuRequested(mouseEvent->pos());
return true;
}
}
}
return QListWidget::viewportEvent(event);
}
 
void SymbolView::startDrag(Qt::DropActions supportedActions)
{
QMimeData *mimeData = new QMimeData;
/trunk/Scribus/scribus/ui/cpalette.cpp
51,11 → 51,12
#include "gradienteditor.h"
#include "insertTable.h"
#include "units.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "util_icon.h"
#include "commonstrings.h"
#include "sccolorengine.h"
#include "sclistwidgetdelegate.h"
#include "scpainter.h"
#include "scpattern.h"
#include "scribus.h"
78,6 → 79,14
strokeModeCombo->addItem( tr("Solid") );
strokeModeCombo->addItem( tr("Gradient") );
 
/* Setting a delegate to dispaly only icons for the patterns */
/* ScListWidgetDelegate* delegateF = new ScListWidgetDelegate(patternBox, patternBox);
delegateF->setIconOnly(true);
patternBox->setItemDelegate(delegateF);
ScListWidgetDelegate* delegateS = new ScListWidgetDelegate(patternBoxStroke, patternBoxStroke);
delegateS->setIconOnly(true);
patternBoxStroke->setItemDelegate(delegateS);
*/
gradEdit->layout()->setAlignment(Qt::AlignTop);
gradEditStroke->layout()->setAlignment(Qt::AlignTop);
gradientTypeStroke->setCurrentIndex(0);
860,7 → 869,7
}
if (number == 0)
fillModeCombo->setCurrentIndex(0);
else if (((number > 0) && (number < 8)) || (number == 9) || (number == 10) || (number == 11))
else if (((number > 0) && (number < 8)) || (number == 9) || (number == 10) || (number == 11) || (number == 12))
{
if ((number == 5) || (number == 7))
{
913,6 → 922,11
}
gradientType->setCurrentIndex(4);
}
else if (number == 12)
{
stackedWidget_2->setCurrentIndex(2);
gradientType->setCurrentIndex(5);
}
else
{
stackedWidget_2->setCurrentIndex(0);
1009,6 → 1023,11
}
emit NewGradient(11);
}
else if (gradientType->currentIndex() == 5)
{
stackedWidget_2->setCurrentIndex(2);
emit NewGradient(12);
}
connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
connect(gradEdit, SIGNAL(gradientChanged()) , this, SLOT(handleFillGradient()));
1078,6 → 1097,11
}
emit NewGradient(11);
}
else if (type == 5)
{
stackedWidget_2->setCurrentIndex(2);
emit NewGradient(12);
}
}
 
void Cpalette::slotGradTypeStroke(int type)
/trunk/Scribus/scribus/ui/pagepalette.cpp
20,7 → 20,7
#include <QPainter>
 
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "pagelayout.h"
#include "pagepalette.h"
#include "sccombobox.h"
/trunk/Scribus/scribus/ui/colorpalette.ui
1,858 → 1,863
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>colorPalette</class>
<widget class="QWidget" name="colorPalette">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>258</width>
<height>360</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>5</number>
</property>
<item>
<widget class="QTabWidget" name="tabFillStroke">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabFill">
<attribute name="title">
<string>Fill</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="fillModeLabel">
<property name="text">
<string>Fill Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fillModeCombo"/>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="fillModeStack">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="solidFillPage">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="ColorListBox" name="colorListFill"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Shade:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="fillShade">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="gradientFillPage">
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="gradientType">
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Radial</string>
</property>
</item>
<item>
<property name="text">
<string>4 Colors</string>
</property>
</item>
<item>
<property name="text">
<string>Diamond</string>
</property>
</item>
<item>
<property name="text">
<string>Mesh</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="gradEditButton">
<property name="text">
<string>Move Vector</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget_2">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="ScComboBox" name="namedGradient"/>
</item>
<item>
<widget class="GradientEditor" name="gradEdit">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Shade</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Transparency</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="ColorCombo" name="colorPoint1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="color1Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="color1Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="ColorCombo" name="colorPoint2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="color2Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="color2Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="ColorCombo" name="colorPoint3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="color3Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="color3Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="ColorCombo" name="colorPoint4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="color4Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QSpinBox" name="color4Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>70</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_5">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="ColorCombo" name="colorMeshPoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Shade:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="shadeMeshPoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Transparency:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="transparencyMeshPoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QToolButton" name="editMeshColors">
<property name="text">
<string>Edit Colors</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="patternFillPage">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="patternBox">
<property name="movement">
<enum>QListView::Snap</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QToolButton" name="editPatternProps">
<property name="text">
<string>Properties...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabStroke">
<attribute name="title">
<string>Stroke</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="strokeModeLabel">
<property name="text">
<string>Stroke Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="strokeModeCombo"/>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="strokeModeStack">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="solidStrokePage">
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="ColorListBox" name="colorListStroke"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Shade:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="strokeShade">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="gradientStrokePage">
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QComboBox" name="gradientTypeStroke">
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Radial</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="gradEditButtonStroke">
<property name="text">
<string>Move Vector</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="ScComboBox" name="namedGradientStroke"/>
</item>
<item>
<widget class="GradientEditor" name="gradEditStroke">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="patternStrokePage">
<layout class="QVBoxLayout" name="verticalLayout_14">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="patternBoxStroke">
<property name="movement">
<enum>QListView::Snap</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QToolButton" name="editPatternPropsStroke">
<property name="text">
<string>Properties...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="followsPath">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Pattern follows Path</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="overprintLabel">
<property name="text">
<string>Overprinting</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="overPrintCombo">
<item>
<property name="text">
<string>Knockout</string>
</property>
</item>
<item>
<property name="text">
<string>Overprint</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="displayAllColors">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Display only used colors</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ScComboBox</class>
<extends>QComboBox</extends>
<header>ui/sccombobox.h</header>
</customwidget>
<customwidget>
<class>GradientEditor</class>
<extends>QFrame</extends>
<header>ui/gradienteditor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ColorListBox</class>
<extends>QListWidget</extends>
<header>ui/colorlistbox.h</header>
</customwidget>
<customwidget>
<class>ColorCombo</class>
<extends>QComboBox</extends>
<header>ui/colorcombo.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>colorPalette</class>
<widget class="QWidget" name="colorPalette">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>258</width>
<height>360</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>5</number>
</property>
<item>
<widget class="QTabWidget" name="tabFillStroke">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabFill">
<attribute name="title">
<string>Fill</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="fillModeLabel">
<property name="text">
<string>Fill Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fillModeCombo"/>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="fillModeStack">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="solidFillPage">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="ColorListBox" name="colorListFill"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Shade:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="fillShade">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="gradientFillPage">
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="gradientType">
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Radial</string>
</property>
</item>
<item>
<property name="text">
<string>4 Colors</string>
</property>
</item>
<item>
<property name="text">
<string>Diamond</string>
</property>
</item>
<item>
<property name="text">
<string>Mesh</string>
</property>
</item>
<item>
<property name="text">
<string>Patch Mesh</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="gradEditButton">
<property name="text">
<string>Move Vector</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget_2">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="ScComboBox" name="namedGradient"/>
</item>
<item>
<widget class="GradientEditor" name="gradEdit">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Shade</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Transparency</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="ColorCombo" name="colorPoint1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="color1Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="color1Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="ColorCombo" name="colorPoint2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="color2Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="color2Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="ColorCombo" name="colorPoint3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="color3Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="color3Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="ColorCombo" name="colorPoint4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="color4Shade">
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QSpinBox" name="color4Alpha">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>70</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_5">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="ColorCombo" name="colorMeshPoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Shade:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="shadeMeshPoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Transparency:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="transparencyMeshPoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QToolButton" name="editMeshColors">
<property name="text">
<string>Edit Colors</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="patternFillPage">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="patternBox">
<property name="movement">
<enum>QListView::Snap</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QToolButton" name="editPatternProps">
<property name="text">
<string>Properties...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabStroke">
<attribute name="title">
<string>Stroke</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="strokeModeLabel">
<property name="text">
<string>Stroke Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="strokeModeCombo"/>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="strokeModeStack">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="solidStrokePage">
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="ColorListBox" name="colorListStroke"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Shade:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="strokeShade">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="gradientStrokePage">
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QComboBox" name="gradientTypeStroke">
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Radial</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="gradEditButtonStroke">
<property name="text">
<string>Move Vector</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="ScComboBox" name="namedGradientStroke"/>
</item>
<item>
<widget class="GradientEditor" name="gradEditStroke">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="patternStrokePage">
<layout class="QVBoxLayout" name="verticalLayout_14">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="patternBoxStroke">
<property name="movement">
<enum>QListView::Snap</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QToolButton" name="editPatternPropsStroke">
<property name="text">
<string>Properties...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="followsPath">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Pattern follows Path</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="overprintLabel">
<property name="text">
<string>Overprinting</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="overPrintCombo">
<item>
<property name="text">
<string>Knockout</string>
</property>
</item>
<item>
<property name="text">
<string>Overprint</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="displayAllColors">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Display only used colors</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ScComboBox</class>
<extends>QComboBox</extends>
<header>ui/sccombobox.h</header>
</customwidget>
<customwidget>
<class>GradientEditor</class>
<extends>QFrame</extends>
<header>ui/gradienteditor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ColorListBox</class>
<extends>QListWidget</extends>
<header>ui/colorlistbox.h</header>
</customwidget>
<customwidget>
<class>ColorCombo</class>
<extends>QComboBox</extends>
<header>ui/colorcombo.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/trunk/Scribus/scribus/ui/guidemanager.cpp
24,7 → 24,7
 
#include "guidemanager.h"
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "scinputdialog.h"
#include "scribuscore.h"
#include "scribusdoc.h"
188,7 → 188,7
// drawGuides(); let Canvas::DrawPageMarks take care of it and avoid a costly ScribusView::DrawNew()
}
 
void GuideManager::storePageValues(Page *page)
void GuideManager::storePageValues(ScPage *page)
{
if (!page || !m_Doc)
return;
355,8 → 355,8
 
void GuideManager::copyGuidesToAllPages(GuideManagerCore::GuideType t)
{
QListIterator<Page*> it(*m_Doc->Pages);
Page *tmpPage;
QListIterator<ScPage*> it(*m_Doc->Pages);
ScPage *tmpPage;
while (it.hasNext())
{
tmpPage=it.next();
567,7 → 567,7
QDialog::windowActivationChange( oldActive );
}
 
Guides GuideManager::getAutoVerticals(Page * page)
Guides GuideManager::getAutoVerticals(ScPage * page)
{
GuideManagerCore guides;
 
588,7 → 588,7
return guides.getAutoVerticals(page);
}
 
Guides GuideManager::getAutoHorizontals(Page * page)
Guides GuideManager::getAutoHorizontals(ScPage * page)
{
GuideManagerCore guides;
 
/trunk/Scribus/scribus/ui/missing.cpp
15,7 → 15,7
 
#include "fontcombo.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "prefsmanager.h"
#include "commonstrings.h"
#include "util_icon.h"
/trunk/Scribus/scribus/ui/fontcombo.cpp
33,7 → 33,7
 
#include "scribusdoc.h"
#include "fontcombo.h"
#include "page.h"
#include "scpage.h"
#include "prefsmanager.h"
#include "util_icon.h"
#include "util.h"
/trunk/Scribus/scribus/ui/sclistwidgetdelegate.cpp
0,0 → 1,66
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
sclistwidgetdelegate.cpp - description
-------------------
begin : Sat June 18 2011
copyright : (C) 2011 by Franz Schmid
email : Franz.Schmid@altmuehlnet.de
***************************************************************************/
 
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
#include <QPainter>
#include "sclistwidgetdelegate.h"
 
ScListWidgetDelegate::ScListWidgetDelegate(QListWidget *view, QWidget *parent) : QItemDelegate(parent), m_view(view)
{
m_dispIconOnly = false;
}
 
void ScListWidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
const QAbstractItemModel *model = index.model();
Q_ASSERT(model);
if (m_dispIconOnly)
{
painter->save();
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
painter->drawPixmap(option.rect, icon.pixmap(m_view->iconSize()));
painter->restore();
}
else
QItemDelegate::paint(painter, option, index);
}
 
QSize ScListWidgetDelegate::sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const
{
QStyleOptionViewItem option = opt;
if (m_dispIconOnly)
{
QSize sz = m_view->iconSize();
return sz;
}
return QItemDelegate::sizeHint(opt, index);
}
 
void ScListWidgetDelegate::setIconOnly(bool setter)
{
m_dispIconOnly = setter;
}
 
bool ScListWidgetDelegate::iconOnly()
{
return m_dispIconOnly;
}
/trunk/Scribus/scribus/ui/propertiespalette.cpp
491,7 → 491,7
int currentTab = TabStack->currentIndex();
disconnect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
 
qDebug() << "PropertiesPalette::handleSelectionChanged()";
// qDebug() << "PropertiesPalette::handleSelectionChanged()";
 
/*xyzPal->handleSelectionChanged();
shapePal->handleSelectionChanged();
/trunk/Scribus/scribus/ui/colorlistbox.cpp
446,7 → 446,9
 
bool ColorListBox::viewportEvent(QEvent *event)
{
/* commented out because of random crashes in the colorcombobox of the gradient editor
if (event != NULL)
{
/* commented out because of random crashes in the colorcombobox of the gradient editor */
if (event->type() == QEvent::ToolTip)
{
if (cList != NULL)
478,7 → 480,7
}
}
}
else */
else
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
494,5 → 496,6
return true;
}
}
}
return QListWidget::viewportEvent(event);
}
/trunk/Scribus/scribus/ui/outlinepalette.cpp
25,7 → 25,7
#include "commonstrings.h"
#include "contextmenu.h"
#include "outlinepalette.h"
#include "page.h"
#include "scpage.h"
#include "propertiespalette.h"
#include "scribus.h"
#include "selection.h"
/trunk/Scribus/scribus/ui/sclistwidgetdelegate.h
0,0 → 1,44
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
sclistwidgetdelegate.h - description
-------------------
copyright : Scribus Team
***************************************************************************/
 
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
#ifndef SCLISTWIDGETDELEGATE_H
#define SCLISTWIDGETDELEGATE_H
 
#include <QItemDelegate>
#include <QListWidget>
#include "scribusapi.h"
 
class SCRIBUS_API ScListWidgetDelegate : public QItemDelegate
{
Q_OBJECT
public:
ScListWidgetDelegate(QListWidget *view, QWidget *parent);
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual QSize sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const;
void setIconOnly(bool setter);
bool iconOnly();
 
private:
QListWidget *m_view;
bool m_dispIconOnly;
};
 
#endif // SCLISTWIDGETDELEGATE_H
/trunk/Scribus/scribus/ui/vruler.cpp
34,7 → 34,7
#include <cmath>
 
#include "canvasgesture_rulermove.h"
#include "page.h"
#include "scpage.h"
#include "prefsmanager.h"
#include "scribus.h"
#include "scribusdoc.h"
/trunk/Scribus/scribus/ui/preview.cpp
1283,7 → 1283,7
}
}
}
const Page* page = doc->Pages->at(Seite);
const ScPage* page = doc->Pages->at(Seite);
if ((page->orientation() == 1) && (image.width() < image.height()))
image = image.transformed( QMatrix(0, 1, -1, 0, 0, 0) );
if (AliasTr->isChecked())
/trunk/Scribus/scribus/ui/margindialog.cpp
17,7 → 17,7
#include "margindialog.h"
#include "marginwidget.h"
#include "pagestructs.h"
#include "page.h"
#include "scpage.h"
#include "scribusdoc.h"
#include "units.h"
#include "scrspinbox.h"
/trunk/Scribus/scribus/ui/spalette.cpp
26,7 → 26,7
 
#include <QListView>
 
#include "page.h"
#include "scpage.h"
#include "util.h"
 
ParaStyleComboBox::ParaStyleComboBox(QWidget* parent) : QComboBox(parent)
/trunk/Scribus/scribus/ui/hruler.cpp
35,7 → 35,7
 
#include "canvasgesture_rulermove.h"
#include "hruler.h"
#include "page.h"
#include "scpage.h"
#include "prefsmanager.h"
#include "scribus.h"
#include "scribusdoc.h"
/trunk/Scribus/scribus/ui/search.cpp
24,7 → 24,7
#include "colorcombo.h"
#include "fontcombo.h"
#include "scrspinbox.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/ui/effectsdialog.cpp
27,7 → 27,7
#include "cmsettings.h"
#include "colorcombo.h"
#include "curvewidget.h"
#include "page.h"
#include "scpage.h"
#include "sccombobox.h"
#include "scclocale.h"
#include "scribusdoc.h"
/trunk/Scribus/scribus/ui/annot.cpp
53,7 → 53,7
#include "util_icon.h"
#include "util.h"
 
Annot::Annot(QWidget* parent, PageItem *it, int Seite, int b, int h, ColorList Farben, ScribusView* vie)
ScAnnot::ScAnnot(QWidget* parent, PageItem *it, int Seite, int b, int h, ColorList Farben, ScribusView* vie)
: QDialog( parent )
{
ScribusDoc* doc = Farben.document();
1196,10 → 1196,10
resize( minimumSizeHint() );
}
 
Annot::~Annot()
ScAnnot::~ScAnnot()
{}
 
void Annot::NewName()
void ScAnnot::NewName()
{
QString NameNew = Name->text();
if (NameNew.isEmpty())
1234,7 → 1234,7
}
}
 
void Annot::IPlace()
void ScAnnot::IPlace()
{
ButtonIcon* dia = new ButtonIcon(this, item);
if (dia->exec())
1268,7 → 1268,7
delete dia;
}
 
void Annot::RemoveNIcon()
void ScAnnot::RemoveNIcon()
{
NiconPrev->clear();
item->Pfile = "";
1276,7 → 1276,7
IconNR->setEnabled(false);
}
 
void Annot::RemovePIcon()
void ScAnnot::RemovePIcon()
{
PiconPrev->clear();
item->Pfile2 = "";
1283,7 → 1283,7
IconPR->setEnabled(false);
}
 
void Annot::RemoveRIcon()
void ScAnnot::RemoveRIcon()
{
RiconPrev->clear();
item->Pfile3 = "";
1290,7 → 1290,7
IconRR->setEnabled(false);
}
 
void Annot::IconsEin()
void ScAnnot::IconsEin()
{
bool setter = !UseIcons->isChecked() ? false : true;
IconN->setEnabled(setter);
1307,7 → 1307,7
item->annotation().setUseIcons(UseIcons->isChecked());
}
 
void Annot::GetNIcon()
void ScAnnot::GetNIcon()
{
QString fileName;
QString wdir = dirs->get("icon", ".");
1339,7 → 1339,7
}
}
 
void Annot::GetPIcon()
void ScAnnot::GetPIcon()
{
QString fileName;
QString wdir = dirs->get("icon", ".");
1364,7 → 1364,7
}
}
 
void Annot::GetRIcon()
void ScAnnot::GetRIcon()
{
QString fileName;
QString wdir = dirs->get("icon", ".");
1389,7 → 1389,7
}
}
 
void Annot::SelectFelder()
void ScAnnot::SelectFelder()
{
SelectFields* dia = new SelectFields(this, CalcFields->text(), item->itemName(), view->Doc, 3);
if (dia->exec())
1397,7 → 1397,7
delete dia;
}
 
void Annot::editKeySc()
void ScAnnot::editKeySc()
{
Editor* dia = new Editor(this, item->annotation().K_act(), view);
if (dia->exec())
1408,7 → 1408,7
delete dia;
}
 
void Annot::editFormatSc()
void ScAnnot::editFormatSc()
{
Editor* dia = new Editor(this, item->annotation().F_act(), view);
if (dia->exec())
1419,7 → 1419,7
delete dia;
}
 
void Annot::editValidSc()
void ScAnnot::editValidSc()
{
Editor* dia = new Editor(this, item->annotation().V_act(), view);
if (dia->exec())
1430,7 → 1430,7
delete dia;
}
 
void Annot::editCalcSc()
void ScAnnot::editCalcSc()
{
Editor* dia = new Editor(this, item->annotation().C_act(), view);
if (dia->exec())
1441,7 → 1441,7
delete dia;
}
 
void Annot::editJavaSc()
void ScAnnot::editJavaSc()
{
Editor* dia = new Editor(this, EditJava->toPlainText(), view);
if (dia->exec())
1449,7 → 1449,7
delete dia;
}
 
void Annot::setDateSample(const QString& ds)
void ScAnnot::setDateSample(const QString& ds)
{
QDateTime dt = QDateTime::currentDateTime();
QString tmp = "";
1490,7 → 1490,7
TextDa1->setText( tr("Example:")+" "+dt.toString(tmp));
}
 
void Annot::DecodeVali()
void ScAnnot::DecodeVali()
{
QString pfor = item->annotation().V_act();
int ss = pfor.indexOf("(");
1501,7 → 1501,7
MaxValid->setText(pfol[3].simplified());
}
 
void Annot::DecodeCalc()
void ScAnnot::DecodeCalc()
{
QString tm = "";
QString tm2;
1534,7 → 1534,7
}
}
 
void Annot::DecodeNum()
void ScAnnot::DecodeNum()
{
QString pfor = item->annotation().F_act();
int ss = pfor.indexOf("(");
1636,7 → 1636,7
}
}
 
void Annot::SetFormNum()
void ScAnnot::SetFormNum()
{
switch (item->annotation().Format())
{
1673,7 → 1673,7
}
}
 
void Annot::HandleVali()
void ScAnnot::HandleVali()
{
bool setter = SimpleValid->isChecked() ? true : false;
MaxValid->setEnabled(setter);
1683,7 → 1683,7
EditValScript->setEnabled(true);
}
 
void Annot::SetVali()
void ScAnnot::SetVali()
{
MaxValid->setEnabled(false);
MinValid->setEnabled(false);
1709,7 → 1709,7
}
}
 
void Annot::HandleCalc()
void ScAnnot::HandleCalc()
{
bool setter = SimpleCalc->isChecked() ? true : false;
CalcFields->setEnabled(setter);
1720,7 → 1720,7
EditCalc->setEnabled(true);
}
 
void Annot::SetCalc()
void ScAnnot::SetCalc()
{
CalcFields->setEnabled(false);
CalcArt->setEnabled(false);
1747,7 → 1747,7
}
}
 
void Annot::SetCurr()
void ScAnnot::SetCurr()
{
bool setter = UseCurr->isChecked() ? true : false;
CurSym->setEnabled(setter);
1754,7 → 1754,7
PreCurr->setEnabled(setter);
}
 
void Annot::SetFoScript(int it)
void ScAnnot::SetFoScript(int it)
{
if (it >= 0 && it <=5)
FoFram->setCurrentIndex(it);
1772,13 → 1772,13
item->annotation().setFormat(it);
}
 
void Annot::SetCoords(double x, double y)
void ScAnnot::SetCoords(double x, double y)
{
SpinBox21->setValue(static_cast<int>(x*Width));
SpinBox31->setValue(static_cast<int>(y*Height));
}
 
void Annot::SetPage(int v)
void ScAnnot::SetPage(int v)
{
disconnect(SpinBox11, SIGNAL(valueChanged(int)), this, SLOT(SetPage(int)));
if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
1805,7 → 1805,7
connect(SpinBox11, SIGNAL(valueChanged(int)), this, SLOT(SetPage(int)));
}
 
void Annot::SetCross()
void ScAnnot::SetCross()
{
int x,y;
disconnect(Pg1, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
1815,7 → 1815,7
connect(Pg1, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
}
 
void Annot::SetValues()
void ScAnnot::SetValues()
{
QString tmp, tmp2;
QString Nfo("");
2048,7 → 2048,7
accept();
}
 
void Annot::SetAnnotationType(int it)
void ScAnnot::SetAnnotationType(int it)
{
disconnect(ActionCombo, SIGNAL(activated(int)), this, SLOT(SetActionType(int)));
disconnect(TxFormat, SIGNAL(activated(int)), this, SLOT(SetFoScript(int)));
2143,12 → 2143,12
connect(TxFormat, SIGNAL(activated(int)), this, SLOT(SetFoScript(int)));
}
 
void Annot::SetLimit()
void ScAnnot::SetLimit()
{
Limit->isChecked() ? MaxChars->setEnabled(true) :MaxChars->setEnabled(false);
}
 
void Annot::SetExternLink()
void ScAnnot::SetExternLink()
{
disconnect(LExtern, SIGNAL(clicked()), this, SLOT(SetExternLink()));
bool enable;
2188,7 → 2188,7
connect(LExtern, SIGNAL(clicked()), this, SLOT(SetExternLink()));
}
 
void Annot::SetActionType(int it)
void ScAnnot::SetActionType(int it)
{
bool setter;
switch (it)
2220,7 → 2220,7
}
}
 
void Annot::SetActionScript(int it)
void ScAnnot::SetActionScript(int it)
{
switch (ScrEdited)
{
2273,7 → 2273,7
ScrEdited = it;
}
 
void Annot::GetFile()
void ScAnnot::GetFile()
{
QString fn;
QString wdir = dirs->get("annot_getfile", ".");
/trunk/Scribus/scribus/ui/applytemplatedialog.cpp
29,7 → 29,7
 
#include "commonstrings.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "util_icon.h"
 
enum {
/trunk/Scribus/scribus/ui/outlinepalette.h
22,7 → 22,7
class ScribusMainWindow;
class ScribusDoc;
class PageItem;
class Page;
class ScPage;
 
class SCRIBUS_API OutlineTreeItem : public QTreeWidgetItem
{
31,7 → 31,7
OutlineTreeItem(QTreeWidget* parent, OutlineTreeItem* after);
~OutlineTreeItem() {};
PageItem *PageItemObject;
Page *PageObject;
ScPage *PageObject;
int type;
};
 
/trunk/Scribus/scribus/ui/masterpagepalette.cpp
23,7 → 23,7
#include "commonstrings.h"
#include "mergedoc.h"
#include "newtemp.h"
#include "page.h"
#include "scpage.h"
#include "pagestructs.h"
#include "selection.h"
#include "prefsmanager.h"
208,8 → 208,8
PrefsManager* prefsManager = PrefsManager::instance();
int inde = currentDoc->MasterNames[sMuster];
int nr = currentDoc->Pages->count();
Page* from = currentDoc->Pages->at(inde);
Page* destination = currentDoc->addMasterPage(nr, MasterPageName);
ScPage* from = currentDoc->Pages->at(inde);
ScPage* destination = currentDoc->addMasterPage(nr, MasterPageName);
if (currentDoc->pagePositioning() != singlePage)
{
int lp = dia->Links->currentIndex();
/trunk/Scribus/scribus/ui/applytemplatedialog.h
20,7 → 20,7
 
#include "scribusapi.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
 
class QCheckBox;
class QComboBox;
/trunk/Scribus/scribus/ui/multiprogressdialog.cpp
107,6 → 107,17
return false;
}
 
bool MultiProgressDialog::setBusyIndicator(const QString &barName)
{
if (progressBars.contains(barName))
{
progressBars[barName]->setMaximum(0);
progressBars[barName]->setMinimum(0);
return true;
}
return false;
}
 
bool MultiProgressDialog::setTotalSteps(const QString &barName, int totalSteps)
{
if (progressBars.contains(barName))
/trunk/Scribus/scribus/ui/propertiespalette.h
22,7 → 22,7
#include "scguardedptr.h"
#include "scrspinbox.h"
#include "pageitem.h"
#include "page.h"
#include "scpage.h"
#include "linkbutton.h"
#include "linecombo.h"
#include "spalette.h"
/trunk/Scribus/scribus/ui/annot.h
34,13 → 34,13
class ScribusView;
class PrefsContext;
 
class SCRIBUS_API Annot : public QDialog
class SCRIBUS_API ScAnnot : public QDialog
{
Q_OBJECT
 
public:
Annot ( QWidget* parent, PageItem *it, int Seite, int b, int h, ColorList Farben, ScribusView* vie );
~Annot();
ScAnnot ( QWidget* parent, PageItem *it, int Seite, int b, int h, ColorList Farben, ScribusView* vie );
~ScAnnot();
void DecodeNum();
void DecodeVali();
void DecodeCalc();
/trunk/Scribus/scribus/ui/javadocs.cpp
16,7 → 16,7
#include "editor.h"
#include "ui/scmessagebox.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "commonstrings.h"
#include "query.h"
#include "util_icon.h"
/trunk/Scribus/scribus/ui/prefs_tableofcontents.cpp
8,7 → 8,7
#include "ui/prefs_tableofcontents.h"
#include "pagestructs.h"
#include "prefsstructs.h"
#include "page.h"
#include "scpage.h"
#include "scribusdoc.h"
#include "commonstrings.h"
#include "util.h"
/trunk/Scribus/scribus/ui/newtemp.cpp
15,7 → 15,7
#include <QLabel>
#include <QPushButton>
 
#include "page.h"
#include "scpage.h"
#include "pagestructs.h"
#include "scribusdoc.h"
#include "commonstrings.h"
/trunk/Scribus/scribus/ui/dcolor.cpp
15,7 → 15,7
 
#include "commonstrings.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "colorcombo.h"
#include "prefsmanager.h"
 
/trunk/Scribus/scribus/ui/inspage.cpp
14,7 → 14,7
#include <QCheckBox>
#include <QPushButton>
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "units.h"
#include "scrspinbox.h"
#include "pagesize.h"
/trunk/Scribus/scribus/ui/symbolpalette.h
41,6 → 41,7
 
#include "scribusapi.h"
#include "scdockpalette.h"
#include "sclistwidgetdelegate.h"
 
class SCRIBUS_API SymbolView : public QListWidget
{
50,11 → 51,19
SymbolView( QWidget* parent);
~SymbolView() {};
 
public slots:
void HandleContextMenu(QPoint);
void changeDisplay();
 
protected:
bool viewportEvent(QEvent *event);
void dragEnterEvent(QDragEnterEvent *e);
void dragMoveEvent(QDragMoveEvent *e);
void dropEvent(QDropEvent *e);
void startDrag(Qt::DropActions supportedActions);
 
private:
ScListWidgetDelegate* delegate;
};
 
class SCRIBUS_API SymbolPalette : public ScDockPalette
90,4 → 99,4
QStringList editItemNames;
};
 
#endif
#endif
/trunk/Scribus/scribus/ui/aligndistribute.cpp
35,7 → 35,7
#include <QVariant>
 
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "ui/scmessagebox.h"
#include "scribusdoc.h"
#include "ui/scrspinbox.h"
/trunk/Scribus/scribus/ui/guidemanager.h
13,7 → 13,7
#include "guidemanagercore.h"
#include "ui/scrpalettebase.h"
#include "scribusstructs.h"
#include "page.h"
#include "scpage.h"
 
class GuidesModel;
class ScribusDoc;
76,7 → 76,7
 
ScribusDoc* m_Doc;
//! \brief a reference to the current pages
Page * currentPage;
ScPage * currentPage;
//! \brief A flag to prevent guides drawing when it's not needed
bool m_drawGuides;
 
97,7 → 97,7
/*! \brief Save needed (Auto) values into GuideManagerCore.
To be restored on the page return.
\param page A reference to the page to store values. */
void storePageValues(Page * page);
void storePageValues(ScPage * page);
 
/*! \brief Overriden QDialog method to operate selection related widgets.
Auto guides tab. It disables the "selection" radio buttons when there
108,13 → 108,13
Calculates positions of the guides.
\param p a Page for what should be calculation performed
*/
Guides getAutoHorizontals(Page * p);
Guides getAutoHorizontals(ScPage * p);
 
/*! \brief Create automatic vertical guides.
Calculates positions of the guides.
\param p a Page for what should be calculation performed
*/
Guides getAutoVerticals(Page * p);
Guides getAutoVerticals(ScPage * p);
 
/*! \brief Recalculate the selection position and measurements for the current page.
It's used for automatic guides position. It's called for every
/trunk/Scribus/scribus/guidemanagercore.h
14,7 → 14,7
#include "scribusapi.h"
 
class QColor;
class Page;
class ScPage;
class ScPainter;
class UndoManager;
class ScribusDoc;
37,7 → 37,7
{
public:
GuideManagerCore();
GuideManagerCore(Page* parentPage);
GuideManagerCore(ScPage* parentPage);
~GuideManagerCore();
 
typedef enum {Standard, Auto} GuideType;
56,8 → 56,8
double horizontal(uint ix, GuideType type);
double vertical(uint ix, GuideType type);
 
Guides getAutoHorizontals(Page* page = NULL);
Guides getAutoVerticals(Page* page = NULL);
Guides getAutoHorizontals(ScPage* page = NULL);
Guides getAutoVerticals(ScPage* page = NULL);
 
void clearHorizontals(GuideType type);
void clearVerticals(GuideType type);
70,7 → 70,7
int isMouseOnHorizontal(double low, double high, GuideType type);
int isMouseOnVertical(double low, double high, GuideType type);
 
void setPage(Page *p);
void setPage(ScPage *p);
 
QPair<double, double> topLeft(double x, double y);// const;
QPair<double, double> topRight(double x, double y);// const;
110,7 → 110,7
 
private:
UndoManager * const undoManager;
Page* m_page;
ScPage* m_page;
Guides horizontalStdG;
Guides verticalStdG;
Guides horizontalAutoG;
150,7 → 150,7
in the ancient times. So when is the obsolete XML attribute found in reading document
the old reading method is used. All guides are saved in new format then. */
static void readHorizontalGuides(const QString guideString,
Page *page,
ScPage *page,
GuideManagerCore::GuideType type,
bool useOldGuides=false);
 
164,15 → 164,15
in the ancient times. So when is the obsolete XML attribute found in reading document
the old reading method is used. All guides are saved in new format then. */
static void readVerticalGuides(const QString guideString,
Page *page,
ScPage *page,
GuideManagerCore::GuideType type,
bool useOldGuides=false);
 
static QString writeHorizontalGuides(Page *page, GuideManagerCore::GuideType type);
static QString writeVerticalGuides(Page *page, GuideManagerCore::GuideType type);
static QString writeHorizontalGuides(ScPage *page, GuideManagerCore::GuideType type);
static QString writeVerticalGuides(ScPage *page, GuideManagerCore::GuideType type);
 
static void readSelection(const QString guideString, Page *page);
static QString writeSelection(Page *page);
static void readSelection(const QString guideString, ScPage *page);
static QString writeSelection(ScPage *page);
};
 
#endif
/trunk/Scribus/scribus/pageitem_imageframe.cpp
30,7 → 30,7
#include <cassert>
 
#include "filewatcher.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/scribus.cpp
99,7 → 99,7
#include "gtgettext.h"
#include "hyphenator.h"
#include "langmgr.h"
#include "page.h"
#include "scpage.h"
#include "pageitem_imageframe.h"
#include "pageitem_latexframe.h"
#include "pageitem_textframe.h"
5541,7 → 5541,7
wot=doc->Pages->count();
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
view->updatesOn(false);
Page* currentPage = doc->currentPage();
ScPage* currentPage = doc->currentPage();
for (cc = 0; cc < numPages; ++cc)
{
slotNewPage(wot, base[(wot+doc->pageSets()[doc->pagePositioning()].FirstPage) % doc->pageSets()[doc->pagePositioning()].Columns], mov); //Avoid the master page application with QString::null
6725,7 → 6725,7
tmpSelection.addItem(ite);
}
}
Page *page = doc->Pages->at(a); // need to remove guides too to get their undo/redo actions working
ScPage *page = doc->Pages->at(a); // need to remove guides too to get their undo/redo actions working
page->guides.clearHorizontals(GuideManagerCore::Standard);
page->guides.clearHorizontals(GuideManagerCore::Auto);
page->guides.clearVerticals(GuideManagerCore::Standard);
9078,7 → 9078,7
}
else
{
Annot *dia = new Annot(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), doc->PageColors, view);
ScAnnot *dia = new ScAnnot(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), doc->PageColors, view);
if (dia->exec())
slotDocCh();
delete dia;
/trunk/Scribus/scribus/pageitem_arc.cpp
27,7 → 27,7
#include <cmath>
#include <cassert>
 
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_arc.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
6,7 → 6,7
*/
#include "cmdpage.h"
#include "cmdutil.h"
#include "page.h"
#include "scpage.h"
#include "scribuscore.h"
#include "commonstrings.h"
#include "scribusdoc.h"
/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
6,7 → 6,7
*/
#include "cmdutil.h"
#include "units.h"
#include "page.h"
#include "scpage.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "selection.h"
/trunk/Scribus/scribus/plugins/scriptplugin/objimageexport.cpp
6,7 → 6,7
*/
#include "objimageexport.h"
#include "cmdutil.h"
#include "page.h"
#include "scpage.h"
 
#include <QImageWriter>
#include <structmember.h>
/trunk/Scribus/scribus/plugins/short-words/parse.cpp
26,7 → 26,7
 
#include "scribus.h"
#include "scribusdoc.h"
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "selection.h"
#include "langmgr.h"
/trunk/Scribus/scribus/plugins/short-words/shortwords.cpp
29,7 → 29,7
#include "swdialog.h"
#include "configuration.h"
#include "parse.h"
#include "page.h"
#include "scpage.h"
#include "swprefsgui.h"
#include "prefs_shortwords.h"
#include "scpaths.h"
/trunk/Scribus/scribus/plugins/pixmapexport/export.cpp
176,7 → 176,7
 
if (!doc->Pages->at(pageNr))
return false;
Page* page = doc->Pages->at(pageNr);
ScPage* page = doc->Pages->at(pageNr);
 
/* a little magic here - I need to compute the "maxGr" value...
* We need to know the right size of the page for landscape,
/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
180,7 → 180,7
QList<PageItem*> TableItemsF;
int a;
PageItem *Neu;
Page* Apage;
ScPage* Apage;
itemRemap.clear();
itemNext.clear();
itemCount = 0;
1939,7 → 1939,7
ParagraphStyle vg;
struct ScribusDoc::BookMa bok;
PageItem *Neu;
Page* Apage = NULL;
ScPage* Apage = NULL;
itemRemap.clear();
itemNext.clear();
itemCount = 0;
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
1051,7 → 1051,7
void Scribus150Format::WritePages(ScribusDoc *doc, ScXmlStreamWriter& docu, QProgressBar *dia2, uint maxC, bool master)
{
uint ObCount = maxC;
Page *page;
ScPage *page;
uint pages;
QString tmp;
if (master)
1355,6 → 1355,10
docu.writeAttribute("GMAY", item->meshGradientArray[0].count());
docu.writeAttribute("GMAX", item->meshGradientArray.count());
}
else if (item->GrType == 12)
{
docu.writeAttribute("GMAX", item->meshGradientPatches.count());
}
else
{
docu.writeAttribute("GRSTARTX", item->GrStartX);
1580,6 → 1584,40
}
}
}
if (item->GrType == 12)
{
for (int grow = 0; grow < item->meshGradientPatches.count(); grow++)
{
meshGradientPatch patch = item->meshGradientPatches[grow];
for (int gcol = 0; gcol < 4; gcol++)
{
meshPoint mp;
if (gcol == 0)
mp = patch.TL;
else if (gcol == 1)
mp = patch.TR;
else if (gcol == 2)
mp = patch.BR;
else if (gcol == 3)
mp = patch.BL;
docu.writeStartElement("PMPoint");
docu.writeAttribute("GX", mp.gridPoint.x());
docu.writeAttribute("GY", mp.gridPoint.y());
docu.writeAttribute("CTX", mp.controlTop.x());
docu.writeAttribute("CTY", mp.controlTop.y());
docu.writeAttribute("CBX", mp.controlBottom.x());
docu.writeAttribute("CBY", mp.controlBottom.y());
docu.writeAttribute("CLX", mp.controlLeft.x());
docu.writeAttribute("CLY", mp.controlLeft.y());
docu.writeAttribute("CRX", mp.controlRight.x());
docu.writeAttribute("CRY", mp.controlRight.y());
docu.writeAttribute("NAME", mp.colorName);
docu.writeAttribute("SHADE", mp.shade);
docu.writeAttribute("TRANS", mp.transparency);
docu.writeEndElement();
}
}
}
if (item->asLatexFrame())
{
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
2522,7 → 2522,7
return true;
}
m_Doc->setMasterPageMode(!pageName.isEmpty());
Page* newPage = pageName.isEmpty() ? doc->addPage(pageNum) : doc->addMasterPage(pageNum, pageName);
ScPage* newPage = pageName.isEmpty() ? doc->addPage(pageNum) : doc->addMasterPage(pageNum, pageName);
 
newPage->LeftPg = attrs.valueAsInt("LEFT", 0);
QString mpName = attrs.valueAsString("MNAM", "Normal");
2695,6 → 2695,34
mGArrayRows++;
}
}
if (tName == "PMPoint")
{
meshPoint mp;
mp.colorName = tAtt.valueAsString("NAME");
mp.shade = tAtt.valueAsInt("SHADE", 100);
mp.transparency = tAtt.valueAsDouble("TRANS", 1.0);
mp.gridPoint = FPoint(tAtt.valueAsDouble("GX", 0.0), tAtt.valueAsDouble("GY", 0.0));
mp.controlTop = FPoint(tAtt.valueAsDouble("CTX", 0.0), tAtt.valueAsDouble("CTY", 0.0));
mp.controlBottom = FPoint(tAtt.valueAsDouble("CBX", 0.0), tAtt.valueAsDouble("CBY", 0.0));
mp.controlLeft = FPoint(tAtt.valueAsDouble("CLX", 0.0), tAtt.valueAsDouble("CLY", 0.0));
mp.controlRight = FPoint(tAtt.valueAsDouble("CRX", 0.0), tAtt.valueAsDouble("CRY", 0.0));
mp.color = SetColor(doc, mp.colorName, mp.shade);
mp.color.setAlphaF(mp.transparency);
if (mGArrayCols == 0)
newItem->meshGradientPatches[mGArrayRows].TL = mp;
else if (mGArrayCols == 1)
newItem->meshGradientPatches[mGArrayRows].TR = mp;
else if (mGArrayCols == 2)
newItem->meshGradientPatches[mGArrayRows].BR = mp;
else if (mGArrayCols == 3)
newItem->meshGradientPatches[mGArrayRows].BL = mp;
mGArrayCols++;
if (mGArrayCols == 4)
{
mGArrayCols = 0;
mGArrayRows++;
}
}
 
if (tName == "ITEXT")
readItemText(newItem, tAtt, lastStyle);
3786,6 → 3814,16
currItem->meshGradientArray.append(ml);
}
}
else if (currItem->GrType == 12)
{
currItem->meshGradientPatches.clear();
int mGArrayRows = attrs.valueAsInt("GMAX", 1);
for (int mgr = 0; mgr < mGArrayRows; mgr++)
{
meshGradientPatch patchM;
currItem->meshGradientPatches.append(patchM);
}
}
else
{
currItem->GrStartX = attrs.valueAsDouble("GRSTARTX", 0.0);
3974,7 → 4012,7
struct ScribusDoc::BookMa bok;
QMap<int, ScribusDoc::BookMa> bookmarks;
 
Page* newPage = NULL;
ScPage* newPage = NULL;
QString tmp;
QMap<int,int> TableID;
/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
1751,7 → 1751,7
return true;
}
m_Doc->setMasterPageMode(!pageName.isEmpty());
Page* newPage = pageName.isEmpty() ? doc->addPage(pageNum) : doc->addMasterPage(pageNum, pageName);
ScPage* newPage = pageName.isEmpty() ? doc->addPage(pageNum) : doc->addMasterPage(pageNum, pageName);
 
newPage->LeftPg = attrs.valueAsInt("LEFT", 0);
QString mpName = attrs.valueAsString("MNAM", "Normal");
1884,7 → 1884,7
{
newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::PARSEP);
ParagraphStyle newStyle;
PrefsManager* prefsManager = PrefsManager::instance();
// PrefsManager* prefsManager = PrefsManager::instance();
readParagraphStyle(doc, reader, newStyle);
newItem->itemText.setStyle(newItem->itemText.length()-1, newStyle);
newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, lastStyle->Style);
1892,7 → 1892,7
else if (tName == "trail")
{
ParagraphStyle newStyle;
PrefsManager* prefsManager = PrefsManager::instance();
// PrefsManager* prefsManager = PrefsManager::instance();
readParagraphStyle(doc, reader, newStyle);
newItem->itemText.setStyle(newItem->itemText.length(), newStyle);
}
3020,7 → 3020,7
struct ScribusDoc::BookMa bok;
QMap<int, ScribusDoc::BookMa> bookmarks;
 
Page* newPage = NULL;
ScPage* newPage = NULL;
QString tmp;
QMap<int,int> TableID;
3378,7 → 3378,7
bool fou(false);
QString tmpf, tmV;
const StyleSet<ParagraphStyle> * docParagraphStyles = tempStyles? tempStyles : & doc->paragraphStyles();
PrefsManager* prefsManager = PrefsManager::instance();
// PrefsManager* prefsManager = PrefsManager::instance();
readParagraphStyle(doc, reader, style);
for (int xx=0; xx<docParagraphStyles->count(); ++xx)
{
/trunk/Scribus/scribus/plugins/import/cvg/importcvgplugin.cpp
9,7 → 9,7
#include "importcvg.h"
#include "importcvgplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/ps/importpsplugin.cpp
9,10 → 9,11
#include "importps.h"
#include "importpsplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scconfig.h"
#include "scraction.h"
#include "scribuscore.h"
#include "undomanager.h"
/trunk/Scribus/scribus/plugins/import/idml/importidmlimpl.cpp
803,7 → 803,7
pageNumber = pageNumber+1;
QDomElement elem = node.toElement();
QString appliedMaster;
Page* newPage;
ScPage* newPage;
if(!elem.isNull())
{
appliedMaster = elem.attribute("AppliedMaster","");
/trunk/Scribus/scribus/plugins/import/pct/importpctplugin.cpp
9,7 → 9,7
#include "importpct.h"
#include "importpctplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/ai/importaiplugin.cpp
9,10 → 9,11
#include "importai.h"
#include "importaiplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scconfig.h"
#include "scraction.h"
#include "scribuscore.h"
#include "undomanager.h"
151,6 → 152,52
UndoManager::instance()->setUndoEnabled(false);
if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(UndoManager::instance()->beginTransaction(trSettings));
#ifdef HAVE_POPPLER
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
/* Check if the file is an old style AI or one of the newer PDF wrapped ones */
QFile fT(fileName);
if (fT.open(QIODevice::ReadOnly))
{
QByteArray tempBuf(9, ' ');
fT.read(tempBuf.data(), 8);
fT.close();
if (tempBuf.startsWith("%PDF"))
{
QMessageBox msgBox(ScCore->primaryMainWindow());
msgBox.setText( tr("This file contains 2 versions of the data."));
msgBox.setInformativeText( tr("Choose which one should be imported"));
msgBox.setIcon(QMessageBox::Question);
QPushButton *pdfButton = msgBox.addButton( tr("Use the pdf part"), QMessageBox::ActionRole);
msgBox.addButton( tr("Use the ai part"), QMessageBox::ActionRole);
msgBox.setDefaultButton(pdfButton);
msgBox.exec();
if ((QPushButton *)msgBox.clickedButton() == pdfButton)
{
//Import PDF
const FileFormat *fmt = LoadSavePlugin::getFormatById(FORMATID_PDFIMPORT);
if (!fmt)
{
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The PDF Import plugin could not be found"), 1, 0, 0);
return false;
}
bool success = fmt->loadFile(fileName, flags);
if (activeTransaction)
{
activeTransaction->commit();
delete activeTransaction;
activeTransaction = NULL;
}
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(true);
if (!success)
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0);
return success;
}
}
}
}
#endif
AIPlug *dia = new AIPlug(m_Doc, flags);
Q_CHECK_PTR(dia);
bool success = dia->import(fileName, trSettings, flags);
/trunk/Scribus/scribus/plugins/import/xar/importxarplugin.cpp
9,7 → 9,7
#include "importxar.h"
#include "importxarplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/sml/importsmlplugin.cpp
9,7 → 9,7
#include "importsml.h"
#include "importsmlplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/drw/importdrwplugin.cpp
16,7 → 16,7
#include "importdrw.h"
#include "importdrwplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/xfig/importxfigplugin.cpp
9,7 → 9,7
#include "importxfig.h"
#include "importxfigplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/wpg/importwpgplugin.cpp
9,7 → 9,7
#include "importwpg.h"
#include "importwpgplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/shape/importshapeplugin.cpp
9,7 → 9,7
#include "importshape.h"
#include "importshapeplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/cgm/importcgmplugin.cpp
16,7 → 16,7
#include "importcgm.h"
#include "importcgmplugin.h"
#include "ui/scmwmenumanager.h"
#include "page.h"
#include "scpage.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
0,0 → 1,1853
#include "slaoutput.h"
#include <GlobalParams.h>
#include <QFile>
#include "commonstrings.h"
#include "loadsaveplugin.h"
#include "sccolorengine.h"
#include "util.h"
#include "util_math.h"
 
 
SlaOutputDev::SlaOutputDev(ScribusDoc* doc, QList<PageItem*> *Elements, QStringList *importedColors, int flags)
{
m_doc = doc;
m_Elements = Elements;
m_groupStack.clear();
groupEntry gElements;
gElements.forSoftMask = gFalse;
gElements.alpha = gFalse;
gElements.maskName = "";
m_groupStack.push(gElements);
m_clipStack.clear();
m_currentMask = "";
m_importedColors = importedColors;
CurrColorStroke = "Black";
CurrColorFill = "Black";
Coords = "";
pathIsClosed = false;
tmpSel = new Selection(m_doc, false);
grStackDepth = 0;
firstLayer = true;
layerNum = 1;
importerFlags = flags;
currentLayer = m_doc->activeLayer();
xref = NULL;
m_fontEngine = 0;
m_font = 0;
firstPage = true;
pagecount = 1;
}
 
SlaOutputDev::~SlaOutputDev()
{
m_groupStack.clear();
tmpSel->clear();
delete tmpSel;
delete m_fontEngine;
}
 
 
void SlaOutputDev::startDoc(XRef *xrefA, Catalog *catA)
{
xref = xrefA;
catalog = catA;
firstPage = true;
pagecount = 1;
m_fontEngine = new SplashFontEngine(
#if HAVE_T1LIB_H
globalParams->getEnableT1lib(),
#endif
#if HAVE_FREETYPE_H
globalParams->getEnableFreeType(),
true,
true,
#endif
true);
}
 
void SlaOutputDev::startPage(int pageNum, GfxState *state)
{
// qDebug() << "starting page" << pageNum;
if (firstPage)
firstPage = false;
else
{
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
m_doc->addPage(pagecount);
m_doc->view()->addPage(pagecount, true);
pagecount++;
}
}
// qDebug() << "page size =" << pageSize;
}
 
void SlaOutputDev::endPage()
{
// qDebug() << "ending page";
}
 
void SlaOutputDev::saveState(GfxState *state)
{
// qDebug() << "saveState" << grStackDepth;
grStackDepth++;
}
 
void SlaOutputDev::restoreState(GfxState *state)
{
// qDebug() << "restoreState" << grStackDepth;
grStackDepth--;
if (m_groupStack.count() != 0)
m_groupStack.top().maskName = "";
if (m_clipStack.count() != 0)
{
while (m_clipStack.top().grStackDepth > grStackDepth)
{
clipEntry clp = m_clipStack.pop();
PageItem *ite = clp.ClipItem;
if (m_groupStack.count() != 0)
{
groupEntry gElements = m_groupStack.pop();
if (gElements.Items.count() > 0)
{
for (int d = 0; d < gElements.Items.count(); d++)
{
m_Elements->removeAll(gElements.Items.at(d));
}
m_doc->groupObjectsToItem(ite, gElements.Items);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
}
else
{
m_Elements->removeAll(ite);
m_doc->Items->removeAll(ite);
m_groupStack.top().Items.removeAll(ite);
}
}
if (m_clipStack.count() == 0)
break;
}
}
}
 
void SlaOutputDev::updateFillColor(GfxState *state)
{
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
}
 
void SlaOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, GfxColorSpace * /*blendingColorSpace*/, GBool /*isolated*/, GBool /*knockout*/, GBool forSoftMask)
{
// qDebug() << "Start Group";
groupEntry gElements;
gElements.forSoftMask = forSoftMask;
gElements.alpha = gFalse;
gElements.maskName = "";
m_groupStack.push(gElements);
}
 
void SlaOutputDev::endTransparencyGroup(GfxState *state)
{
// qDebug() << "End Group";
if (m_groupStack.count() != 0)
{
groupEntry gElements = m_groupStack.pop();
tmpSel->clear();
if (gElements.Items.count() > 0)
{
for (int dre = 0; dre < gElements.Items.count(); ++dre)
{
tmpSel->addItem(gElements.Items.at(dre), true);
m_Elements->removeAll(gElements.Items.at(dre));
}
PageItem *ite = m_doc->groupObjectsSelection(tmpSel);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
if (gElements.forSoftMask)
{
ScPattern pat = ScPattern();
pat.setDoc(m_doc);
m_doc->DoDrawing = true;
pat.pattern = ite->DrawObj_toImage(qMax(ite->width(), ite->height()));
pat.xoffset = 0;
pat.yoffset = 0;
m_doc->DoDrawing = false;
pat.width = ite->width();
pat.height = ite->height();
pat.items.append(ite);
m_doc->Items->removeAll(ite);
QString id = QString("Pattern_from_PDF_%1S").arg(m_doc->docPatterns.count() + 1);
m_doc->addPattern(id, pat);
m_currentMask = id;
tmpSel->clear();
return;
}
else
{
for (int as = 0; as < tmpSel->count(); ++as)
{
m_Elements->append(tmpSel->itemAt(as));
}
}
if (m_groupStack.count() != 0)
{
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
}
if (m_groupStack.count() != 0)
{
for (int as = 0; as < tmpSel->count(); ++as)
{
m_groupStack.top().Items.append(tmpSel->itemAt(as));
}
}
tmpSel->clear();
}
}
 
void SlaOutputDev::setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool alpha, Function * /*transferFunc*/, GfxColor * /*backdropColor*/)
{
if (m_groupStack.count() != 0)
{
m_groupStack.top().maskName = m_currentMask;
m_groupStack.top().alpha = alpha;
}
}
 
void SlaOutputDev::clearSoftMask(GfxState * /*state*/)
{
if (m_groupStack.count() != 0)
{
m_groupStack.top().maskName = "";
}
}
 
void SlaOutputDev::clip(GfxState *state)
{
// qDebug() << "Clip";
double *ctm;
ctm = state->getCTM();
QString output = convertPath(state->getPath());
FPointArray out;
out.parseSVG(output);
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
out.map(m_ctm);
double xmin, ymin, xmax, ymax;
state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
crect = crect.normalized();
int z = m_doc->itemAdd(PageItem::Group, PageItem::Rectangle, crect.x() + m_doc->currentPage()->xOffset(), crect.y() + m_doc->currentPage()->yOffset(), crect.width(), crect.height(), 0, CommonStrings::None, CommonStrings::None, true);
PageItem *ite = m_doc->Items->at(z);
FPoint wh(getMinClipF(&out));
out.translate(-wh.x(), -wh.y());
ite->PoLine = out.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
ite->ClipEdited = true;
ite->FrameType = 3;
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
ite->ContourLine = ite->PoLine.copy();
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
clipEntry clp;
clp.ClipCoords = out.copy();
clp.ClipItem = ite;
clp.grStackDepth = grStackDepth;
m_clipStack.push(clp);
m_doc->GroupCounter++;
groupEntry gElements;
gElements.forSoftMask = gFalse;
gElements.alpha = gFalse;
gElements.maskName = "";
m_groupStack.push(gElements);
}
 
void SlaOutputDev::eoClip(GfxState *state)
{
// qDebug() << "EoClip";
double *ctm;
ctm = state->getCTM();
QString output = convertPath(state->getPath());
FPointArray out;
out.parseSVG(output);
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
out.map(m_ctm);
double xmin, ymin, xmax, ymax;
state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
crect = crect.normalized();
int z = m_doc->itemAdd(PageItem::Group, PageItem::Rectangle, crect.x() + m_doc->currentPage()->xOffset(), crect.y() + m_doc->currentPage()->yOffset(), crect.width(), crect.height(), 0, CommonStrings::None, CommonStrings::None, true);
PageItem *ite = m_doc->Items->at(z);
FPoint wh(getMinClipF(&out));
out.translate(-wh.x(), -wh.y());
ite->PoLine = out.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
ite->ClipEdited = true;
ite->FrameType = 3;
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
ite->ContourLine = ite->PoLine.copy();
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
clipEntry clp;
clp.ClipCoords = out.copy();
clp.ClipItem = ite;
clp.grStackDepth = grStackDepth;
m_clipStack.push(clp);
m_doc->GroupCounter++;
groupEntry gElements;
gElements.forSoftMask = gFalse;
gElements.alpha = gFalse;
gElements.maskName = "";
m_groupStack.push(gElements);
}
 
void SlaOutputDev::stroke(GfxState *state)
{
// qDebug() << "Stroke";
double *ctm;
ctm = state->getCTM();
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor());
QString output = convertPath(state->getPath());
getPenState(state);
if ((m_Elements->count() != 0) && (output == Coords)) // Path is the same as in last fill
{
PageItem* ite = m_Elements->at(m_Elements->count()-1);
ite->setLineColor(CurrColorStroke);
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setLineWidth(state->getTransformedLineWidth());
ite->setDashes(DashValues);
ite->setDashOffset(DashOffset);
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
}
else
{
FPointArray out;
out.parseSVG(output);
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
out.map(m_ctm);
FPoint wh = out.WidthHeight();
if ((out.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
{
int z;
if (pathIsClosed)
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, state->getTransformedLineWidth(), CommonStrings::None, CurrColorStroke, true);
else
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, state->getTransformedLineWidth(), CommonStrings::None, CurrColorStroke, true);
PageItem* ite = m_doc->Items->at(z);
ite->PoLine = out.copy();
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setLineShade(100);
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setDashes(DashValues);
ite->setDashOffset(DashOffset);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
m_groupStack.top().Items.append(ite);
}
}
}
 
void SlaOutputDev::fill(GfxState *state)
{
// qDebug() << "Fill";
double *ctm;
ctm = state->getCTM();
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
FPointArray out;
QString output = convertPath(state->getPath());
out.parseSVG(output);
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
out.map(m_ctm);
Coords = output;
FPoint wh = out.WidthHeight();
if ((out.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
{
int z;
if (pathIsClosed)
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None, true);
else
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None, true);
PageItem* ite = m_doc->Items->at(z);
ite->PoLine = out.copy();
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
}
}
 
void SlaOutputDev::eoFill(GfxState *state)
{
// qDebug() << "EoFill";
double *ctm;
ctm = state->getCTM();
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
FPointArray out;
QString output = convertPath(state->getPath());
out.parseSVG(output);
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
out.map(m_ctm);
Coords = output;
FPoint wh = out.WidthHeight();
if ((out.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
{
int z;
if (pathIsClosed)
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None, true);
else
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None, true);
PageItem* ite = m_doc->Items->at(z);
ite->PoLine = out.copy();
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(true);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
}
}
 
GBool SlaOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax)
{
double GrStartX;
double GrStartY;
double GrEndX;
double GrEndY;
Function *func = shading->getFunc(0);
VGradient FillGradient = VGradient(VGradient::linear);
FillGradient.clearStops();
GfxColorSpace *color_space = shading->getColorSpace();
if (func->getType() == 3)
{
StitchingFunction *stitchingFunc = (StitchingFunction*)func;
double *bounds = stitchingFunc->getBounds();
int num_funcs = stitchingFunc->getNumFuncs();
// Add stops from all the stitched functions
for ( int i = 0 ; i < num_funcs ; i++ )
{
GfxColor temp;
((GfxAxialShading*)shading)->getColor(bounds[i], &temp);
QString stopColor = getColor(color_space, &temp);
const ScColor& gradC1 = m_doc->PageColors[stopColor];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i], 0.5, 1.0, stopColor, 100 );
if (i == num_funcs - 1)
{
((GfxAxialShading*)shading)->getColor(bounds[i+1], &temp);
QString stopColor = getColor(color_space, &temp);
const ScColor& gradC1 = m_doc->PageColors[stopColor];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i+1], 0.5, 1.0, stopColor, 100 );
}
}
}
else if (func->getType() == 2)
{
GfxColor stop1;
((GfxAxialShading*)shading)->getColor(0.0, &stop1);
QString stopColor1 = getColor(color_space, &stop1);
const ScColor& gradC1 = m_doc->PageColors[stopColor1];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), 0.0, 0.5, 1.0, stopColor1, 100 );
GfxColor stop2;
((GfxAxialShading*)shading)->getColor(1.0, &stop2);
QString stopColor2 = getColor(color_space, &stop2);
const ScColor& gradC2 = m_doc->PageColors[stopColor2];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC2, m_doc), 1.0, 0.5, 1.0, stopColor2, 100 );
}
((GfxAxialShading*)shading)->getCoords(&GrStartX, &GrStartY, &GrEndX, &GrEndY);
double xmin, ymin, xmax, ymax;
// get the clip region bbox
state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
crect = crect.normalized();
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
FPointArray gr;
gr.addPoint(GrStartX, GrStartY);
gr.addPoint(GrEndX, GrEndY);
gr.map(m_ctm);
GrStartX = gr.point(0).x() - crect.x();
GrStartY = gr.point(0).y() - crect.y();
GrEndX = gr.point(1).x() - crect.x();
GrEndY = gr.point(1).y() - crect.y();
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
QString output = QString("M %1 %2").arg(0.0).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(0.0);
output += QString("Z");
pathIsClosed = true;
Coords = output;
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, CurrColorFill, CommonStrings::None, true);
PageItem* ite = m_doc->Items->at(z);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
ite->GrType = 6;
ite->fill_gradient = FillGradient;
ite->setGradientVector(GrStartX, GrStartY, GrEndX, GrEndY, 0, 0, 1, 0);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
return gTrue;
}
 
GBool SlaOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax)
{
double GrStartX;
double GrStartY;
double GrEndX;
double GrEndY;
Function *func = shading->getFunc(0);
VGradient FillGradient = VGradient(VGradient::linear);
FillGradient.clearStops();
GfxColorSpace *color_space = shading->getColorSpace();
if (func->getType() == 3)
{
StitchingFunction *stitchingFunc = (StitchingFunction*)func;
double *bounds = stitchingFunc->getBounds();
int num_funcs = stitchingFunc->getNumFuncs();
// Add stops from all the stitched functions
for ( int i = 0 ; i < num_funcs ; i++ )
{
GfxColor temp;
((GfxRadialShading*)shading)->getColor(bounds[i], &temp);
QString stopColor = getColor(color_space, &temp);
const ScColor& gradC1 = m_doc->PageColors[stopColor];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i], 0.5, 1.0, stopColor, 100 );
if (i == num_funcs - 1)
{
((GfxRadialShading*)shading)->getColor(bounds[i+1], &temp);
QString stopColor = getColor(color_space, &temp);
const ScColor& gradC1 = m_doc->PageColors[stopColor];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), bounds[i+1], 0.5, 1.0, stopColor, 100 );
}
}
}
else if (func->getType() == 2)
{
GfxColor stop1;
((GfxRadialShading*)shading)->getColor(0.0, &stop1);
QString stopColor1 = getColor(color_space, &stop1);
const ScColor& gradC1 = m_doc->PageColors[stopColor1];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC1, m_doc), 0.0, 0.5, 1.0, stopColor1, 100 );
GfxColor stop2;
((GfxRadialShading*)shading)->getColor(1.0, &stop2);
QString stopColor2 = getColor(color_space, &stop2);
const ScColor& gradC2 = m_doc->PageColors[stopColor2];
FillGradient.addStop( ScColorEngine::getRGBColor(gradC2, m_doc), 1.0, 0.5, 1.0, stopColor2, 100 );
}
double r0, x1, y1, r1;
((GfxRadialShading*)shading)->getCoords(&GrStartX, &GrStartY, &r0, &x1, &y1, &r1);
double xmin, ymin, xmax, ymax;
// get the clip region bbox
state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
crect = crect.normalized();
double GrFocalX = x1;
double GrFocalY = y1;
GrEndX = GrFocalX + r1;
GrEndY = GrFocalY;
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
FPointArray gr;
gr.addPoint(GrStartX, GrStartY);
gr.addPoint(GrEndX, GrEndY);
gr.addPoint(GrFocalX, GrFocalY);
gr.map(m_ctm);
GrStartX = gr.point(0).x() - crect.x();
GrStartY = gr.point(0).y() - crect.y();
GrEndX = gr.point(1).x() - crect.x();
GrEndY = gr.point(1).y() - crect.y();
GrFocalX = gr.point(2).x() - crect.x();
GrFocalY = gr.point(2).y() - crect.y();
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
QString output = QString("M %1 %2").arg(0.0).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(0.0);
output += QString("Z");
pathIsClosed = true;
Coords = output;
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, CurrColorFill, CommonStrings::None, true);
PageItem* ite = m_doc->Items->at(z);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
ite->GrType = 7;
ite->fill_gradient = FillGradient;
ite->setGradientVector(GrStartX, GrStartY, GrEndX, GrEndY, GrFocalX, GrFocalY, 1, 0);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
return gTrue;
}
 
GBool SlaOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
{
// qDebug() << "mesh shaded fill";
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
double xmin, ymin, xmax, ymax;
// get the clip region bbox
state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
crect = crect.normalized();
QString output = QString("M %1 %2").arg(0.0).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(0.0);
output += QString("Z");
pathIsClosed = true;
Coords = output;
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, CurrColorFill, CommonStrings::None, true);
PageItem* ite = m_doc->Items->at(z);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
// qDebug() << "Mesh of" << shading->getNPatches() << "Patches";
for (int i = 0; i < shading->getNPatches(); i++)
{
GfxPatch *patch = shading->getPatch(i);
GfxColor color;
meshGradientPatch patchM;
meshPoint mp1;
meshPoint mp2;
meshPoint mp3;
meshPoint mp4;
int u, v;
patchM.BL.resetTo(FPoint(patch->x[0][0], patch->y[0][0]));
patchM.BL.controlTop = FPoint(patch->x[0][1], patch->y[0][1]);
patchM.BL.controlRight = FPoint(patch->x[1][0], patch->y[1][0]);
u = 0;
v = 0;
if (shading->isParameterized())
{
shading->getParameterizedColor (patch->color[u][v].c[0], &color);
}
else
{
for (int k = 0; k < shading->getColorSpace()->getNComps(); k++)
{
color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
}
}
patchM.BL.colorName = getColor(shading->getColorSpace(), &color);
patchM.BL.shade = 100;
patchM.BL.transparency = 1.0;
const ScColor& col1 = m_doc->PageColors[patchM.BL.colorName];
patchM.BL.color = ScColorEngine::getShadeColorProof(col1, m_doc, 100);
 
u = 0;
v = 1;
patchM.TL.resetTo(FPoint(patch->x[0][3], patch->y[0][3]));
patchM.TL.controlRight = FPoint(patch->x[1][3], patch->y[1][3]);
patchM.TL.controlBottom = FPoint(patch->x[0][2], patch->y[0][2]);
if (shading->isParameterized())
{
shading->getParameterizedColor (patch->color[u][v].c[0], &color);
}
else
{
for (int k = 0; k < shading->getColorSpace()->getNComps(); k++)
{
color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
}
}
patchM.TL.colorName = getColor(shading->getColorSpace(), &color);
patchM.TL.shade = 100;
patchM.TL.transparency = 1.0;
const ScColor& col2 = m_doc->PageColors[patchM.TL.colorName];
patchM.TL.color = ScColorEngine::getShadeColorProof(col2, m_doc, 100);
 
u = 1;
v = 1;
patchM.TR.resetTo(FPoint(patch->x[3][3], patch->y[3][3]));
patchM.TR.controlBottom = FPoint(patch->x[3][2], patch->y[3][2]);
patchM.TR.controlLeft = FPoint(patch->x[2][3], patch->y[2][3]);
if (shading->isParameterized())
{
shading->getParameterizedColor (patch->color[u][v].c[0], &color);
}
else
{
for (int k = 0; k < shading->getColorSpace()->getNComps(); k++)
{
color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
}
}
patchM.TR.colorName = getColor(shading->getColorSpace(), &color);
patchM.TR.shade = 100;
patchM.TR.transparency = 1.0;
const ScColor& col4 = m_doc->PageColors[patchM.TR.colorName];
patchM.TR.color = ScColorEngine::getShadeColorProof(col4, m_doc, 100);
 
u = 1;
v = 0;
patchM.BR.resetTo(FPoint(patch->x[3][0], patch->y[3][0]));
patchM.BR.controlLeft = FPoint(patch->x[2][0], patch->y[2][0]);
patchM.BR.controlTop = FPoint(patch->x[3][1], patch->y[3][1]);
if (shading->isParameterized())
{
shading->getParameterizedColor (patch->color[u][v].c[0], &color);
}
else
{
for (int k = 0; k < shading->getColorSpace()->getNComps(); k++)
{
color.c[k] = GfxColorComp (patch->color[u][v].c[k]);
}
}
patchM.BR.colorName = getColor(shading->getColorSpace(), &color);
patchM.BR.shade = 100;
patchM.BR.transparency = 1.0;
const ScColor& col3 = m_doc->PageColors[patchM.BR.colorName];
patchM.BR.color = ScColorEngine::getShadeColorProof(col3, m_doc, 100);
 
patchM.TL.transform(m_ctm);
patchM.TL.moveRel(-crect.x(), -crect.y());
patchM.TR.transform(m_ctm);
patchM.TR.moveRel(-crect.x(), -crect.y());
patchM.BR.transform(m_ctm);
patchM.BR.moveRel(-crect.x(), -crect.y());
patchM.BL.transform(m_ctm);
patchM.BL.moveRel(-crect.x(), -crect.y());
ite->meshGradientPatches.append(patchM);
}
ite->GrType = 12;
return gTrue;
}
 
GBool SlaOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str, double *pmat, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep)
{
PDFRectangle box;
Gfx *gfx;
QString id;
PageItem *ite;
groupEntry gElements;
gElements.forSoftMask = gFalse;
gElements.alpha = gFalse;
gElements.maskName = "";
gElements.Items.clear();
m_groupStack.push(gElements);
double width, height;
width = bbox[2] - bbox[0];
height = bbox[3] - bbox[1];
if (xStep != width || yStep != height)
return gFalse;
box.x1 = bbox[0];
box.y1 = bbox[1];
box.x2 = bbox[2];
box.y2 = bbox[3];
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
QTransform mm = QTransform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
QTransform mmx = mm * m_ctm;
// qDebug() << "Pattern Fill";
// qDebug() << "mat" << mat[0] << mat[1] << mat[2] << mat[3] << mat[4] << mat[5];
// qDebug() << "pmat" << pmat[0] << pmat[1] << pmat[2] << pmat[3] << pmat[4] << pmat[5];
// qDebug() << "ctm" << ctm[0] << ctm[1] << ctm[2] << ctm[3] << ctm[4] << ctm[5];
// qDebug() << "cumulated ctm" << mmx;
gfx = new Gfx(xref, this, resDict, catalog, &box, NULL);
gfx->display(str);
gElements = m_groupStack.pop();
tmpSel->clear();
double pwidth = 0;
double pheight = 0;
if (gElements.Items.count() > 0)
{
for (int dre = 0; dre < gElements.Items.count(); ++dre)
{
tmpSel->addItem(gElements.Items.at(dre), true);
m_Elements->removeAll(gElements.Items.at(dre));
}
ite = m_doc->groupObjectsSelection(tmpSel);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
m_doc->m_Selection->addItem(ite, true);
m_doc->itemSelection_FlipV();
m_doc->m_Selection->clear();
ScPattern pat = ScPattern();
pat.setDoc(m_doc);
m_doc->DoDrawing = true;
pat.pattern = ite->DrawObj_toImage(qMax(ite->width(), ite->height()));
pat.xoffset = 0;
pat.yoffset = 0;
m_doc->DoDrawing = false;
pat.width = ite->width();
pat.height = ite->height();
pwidth = ite->width();
pheight = ite->height();
pat.items.append(ite);
m_doc->Items->removeAll(ite);
id = QString("Pattern_from_PDF_%1").arg(m_doc->docPatterns.count() + 1);
m_doc->addPattern(id, pat);
tmpSel->clear();
}
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
double xmin, ymin, xmax, ymax;
// get the clip region bbox
state->getClipBBox(&xmin, &ymin, &xmax, &ymax);
QRectF crect = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
crect = crect.normalized();
// qDebug() << "Crect" << crect;
// qDebug() << "Xoffs" << crect.x() - (pmat[4] / fabs(pmat[0])) << "Yoffs" << crect.y() - (m_doc->currentPage()->height() - (pmat[5] / fabs(pmat[3])));
QString output = QString("M %1 %2").arg(0.0).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(0.0);
output += QString("L %1 %2").arg(crect.width()).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(crect.height());
output += QString("L %1 %2").arg(0.0).arg(0.0);
output += QString("Z");
pathIsClosed = true;
Coords = output;
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, CurrColorFill, CommonStrings::None, true);
ite = m_doc->Items->at(z);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
ite->GrType = 8;
ite->setPattern(id);
ite->setPatternTransform(fabs(pmat[0]) * 100, fabs(pmat[3]) * 100, mmx.dx() - ctm[4], mmx.dy() - ctm[5], 0, -1 * pmat[1], pmat[2]);
// ite->setPatternTransform(fabs(pmat[0]) * 100, fabs(pmat[3]) * 100, pmat[4], -1 * pmat[5], 0, -1 * pmat[1], pmat[2]);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
delete gfx;
return gTrue;
}
 
void SlaOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight,
GfxImageColorMap *maskColorMap, GBool maskInterpolate)
{
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
imgStr->reset();
unsigned int *dest = 0;
unsigned char * buffer = new unsigned char[width * height * 4];
QImage * image = 0;
for (int y = 0; y < height; y++)
{
dest = (unsigned int *)(buffer + y * 4 * width);
Guchar * pix = imgStr->getLine();
colorMap->getRGBLine(pix, dest, width);
}
image = new QImage(buffer, width, height, QImage::Format_RGB32);
if (image == NULL || image->isNull())
{
delete imgStr;
delete[] buffer;
delete image;
return;
}
ImageStream *mskStr = new ImageStream(maskStr, maskWidth, maskColorMap->getNumPixelComps(), maskColorMap->getBits());
mskStr->reset();
Guchar *mdest = 0;
unsigned char * mbuffer = new unsigned char[maskWidth * maskHeight];
for (int y = 0; y < maskHeight; y++)
{
mdest = (Guchar *)(mbuffer + y * maskWidth);
Guchar * pix = mskStr->getLine();
maskColorMap->getGrayLine(pix, mdest, maskWidth);
}
if ((maskWidth != width) || (maskHeight != height))
{
delete imgStr;
delete[] buffer;
delete image;
delete mskStr;
delete[] mbuffer;
return;
}
QImage res = image->convertToFormat(QImage::Format_ARGB32);
unsigned char cc, cm, cy, ck;
int s = 0;
for( int yi=0; yi < res.height(); ++yi )
{
QRgb *t = (QRgb*)(res.scanLine( yi ));
for(int xi=0; xi < res.width(); ++xi )
{
cc = qRed(*t);
cm = qGreen(*t);
cy = qBlue(*t);
ck = mbuffer[s];
(*t) = qRgba(cc, cm, cy, ck);
s++;
t++;
}
}
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
double sx = ctm[0] / width;
double sy = ctm[3] / height;
if (sx < 0)
xCoor = xCoor + ctm[4] - (fabs(sx) * width);
else
xCoor = xCoor + ctm[4];
if (sy < 0)
yCoor = yCoor + ctm[5] - (fabs(sy) * height);
else
yCoor = yCoor + ctm[5];
int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor , yCoor, fabs(sx) * width, fabs(sy) * height, 0, CurrColorFill, CurrColorStroke, true);
PageItem* ite = m_doc->Items->at(z);
ite->SetRectFrame();
m_doc->setRedrawBounding(ite);
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pdf_XXXXXX.png");
ite->tempImageFile->open();
QString fileName = getLongPathName(ite->tempImageFile->fileName());
ite->tempImageFile->close();
ite->isInlineImage = true;
res.save(fileName, "PNG");
m_doc->LoadPict(fileName, z);
ite->setImageScalingMode(false, true);
if (sx < 0)
ite->setImageFlippedH(true);
if (sy > 0)
ite->setImageFlippedV(true);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
delete imgStr;
delete[] buffer;
delete image;
delete mskStr;
delete[] mbuffer;
}
 
void SlaOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, int *maskColors, GBool inlineImg)
{
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
imgStr->reset();
unsigned int *dest = 0;
unsigned char * buffer = new unsigned char[width * height * 4];
QImage * image = 0;
if (maskColors)
{
for (int y = 0; y < height; y++)
{
dest = (unsigned int *)(buffer + y * 4 * width);
Guchar * pix = imgStr->getLine();
colorMap->getRGBLine(pix, dest, width);
for (int x = 0; x < width; x++)
{
for (int i = 0; i < colorMap->getNumPixelComps(); ++i)
{
if (pix[i] < maskColors[2*i] * 255 || pix[i] > maskColors[2*i+1] * 255)
{
*dest = *dest | 0xff000000;
break;
}
}
pix += colorMap->getNumPixelComps();
dest++;
}
}
image = new QImage(buffer, width, height, QImage::Format_ARGB32);
}
else
{
for (int y = 0; y < height; y++)
{
dest = (unsigned int *)(buffer + y * 4 * width);
Guchar * pix = imgStr->getLine();
colorMap->getRGBLine(pix, dest, width);
}
image = new QImage(buffer, width, height, QImage::Format_RGB32);
}
if (image == NULL || image->isNull())
{
delete imgStr;
delete[] buffer;
delete image;
return;
}
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
double sx = ctm[0] / width;
double sy = ctm[3] / height;
if (sx < 0)
xCoor = xCoor + ctm[4] - (fabs(sx) * width);
else
xCoor = xCoor + ctm[4];
if (sy < 0)
yCoor = yCoor + ctm[5] - (fabs(sy) * height);
else
yCoor = yCoor + ctm[5];
int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor , yCoor, fabs(sx) * width, fabs(sy) * height, 0, CurrColorFill, CurrColorStroke, true);
PageItem* ite = m_doc->Items->at(z);
ite->SetRectFrame();
m_doc->setRedrawBounding(ite);
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineBlendmode(getBlendMode(state));
ite->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pdf_XXXXXX.png");
ite->tempImageFile->open();
QString fileName = getLongPathName(ite->tempImageFile->fileName());
ite->tempImageFile->close();
ite->isInlineImage = true;
image->save(fileName, "PNG");
m_doc->LoadPict(fileName, z);
ite->setImageScalingMode(false, true);
if (sx < 0)
ite->setImageFlippedH(true);
if (sy > 0)
ite->setImageFlippedV(true);
m_doc->AdjustItemSize(ite);
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
delete imgStr;
delete[] buffer;
delete image;
}
 
void SlaOutputDev::beginMarkedContent(char *name, Dict *properties)
{
// qDebug() << "Begin Marked Content with Name " << QString(name);
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
if (QString(name) == "Layer") // Handle Adobe Illustrator Layer command
{
layerNum++;
if (!firstLayer)
currentLayer = m_doc->addLayer(QString("Layer_%1").arg(layerNum), true);
firstLayer = false;
Object obj;
if (properties->lookup((char*)"Title", &obj))
{
if (obj.isString())
{
QString lName = QString(obj.getString()->getCString());
m_doc->changeLayerName(currentLayer, lName);
}
obj.free();
}
if (properties->lookup((char*)"Visible", &obj))
{
if (obj.isBool())
m_doc->setLayerVisible(currentLayer, obj.getBool());
obj.free();
}
if (properties->lookup((char*)"Editable", &obj))
{
if (obj.isBool())
m_doc->setLayerLocked(currentLayer, !obj.getBool());
obj.free();
}
if (properties->lookup((char*)"Printed", &obj))
{
if (obj.isBool())
m_doc->setLayerPrintable(currentLayer, obj.getBool());
obj.free();
}
if (properties->lookup((char*)"Color", &obj))
{
if (obj.isArray())
{
Object obj1;
obj.arrayGet(0, &obj1);
int r = obj1.getNum() / 256;
obj1.free();
obj.arrayGet(1, &obj1);
int g = obj1.getNum() / 256;
obj1.free();
obj.arrayGet(2, &obj1);
int b = obj1.getNum() / 256;
obj1.free();
m_doc->setLayerMarker(currentLayer, QColor(r, g, b));
}
obj.free();
}
}
}
}
 
void SlaOutputDev::endMarkedContent(GfxState *state)
{
// qDebug() << "End Marked Content";
}
 
void SlaOutputDev::updateFont(GfxState *state)
{
GfxFont *gfxFont;
GfxFontType fontType;
SplashOutFontFileID *id;
SplashFontFile *fontFile;
SplashFontSrc *fontsrc = NULL;
FoFiTrueType *ff;
Ref embRef;
Object refObj, strObj;
GooString *fileName;
char *tmpBuf;
int tmpBufLen;
Gushort *codeToGID;
DisplayFontParam *dfp;
double *textMat;
double m11, m12, m21, m22, fontSize;
SplashCoord mat[4];
int n;
int faceIndex = 0;
SplashCoord matrix[6];
 
m_font = NULL;
fileName = NULL;
tmpBuf = NULL;
 
if (!(gfxFont = state->getFont()))
goto err1;
fontType = gfxFont->getType();
if (fontType == fontType3)
goto err1;
 
// check the font file cache
id = new SplashOutFontFileID(gfxFont->getID());
if ((fontFile = m_fontEngine->getFontFile(id)))
{
delete id;
}
else
{
// if there is an embedded font, write it to disk
if (gfxFont->getEmbeddedFontID(&embRef))
{
tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
if (!tmpBuf)
goto err2;
// if there is an external font file, use it
}
else if (!(fileName = gfxFont->getExtFontFile()))
{
// look for a display font mapping or a substitute font
dfp = NULL;
if (gfxFont->getName())
{
dfp = globalParams->getDisplayFont(gfxFont);
}
if (!dfp)
{
// error(-1, "Couldn't find a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
switch (dfp->kind)
{
case displayFontT1:
fileName = dfp->t1.fileName;
fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1;
break;
case displayFontTT:
fileName = dfp->tt.fileName;
fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType;
faceIndex = dfp->tt.faceIndex;
break;
}
}
fontsrc = new SplashFontSrc;
if (fileName)
fontsrc->setFile(fileName, gFalse);
else
fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
// load the font file
switch (fontType)
{
case fontType1:
if (!(fontFile = m_fontEngine->loadType1Font( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding())))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
case fontType1C:
if (!(fontFile = m_fontEngine->loadType1CFont( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding())))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
case fontType1COT:
if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont( id, fontsrc, ((Gfx8BitFont *)gfxFont)->getEncoding())))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
case fontTrueType:
case fontTrueTypeOT:
if (fileName)
ff = FoFiTrueType::load(fileName->getCString());
else
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (ff)
{
codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
n = 256;
delete ff;
}
else
{
codeToGID = NULL;
n = 0;
}
if (!(fontFile = m_fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n)))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
case fontCIDType0:
case fontCIDType0C:
if (!(fontFile = m_fontEngine->loadCIDFont( id, fontsrc)))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
case fontCIDType0COT:
if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont( id, fontsrc)))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
case fontCIDType2:
case fontCIDType2OT:
codeToGID = NULL;
n = 0;
if (((GfxCIDFont *)gfxFont)->getCIDToGID())
{
n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen();
if (n)
{
codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort));
memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(Gushort));
}
}
else
{
if (fileName)
ff = FoFiTrueType::load(fileName->getCString());
else
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (!ff)
goto err2;
codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
delete ff;
}
if (!(fontFile = m_fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n, faceIndex)))
{
// error(-1, "Couldn't create a font for '%s'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
goto err2;
}
break;
default:
// this shouldn't happen
goto err2;
}
}
// get the font matrix
textMat = state->getTextMat();
fontSize = state->getFontSize();
m11 = textMat[0] * fontSize * state->getHorizScaling();
m12 = textMat[1] * fontSize * state->getHorizScaling();
m21 = textMat[2] * fontSize;
m22 = textMat[3] * fontSize;
matrix[0] = 1;
matrix[1] = 0;
matrix[2] = 0;
matrix[3] = 1;
matrix[4] = 0;
matrix[5] = 0;
// create the scaled font
mat[0] = m11;
mat[1] = -m12;
mat[2] = m21;
mat[3] = -m22;
m_font = m_fontEngine->getFont(fontFile, mat, matrix);
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
return;
 
err2:
delete id;
err1:
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
return;
}
 
void SlaOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen)
{
double x1, y1, x2, y2;
int render;
updateFont(state);
if (!m_font)
return;
// check for invisible text -- this is used by Acrobat Capture
render = state->getRender();
if (render == 3)
return;
if (!(render & 1))
{
SplashPath * fontPath;
fontPath = m_font->getGlyphPath(code);
if (fontPath)
{
QPainterPath qPath;
qPath.setFillRule(Qt::WindingFill);
for (int i = 0; i < fontPath->getLength(); ++i)
{
Guchar f;
fontPath->getPoint(i, &x1, &y1, &f);
if (f & splashPathFirst)
qPath.moveTo(x1,y1);
else if (f & splashPathCurve)
{
double x3, y3;
++i;
fontPath->getPoint(i, &x2, &y2, &f);
++i;
fontPath->getPoint(i, &x3, &y3, &f);
qPath.cubicTo(x1,y1,x2,y2,x3,y3);
}
else
qPath.lineTo(x1,y1);
if (f & splashPathLast)
qPath.closeSubpath();
}
double *ctm;
ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
CurrColorFill = getColor(state->getFillColorSpace(), state->getFillColor());
FPointArray textPath;
textPath.fromQPainterPath(qPath);
FPoint wh = textPath.WidthHeight();
if ((textPath.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
{
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, CurrColorFill, CommonStrings::None, true);
PageItem* ite = m_doc->Items->at(z);
FPoint tp2(getMinClipF(&textPath));
QTransform mm;
mm.scale(1, -1);
mm.translate(x, -y);
textPath.map(mm);
textPath.map(m_ctm);
ite->PoLine = textPath.copy();
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(100);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
ite->setLineEnd(PLineEnd);
ite->setLineJoin(PLineJoin);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_doc->AdjustItemSize(ite);
if ((render & 3) == 1 || (render & 3) == 2)
{
CurrColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor());
ite->setLineColor(CurrColorStroke);
ite->setLineWidth(state->getTransformedLineWidth());
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setLineBlendmode(getBlendMode(state));
}
m_Elements->append(ite);
if (m_groupStack.count() != 0)
{
m_groupStack.top().Items.append(ite);
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
delete fontPath;
}
}
}
}
 
void SlaOutputDev::beginTextObject(GfxState *state)
{
// qDebug() << "Begin Text Object";
groupEntry gElements;
gElements.forSoftMask = gFalse;
gElements.alpha = gFalse;
gElements.maskName = "";
m_groupStack.push(gElements);
}
 
void SlaOutputDev::endTextObject(GfxState *state)
{
// qDebug() << "End Text Object";
if (m_groupStack.count() != 0)
{
groupEntry gElements = m_groupStack.pop();
tmpSel->clear();
if (gElements.Items.count() > 0)
{
for (int dre = 0; dre < gElements.Items.count(); ++dre)
{
tmpSel->addItem(gElements.Items.at(dre), true);
m_Elements->removeAll(gElements.Items.at(dre));
}
PageItem *ite = m_doc->groupObjectsSelection(tmpSel);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
for (int as = 0; as < tmpSel->count(); ++as)
{
m_Elements->append(tmpSel->itemAt(as));
}
if (m_groupStack.count() != 0)
{
if (!m_groupStack.top().maskName.isEmpty())
{
ite->setPatternMask(m_groupStack.top().maskName);
if (m_groupStack.top().alpha)
ite->setMaskType(3);
else
ite->setMaskType(6);
}
}
}
if (m_groupStack.count() != 0)
{
for (int as = 0; as < tmpSel->count(); ++as)
{
m_groupStack.top().Items.append(tmpSel->itemAt(as));
}
}
tmpSel->clear();
}
}
 
QString SlaOutputDev::getColor(GfxColorSpace *color_space, GfxColor *color)
{
QString fNam;
QString namPrefix = "FromPDF";
ScColor tmp;
tmp.setSpotColor(false);
tmp.setRegistrationColor(false);
if ((color_space->getMode() == csDeviceRGB) || (color_space->getMode() == csCalRGB))
{
GfxRGB rgb;
color_space->getRGB(color, &rgb);
int Rc = qRound(colToDbl(rgb.r) * 255);
int Gc = qRound(colToDbl(rgb.g) * 255);
int Bc = qRound(colToDbl(rgb.b) * 255);
tmp.setColorRGB(Rc, Gc, Bc);
fNam = m_doc->PageColors.tryAddColor(namPrefix+tmp.name(), tmp);
}
else if (color_space->getMode() == csDeviceCMYK)
{
GfxCMYK cmyk;
color_space->getCMYK(color, &cmyk);
int Cc = qRound(colToDbl(cmyk.c) * 255);
int Mc = qRound(colToDbl(cmyk.m) * 255);
int Yc = qRound(colToDbl(cmyk.y) * 255);
int Kc = qRound(colToDbl(cmyk.k) * 255);
tmp.setColor(Cc, Mc, Yc, Kc);
fNam = m_doc->PageColors.tryAddColor(namPrefix+tmp.name(), tmp);
}
else if ((color_space->getMode() == csCalGray) || (color_space->getMode() == csDeviceGray))
{
GfxGray gray;
color_space->getGray(color, &gray);
int Kc = 255 - qRound(colToDbl(gray) * 255);
tmp.setColor(0, 0, 0, Kc);
fNam = m_doc->PageColors.tryAddColor(namPrefix+tmp.name(), tmp);
}
else if (color_space->getMode() == csSeparation)
{
GfxCMYK cmyk;
color_space->getCMYK(color, &cmyk);
int Cc = qRound(colToDbl(cmyk.c) * 255);
int Mc = qRound(colToDbl(cmyk.m) * 255);
int Yc = qRound(colToDbl(cmyk.y) * 255);
int Kc = qRound(colToDbl(cmyk.k) * 255);
tmp.setColor(Cc, Mc, Yc, Kc);
tmp.setSpotColor(true);
QString nam = QString(((GfxSeparationColorSpace*)color_space)->getName()->getCString());
fNam = m_doc->PageColors.tryAddColor(nam, tmp);
}
else
{
GfxRGB rgb;
color_space->getRGB(color, &rgb);
int Rc = qRound(colToDbl(rgb.r) * 255);
int Gc = qRound(colToDbl(rgb.g) * 255);
int Bc = qRound(colToDbl(rgb.b) * 255);
tmp.setColorRGB(Rc, Gc, Bc);
fNam = m_doc->PageColors.tryAddColor(namPrefix+tmp.name(), tmp);
// qDebug() << "update fill color other colorspace" << color_space->getMode() << "treating as rgb" << Rc << Gc << Bc;
}
if (fNam == namPrefix+tmp.name())
m_importedColors->append(fNam);
return fNam;
}
 
QString SlaOutputDev::convertPath(GfxPath *path)
{
if (! path)
return QString();
 
QString output;
pathIsClosed = false;
 
for (int i = 0; i < path->getNumSubpaths(); ++i)
{
GfxSubpath * subpath = path->getSubpath(i);
if (subpath->getNumPoints() > 0)
{
output += QString("M %1 %2").arg(subpath->getX(0)).arg(subpath->getY(0));
int j = 1;
while (j < subpath->getNumPoints())
{
if (subpath->getCurve(j))
{
output += QString("C %1 %2 %3 %4 %5 %6")
.arg(subpath->getX(j)).arg(subpath->getY(j))
.arg(subpath->getX(j + 1)).arg(subpath->getY(j + 1))
.arg(subpath->getX(j + 2)).arg(subpath->getY(j + 2));
j += 3;
}
else
{
output += QString("L %1 %2").arg(subpath->getX(j)).arg(subpath->getY(j));
++j;
}
}
if (subpath->isClosed())
{
output += QString("Z");
pathIsClosed = true;
}
}
}
return output;
}
 
void SlaOutputDev::getPenState(GfxState *state)
{
switch (state->getLineCap())
{
case 0:
PLineEnd = Qt::FlatCap;
break;
case 1:
PLineEnd = Qt::RoundCap;
break;
case 2:
PLineEnd = Qt::SquareCap;
break;
}
switch (state->getLineJoin())
{
case 0:
PLineJoin = Qt::MiterJoin;
break;
case 1:
PLineJoin = Qt::RoundJoin;
break;
case 2:
PLineJoin = Qt::BevelJoin;
break;
}
double *dashPattern;
int dashLength;
state->getLineDash(&dashPattern, &dashLength, &DashOffset);
QVector<double> pattern(dashLength);
for (int i = 0; i < dashLength; ++i)
{
pattern[i] = dashPattern[i];
}
DashValues = pattern;
}
 
int SlaOutputDev::getBlendMode(GfxState *state)
{
int mode = 0;
switch (state->getBlendMode())
{
default:
case gfxBlendNormal:
mode = 0;
break;
case gfxBlendDarken:
mode = 1;
break;
case gfxBlendLighten:
mode = 2;
break;
case gfxBlendMultiply:
mode = 3;
break;
case gfxBlendScreen:
mode = 4;
break;
case gfxBlendOverlay:
mode = 5;
break;
case gfxBlendHardLight:
mode = 6;
break;
case gfxBlendSoftLight:
mode = 7;
break;
case gfxBlendDifference:
mode = 8;
break;
case gfxBlendExclusion:
mode = 9;
break;
case gfxBlendColorDodge:
mode = 10;
break;
case gfxBlendColorBurn:
mode = 11;
break;
case gfxBlendHue:
mode = 12;
break;
case gfxBlendSaturation:
mode = 13;
break;
case gfxBlendColor:
mode = 14;
break;
case gfxBlendLuminosity:
mode = 15;
break;
}
return mode;
}
 
/trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.cpp
0,0 → 1,252
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "commonstrings.h"
#include "ui/customfdialog.h"
#include "importpdf.h"
#include "importpdfplugin.h"
#include "ui/scmwmenumanager.h"
#include "scpage.h"
#include "scpaths.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scraction.h"
#include "scribuscore.h"
#include "undomanager.h"
#include "util_formats.h"
#include "util.h"
#include <QMessageBox>
 
 
int importpdf_getPluginAPIVersion()
{
return PLUGIN_API_VERSION;
}
 
ScPlugin* importpdf_getPlugin()
{
ImportPdfPlugin* plug = new ImportPdfPlugin();
Q_CHECK_PTR(plug);
return plug;
}
 
void importpdf_freePlugin(ScPlugin* plugin)
{
ImportPdfPlugin* plug = dynamic_cast<ImportPdfPlugin*>(plugin);
Q_ASSERT(plug);
delete plug;
}
 
ImportPdfPlugin::ImportPdfPlugin() : LoadSavePlugin(),
importAction(new ScrAction(ScrAction::DLL, QPixmap(), QPixmap(), "", QKeySequence(), this))
{
// Set action info in languageChange, so we only have to do it in one
// place. This includes registering file format support.
languageChange();
}
/*
void ImportXfigPlugin::addToMainWindowMenu(ScribusMainWindow *mw)
{
importAction->setEnabled(true);
connect( importAction, SIGNAL(triggered()), SLOT(import()) );
mw->scrMenuMgr->addMenuItem(importAction, "FileImport");
}
*/
void ImportPdfPlugin::languageChange()
{
importAction->setText( tr("Import PDF..."));
// (Re)register file format support
unregisterAll();
registerFormats();
}
 
ImportPdfPlugin::~ImportPdfPlugin()
{
unregisterAll();
};
 
const QString ImportPdfPlugin::fullTrName() const
{
return QObject::tr("PDF Importer");
}
 
 
const ScActionPlugin::AboutData* ImportPdfPlugin::getAboutData() const
{
AboutData* about = new AboutData;
about->authors = "Franz Schmid <franz@scribus.info>";
about->shortDescription = tr("Imports PDF Files");
about->description = tr("Imports most PDF files into the current document,\nconverting their vector data into Scribus objects.");
about->license = "GPL";
Q_CHECK_PTR(about);
return about;
}
 
void ImportPdfPlugin::deleteAboutData(const AboutData* about) const
{
Q_ASSERT(about);
delete about;
}
 
void ImportPdfPlugin::registerFormats()
{
FileFormat fmt(this);
fmt.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::PDF); // Human readable name
fmt.formatId = FORMATID_PDFIMPORT;
fmt.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::PDF); // QFileDialog filter
fmt.nameMatch = QRegExp("\\."+FormatsManager::instance()->extensionListForFormat(FormatsManager::PDF, 1)+"$", Qt::CaseInsensitive);
fmt.fileExtensions = QStringList() << "pdf";
fmt.load = true;
fmt.save = false;
fmt.thumb = true;
fmt.mimeTypes = FormatsManager::instance()->mimetypeOfFormat(FormatsManager::PDF); // MIME types
fmt.priority = 64; // Priority
registerFormat(fmt);
 
if (ScCore->haveGS())
{
FileFormat fmt2(this);
fmt2.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::EPS); // Human readable name
fmt2.formatId = FORMATID_EPSIMPORT;
fmt2.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::EPS);// QFileDialog filter
fmt2.nameMatch = QRegExp("\\.("+FormatsManager::instance()->extensionListForFormat(FormatsManager::EPS, 1)+")$", Qt::CaseInsensitive);
fmt2.fileExtensions = QStringList() << "eps" << "epsf" << "epsi" << "eps2" << "eps3" << "epi" << "ept";
fmt2.load = true;
fmt2.save = false;
fmt2.mimeTypes = FormatsManager::instance()->mimetypeOfFormat(FormatsManager::EPS); // MIME types
fmt2.priority = 64; // Priority
registerFormat(fmt2);
 
FileFormat fmt3(this);
fmt3.trName = FormatsManager::instance()->nameOfFormat(FormatsManager::PS); // Human readable name
fmt3.formatId = FORMATID_PSIMPORT;
fmt3.filter = FormatsManager::instance()->extensionsForFormat(FormatsManager::PS);// QFileDialog filter
fmt3.nameMatch = QRegExp("\\.("+FormatsManager::instance()->extensionListForFormat(FormatsManager::PS, 1)+")$", Qt::CaseInsensitive);
fmt3.fileExtensions = QStringList() << "ps";
fmt3.load = true;
fmt3.save = false;
fmt3.mimeTypes = FormatsManager::instance()->mimetypeOfFormat(FormatsManager::PS); // MIME types
fmt3.priority = 64; // Priority
registerFormat(fmt3);
}
}
 
bool ImportPdfPlugin::fileSupported(QIODevice* /* file */, const QString & fileName) const
{
return true;
}
 
bool ImportPdfPlugin::loadFile(const QString & fileName, const FileFormat &, int flags, int /*index*/)
{
// There's only one format to handle, so we just call import(...)
return import(fileName, flags);
}
 
bool ImportPdfPlugin::import(QString fileName, int flags)
{
if (!checkFlags(flags))
return false;
if( fileName.isEmpty() )
{
flags |= lfInteractive;
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("importpdf");
QString wdir = prefs->get("wdir", ".");
CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.pdf *.PDF);;All Files (*)");
if (diaf.exec())
{
fileName = diaf.selectedFile();
prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
}
else
return true;
}
m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction* activeTransaction = NULL;
bool emptyDoc = (m_Doc == NULL);
bool hasCurrentPage = (m_Doc && m_Doc->currentPage());
TransactionSettings trSettings;
trSettings.targetName = hasCurrentPage ? m_Doc->currentPage()->getUName() : "";
trSettings.targetPixmap = Um::IImageFrame;
trSettings.actionName = Um::ImportXfig;
trSettings.description = fileName;
trSettings.actionPixmap = Um::IXFIG;
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(false);
if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(UndoManager::instance()->beginTransaction(trSettings));
bool isCleanedFile = false;
QString cleanFile = "";
QFileInfo fi(fileName);
QStringList exts = QStringList() << "eps" << "epsf" << "epsi" << "eps2" << "eps3" << "epi" << "ept" << "ps";
if (exts.contains(fi.suffix().toLower()))
{
if (ScCore->haveGS())
{
// Destill the eps/ps with ghostscript to get a clean pdf file
bool cancel = false;
QString errFile = getShortPathName(ScPaths::getTempFileDir())+ "/ps.err";
cleanFile = getShortPathName(ScPaths::getTempFileDir())+ "/clean.pdf";
QStringList args;
args.append( "-q" );
args.append( "-dNOPAUSE" );
args.append( "-sDEVICE=pdfwrite" );
args.append( "-dBATCH" );
args.append( "-dSAFER" );
if (extensionIndicatesEPS(fi.suffix().toLower()))
args.append("-dEPSCrop");
args.append("-dCompatibilityLevel=1.4");
args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(cleanFile)) );
args.append( QDir::toNativeSeparators(fileName) );
System(getShortPathName(PrefsManager::instance()->ghostscriptExecutable()), args, errFile, errFile, &cancel);
args.clear();
isCleanedFile = true;
}
else
{
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The Import plugin cannot handle Postscript files"), 1, 0, 0);
return false;
}
}
PdfPlug *dia = new PdfPlug(m_Doc, flags);
Q_CHECK_PTR(dia);
if (isCleanedFile)
dia->import(cleanFile, trSettings, flags);
else
dia->import(fileName, trSettings, flags);
if (activeTransaction)
{
activeTransaction->commit();
delete activeTransaction;
activeTransaction = NULL;
}
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(true);
delete dia;
if (isCleanedFile)
QFile::remove(cleanFile);
return true;
}
 
QImage ImportPdfPlugin::readThumbnail(const QString& fileName)
{
bool wasUndo = false;
if( fileName.isEmpty() )
return QImage();
if (UndoManager::undoEnabled())
{
UndoManager::instance()->setUndoEnabled(false);
wasUndo = true;
}
m_Doc = NULL;
PdfPlug *dia = new PdfPlug(m_Doc, lfCreateThumbnail);
Q_CHECK_PTR(dia);
QImage ret = dia->readThumbnail(fileName);
if (wasUndo)
UndoManager::instance()->setUndoEnabled(true);
delete dia;
return ret;
}
/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
0,0 → 1,427
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include <QByteArray>
#include <QCursor>
#include <QDrag>
#include <QFile>
#include <QList>
#include <QMimeData>
#include <QRegExp>
#include <QStack>
#include <QDebug>
#include "slaoutput.h"
#include <GlobalParams.h>
 
#include "importpdf.h"
 
#include <cstdlib>
 
#include "commonstrings.h"
#include "ui/customfdialog.h"
#include "loadsaveplugin.h"
#include "ui/missing.h"
#include "ui/multiprogressdialog.h"
#include "pagesize.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "prefstable.h"
#include "ui/propertiespalette.h"
#include "rawimage.h"
#include "scclocale.h"
#include "sccolorengine.h"
#include "scconfig.h"
#include "scmimedata.h"
#include "scpaths.h"
#include "scribus.h"
#include "scribusXml.h"
#include "scribuscore.h"
#include "sctextstream.h"
#include "selection.h"
#include "undomanager.h"
#include "util.h"
#include "util_formats.h"
#include "util_ghostscript.h"
#include "util_icon.h"
#include "util_math.h"
 
 
PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
{
tmpSele = new Selection(this, false);
m_Doc = doc;
importerFlags = flags;
interactive = (flags & LoadSavePlugin::lfInteractive);
}
 
QImage PdfPlug::readThumbnail(QString fName)
{
QString tmp, cmd1, cmd2;
QString pdfFile = QDir::toNativeSeparators(fName);
QString tmpFile = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc.png");
int ret = -1;
tmp.setNum(1);
QStringList args;
args.append("-r72");
args.append("-sOutputFile="+tmpFile);
args.append("-dFirstPage="+tmp);
args.append("-dLastPage="+tmp);
args.append(pdfFile);
ret = callGS(args);
if (ret == 0)
{
QImage image;
image.load(tmpFile);
QFile::remove(tmpFile);
image.setText("XSize", QString("%1").arg(image.width()));
image.setText("YSize", QString("%1").arg(image.height()));
return image;
}
return QImage();
}
 
bool PdfPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
{
QString fName = fNameIn;
bool success = false;
interactive = (flags & LoadSavePlugin::lfInteractive);
importerFlags = flags;
cancel = false;
double x, y, b, h;
bool ret = false;
QFileInfo fi = QFileInfo(fName);
if ( !ScCore->usingGUI() )
{
interactive = false;
showProgress = false;
}
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
if ( showProgress )
{
ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
QStringList barNames, barTexts;
barNames << "GI";
barTexts << tr("Analyzing File:");
QList<bool> barsNumeric;
barsNumeric << false;
progressDialog->addExtraProgressBars(barNames, barTexts, barsNumeric);
progressDialog->setOverallTotalSteps(3);
progressDialog->setOverallProgress(0);
progressDialog->setProgress("GI", 0);
progressDialog->show();
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
qApp->processEvents();
}
else
progressDialog = NULL;
/* Set default Page to size defined in Preferences */
x = 0.0;
y = 0.0;
b = 0.0;
h = 0.0;
if (progressDialog)
{
progressDialog->setOverallProgress(1);
qApp->processEvents();
}
if (b == 0.0)
b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
if (h == 0.0)
h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
docWidth = b;
docHeight = h;
baseX = 0;
baseY = 0;
if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
{
m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
m_Doc->view()->addPage(0, true);
baseX = 0;
baseY = 0;
}
else
{
if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
{
m_Doc=ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
ScCore->primaryMainWindow()->HaveNewDoc();
ret = true;
baseX = 0;
baseY = 0;
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
}
if ((!ret) && (interactive))
{
baseX = m_Doc->currentPage()->xOffset();
baseY = m_Doc->currentPage()->yOffset();
}
if ((ret) || (!interactive))
{
if (docWidth > docHeight)
m_Doc->setPageOrientation(1);
else
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
}
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
QString CurDirP = QDir::currentPath();
QDir::setCurrent(fi.path());
if (convert(fName))
{
tmpSele->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
if ((Elements.count() > 0) && (!ret) && (interactive))
{
if (flags & LoadSavePlugin::lfScripted)
{
bool loadF = m_Doc->isLoading();
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
{
m_Doc->m_Selection->addItem(Elements.at(dre), true);
}
m_Doc->m_Selection->delaySignalsOff();
m_Doc->m_Selection->setGroupRect();
m_Doc->view()->updatesOn(true);
}
}
else
{
m_Doc->DragP = true;
m_Doc->DraggedElem = 0;
m_Doc->DragElements.clear();
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
{
m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
tmpSele->addItem(Elements.at(dre), true);
}
tmpSele->setGroupRect();
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_Doc, tmpSele));
delete ss;
m_Doc->itemSelection_DeleteItem(tmpSele);
m_Doc->view()->updatesOn(true);
m_Doc->m_Selection->delaySignalsOff();
// We must copy the TransationSettings object as it is owned
// by handleObjectImport method afterwards
TransactionSettings* transacSettings = new TransactionSettings(trSettings);
m_Doc->view()->handleObjectImport(md, transacSettings);
m_Doc->DragP = false;
m_Doc->DraggedElem = 0;
m_Doc->DragElements.clear();
}
}
else
{
m_Doc->changed();
m_Doc->reformPages();
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
}
else
{
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
}
return success;
}
 
PdfPlug::~PdfPlug()
{
if (progressDialog)
delete progressDialog;
delete tmpSele;
}
 
bool PdfPlug::convert(QString fn)
{
QString tmp;
importedColors.clear();
if(progressDialog)
{
progressDialog->setOverallProgress(2);
progressDialog->setLabel("GI", tr("Generating Items"));
qApp->processEvents();
}
QFile f(fn);
oldDocItemCount = m_Doc->Items->count();
if (progressDialog)
{
progressDialog->setBusyIndicator("GI");
qApp->processEvents();
}
 
globalParams = new GlobalParams();
if (globalParams)
{
GooString *fname = new GooString(QFile::encodeName(fn).data());
globalParams->setErrQuiet(gTrue);
// globalParams->setPrintCommands(gTrue);
PDFDoc *pdfDoc = new PDFDoc(fname, 0, 0, 0);
if (pdfDoc)
{
if (pdfDoc->isOk())
{
double hDPI = 72.0;
double vDPI = 72.0;
int firstPage = 1;
int lastPage = pdfDoc->getNumPages();
// qDebug() << "converting page" << firstPage;
SlaOutputDev *dev = new SlaOutputDev(m_Doc, &Elements, &importedColors, importerFlags);
if (dev->isOk())
{
GBool useMediaBox = gTrue;
GBool crop = gFalse;
GBool printing = gFalse;
dev->startDoc(pdfDoc->getXRef(), pdfDoc->getCatalog());
int rotate = pdfDoc->getPageRotate(firstPage);
if (importerFlags & LoadSavePlugin::lfCreateDoc)
{
m_Doc->currentPage()->setInitialHeight(pdfDoc->getPageMediaHeight(firstPage));
m_Doc->currentPage()->setInitialWidth(pdfDoc->getPageMediaWidth(firstPage));
m_Doc->currentPage()->setHeight(pdfDoc->getPageMediaHeight(firstPage));
m_Doc->currentPage()->setWidth(pdfDoc->getPageMediaWidth(firstPage));
m_Doc->reformPages(true);
Object info;
pdfDoc->getDocInfo(&info);
if (info.isDict())
{
Object obj;
GooString *s1;
Dict *infoDict = info.getDict();
if (infoDict->lookup("Title", &obj )->isString())
{
s1 = obj.getString();
m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString()));
obj.free();
}
if (infoDict->lookup("Author", &obj )->isString())
{
s1 = obj.getString();
m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString()));
obj.free();
}
if (infoDict->lookup("Subject", &obj )->isString())
{
s1 = obj.getString();
m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString()));
obj.free();
}
if (infoDict->lookup("Keywords", &obj )->isString())
{
s1 = obj.getString();
m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString()));
obj.free();
}
}
info.free();
pdfDoc->displayPages(dev, firstPage, lastPage, hDPI, vDPI, rotate, useMediaBox, crop, printing);
}
else
pdfDoc->displayPage(dev, firstPage, hDPI, vDPI, rotate, useMediaBox, crop, printing);
}
delete dev;
}
}
delete pdfDoc;
}
delete globalParams;
globalParams = 0;
 
// qDebug() << "converting finished";
// qDebug() << "Imported" << Elements.count() << "Elements";
 
if (Elements.count() == 0)
{
if (importedColors.count() != 0)
{
for (int cd = 0; cd < importedColors.count(); cd++)
{
m_Doc->PageColors.remove(importedColors[cd]);
}
}
}
 
if (progressDialog)
progressDialog->close();
return true;
}
 
QString PdfPlug::UnicodeParsedString(GooString *s1)
{
if ( !s1 || s1->getLength() == 0 )
return QString();
GBool isUnicode;
int i;
Unicode u;
QString result;
if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getLength() > 1 && (s1->getChar(1) & 0xff) == 0xff))
{
isUnicode = gTrue;
i = 2;
result.reserve((s1->getLength() - 2) / 2);
}
else
{
isUnicode = gFalse;
i = 0;
result.reserve(s1->getLength());
}
while (i < s1->getLength())
{
if (isUnicode)
{
u = ((s1->getChar(i) & 0xff) << 8) | (s1->getChar(i+1) & 0xff);
i += 2;
}
else
{
u = s1->getChar(i) & 0xff;
++i;
}
result += QChar( u );
}
return result;
}
/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
0,0 → 1,207
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SLAOUTPUT_H
#define SLAOUTPUT_H
 
#include <QString>
#include <QTextStream>
#include <QSizeF>
#include <QBuffer>
#include <QColor>
#include <QBrush>
#include <QPen>
#include <QImage>
#include <QList>
#include <QTransform>
#include <QStack>
#include <QDebug>
#include "fpointarray.h"
#include "pageitem.h"
#include "scribusdoc.h"
#include "selection.h"
#include "vgradient.h"
 
#include <goo/gtypes.h>
#include <Object.h>
#include <OutputDev.h>
#include <Gfx.h>
#include <GfxState.h>
#include <Stream.h>
#include <GfxFont.h>
#include <PDFDoc.h>
#include <Error.h>
#include <Page.h>
#include <Catalog.h>
#include <CharCodeToUnicode.h>
#include <FontEncodingTables.h>
#include <fofi/FoFiTrueType.h>
#include <splash/SplashFontFileID.h>
#include <splash/SplashFontFile.h>
#include <splash/SplashFontEngine.h>
#include <splash/SplashFont.h>
#include <splash/SplashMath.h>
#include <splash/SplashPath.h>
#include <splash/SplashGlyphBitmap.h>
 
//------------------------------------------------------------------------
// SplashOutFontFileID
//------------------------------------------------------------------------
 
class SplashOutFontFileID: public SplashFontFileID
{
public:
 
SplashOutFontFileID(Ref *rA) { r = *rA; }
~SplashOutFontFileID() {}
GBool matches(SplashFontFileID *id)
{
return ((SplashOutFontFileID *)id)->r.num == r.num && ((SplashOutFontFileID *)id)->r.gen == r.gen;
}
 
private:
 
Ref r;
};
 
 
class SlaOutputDev : public OutputDev
{
public:
SlaOutputDev(ScribusDoc* doc, QList<PageItem*> *Elements, QStringList *importedColors, int flags);
virtual ~SlaOutputDev();
void startDoc(XRef *xrefA, Catalog *catA);
 
GBool isOk() { return gTrue; }
virtual GBool upsideDown() { return gTrue; }
virtual GBool useDrawChar() { return gTrue; }
virtual GBool interpretType3Chars() { return gTrue; }
virtual GBool useTilingPatternFill() { return gTrue; }
virtual GBool useShadedFills(int type) { return type <= 7; }
virtual GBool useFillColorStop() { return gTrue; }
virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
// grapics state
virtual void saveState(GfxState *state);
virtual void restoreState(GfxState *state);
 
//----- path painting
virtual void stroke(GfxState *state);
virtual void fill(GfxState *state);
virtual void eoFill(GfxState *state);
virtual void clipToStrokePath(GfxState *state) { qDebug() << "clip to stroke path"; }
virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str, double *pmat, int paintType, Dict *resDict,
double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep);
virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax);
virtual GBool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); }
virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax);
virtual GBool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); }
virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) { qDebug() << "triangle shaded fill"; return gTrue; }
virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading);
//----- path clipping
virtual void clip(GfxState *state);
virtual void eoClip(GfxState *state);
//----- text drawing
virtual void beginTextObject(GfxState *state);
virtual GBool deviceHasTextClip(GfxState *state) { return gFalse; }
virtual void endTextObject(GfxState *state);
virtual void drawChar(GfxState *state, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/);
 
// If current colorspace is pattern,
// does this device support text in pattern colorspace?
virtual GBool supportTextCSPattern(GfxState *state) {
return state->getFillColorSpace()->getMode() == csPattern; }
 
// If current colorspace is pattern,
// need this device special handling for masks in pattern colorspace?
virtual GBool fillMaskCSPattern(GfxState * state) {
return state->getFillColorSpace()->getMode() == csPattern; }
 
virtual void endMaskClip(GfxState *state) { qDebug() << "End Mask Clip"; }
 
//----- grouping operators
virtual void beginMarkedContent(char *name, Dict *properties);
virtual void endMarkedContent(GfxState *state);
//----- image drawing
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
int width, int height, GBool invert, GBool interpolate,
GBool inlineImg) { qDebug() << "Draw Image Mask"; }
virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, GBool interpolate, int *maskColors, GBool inlineImg);
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height,
GfxImageColorMap *colorMap,
GBool interpolate,
Stream *maskStr,
int maskWidth, int maskHeight,
GfxImageColorMap *maskColorMap,
GBool maskInterpolate);
 
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height,
GfxImageColorMap *colorMap,
GBool interpolate,
Stream *maskStr,
int maskWidth, int maskHeight,
GBool maskInvert, GBool maskInterpolate) { qDebug() << "Draw Masked Image"; }
 
//----- transparency groups and soft masks
virtual void beginTransparencyGroup(GfxState *state, double *bbox, GfxColorSpace * /*blendingColorSpace*/, GBool /*isolated*/, GBool /*knockout*/, GBool /*forSoftMask*/);
virtual void paintTransparencyGroup(GfxState *state, double *bbox) {}
virtual void endTransparencyGroup(GfxState *state);
virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/);
virtual void clearSoftMask(GfxState * /*state*/);
 
virtual void updateFillColor(GfxState *state);
virtual void updateFont(GfxState *state);
 
private:
void getPenState(GfxState *state);
QString getColor(GfxColorSpace *color_space, GfxColor *color);
QString convertPath(GfxPath *path);
int getBlendMode(GfxState *state);
bool pathIsClosed;
bool firstLayer;
QString CurrColorFill;
QString CurrColorStroke;
Qt::PenCapStyle PLineEnd;
Qt::PenJoinStyle PLineJoin;
QVector<double> DashValues;
double DashOffset;
QString Coords;
struct clipEntry
{
PageItem* ClipItem;
FPointArray ClipCoords;
int grStackDepth;
};
QStack<clipEntry> m_clipStack;
struct groupEntry
{
QList<PageItem*> Items;
GBool forSoftMask;
GBool alpha;
QString maskName;
};
QStack<groupEntry> m_groupStack;
QString m_currentMask;
ScribusDoc* m_doc;
Selection* tmpSel;
QList<PageItem*> *m_Elements;
QStringList *m_importedColors;
QTransform m_ctm;
int grStackDepth;
int layerNum;
int currentLayer;
int importerFlags;
bool firstPage;
int pagecount;
XRef *xref; // xref table for current document
Catalog *catalog;
SplashFontEngine *m_fontEngine;
SplashFont *m_font;
};
 
#endif
/trunk/Scribus/scribus/plugins/import/pdf/importpdfplugin.h
0,0 → 1,58
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef IMPORTPDFPLUGIN_H
#define IMPORTPDFPLUGIN_H
 
#include "pluginapi.h"
#include "loadsaveplugin.h"
#include "../../formatidlist.h"
 
class ScrAction;
 
class PLUGIN_API ImportPdfPlugin : public LoadSavePlugin
{
Q_OBJECT
 
public:
// Standard plugin implementation
ImportPdfPlugin();
virtual ~ImportPdfPlugin();
/*!
\author Franz Schmid
\date
\brief Returns name of plugin
\retval QString containing name of plugin: Import EPS/PDF/PS...
*/
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
virtual void languageChange();
virtual bool fileSupported(QIODevice* file, const QString & fileName=QString::null) const;
virtual bool loadFile(const QString & fileName, const FileFormat & fmt, int flags, int index = 0);
virtual QImage readThumbnail(const QString& fileName);
virtual void addToMainWindowMenu(ScribusMainWindow *) {};
 
public slots:
/*!
\author Franz Schmid
\date
\brief Run the EPS import
\param fileName input filename, or QString::null to prompt.
\retval bool always true
*/
virtual bool import(QString fileName = QString::null, int flags = lfUseCurrentPage|lfInteractive);
 
private:
void registerFormats();
ScrAction* importAction;
};
 
extern "C" PLUGIN_API int importpdf_getPluginAPIVersion();
extern "C" PLUGIN_API ScPlugin* importpdf_getPlugin();
extern "C" PLUGIN_API void importpdf_freePlugin(ScPlugin* plugin);
 
#endif
/trunk/Scribus/scribus/plugins/import/pdf/importpdf.h
0,0 → 1,97
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef IMPORTPDF_H
#define IMPORTPDF_H
 
 
#include "pluginapi.h"
#include "pageitem.h"
#include "sccolor.h"
#include "fpointarray.h"
#include <QList>
#include <QTransform>
#include <QMultiMap>
#include <QtGlobal>
#include <QObject>
#include <QString>
#include <QTextStream>
#include <QSizeF>
#include <QBuffer>
#include <QColor>
#include <QBrush>
#include <QPen>
#include <QImage>
 
 
class QColor;
class QMatrix;
 
class MultiProgressDialog;
class ScribusDoc;
class Selection;
class TransactionSettings;
 
class GooString;
 
 
//! \brief PDF importer plugin
class PdfPlug : public QObject
{
Q_OBJECT
 
public:
/*!
\author Franz Schmid
\date
\brief Create the PDF importer window.
\param fName QString
\param flags combination of loadFlags
\param showProgress if progress must be displayed
\retval EPSPlug plugin
*/
PdfPlug( ScribusDoc* doc, int flags );
~PdfPlug();
 
/*!
\author Franz Schmid
\date
\brief Perform import.
\param fn QString
\param trSettings undo transaction settings
\param flags combination of loadFlags
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
QImage readThumbnail(QString fn);
 
private:
bool convert(QString fn);
QString UnicodeParsedString(GooString *s1);
QList<PageItem*> Elements;
double baseX, baseY;
double docWidth;
double docHeight;
qreal scPg;
 
QStringList importedColors;
 
bool interactive;
MultiProgressDialog * progressDialog;
bool cancel;
ScribusDoc* m_Doc;
Selection* tmpSele;
int importerFlags;
int oldDocItemCount;
QString baseFile;
 
public slots:
void cancelRequested() { cancel = true; }
};
 
#endif
/trunk/Scribus/scribus/plugins/import/pdf/CMakeLists.txt
0,0 → 1,42
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/scribus
${POPPLER_INCLUDE_DIR}
)
 
SET(IMPORTPDF_PLUGIN_MOC_CLASSES
importpdf.h
importpdfplugin.h
)
 
SET(IMPORTPDF_PLUGIN_SOURCES
importpdf.cpp
importpdfplugin.cpp
slaoutput.cpp
)
 
IF(HAVE_POPPLER)
IF(HAVE_LCMS1)
ADD_DEFINITIONS(-DUSE_CMS)
ENDIF(HAVE_LCMS1)
ADD_DEFINITIONS(-DHAVE_FREETYPE_H)
ENDIF(HAVE_POPPLER)
 
SET(SCRIBUS_IMPORTPDF_PLUGIN "importpdf")
 
QT4_WRAP_CPP(IMPORTPDF_PLUGIN_MOC_SOURCES ${IMPORTPDF_PLUGIN_MOC_CLASSES})
 
ADD_LIBRARY(${SCRIBUS_IMPORTPDF_PLUGIN} MODULE ${IMPORTPDF_PLUGIN_SOURCES} ${IMPORTPDF_PLUGIN_MOC_SOURCES})
 
LINK_DIRECTORIES( /usr/local/lib )
TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTPDF_PLUGIN} ${PLUGIN_LIBRARIES} ${POPPLER_LIBRARY})
 
INSTALL(TARGETS ${SCRIBUS_IMPORTPDF_PLUGIN}
LIBRARY
DESTINATION ${PLUGINDIR}
PERMISSIONS ${PLUGIN_PERMISSIONS}
)
 
ADD_DEPENDENCIES(${SCRIBUS_IMPORTPDF_PLUGIN} ${EXE_NAME})
 
# SET_TARGET_PROPERTIES(${SCRIBUS_FONTPREVIEW_PLUGIN} PROPERTIES VERSION "0.0.0")
/trunk/Scribus/scribus/plugins/import/CMakeLists.txt
5,7 → 5,11
ADD_SUBDIRECTORY(idml)
ADD_SUBDIRECTORY(oodraw)
ADD_SUBDIRECTORY(pct)
ADD_SUBDIRECTORY(ps)
IF(HAVE_POPPLER)
ADD_SUBDIRECTORY(pdf)
ELSE(HAVE_POPPLER)
ADD_SUBDIRECTORY(ps)
ENDIF(HAVE_POPPLER)
ADD_SUBDIRECTORY(shape)
ADD_SUBDIRECTORY(sml)
ADD_SUBDIRECTORY(svg)
/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.h
17,7 → 17,7
class ScribusDoc;
class ScribusMainWindow;
class PageItem;
class Page;
class ScPage;
class ScText;
 
struct SVGOptions
78,7 → 78,7
\brief Process a page to export to SVG format
\param Seite Page *
*/
void ProcessPageLayer(Page *page, ScLayer& layer);
void ProcessPageLayer(ScPage *page, ScLayer& layer);
void ProcessItemOnPage(double xOffset, double yOffset, PageItem *Item, QDomElement *parentElem);
QDomElement processSymbolStroke(PageItem *Item, QString trans);
QDomElement processSymbolItem(PageItem *Item, QString trans);
/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
36,7 → 36,7
#include "canvas.h"
#include "cmsettings.h"
#include "commonstrings.h"
#include "page.h"
#include "scpage.h"
#include "prefsmanager.h"
#include "prefsfile.h"
#include "prefscontext.h"
191,7 → 191,7
Options = Opts;
QFileInfo fiBase(fName);
baseDir = fiBase.absolutePath();
Page *page;
ScPage *page;
GradCount = 0;
ClipCount = 0;
PattCount = 0;
274,12 → 274,12
return true;
}
 
void SVGExPlug::ProcessPageLayer(Page *page, ScLayer& layer)
void SVGExPlug::ProcessPageLayer(ScPage *page, ScLayer& layer)
{
QDomElement layerGroup;
PageItem *Item;
QList<PageItem*> Items;
Page* SavedAct = m_Doc->currentPage();
ScPage* SavedAct = m_Doc->currentPage();
if (page->pageName().isEmpty())
Items = m_Doc->DocItems;
else
/trunk/Scribus/scribus/scpageoutput_ps2.h
1,48 → 1,48
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCPAGEOUTPUTPS2_H
#define SCPAGEOUTPUTPS2_H
 
#include <QDataStream>
#include <QRect>
 
#include "scconfig.h"
#include "scribusapi.h"
#include "scpageoutput.h"
#include "scpainterex_ps2.h"
 
class ScribusDoc;
class Page;
class QIODevice;
 
class SCRIBUS_API ScPageOutput_Ps2 : public ScPageOutput
{
protected:
 
QRect m_clip;
QIODevice* m_device;
QTextStream m_stream;
ScPs2OutputParams m_options;
 
int m_pageIndex;
 
virtual void initStream(QIODevice* dev);
 
public:
 
ScPageOutput_Ps2(QIODevice* dev, ScribusDoc* doc, int pageIndex, ScPs2OutputParams& options);
virtual ~ScPageOutput_Ps2();
 
virtual void begin(void);
virtual void drawPage(Page* page);
virtual void end(void);
 
const QRect clip(void);
void setClip(const QRect& rect) { m_clip = rect; }
};
 
#endif
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCPAGEOUTPUTPS2_H
#define SCPAGEOUTPUTPS2_H
 
#include <QDataStream>
#include <QRect>
 
#include "scconfig.h"
#include "scribusapi.h"
#include "scpageoutput.h"
#include "scpainterex_ps2.h"
 
class ScribusDoc;
class ScPage;
class QIODevice;
 
class SCRIBUS_API ScPageOutput_Ps2 : public ScPageOutput
{
protected:
 
QRect m_clip;
QIODevice* m_device;
QTextStream m_stream;
ScPs2OutputParams m_options;
 
int m_pageIndex;
 
virtual void initStream(QIODevice* dev);
 
public:
 
ScPageOutput_Ps2(QIODevice* dev, ScribusDoc* doc, int pageIndex, ScPs2OutputParams& options);
virtual ~ScPageOutput_Ps2();
 
virtual void begin(void);
virtual void drawPage(ScPage* page);
virtual void end(void);
 
const QRect clip(void);
void setClip(const QRect& rect) { m_clip = rect; }
};
 
#endif
/trunk/Scribus/scribus/scribus.h
486,8 → 486,8
void setNewCharStyle(const QString& name);
void setAlignmentValue(int a);
void selectItemsFromOutlines(PageItem *ite, bool single = false);
void selectItemsFromOutlines(int Page, int Item, bool single = false);
void selectPagesFromOutlines(int Page);
void selectItemsFromOutlines(int ScPage, int Item, bool single = false);
void selectPagesFromOutlines(int ScPage);
void doPrintPreview();
void printPreview();
void SaveAsEps();
/trunk/Scribus/scribus/vgradient.h
86,7 → 86,8
radial = 1,
fourcolor = 2,
diamond = 3,
mesh = 4
mesh = 4,
freemesh = 5
};
 
enum VGradientRepeatMethod
/trunk/Scribus/scribus/mesh.h
37,6 → 37,7
void moveRel(double dx, double dy);
void moveAbs(double x, double y);
void transform(QTransform t);
void resetTo(FPoint p);
FPoint gridPoint;
FPoint controlTop;
FPoint controlBottom;
48,4 → 49,12
QColor color;
};
 
struct meshGradientPatch
{
meshPoint TL;
meshPoint TR;
meshPoint BL;
meshPoint BR;
};
 
#endif
/trunk/Scribus/scribus/pageitem_polygon.cpp
24,7 → 24,7
#include <cmath>
#include <cassert>
 
#include "page.h"
#include "scpage.h"
#include "pageitem.h"
#include "pageitem_polygon.h"
#include "prefsmanager.h"
/trunk/Scribus/scribus/scdocoutput_ps2.h
1,62 → 1,62
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCDOCOUTPUT_PS2_H
#define SCDOCOUTPUT_PS2_H
 
#include <vector>
 
#include <QFile>
#include <QTextStream>
 
#include "scribusapi.h"
#include "scpainterexbase.h"
#include "scpageoutput_ps2.h"
#include "scdocoutput.h"
 
class ScribusDoc;
class Page;
 
class SCRIBUS_API ScDocOutput_Ps2 : public ScDocOutput
{
protected:
 
QFile m_file;
QIODevice* m_device;
QTextStream m_stream;
ScribusDoc* m_doc;
std::vector<int> m_pageNumbers;
ScPs2OutputParams m_options;
 
int m_status;
QString m_lastError;
 
QString m_author;
QString m_creator;
QString m_title;
 
QRect m_clip;
 
virtual void begin(void);
virtual void end(void);
 
virtual ScPageOutput* createPageOutputComponent(int pageIndex);
 
bool initializeCmsTransforms(void);
 
public:
ScDocOutput_Ps2(ScribusDoc* doc, QString fileName, std::vector<int>& pageNumbers, QRect& clip, ScPs2OutputParams& options);
~ScDocOutput_Ps2();
 
void setAuthor(const QString& author) { m_author = author; }
void setCreateor(const QString& creator) { m_creator = creator; }
void setTitle(const QString& title) { m_title = title; }
 
int status() { return m_status; }
QString lastError() { return m_lastError; }
};
 
#endif
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SCDOCOUTPUT_PS2_H
#define SCDOCOUTPUT_PS2_H
 
#include <vector>
 
#include <QFile>
#include <QTextStream>
 
#include "scribusapi.h"
#include "scpainterexbase.h"
#include "scpageoutput_ps2.h"
#include "scdocoutput.h"
 
class ScribusDoc;
class ScPage;
 
class SCRIBUS_API ScDocOutput_Ps2 : public ScDocOutput
{
protected:
 
QFile m_file;
QIODevice* m_device;
QTextStream m_stream;
ScribusDoc* m_doc;
std::vector<int> m_pageNumbers;
ScPs2OutputParams m_options;
 
int m_status;
QString m_lastError;
 
QString m_author;
QString m_creator;
QString m_title;
 
QRect m_clip;
 
virtual void begin(void);
virtual void end(void);
 
virtual ScPageOutput* createPageOutputComponent(int pageIndex);
 
bool initializeCmsTransforms(void);
 
public:
ScDocOutput_Ps2(ScribusDoc* doc, QString fileName, std::vector<int>& pageNumbers, QRect& clip, ScPs2OutputParams& options);
~ScDocOutput_Ps2();
 
void setAuthor(const QString& author) { m_author = author; }
void setCreateor(const QString& creator) { m_creator = creator; }
void setTitle(const QString& title) { m_title = title; }
 
int status() { return m_status; }
QString lastError() { return m_lastError; }
};
 
#endif
/trunk/Scribus/scribus/pslib.cpp
584,7 → 584,7
PutStream("} bind def\n");
}
 
void PSLib::PS_begin_page(Page* pg, MarginStruct* Ma, bool Clipping)
void PSLib::PS_begin_page(ScPage* pg, MarginStruct* Ma, bool Clipping)
{
double bleedRight = 0.0;
double bleedLeft = 0.0;
1623,7 → 1623,7
if (usingGUI)
ScQApp->processEvents();
a = pageNs[aa]-1;
Page* page = Doc->Pages->at(a);
ScPage* page = Doc->Pages->at(a);
if ((!psExport) && (Doc->m_Selection->count() != 0))
{
MarginStruct Ma;
1705,7 → 1705,7
return 0;
}
 
bool PSLib::ProcessItem(ScribusDoc* Doc, Page* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded, bool useTemplate)
bool PSLib::ProcessItem(ScribusDoc* Doc, ScPage* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded, bool useTemplate)
{
double tsz;
int h, s, v, k;
2660,7 → 2660,7
return true;
}
 
void PSLib::ProcessPage(ScribusDoc* Doc, Page* a, uint PNr, bool sep, bool farb, bool ic, bool gcr)
void PSLib::ProcessPage(ScribusDoc* Doc, ScPage* a, uint PNr, bool sep, bool farb, bool ic, bool gcr)
{
int b;
int h, s, v, k;
2794,12 → 2794,12
}
}
 
bool PSLib::ProcessMasterPageLayer(ScribusDoc* Doc, Page* page, ScLayer& layer, uint PNr, bool sep, bool farb, bool ic, bool gcr)
bool PSLib::ProcessMasterPageLayer(ScribusDoc* Doc, ScPage* page, ScLayer& layer, uint PNr, bool sep, bool farb, bool ic, bool gcr)
{
bool success = true;
int h, s, v, k;
QVector<double> dum;
Page* mPage = Doc->MasterPages.at(Doc->MasterNames[page->MPageNam]);
ScPage* mPage = Doc->MasterPages.at(Doc->MasterNames[page->MPageNam]);
if (layer.isPrintable)
{
for (int am = 0; am < page->FromMaster.count() && !abortExport; ++am)
2967,7 → 2967,7
return success;
}
 
bool PSLib::ProcessPageLayer(ScribusDoc* Doc, Page* page, ScLayer& layer, uint PNr, bool sep, bool farb, bool ic, bool gcr)
bool PSLib::ProcessPageLayer(ScribusDoc* Doc, ScPage* page, ScLayer& layer, uint PNr, bool sep, bool farb, bool ic, bool gcr)
{
bool success = true;
int b, h, s, v, k;
3092,7 → 3092,7
}
 
 
void PSLib::HandleBrushPattern(PageItem *c, QPainterPath &path, Page* a, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master)
void PSLib::HandleBrushPattern(PageItem *c, QPainterPath &path, ScPage* a, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master)
{
ScPattern pat = m_Doc->docPatterns[c->strokePattern()];
double pLen = path.length() - ((pat.width / 2.0) * (c->patternStrokeScaleX / 100.0));
3307,6 → 3307,167
return;
}
 
void PSLib::HandlePatchMeshGradient(PageItem* c, bool gcr)
{
QString GCol;
QString hs,ss,vs,ks;
int ch,cs,cv,ck;
QStringList cols;
QStringList colorValues;
QStringList spotColorSet;
QList<int> colsSh;
for (int col = 0; col < c->meshGradientPatches.count(); col++)
{
meshGradientPatch patch = c->meshGradientPatches[col];
meshPoint mp1 = patch.TL;
cols.append(mp1.colorName);
colsSh.append(mp1.shade);
if (spotMap.contains(mp1.colorName))
{
if (!spotColorSet.contains(mp1.colorName))
spotColorSet.append(mp1.colorName);
}
meshPoint mp2 = patch.TR;
cols.append(mp2.colorName);
colsSh.append(mp2.shade);
if (spotMap.contains(mp2.colorName))
{
if (!spotColorSet.contains(mp2.colorName))
spotColorSet.append(mp2.colorName);
}
meshPoint mp3 = patch.BR;
cols.append(mp3.colorName);
colsSh.append(mp3.shade);
if (spotMap.contains(mp3.colorName))
{
if (!spotColorSet.contains(mp3.colorName))
spotColorSet.append(mp3.colorName);
}
meshPoint mp4 = patch.BL;
cols.append(mp4.colorName);
colsSh.append(mp4.shade);
if (spotMap.contains(mp4.colorName))
{
if (!spotColorSet.contains(mp4.colorName))
spotColorSet.append(mp4.colorName);
}
}
for (int ac = 0; ac < cols.count(); ac++)
{
QString colorVal = "";
if ((useSpotColors) && ((spotColorSet.count() > 0) && (spotColorSet.count() < 28)) && (!GraySc))
{
if (spotColorSet.contains(cols.at(ac)))
{
colorVal = "0 0 0 0";
for (int sc = 0; sc < spotColorSet.count(); sc++)
{
if (spotColorSet.at(sc) == cols.at(ac))
colorVal += " "+ToStr(colsSh[ac] / 100.0);
else
colorVal += " 0";
}
}
else
{
SetColor(cols.at(ac), colsSh.at(ac), &ch, &cs, &cv, &ck, gcr);
colorVal += hs.setNum(ch / 255.0)+" "+ss.setNum(cs / 255.0)+" "+vs.setNum(cv / 255.0)+" "+ks.setNum(ck / 255.0);
for (int sc = 0; sc < spotColorSet.count(); sc++)
{
colorVal += " 0";
}
}
colorValues.append(colorVal);
}
else
{
SetColor(cols.at(ac), colsSh.at(ac), &ch, &cs, &cv, &ck, gcr);
if (GraySc)
colorVal += hs.setNum((255.0 - qMin(0.3 * ch + 0.59 * cs + 0.11 * cv + ck, 255.0)) / 255.0);
else
colorVal += hs.setNum(ch / 255.0)+" "+ss.setNum(cs / 255.0)+" "+vs.setNum(cv / 255.0)+" "+ks.setNum(ck / 255.0);
if (DoSep)
{
int pla = Plate - 1 < 0 ? 3 : Plate - 1;
QStringList cols2 = colorVal.split(" ", QString::SkipEmptyParts);
colorVal = ToStr(1 - ScCLocale::toDoubleC(cols2[pla]));
}
colorValues.append(colorVal);
}
}
PutStream("<<\n");
PutStream("/PatternType 2\n");
PutStream("/Shading\n");
PutStream("<<\n");
PutStream("/ShadingType 6\n");
if ((DoSep) || (GraySc))
PutStream("/ColorSpace /DeviceGray\n");
else if ((useSpotColors) && ((spotColorSet.count() > 0) && (spotColorSet.count() < 28)))
{
PutStream("/ColorSpace [ /DeviceN [/Cyan /Magenta /Yellow /Black");
for (int sc = 0; sc < spotColorSet.count(); sc++)
{
PutStream(" ("+spotColorSet.at(sc)+")");
}
PutStream("]\n");
PutStream("/DeviceCMYK\n");
PutStream("{\n");
int maxSp = spotColorSet.count() - 1;
for (int sc = 0; sc < spotColorSet.count(); sc++)
{
int cc = 0;
int mc = 0;
int yc = 0;
int kc = 0;
CMYKColor cmykValues;
ScColorEngine::getCMYKValues(m_Doc->PageColors[spotColorSet.at(maxSp - sc)], m_Doc, cmykValues);
cmykValues.getValues(cc, mc, yc, kc);
if (sc == 0)
PutStream("dup "+ToStr(static_cast<double>(cc) / 255.0)+" mul ");
else
PutStream(IToStr(sc*4 + 1)+" -1 roll dup "+ToStr(static_cast<double>(cc) / 255.0)+" mul ");
PutStream("exch dup "+ToStr(static_cast<double>(mc) / 255.0)+" mul ");
PutStream("exch dup "+ToStr(static_cast<double>(yc) / 255.0)+" mul ");
PutStream("exch "+ToStr(static_cast<double>(kc) / 255.0)+" mul\n");
}
for (int sc = 0; sc < spotColorSet.count(); sc++)
{
PutStream("8 -1 roll 5 -1 roll add 7 -1 roll 5 -1 roll add 6 -1 roll 5 -1 roll add 5 -1 roll 5 -1 roll add\n");
}
PutStream("} ]\n");
}
else
PutStream("/ColorSpace /DeviceCMYK\n");
PutStream("/DataSource [\n");
for (int col = 0; col < c->meshGradientPatches.count(); col++)
{
meshGradientPatch patch = c->meshGradientPatches[col];
meshPoint mp1 = patch.TL;
meshPoint mp2 = patch.TR;
meshPoint mp3 = patch.BR;
meshPoint mp4 = patch.BL;
int colInd1 = 4 * col;
int colInd2 = 4 * col + 1;
int colInd3 = 4 * col + 2;
int colInd4 = 4 * col + 3;
PutStream("0\n");
PutStream(ToStr(mp4.gridPoint.x())+" "+ToStr(-mp4.gridPoint.y())+" "+ToStr(mp4.controlTop.x())+" "+ToStr(-mp4.controlTop.y())+" "+ToStr(mp1.controlBottom.x())+" "+ToStr(-mp1.controlBottom.y())+"\n");
PutStream(ToStr(mp1.gridPoint.x())+" "+ToStr(-mp1.gridPoint.y())+" "+ToStr(mp1.controlRight.x())+" "+ToStr(-mp1.controlRight.y())+" "+ToStr(mp2.controlLeft.x())+" "+ToStr(-mp2.controlLeft.y())+"\n");
PutStream(ToStr(mp2.gridPoint.x())+" "+ToStr(-mp2.gridPoint.y())+" "+ToStr(mp2.controlBottom.x())+" "+ToStr(-mp2.controlBottom.y())+" "+ToStr(mp3.controlTop.x())+" "+ToStr(-mp3.controlTop.y())+"\n");
PutStream(ToStr(mp3.gridPoint.x())+" "+ToStr(-mp3.gridPoint.y())+" "+ToStr(mp3.controlLeft.x())+" "+ToStr(-mp3.controlLeft.y())+" "+ToStr(mp4.controlRight.x())+" "+ToStr(-mp4.controlRight.y())+"\n");
PutStream(colorValues[colInd4]+" "+colorValues[colInd1]+" "+colorValues[colInd2]+" "+colorValues[colInd3]+"\n");
}
PutStream("]\n");
PutStream(">>\n");
PutStream(">>\n");
PutStream("[1 0 0 1 0 0] makepattern setpattern\n");
if (fillRule)
PutStream("eofill\n");
else
PutStream("fill\n");
return;
}
 
void PSLib::HandleDiamondGradient(PageItem* c, bool gcr)
{
QString GCol;
3702,6 → 3863,11
HandleMeshGradient(c, gcr);
return;
}
else if (GType == 12)
{
HandlePatchMeshGradient(c, gcr);
return;
}
}
QList<VColorStop*> cstops = gradient.colorStops();
PutStream("<<\n");
4084,7 → 4250,7
}
}
 
void PSLib::setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint argh, Page* pg, bool sep, bool farb, bool ic, bool master)
void PSLib::setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint argh, ScPage* pg, bool sep, bool farb, bool ic, bool master)
{
// qDebug() << QString("pslib setTextSt: ownPage=%1 pageNr=%2 OnMasterPage=%3;").arg(ite->OwnPage).arg(pg->pageNr()).arg(ite->OnMasterPage);
int tabCc = 0;
4208,7 → 4374,7
#endif
}
 
void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint argh, uint doh, ScText *hl, const ParagraphStyle& pstyle, Page* pg, bool sep, bool farb, bool ic, bool master)
void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint argh, uint doh, ScText *hl, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master)
{
const CharStyle & cstyle(*hl);
const GlyphLayout & glyphs(hl->glyph);
4619,7 → 4785,7
}
}
 
void PSLib::GetBleeds(Page* page, double& left, double& right)
void PSLib::GetBleeds(ScPage* page, double& left, double& right)
{
MarginStruct values;
m_Doc->getBleeds(page, Options.bleeds, values);
4627,7 → 4793,7
right = values.Right;
}
 
void PSLib::GetBleeds(Page* page, double& left, double& right, double& bottom, double& top)
void PSLib::GetBleeds(ScPage* page, double& left, double& right, double& bottom, double& top)
{
MarginStruct values;
m_Doc->getBleeds(page, Options.bleeds, values);
/trunk/Scribus/scribus/canvasmode_normal.cpp
1,1373 → 1,1373
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
 
#include "canvasmode_normal.h"
 
#include <QApplication>
#include <QButtonGroup>
#include <QCheckBox>
#include <QCursor>
#include <QEvent>
#include <QMessageBox>
#include <QMouseEvent>
#include <QPainterPath>
#include <QPoint>
#include <QRect>
#include <QTimer>
#include <QWidgetAction>
#include <QDebug>
 
#include "canvas.h"
#include "canvasgesture_linemove.h"
#include "canvasgesture_resize.h"
#include "canvasgesture_rulermove.h"
#include "fileloader.h"
#include "fpoint.h"
#include "fpointarray.h"
#include "hyphenator.h"
#include "loadsaveplugin.h"
#include "pageitem_textframe.h"
#include "pageitem_regularpolygon.h"
#include "pageitem_arc.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scmimedata.h"
#include "scribus.h"
#include "scribusdoc.h"
#include "scribusview.h"
#include "scribusXml.h"
#include "selection.h"
#include "undomanager.h"
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
#include "ui/aligndistribute.h"
#include "ui/contextmenu.h"
#include "ui/customfdialog.h"
#include "ui/insertTable.h"
#include "ui/pageselector.h"
#include "ui/polyprops.h"
#include "ui/propertiespalette.h"
#include "ui/propertiespalette_line.h"
#include "ui/propertiespalette_text.h"
#include "plugins/formatidlist.h"
 
 
 
CanvasMode_Normal::CanvasMode_Normal(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW)
{
frameResizeHandle = -1;
shiftSelItems = false;
resizeGesture = NULL;
lineMoveGesture = NULL;
guideMoveGesture = NULL;
m_mousePressPoint.setXY(0, 0);
m_mouseCurrentPoint.setXY(0, 0);
m_mouseSavedPoint.setXY(0, 0);
m_objectDeltaPos.setXY(0,0 );
}
 
inline bool CanvasMode_Normal::GetItem(PageItem** pi)
{
*pi = m_doc->m_Selection->itemAt(0);
return (*pi) != NULL;
}
 
void CanvasMode_Normal::drawControls(QPainter* p)
{
// qDebug() << "CanvasMode_Normal::drawControls";
if (m_canvas->m_viewMode.operItemMoving)
{
drawOutline(p, 1.0, 1.0, m_objectDeltaPos.x(), m_objectDeltaPos.y());
}
else
{
drawSelection(p, true);
}
}
 
void CanvasMode_Normal::enterEvent(QEvent *)
{
if (!m_canvas->m_viewMode.m_MouseButtonPressed)
{
setModeCursor();
}
}
 
void CanvasMode_Normal::leaveEvent(QEvent *e)
{
if (!m_canvas->m_viewMode.m_MouseButtonPressed)
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
 
 
void CanvasMode_Normal::activate(bool fromGesture)
{
// qDebug() << "CanvasMode_Normal::activate" << fromGesture;
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m_canvas->m_viewMode.operItemMoving = false;
m_canvas->m_viewMode.operItemResizing = false;
m_view->MidButt = false;
m_mousePressPoint.setXY(0, 0);
m_mouseCurrentPoint.setXY(0, 0);
m_mouseSavedPoint.setXY(0, 0);
m_objectDeltaPos.setXY(0,0 );
frameResizeHandle = -1;
shiftSelItems = false;
setModeCursor();
if (fromGesture)
{
m_view->update();
}
}
 
void CanvasMode_Normal::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_Normal::deactivate" << forGesture;
m_view->redrawMarker->hide();
}
 
void CanvasMode_Normal::mouseDoubleClickEvent(QMouseEvent *m)
{
m->accept();
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
// m_view->stopDragTimer();
PageItem *currItem = 0;
if (m_doc->m_Selection->isMultipleSelection())
{
if (GetItem(&currItem))
{
/* CB: old code, removing this as shift-alt select on an unselected table selects a cell now.
//#6789 is closed by sorting this.
if (currItem->isTableItem)
{
m_view->Deselect(false);
m_doc->m_Selection->addItem(currItem);
currItem->isSingleSel = true;
//CB FIXME dont call this if the added item is item 0
if (!m_doc->m_Selection->primarySelectionIs(currItem))
currItem->emitAllToGUI();
m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
}*/
}
return;
}
if (GetItem(&currItem))
{
if (currItem->asLatexFrame())
{
if (currItem->locked()) // || (!currItem->ScaleType))
{
return;
}
if (currItem->imageShown())
m_view->requestMode(modeEdit);
}
#ifdef HAVE_OSG
else if (currItem->asOSGFrame())
{
m_view->requestMode(submodeEditExternal);
}
#endif
else if ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::PolyLine) || (currItem->itemType() == PageItem::Group) || (currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::PathText))
{
if (currItem->locked()) //|| (!currItem->ScaleType))
{
//mousePressEvent(m);
return;
}
//If we double click on an image frame and theres no image assigned, open the
//load picture dialog, else put it into edit mode if the frame is set to show the image
if (currItem->itemType() == PageItem::ImageFrame)
{
if (currItem->Pfile.isEmpty())
m_view->requestMode(submodeLoadPic);
else if (!currItem->PictureIsAvailable)
m_view->requestMode(submodeStatusPic);
else if (currItem->imageShown())
m_view->requestMode(modeEdit);
}
else if (currItem->itemType() == PageItem::TextFrame)
{
m_view->requestMode(modeEdit);
}
else
m_view->requestMode(modeEditClip);
}
else if (currItem->itemType() == PageItem::TextFrame)
{
//CB old code
//emit currItem->isAnnotation() ? AnnotProps() : Amode(modeEdit);
//mousePressEvent(m);
//CB if annotation, open the annotation dialog
if (currItem->isAnnotation())
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_view->requestMode(submodeAnnotProps);
//mousePressEvent(m);
}
//else if not in mode edit, set mode edit
else if (m_doc->appMode != modeEdit)
{
m_view->requestMode(modeEdit);
m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
//CB ignore the double click and go with a single one
//if we werent in mode edit before.
//unsure if this is correct, but its ok given we had no
//double click select until now.
// mousePressEvent(m);
}
}
else if (currItem->asSymbolFrame())
{
if (!m_doc->symbolEditMode())
m_view->requestMode(submodeEditSymbol);
}
else if (currItem->asArc())
{
m_view->requestMode(modeEditArc);
}
else if (currItem->asRegularPolygon())
{
m_view->requestMode(modeEditPolygon);
}
else if (currItem->asSpiral())
{
m_view->requestMode(modeEditSpiral);
}
}
}
 
 
void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
{
// qDebug()<<"CanvasMode_Normal::mouseMoveEvent";
// const double mouseX = m->globalX();
// const double mouseY = m->globalY();
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m_lastPosWasOverGuide = false;
double newX, newY;
PageItem *currItem;
bool erf = false;
m->accept();
// qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
// emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(),
// m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
 
if (commonMouseMove(m))
return;
m_mouseCurrentPoint = mousePointDoc;
bool movingOrResizing = (m_canvas->m_viewMode.operItemMoving || m_canvas->m_viewMode.operItemResizing);
bool mouseIsOnPage = (m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y()) != -1);
if ((m_doc->guidesPrefs().guidesShown) && (!m_doc->GuideLock) && (!movingOrResizing) && (mouseIsOnPage) )
{
// #9002: Resize points undraggable when object is aligned to a guide
// Allow item resize when guides are aligned to item while preserving
// ability to drag guide when guis is in foreground and inside selection
bool enableGuideGesture(false);
Canvas::FrameHandle frameResizeHandle(Canvas::OUTSIDE);
if (m_doc->m_Selection->count() > 0)
{
double gx(0.0), gy(0.0), gw(0.0), gh(0.0);
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
}
enableGuideGesture |= (frameResizeHandle == Canvas::OUTSIDE);
enableGuideGesture |= ((!m_doc->guidesPrefs().guidePlacement) && (frameResizeHandle == Canvas::INSIDE));
if (enableGuideGesture)
{
if (!guideMoveGesture)
{
guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
connect(guideMoveGesture,SIGNAL(guideInfo(int, qreal)), m_ScMW->alignDistributePalette,SLOT(setGuide(int, qreal)));
}
if (guideMoveGesture->mouseHitsGuide(mousePointDoc))
{
m_lastPosWasOverGuide = true;
switch (guideMoveGesture->getMode())
{
case RulerGesture::HORIZONTAL:
qApp->changeOverrideCursor(QCursor(Qt::SplitVCursor));
break;
case RulerGesture::VERTICAL:
qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
break;
default:
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
return;
}
// Here removed a bunch of comments which made reading code difficult,
// there is svn for tracking changes after all. pm
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
else if (!mouseIsOnPage)
{
QCursor* cursor = qApp->overrideCursor();
if (cursor && ((cursor->shape() == Qt::SplitHCursor) || (cursor->shape() == Qt::SplitVCursor)))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
if ((GetItem(&currItem)) && (!shiftSelItems))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
// #0007865
if (/*(((m_view->dragTimerElapsed()) && (m->buttons() & Qt::LeftButton)) ||*/
(m_view->moveTimerElapsed())
&& (m->buttons() & Qt::RightButton)
&& (m_canvas->m_viewMode.m_MouseButtonPressed)
&& (!m_doc->DragP)
&& (!(currItem->isSingleSel)))
{
// start drag
// m_view->stopDragTimer();
if ((fabs(m_mousePressPoint.x() - newX) > 10) || (fabs(m_mousePressPoint.y() - newY) > 10))
{
m_canvas->setRenderMode(Canvas::RENDER_NORMAL);
// m_view->resetDragTimer();
m_doc->DragP = true;
m_doc->leaveDrag = false;
m_doc->DraggedElem = currItem;
m_doc->DragElements.clear();
for (int dre=0; dre<m_doc->m_Selection->count(); ++dre)
m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre)->ItemNr);
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_doc, m_doc->m_Selection));
delete ss;
ss = NULL;
QDrag* dr = new QDrag(m_view);
dr->setMimeData(md);
const QPixmap& pm = loadIcon("DragPix.xpm");
dr->setPixmap(pm);
// dr->setDragCursor(pm, Qt::CopyAction);
// dr->setDragCursor(pm, Qt::MoveAction);
// dr->setDragCursor(pm, Qt::LinkAction);
dr->exec();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_doc->DraggedElem = 0;
m_doc->DragElements.clear();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_view->updateContents();
}
return;
}
if (m_doc->DragP)
return;
//Operations run here:
//Item resize, esp after creating a new one
if (m_view->moveTimerElapsed() && m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::LeftButton) &&
((m_doc->appMode == modeNormal)) && (!currItem->locked()))
{
// m_view->stopDragTimer();
if (!m_canvas->m_viewMode.operItemResizing)
{
//Dragging an item (plus more?)
QRectF newPlace;
newX = mousePointDoc.x(); //static_cast<int>(m->x()/sc);
newY = mousePointDoc.y(); //static_cast<int>(m->y()/sc);
m_canvas->m_viewMode.operItemMoving = true;
qApp->changeOverrideCursor(Qt::ClosedHandCursor);
erf = false;
int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
if (!m_doc->m_Selection->isMultipleSelection())
{
erf=true;
currItem = m_doc->m_Selection->itemAt(0);
//Control Alt drag image in frame without being in edit mode
if ((currItem->asImageFrame()) && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
{
currItem->moveImageInFrame(dX/currItem->imageXScale(),dY/currItem->imageYScale());
m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
}
else
{
//Dragging orthogonally - Ctrl Drag
if ((m->modifiers() & Qt::ControlModifier) && !(m->modifiers() & Qt::ShiftModifier) && !(m->modifiers() & Qt::AltModifier))
{
if (abs(dX) > abs(dY))
dY=0;
else
if (abs(dY) > abs(dX))
dX=0;
erf=false;
dX+=qRound(dragConstrainInitPtX-currItem->xPos());
dY+=qRound(dragConstrainInitPtY-currItem->yPos());
}
if (!(currItem->isTableItem && currItem->isSingleSel))
{
double gx, gy, gh, gw;
m_objectDeltaPos.setXY(dX, dY);
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
if (m_doc->SnapGuides)
{
double nx = gx + m_objectDeltaPos.x();
double ny = gy + m_objectDeltaPos.y();
double nxo = nx, nyo = ny;
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
nx = nxo = gx + gw + m_objectDeltaPos.x();
ny = nyo = gy + gh + m_objectDeltaPos.y();
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
}
if (m_doc->useRaster)
{
m_doc->m_Selection->setGroupRect();
double gx, gy, gh, gw, gxo, gyo;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
gx += m_objectDeltaPos.x();
gy += m_objectDeltaPos.y();
gxo = gx;
gyo = gy;
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
gx = npw.x() - gw;
else
gx = npx.x();
if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
gy = npw.y() - gh;
else
gy = npx.y();
if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
m_objectDeltaPos += FPoint(gx-gxo, gy-gyo);
}
}
}
}
else
{
double gx, gy, gh, gw;
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
int dX=qRound(newX - m_mousePressPoint.x()), dY=qRound(newY - m_mousePressPoint.y());
erf = true;
if (m->modifiers() & Qt::ControlModifier)
{
if (abs(dX)>abs(dY))
dY=0;
else
if (abs(dY)>abs(dX))
dX=0;
erf=false;
dX+=dragConstrainInitPtX-qRound(gx);
dY+=dragConstrainInitPtY-qRound(gy);
}
m_objectDeltaPos.setXY(dX, dY);
if (m_doc->SnapGuides)
{
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx + m_objectDeltaPos.x();
double ny = gy + m_objectDeltaPos.y();
double nxo = nx, nyo = ny;
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
nx = nxo = gx + gw + m_objectDeltaPos.x();
ny = nyo = gy + gh + m_objectDeltaPos.y();
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
}
if (m_doc->useRaster)
{
double gx, gy, gh, gw, gxo, gyo;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
gx += m_objectDeltaPos.x();
gy += m_objectDeltaPos.y();
gxo = gx;
gyo = gy;
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
gx = npw.x() - gw;
else
gx = npx.x();
if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
gy = npw.y() - gh;
else
gy = npx.y();
if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
m_objectDeltaPos += FPoint(gx-gxo, gy-gyo);
}
}
if (erf)
{
m_mouseCurrentPoint.setXY(newX, newY);
}
{
double gx, gy, gh, gw;
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
m_doc->adjustCanvas(FPoint(gx,gy), FPoint(gx+gw, gy+gh));
QPoint selectionCenter = m_canvas->canvasToLocal(QPointF(gx+gw/2, gy+gh/2));
QPoint localMousePos = m_canvas->canvasToLocal(mousePointDoc);
int localwidth = static_cast<int>(gw * m_canvas->scale());
int localheight = static_cast<int>(gh * m_canvas->scale());
if (localwidth > 200)
{
localwidth = 0;
selectionCenter.setX(localMousePos.x());
}
if (localheight > 200)
{
localheight = 0;
selectionCenter.setY(localMousePos.y());
}
m_view->ensureVisible(selectionCenter.x(), selectionCenter.y(), localwidth/2 + 20, localheight/2 + 20);
m_canvas->repaint();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
m_canvas->displayCorrectedXYHUD(m->globalPos(), gx + m_objectDeltaPos.x(), gy + m_objectDeltaPos.y());
}
}
}
if ((!m_canvas->m_viewMode.m_MouseButtonPressed) && (m_doc->appMode != modeDrawBezierLine))
{
if (m_doc->m_Selection->isMultipleSelection())
{
// QRect mpo = QRect(qRound(m->x()/m_canvas->scale())-m_doc->guidesPrefs().grabRad, qRound(m->y()/m_canvas->scale())-m_doc->guidesPrefs().grabRad, m_doc->guidesPrefs().grabRad*2, m_doc->guidesPrefs().grabRad*2);
// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x()), qRound(m_doc->minCanvasCoordinate.y()));
double gx, gy, gh, gw;
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
// if ((QRect(static_cast<int>(gx), static_cast<int>(gy), static_cast<int>(gw), static_cast<int>(gh)).intersects(mpo))
if (how >= 0)
{
if (how > 0)
{
setResizeCursor(how);
}
else
{
qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
}
}
else
{
setModeCursor();
}
return;
}
for (int a = 0; a < m_doc->m_Selection->count(); ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
if (currItem->locked())
break;
QTransform p;
m_canvas->Transform(currItem, p);
QRect mpo = QRect(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
if ((QRegion(p.map(QPolygon(QRect(-3, -3, static_cast<int>(currItem->width()+6), static_cast<int>(currItem->height()+6))))).contains(mpo)))
{
QRect tx = p.mapRect(QRect(0, 0, static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
if ((tx.intersects(mpo)) && (!currItem->locked()))
{
qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
if (!currItem->sizeLocked())
m_view->HandleCurs(currItem, mpo);
}
}
else
{
// setModeCursor();
}
}
if (GetItem(&currItem) && m_doc->appMode == modeNormal)
{
int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
if (how > 0)
{
if(currItem->asLine())
qApp->changeOverrideCursor(QCursor(Qt::SizeAllCursor));
else if(!currItem->locked() && !currItem->sizeLocked())
setResizeCursor(how, currItem->rotation());
}
else if (how == 0)
qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
else
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
}
}
else
{
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
m_mouseSavedPoint.setXY(newX, newY);
QPoint startP = m_canvas->canvasToGlobal(m_mousePressPoint);
m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
if (!m_view->redrawMarker->isVisible())
m_view->redrawMarker->show();
m_view->HaveSelRect = true;
return;
}
}
}
 
void CanvasMode_Normal::mousePressEvent(QMouseEvent *m)
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
PageItem *currItem;
 
m_objectDeltaPos = FPoint(0, 0);
m_mousePressPoint = m_mouseCurrentPoint = mousePointDoc;
m_mouseSavedPoint = mousePointDoc;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
m_view->registerMousePress(m->globalPos());
QRect mpo(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
 
if (m->button() == Qt::MidButton)
{
m_view->MidButt = true;
if (m->modifiers() & Qt::ControlModifier)
m_view->DrawNew();
return;
}
 
if ((GetItem(&currItem)) && (!m_lastPosWasOverGuide))
{
if ((currItem->asLine()) && (!m_doc->m_Selection->isMultipleSelection()))
{
if (!lineMoveGesture)
lineMoveGesture = new LineMove(this);
lineMoveGesture->mousePressEvent(m);
if (lineMoveGesture->haveLineItem())
{
m_view->startGesture(lineMoveGesture);
return;
}
}
else
{
bool isMS=m_doc->m_Selection->isMultipleSelection();
if (isMS || (!isMS && (!currItem->locked() && !currItem->sizeLocked())))
{
if (!resizeGesture)
resizeGesture = new ResizeGesture(this);
 
resizeGesture->mousePressEvent(m);
if (resizeGesture->frameHandle() > 0)
{
m_view->startGesture(resizeGesture);
return;
}
}
//#7928 else
//#7928 return;
}
qApp->changeOverrideCursor(Qt::ClosedHandCursor);
#if 1
if (m_doc->m_Selection->isMultipleSelection())
{
m_canvas->PaintSizeRect(QRect());
double gx, gy, gh, gw;
bool shiftSel = true;
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
dragConstrainInitPtX = qRound(gx);
dragConstrainInitPtY = qRound(gy);
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
if (frameResizeHandle == Canvas::OUTSIDE ||
(frameResizeHandle == Canvas::INSIDE && m->modifiers() != Qt::NoModifier))
{
frameResizeHandle = 0;
m_doc->m_Selection->delaySignalsOn();
m_view->updatesOn(false);
shiftSel = SeleItem(m);
m_view->updatesOn(true);
m_doc->m_Selection->delaySignalsOff();
}
if (((m_doc->m_Selection->count() == 0) || (!shiftSel)) && (m->modifiers() == Qt::ShiftModifier))
{
shiftSelItems = true;
m_mouseCurrentPoint = m_mousePressPoint = m_mouseSavedPoint = mousePointDoc;
}
else
shiftSelItems = false;
m_canvas->setRenderModeFillBuffer();
}
else // not multiple selection
{
dragConstrainInitPtX = qRound(currItem->xPos());
dragConstrainInitPtY = qRound(currItem->yPos());
// dont call SeleItem() without need here:
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
//#6797
if (frameResizeHandle <= 0 || m->modifiers() != Qt::NoModifier)
{
m_doc->m_Selection->delaySignalsOn();
m_view->updatesOn(false);
SeleItem(m); //Where we send the mouse press event to select an item
if (GetItem(&currItem))
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
else
frameResizeHandle = 0;
m_view->updatesOn(true);
m_doc->m_Selection->delaySignalsOff();
}
if ((currItem && !currItem->locked() && frameResizeHandle > 0) == false)
{
m_mouseCurrentPoint = m_mousePressPoint = m_mouseSavedPoint = mousePointDoc;
}
}
m_canvas->setRenderModeFillBuffer();
#endif
}
else // !GetItem()
{
SeleItem(m);
if (m_doc->m_Selection->count() == 0)
{
m_mouseCurrentPoint = m_mousePressPoint = m_mouseSavedPoint = mousePointDoc;
m_view->redrawMarker->setGeometry(m->globalPos().x(), m->globalPos().y(), 1, 1);
m_view->redrawMarker->show();
}
else
{
m_canvas->setRenderModeFillBuffer();
}
}
/* if (m->button() == MidButton)
{
MidButt = true;
if (m_doc->m_Selection->count() != 0)
m_view->Deselect(true);
DrawNew();
} */
if ((m_doc->m_Selection->count() != 0) && (m->button() == Qt::RightButton))
{
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_mousePressPoint = m_mouseCurrentPoint;
}
// Commented out to fix bug #7865
// if ((m_doc->m_Selection->count() != 0) && (m->button() == Qt::LeftButton) && (frameResizeHandle == 0))
// {
// m_view->startDragTimer();
// }
m_canvas->PaintSizeRect(QRect());
}
 
 
 
void CanvasMode_Normal::mouseReleaseEvent(QMouseEvent *m)
{
// qDebug("CanvasMode_Normal::mouseReleaseEvent");
#ifdef GESTURE_FRAME_PREVIEW
clearPixmapCache();
#endif // GESTURE_FRAME_PREVIEW
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
PageItem *currItem;
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m->accept();
m_view->redrawMarker->hide();
// m_view->stopDragTimer();
//m_canvas->update(); //ugly in a mouseReleaseEvent!!!!!!!
if ((!GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP))
{
createContextMenu(NULL, mousePointDoc.x(), mousePointDoc.y());
return;
}
if ((GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP))
{
createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y());
return;
}
if (m_view->moveTimerElapsed() && (GetItem(&currItem)))
{
// m_view->stopDragTimer();
m_canvas->setRenderModeUseBuffer(false);
if (!m_doc->m_Selection->isMultipleSelection())
{
m_doc->setRedrawBounding(currItem);
currItem->OwnPage = m_doc->OnPage(currItem);
m_canvas->m_viewMode.operItemResizing = false;
if (currItem->asLine())
m_view->updateContents();
}
if (m_canvas->m_viewMode.operItemMoving)
{
// we want to invalidate all frames under the moved frame
// hm, I will try to be more explicit :) - pm
int itemIndex = m_doc->Items->count();
PageItem* underItem( m_canvas->itemUnderItem(currItem, itemIndex) );
while(underItem)
{
if(underItem->asTextFrame())
underItem->asTextFrame()->invalidateLayout();
else
underItem->invalidateLayout();
underItem = m_canvas->itemUnderItem(currItem, itemIndex);
}
m_view->updatesOn(false);
if (!m_view->groupTransactionStarted())
{
m_view->startGroupTransaction(Um::Move, "", Um::IMove);
}
if (m_doc->m_Selection->isMultipleSelection())
{
m_doc->moveGroup(m_objectDeltaPos.x(), m_objectDeltaPos.y());
m_doc->m_Selection->setGroupRect();
double gx, gy, gh, gw;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx;
double ny = gy;
if (!m_doc->ApplyGuides(&nx, &ny))
{
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
nx = npw.x() - gw;
else
nx = npx.x();
if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
ny = npw.y() - gh;
else
ny = npx.y();
}
m_doc->moveGroup(nx-gx, ny-gy, false);
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
nx = gx+gw;
ny = gy+gh;
if (m_doc->ApplyGuides(&nx, &ny))
m_doc->moveGroup(nx-(gx+gw), ny-(gy+gh), false);
m_doc->m_Selection->setGroupRect();
}
else
{
currItem = m_doc->m_Selection->itemAt(0);
m_doc->MoveItem(m_objectDeltaPos.x(), m_objectDeltaPos.y(), currItem);
if (m_doc->useRaster)
{
double nx = currItem->xPos();
double ny = currItem->yPos();
if (!m_doc->ApplyGuides(&nx, &ny))
{
m_doc->m_Selection->setGroupRect();
double gx, gy, gh, gw, gxo, gyo;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
gxo = gx;
gyo = gy;
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
gx = npw.x() - gw;
else
gx = npx.x();
if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
gy = npw.y() - gh;
else
gy = npx.y();
if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
{
nx += (gx - gxo);
ny += (gy - gyo);
}
}
m_doc->MoveItem(nx-currItem->xPos(), ny-currItem->yPos(), currItem);
}
}
m_canvas->m_viewMode.operItemMoving = false;
if (m_doc->m_Selection->isMultipleSelection())
{
double gx, gy, gh, gw;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
FPoint maxSize(gx+gw+m_doc->scratch()->Right, gy+gh+m_doc->scratch()->Bottom);
FPoint minSize(gx-m_doc->scratch()->Left, gy-m_doc->scratch()->Top);
m_doc->adjustCanvas(minSize, maxSize);
}
m_doc->setRedrawBounding(currItem);
currItem->OwnPage = m_doc->OnPage(currItem);
if (currItem->OwnPage != -1)
{
m_doc->setCurrentPage(m_doc->Pages->at(currItem->OwnPage));
m_view->setMenTxt(currItem->OwnPage);
}
//CB done with emitAllToGUI
//emit HaveSel(currItem->itemType());
//EmitValues(currItem);
//CB need this for? a moved item will send its new data with the new xpos/ypos emits
//CB TODO And what if we have dragged to a new page. Items X&Y are not updated anyway now
//currItem->emitAllToGUI();
m_view->updatesOn(true);
m_view->updateContents();
m_doc->changed();
}
}
//CB Drag selection performed here
if (((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt)) || ((shiftSelItems) && (m_view->HaveSelRect) && (!m_view->MidButt)))
{
double dx = m_mouseSavedPoint.x() - m_mousePressPoint.x();
double dy = m_mouseSavedPoint.y() - m_mousePressPoint.y();
QRectF canvasSele = QRectF(m_mousePressPoint.x(), m_mousePressPoint.y(), dx, dy).normalized();
QRectF localSele = m_canvas->canvasToLocal(canvasSele).normalized();
if (!m_doc->masterPageMode())
{
uint docPagesCount=m_doc->Pages->count();
uint docCurrPageNo=m_doc->currentPageNumber();
for (uint i = 0; i < docPagesCount; ++i)
{
Page* page = m_doc->Pages->at(i);
QRectF pageRect(page->xOffset(), page->yOffset(), page->width(), page->height());
if (pageRect.intersects(canvasSele))
{
if (docCurrPageNo != i)
{
m_doc->setCurrentPage(m_doc->Pages->at(i));
m_view->setMenTxt(i);
}
break;
}
}
m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
}
int docItemCount=m_doc->Items->count();
if (docItemCount != 0)
{
m_doc->m_Selection->delaySignalsOn();
for (int a = 0; a < docItemCount; ++a)
{
PageItem* docItem = m_doc->Items->at(a);
if ((m_doc->masterPageMode()) && (docItem->OnMasterPage != m_doc->currentPage()->pageName()))
continue;
QRect apr2 = m_canvas->canvasToLocal( docItem->getCurrentBoundingRect(docItem->lineWidth()) );
if ((localSele.contains(apr2)) && (docItem->LayerID == m_doc->activeLayer()) && (!m_doc->layerLocked(docItem->LayerID)))
{
bool redrawSelection=false;
m_view->SelectItemNr(a, redrawSelection);
}
}
m_doc->m_Selection->delaySignalsOff();
if (m_doc->m_Selection->count() > 1)
{
m_doc->m_Selection->setGroupRect();
double x, y, w, h;
m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
m_view->getGroupRectScreen(&x, &y, &w, &h);
}
}
m_view->HaveSelRect = false;
shiftSelItems = false;
// m_view->redrawMarker->hide();
m_view->updateContents();
}
if (m_doc->appMode != modeEdit)
{
if (!PrefsManager::instance()->appPrefs.uiPrefs.stickyTools)
m_view->requestMode(modeNormal);
else
{
int appMode = m_doc->appMode;
m_view->requestMode(appMode);
}
}
if (GetItem(&currItem))
{
// qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
if (m_doc->m_Selection->count() > 1)
{
m_doc->m_Selection->setGroupRect();
double x, y, w, h;
m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
m_canvas->m_viewMode.operItemMoving = false;
m_canvas->m_viewMode.operItemResizing = false;
m_view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
//Now unuseful as PropertiesPalette_XYZ::setCurrentItem() handles multiple selection
//m_ScMW->propertiesPalette->setXY(x,y);
//m_ScMW->propertiesPalette->setBH(w,h);
}
/*else
currItem->emitAllToGUI();*/
}
else
m_view->Deselect(true);
m_canvas->setRenderModeUseBuffer(false);
m_doc->DragP = false;
m_doc->leaveDrag = false;
m_canvas->m_viewMode.operItemMoving = false;
m_canvas->m_viewMode.operItemResizing = false;
m_view->MidButt = false;
shiftSelItems = false;
if (m_view->groupTransactionStarted())
{
for (int i = 0; i < m_doc->m_Selection->count(); ++i)
m_doc->m_Selection->itemAt(i)->checkChanges(true);
m_view->endGroupTransaction();
}
for (int i = 0; i < m_doc->m_Selection->count(); ++i)
m_doc->m_Selection->itemAt(i)->checkChanges(true);
//Commit drag created items to undo manager.
if (m_doc->m_Selection->itemAt(0)!=NULL)
{
m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0)->ItemNr);
}
//Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas
m_view->zoomSpinBox->clearFocus();
m_view->pageSelector->clearFocus();
if (m_doc->m_Selection->itemAt(0) != 0) // is there the old clip stored for the undo action
{
currItem = m_doc->m_Selection->itemAt(0);
m_doc->nodeEdit.finishTransaction(currItem);
}
}
 
void CanvasMode_Normal::keyPressEvent(QKeyEvent *e)
{
commonkeyPressEvent_NormalNodeEdit(e);
}
 
void CanvasMode_Normal::keyReleaseEvent(QKeyEvent *e)
{
commonkeyReleaseEvent(e);
}
 
//CB-->Doc/Fix
bool CanvasMode_Normal::SeleItem(QMouseEvent *m)
{
m_canvas->m_viewMode.operItemSelecting = true;
const unsigned SELECT_IN_GROUP = Qt::AltModifier; // Qt::MetaModifier;
const unsigned SELECT_MULTIPLE = Qt::ShiftModifier;
const unsigned SELECT_BENEATH = Qt::ControlModifier;
QTransform p;
PageItem *currItem;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m_mouseCurrentPoint = mousePointDoc;
double grabRadius = m_doc->guidesPrefs().grabRadius / m_canvas->scale();
int MxpS = static_cast<int>(mousePointDoc.x()); //m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x());
int MypS = static_cast<int>(mousePointDoc.y()); //m->y()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.y());
QRectF mpo(m_mouseCurrentPoint.x()-grabRadius, m_mouseCurrentPoint.y()-grabRadius, grabRadius*2, grabRadius*2);
m_doc->nodeEdit.deselect();
 
if(!m_doc->guidesPrefs().guidePlacement) // guides are on foreground and want to be processed first
{
if ((m_doc->guidesPrefs().guidesShown) && (m_doc->OnPage(MxpS, MypS) != -1))
{
// #9002: Resize points undraggable when object is aligned to a guide
// Allow item resize when guides are aligned to item while preserving
// ability to drag guide when guis is in foreground and inside selection
bool enableGuideGesture(true);
if (m_doc->m_Selection->count() > 0)
{
double gx(0.0), gy(0.0), gw(0.0), gh(0.0);
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
Canvas::FrameHandle frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
enableGuideGesture = (frameResizeHandle == Canvas::INSIDE);
}
if (enableGuideGesture)
{
if (!guideMoveGesture)
{
guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
connect(guideMoveGesture,SIGNAL(guideInfo(int, qreal)), m_ScMW->alignDistributePalette,SLOT(setGuide(int, qreal)));
}
if ( (!m_doc->GuideLock) && (guideMoveGesture->mouseHitsGuide(mousePointDoc)) )
{
m_view->startGesture(guideMoveGesture);
guideMoveGesture->mouseMoveEvent(m);
m_doc->m_Selection->connectItemToGUI();
// qDebug()<<"Out Of SeleItem"<<__LINE__;
return true;
}
else
{
// If we call startGesture now, a new guide is created each time.
// ### could be a weakness to avoid calling it tho.
// m_view->startGesture(guideMoveGesture);
guideMoveGesture->mouseSelectGuide(m);
}
}
}
}
bool pageChanged(false);
if (!m_doc->masterPageMode())
{
int pgNum = -1;
int docPageCount = static_cast<int>(m_doc->Pages->count() - 1);
MarginStruct pageBleeds;
bool drawBleed = false;
if (m_doc->bleeds()->hasNonZeroValue() && m_doc->guidesPrefs().showBleed)
drawBleed = true;
for (int a = docPageCount; a > -1; a--)
{
if (drawBleed)
m_doc->getBleeds(a, pageBleeds);
int x = static_cast<int>(m_doc->Pages->at(a)->xOffset() - pageBleeds.Left);
int y = static_cast<int>(m_doc->Pages->at(a)->yOffset() - pageBleeds.Top);
int w = static_cast<int>(m_doc->Pages->at(a)->width() + pageBleeds.Left + pageBleeds.Right);
int h = static_cast<int>(m_doc->Pages->at(a)->height() + pageBleeds.Bottom + pageBleeds.Top);
if (QRect(x, y, w, h).contains(MxpS, MypS))
{
pgNum = static_cast<int>(a);
if (drawBleed) // check again if its really on the correct page
{
for (int a2 = docPageCount; a2 > -1; a2--)
{
int xn = static_cast<int>(m_doc->Pages->at(a2)->xOffset());
int yn = static_cast<int>(m_doc->Pages->at(a2)->yOffset());
int wn = static_cast<int>(m_doc->Pages->at(a2)->width());
int hn = static_cast<int>(m_doc->Pages->at(a2)->height());
if (QRect(xn, yn, wn, hn).contains(MxpS, MypS))
{
pgNum = static_cast<int>(a2);
break;
}
}
}
break;
}
}
if (pgNum >= 0)
{
if (m_doc->currentPageNumber() != pgNum)
{
m_doc->setCurrentPage(m_doc->Pages->at(unsigned(pgNum)));
m_view->setMenTxt(unsigned(pgNum));
pageChanged = true;
}
}
m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
}
currItem = NULL;
if ((m->modifiers() & SELECT_BENEATH) != 0)
{
for (int i=0; i < m_doc->m_Selection->count(); ++i)
{
if (m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), m_doc->m_Selection->itemAt(i)) >= 0)
{
currItem = m_doc->m_Selection->itemAt(i);
m_doc->m_Selection->removeItem(currItem);
break;
}
}
}
else if ( (m->modifiers() & SELECT_MULTIPLE) == Qt::NoModifier)
{
m_view->Deselect(false);
}
currItem = m_canvas->itemUnderCursor(m->globalPos(), currItem, (m->modifiers() & SELECT_IN_GROUP));
if (currItem)
{
m_doc->m_Selection->delaySignalsOn();
if (m_doc->m_Selection->containsItem(currItem))
{
m_doc->m_Selection->removeItem(currItem);
}
else
{
//CB: If we have a selection but the user clicks with control on another item that is not below the current
//then clear and select the new item
if ((m->modifiers() == SELECT_BENEATH) && m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem) >= 0)
m_doc->m_Selection->clear();
//CB: #7186: This was prependItem, does not seem to need to be anymore with current select code
m_doc->m_Selection->addItem(currItem);
if ( (m->modifiers() & SELECT_IN_GROUP) && (!currItem->isGroup()))
{
currItem->isSingleSel = true;
}
}
if(pageChanged)
{
m_canvas->m_viewMode.forceRedraw = true;
m_canvas->update();
}
else
m_canvas->update();
m_doc->m_Selection->delaySignalsOff();
if (m_doc->m_Selection->count() > 1)
{
m_doc->beginUpdate();
for (int aa = 0; aa < m_doc->m_Selection->count(); ++aa)
{
PageItem *bb = m_doc->m_Selection->itemAt(aa);
bb->update();
}
m_doc->endUpdate();
m_doc->m_Selection->setGroupRect();
double x, y, w, h;
m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
m_view->getGroupRectScreen(&x, &y, &w, &h);
}
return true;
}
if ((m_doc->guidesPrefs().guidesShown) /*&& (!m_doc->GuideLock)*/ && (m_doc->OnPage(MxpS, MypS) != -1))
{
if (!guideMoveGesture)
{
guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
connect(guideMoveGesture,SIGNAL(guideInfo(int, qreal)), m_ScMW->alignDistributePalette,SLOT(setGuide(int, qreal)));
}
if ( (!m_doc->GuideLock) && (guideMoveGesture->mouseHitsGuide(mousePointDoc)) )
{
m_view->startGesture(guideMoveGesture);
guideMoveGesture->mouseMoveEvent(m);
m_doc->m_Selection->connectItemToGUI();
return true;
}
else
{
// If we call startGesture now, a new guide is created each time.
// ### could be a weakness to avoid calling it tho.
// m_view->startGesture(guideMoveGesture);
guideMoveGesture->mouseSelectGuide(m);
}
}
m_doc->m_Selection->connectItemToGUI();
if ( !(m->modifiers() & SELECT_MULTIPLE))
{
if(m_doc->m_Selection->isEmpty())
{
m_canvas->m_viewMode.forceRedraw = true;
m_canvas->update();
}
else
m_view->Deselect(true);
}
return false;
}
 
void CanvasMode_Normal::importToPage()
{
QString fileName;
QString allFormats = tr("All Supported Formats")+" (";
QStringList formats;
int fmtCode = FORMATID_ODGIMPORT;
const FileFormat *fmt = LoadSavePlugin::getFormatById(fmtCode);
while (fmt != 0)
{
if (fmt->load)
{
formats.append(fmt->filter);
int an = fmt->filter.indexOf("(");
int en = fmt->filter.indexOf(")");
while (an != -1)
{
allFormats += fmt->filter.mid(an+1, en-an-1)+" ";
an = fmt->filter.indexOf("(", en);
en = fmt->filter.indexOf(")", an);
}
}
fmtCode++;
fmt = LoadSavePlugin::getFormatById(fmtCode);
}
allFormats += "*.sce *.SCE);;";
formats.append("Scribus Objects (*.sce *.SCE)");
qSort(formats);
allFormats += formats.join(";;");
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString wdir = dirs->get("pastefile", ".");
FPoint pastePoint = m_mouseCurrentPoint;
CustomFDialog dia(m_view, wdir, tr("Open"), allFormats, fdExistingFiles);
if (dia.exec() == QDialog::Accepted)
fileName = dia.selectedFile();
else
return;
if (!fileName.isEmpty())
{
PrefsManager::instance()->prefsFile->getContext("dirs")->set("pastefile", fileName.left(fileName.lastIndexOf("/")));
m_doc->setLoading(true);
QFileInfo fi(fileName);
bool savedAlignGrid = m_doc->useRaster;
bool savedAlignGuides = m_doc->SnapGuides;
m_doc->useRaster = false;
m_doc->SnapGuides = false;
if (fi.suffix().toLower() == "sce")
m_ScMW->slotElemRead(fileName, pastePoint.x(), pastePoint.y(), true, false, m_doc, m_doc->view());
else
{
FileLoader *fileLoader = new FileLoader(fileName);
int testResult = fileLoader->TestFile();
delete fileLoader;
if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
{
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
}
}
if (m_doc->m_Selection->count() > 0)
{
double x2, y2, w, h;
m_doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
m_doc->moveGroup(pastePoint.x() - x2, pastePoint.y() - y2);
m_ScMW->requestUpdate(reqColorsUpdate | reqLineStylesUpdate | reqTextStylesUpdate);
}
}
for (int a = 0; a < m_doc->m_Selection->count(); ++a)
{
PageItem *currItem = m_doc->m_Selection->itemAt(a);
currItem->LayerID = m_doc->activeLayer();
}
m_doc->useRaster = savedAlignGrid;
m_doc->SnapGuides = savedAlignGuides;
m_doc->setLoading(false);
m_doc->view()->DrawNew();
if (m_doc->m_Selection->count() > 0)
{
m_doc->m_Selection->connectItemToGUI();
m_ScMW->HaveNewSel(m_doc->m_Selection->itemAt(0)->itemType());
}
}
}
 
void CanvasMode_Normal::createContextMenu(PageItem* currItem, double mx, double my)
{
ContextMenu* cmen=NULL;
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_view->setObjectUndoMode();
m_mouseCurrentPoint.setXY(mx, my);
if(currItem!=NULL)
cmen = new ContextMenu(*(m_doc->m_Selection), m_ScMW, m_doc);
else
cmen = new ContextMenu(m_ScMW, m_doc, mx, my);
if (cmen)
cmen->exec(QCursor::pos());
m_view->setGlobalUndoMode();
delete cmen;
}
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
 
#include "canvasmode_normal.h"
 
#include <QApplication>
#include <QButtonGroup>
#include <QCheckBox>
#include <QCursor>
#include <QEvent>
#include <QMessageBox>
#include <QMouseEvent>
#include <QPainterPath>
#include <QPoint>
#include <QRect>
#include <QTimer>
#include <QWidgetAction>
#include <QDebug>
 
#include "canvas.h"
#include "canvasgesture_linemove.h"
#include "canvasgesture_resize.h"
#include "canvasgesture_rulermove.h"
#include "fileloader.h"
#include "fpoint.h"
#include "fpointarray.h"
#include "hyphenator.h"
#include "loadsaveplugin.h"
#include "pageitem_textframe.h"
#include "pageitem_regularpolygon.h"
#include "pageitem_arc.h"
#include "prefscontext.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "scmimedata.h"
#include "scribus.h"
#include "scribusdoc.h"
#include "scribusview.h"
#include "scribusXml.h"
#include "selection.h"
#include "undomanager.h"
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
#include "ui/aligndistribute.h"
#include "ui/contextmenu.h"
#include "ui/customfdialog.h"
#include "ui/insertTable.h"
#include "ui/pageselector.h"
#include "ui/polyprops.h"
#include "ui/propertiespalette.h"
#include "ui/propertiespalette_line.h"
#include "ui/propertiespalette_text.h"
#include "plugins/formatidlist.h"
 
 
 
CanvasMode_Normal::CanvasMode_Normal(ScribusView* view) : CanvasMode(view), m_ScMW(view->m_ScMW)
{
frameResizeHandle = -1;
shiftSelItems = false;
resizeGesture = NULL;
lineMoveGesture = NULL;
guideMoveGesture = NULL;
m_mousePressPoint.setXY(0, 0);
m_mouseCurrentPoint.setXY(0, 0);
m_mouseSavedPoint.setXY(0, 0);
m_objectDeltaPos.setXY(0,0 );
}
 
inline bool CanvasMode_Normal::GetItem(PageItem** pi)
{
*pi = m_doc->m_Selection->itemAt(0);
return (*pi) != NULL;
}
 
void CanvasMode_Normal::drawControls(QPainter* p)
{
// qDebug() << "CanvasMode_Normal::drawControls";
if (m_canvas->m_viewMode.operItemMoving)
{
drawOutline(p, 1.0, 1.0, m_objectDeltaPos.x(), m_objectDeltaPos.y());
}
else
{
drawSelection(p, true);
}
}
 
void CanvasMode_Normal::enterEvent(QEvent *)
{
if (!m_canvas->m_viewMode.m_MouseButtonPressed)
{
setModeCursor();
}
}
 
void CanvasMode_Normal::leaveEvent(QEvent *e)
{
if (!m_canvas->m_viewMode.m_MouseButtonPressed)
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
 
 
void CanvasMode_Normal::activate(bool fromGesture)
{
// qDebug() << "CanvasMode_Normal::activate" << fromGesture;
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m_canvas->m_viewMode.operItemMoving = false;
m_canvas->m_viewMode.operItemResizing = false;
m_view->MidButt = false;
m_mousePressPoint.setXY(0, 0);
m_mouseCurrentPoint.setXY(0, 0);
m_mouseSavedPoint.setXY(0, 0);
m_objectDeltaPos.setXY(0,0 );
frameResizeHandle = -1;
shiftSelItems = false;
setModeCursor();
if (fromGesture)
{
m_view->update();
}
}
 
void CanvasMode_Normal::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_Normal::deactivate" << forGesture;
m_view->redrawMarker->hide();
}
 
void CanvasMode_Normal::mouseDoubleClickEvent(QMouseEvent *m)
{
m->accept();
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
// m_view->stopDragTimer();
PageItem *currItem = 0;
if (m_doc->m_Selection->isMultipleSelection())
{
if (GetItem(&currItem))
{
/* CB: old code, removing this as shift-alt select on an unselected table selects a cell now.
//#6789 is closed by sorting this.
if (currItem->isTableItem)
{
m_view->Deselect(false);
m_doc->m_Selection->addItem(currItem);
currItem->isSingleSel = true;
//CB FIXME dont call this if the added item is item 0
if (!m_doc->m_Selection->primarySelectionIs(currItem))
currItem->emitAllToGUI();
m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
}*/
}
return;
}
if (GetItem(&currItem))
{
if (currItem->asLatexFrame())
{
if (currItem->locked()) // || (!currItem->ScaleType))
{
return;
}
if (currItem->imageShown())
m_view->requestMode(modeEdit);
}
#ifdef HAVE_OSG
else if (currItem->asOSGFrame())
{
m_view->requestMode(submodeEditExternal);
}
#endif
else if ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::PolyLine) || (currItem->itemType() == PageItem::Group) || (currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::PathText))
{
if (currItem->locked()) //|| (!currItem->ScaleType))
{
//mousePressEvent(m);
return;
}
//If we double click on an image frame and theres no image assigned, open the
//load picture dialog, else put it into edit mode if the frame is set to show the image
if (currItem->itemType() == PageItem::ImageFrame)
{
if (currItem->Pfile.isEmpty())
m_view->requestMode(submodeLoadPic);
else if (!currItem->PictureIsAvailable)
m_view->requestMode(submodeStatusPic);
else if (currItem->imageShown())
m_view->requestMode(modeEdit);
}
else if (currItem->itemType() == PageItem::TextFrame)
{
m_view->requestMode(modeEdit);
}
else
m_view->requestMode(modeEditClip);
}
else if (currItem->itemType() == PageItem::TextFrame)
{
//CB old code
//emit currItem->isAnnotation() ? AnnotProps() : Amode(modeEdit);
//mousePressEvent(m);
//CB if annotation, open the annotation dialog
if (currItem->isAnnotation())
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_view->requestMode(submodeAnnotProps);
//mousePressEvent(m);
}
//else if not in mode edit, set mode edit
else if (m_doc->appMode != modeEdit)
{
m_view->requestMode(modeEdit);
m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
//CB ignore the double click and go with a single one
//if we werent in mode edit before.
//unsure if this is correct, but its ok given we had no
//double click select until now.
// mousePressEvent(m);
}
}
else if (currItem->asSymbolFrame())
{
if (!m_doc->symbolEditMode())
m_view->requestMode(submodeEditSymbol);
}
else if (currItem->asArc())
{
m_view->requestMode(modeEditArc);
}
else if (currItem->asRegularPolygon())
{
m_view->requestMode(modeEditPolygon);
}
else if (currItem->asSpiral())
{
m_view->requestMode(modeEditSpiral);
}
}
}
 
 
void CanvasMode_Normal::mouseMoveEvent(QMouseEvent *m)
{
// qDebug()<<"CanvasMode_Normal::mouseMoveEvent";
// const double mouseX = m->globalX();
// const double mouseY = m->globalY();
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m_lastPosWasOverGuide = false;
double newX, newY;
PageItem *currItem;
bool erf = false;
m->accept();
// qDebug() << "legacy mode move:" << m->x() << m->y() << m_canvas->globalToCanvas(m->globalPos()).x() << m_canvas->globalToCanvas(m->globalPos()).y();
// emit MousePos(m->x()/m_canvas->scale(),// + m_doc->minCanvasCoordinate.x(),
// m->y()/m_canvas->scale()); // + m_doc->minCanvasCoordinate.y());
 
if (commonMouseMove(m))
return;
m_mouseCurrentPoint = mousePointDoc;
bool movingOrResizing = (m_canvas->m_viewMode.operItemMoving || m_canvas->m_viewMode.operItemResizing);
bool mouseIsOnPage = (m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y()) != -1);
if ((m_doc->guidesPrefs().guidesShown) && (!m_doc->GuideLock) && (!movingOrResizing) && (mouseIsOnPage) )
{
// #9002: Resize points undraggable when object is aligned to a guide
// Allow item resize when guides are aligned to item while preserving
// ability to drag guide when guis is in foreground and inside selection
bool enableGuideGesture(false);
Canvas::FrameHandle frameResizeHandle(Canvas::OUTSIDE);
if (m_doc->m_Selection->count() > 0)
{
double gx(0.0), gy(0.0), gw(0.0), gh(0.0);
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
frameResizeHandle = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
}
enableGuideGesture |= (frameResizeHandle == Canvas::OUTSIDE);
enableGuideGesture |= ((!m_doc->guidesPrefs().guidePlacement) && (frameResizeHandle == Canvas::INSIDE));
if (enableGuideGesture)
{
if (!guideMoveGesture)
{
guideMoveGesture = new RulerGesture(m_view, RulerGesture::HORIZONTAL);
connect(guideMoveGesture,SIGNAL(guideInfo(int, qreal)), m_ScMW->alignDistributePalette,SLOT(setGuide(int, qreal)));
}
if (guideMoveGesture->mouseHitsGuide(mousePointDoc))
{
m_lastPosWasOverGuide = true;
switch (guideMoveGesture->getMode())
{
case RulerGesture::HORIZONTAL:
qApp->changeOverrideCursor(QCursor(Qt::SplitVCursor));
break;
case RulerGesture::VERTICAL:
qApp->changeOverrideCursor(QCursor(Qt::SplitHCursor));
break;
default:
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
return;
}
// Here removed a bunch of comments which made reading code difficult,
// there is svn for tracking changes after all. pm
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
else if (!mouseIsOnPage)
{
QCursor* cursor = qApp->overrideCursor();
if (cursor && ((cursor->shape() == Qt::SplitHCursor) || (cursor->shape() == Qt::SplitVCursor)))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
if ((GetItem(&currItem)) && (!shiftSelItems))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
// #0007865
if (/*(((m_view->dragTimerElapsed()) && (m->buttons() & Qt::LeftButton)) ||*/
(m_view->moveTimerElapsed())
&& (m->buttons() & Qt::RightButton)
&& (m_canvas->m_viewMode.m_MouseButtonPressed)
&& (!m_doc->DragP)
&& (!(currItem->isSingleSel)))
{
// start drag
// m_view->stopDragTimer();
if ((fabs(m_mousePressPoint.x() - newX) > 10) || (fabs(m_mousePressPoint.y() - newY) > 10))
{
m_canvas->setRenderMode(Canvas::RENDER_NORMAL);
// m_view->resetDragTimer();
m_doc->DragP = true;
m_doc->leaveDrag = false;
m_doc->DraggedElem = currItem;
m_doc->DragElements.clear();
for (int dre=0; dre<m_doc->m_Selection->count(); ++dre)
m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre)->ItemNr);
ScriXmlDoc *ss = new ScriXmlDoc();
ScElemMimeData* md = new ScElemMimeData();
md->setScribusElem(ss->WriteElem(m_doc, m_doc->m_Selection));
delete ss;
ss = NULL;
QDrag* dr = new QDrag(m_view);
dr->setMimeData(md);
const QPixmap& pm = loadIcon("DragPix.xpm");
dr->setPixmap(pm);
// dr->setDragCursor(pm, Qt::CopyAction);
// dr->setDragCursor(pm, Qt::MoveAction);
// dr->setDragCursor(pm, Qt::LinkAction);
dr->exec();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_doc->DraggedElem = 0;
m_doc->DragElements.clear();
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
m_view->updateContents();
}
return;
}
if (m_doc->DragP)
return;
//Operations run here:
//Item resize, esp after creating a new one
if (m_view->moveTimerElapsed() && m_canvas->m_viewMode.m_MouseButtonPressed && (m->buttons() & Qt::LeftButton) &&
((m_doc->appMode == modeNormal)) && (!currItem->locked()))
{
// m_view->stopDragTimer();
if (!m_canvas->m_viewMode.operItemResizing)
{
//Dragging an item (plus more?)
QRectF newPlace;
newX = mousePointDoc.x(); //static_cast<int>(m->x()/sc);
newY = mousePointDoc.y(); //static_cast<int>(m->y()/sc);
m_canvas->m_viewMode.operItemMoving = true;
qApp->changeOverrideCursor(Qt::ClosedHandCursor);
erf = false;
int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
if (!m_doc->m_Selection->isMultipleSelection())
{
erf=true;
currItem = m_doc->m_Selection->itemAt(0);
//Control Alt drag image in frame without being in edit mode
if ((currItem->asImageFrame()) && (m->modifiers() & Qt::ControlModifier) && (m->modifiers() & Qt::AltModifier))
{
currItem->moveImageInFrame(dX/currItem->imageXScale(),dY/currItem->imageYScale());
m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
}
else
{
//Dragging orthogonally - Ctrl Drag
if ((m->modifiers() & Qt::ControlModifier) && !(m->modifiers() & Qt::ShiftModifier) && !(m->modifiers() & Qt::AltModifier))
{
if (abs(dX) > abs(dY))
dY=0;
else
if (abs(dY) > abs(dX))
dX=0;
erf=false;
dX+=qRound(dragConstrainInitPtX-currItem->xPos());
dY+=qRound(dragConstrainInitPtY-currItem->yPos());
}
if (!(currItem->isTableItem && currItem->isSingleSel))
{
double gx, gy, gh, gw;
m_objectDeltaPos.setXY(dX, dY);
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
if (m_doc->SnapGuides)
{
double nx = gx + m_objectDeltaPos.x();
double ny = gy + m_objectDeltaPos.y();
double nxo = nx, nyo = ny;
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx - nxo, ny - nyo);
nx = nxo = gx + gw + m_objectDeltaPos.x();
ny = nyo = gy + gh + m_objectDeltaPos.y();
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
}
if (m_doc->useRaster)
{
m_doc->m_Selection->setGroupRect();
double gx, gy, gh, gw, gxo, gyo;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
gx += m_objectDeltaPos.x();
gy += m_objectDeltaPos.y();
gxo = gx;
gyo = gy;
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
gx = npw.x() - gw;
else
gx = npx.x();
if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
gy = npw.y() - gh;
else
gy = npx.y();
if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
m_objectDeltaPos += FPoint(gx-gxo, gy-gyo);
}
}
}
}
else
{
double gx, gy, gh, gw;
m_doc->m_Selection->setGroupRect();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
int dX=qRound(newX - m_mousePressPoint.x()), dY=qRound(newY - m_mousePressPoint.y());
erf = true;
if (m->modifiers() & Qt::ControlModifier)
{
if (abs(dX)>abs(dY))
dY=0;
else
if (abs(dY)>abs(dX))
dX=0;
erf=false;
dX+=dragConstrainInitPtX-qRound(gx);
dY+=dragConstrainInitPtY-qRound(gy);
}
m_objectDeltaPos.setXY(dX, dY);
if (m_doc->SnapGuides)
{
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
double nx = gx + m_objectDeltaPos.x();
double ny = gy + m_objectDeltaPos.y();
double nxo = nx, nyo = ny;
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
nx = nxo = gx + gw + m_objectDeltaPos.x();
ny = nyo = gy + gh + m_objectDeltaPos.y();
m_doc->ApplyGuides(&nx, &ny);
m_objectDeltaPos += FPoint(nx-nxo, ny-nyo);
}
if (m_doc->useRaster)
{
double gx, gy, gh, gw, gxo, gyo;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
gx += m_objectDeltaPos.x();
gy += m_objectDeltaPos.y();
gxo = gx;
gyo = gy;
FPoint npx = m_doc->ApplyGridF(FPoint(gx, gy));
FPoint npw = m_doc->ApplyGridF(FPoint(gx+gw, gy+gh));
if ((fabs(gx-npx.x())) > (fabs((gx+gw)-npw.x())))
gx = npw.x() - gw;
else
gx = npx.x();
if ((fabs(gy-npx.y())) > (fabs((gy+gh)-npw.y())))
gy = npw.y() - gh;
else
gy = npx.y();
if ((fabs(gx - gxo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()) && (fabs(gy - gyo) < (m_doc->guidesPrefs().guideRad) / m_canvas->scale()))
m_objectDeltaPos += FPoint(gx-gxo, gy-gyo);
}
}
if (erf)
{
m_mouseCurrentPoint.setXY(newX, newY);
}
{
double gx, gy, gh, gw;
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
m_doc->adjustCanvas(FPoint(gx,gy), FPoint(gx+gw, gy+gh));
QPoint selectionCenter = m_canvas->canvasToLocal(QPointF(gx+gw/2, gy+gh/2));
QPoint localMousePos = m_canvas->canvasToLocal(mousePointDoc);
int localwidth = static_cast<int>(gw * m_canvas->scale());
int localheight = static_cast<int>(gh * m_canvas->scale());
if (localwidth > 200)
{
localwidth = 0;
selectionCenter.setX(localMousePos.x());
}
if (localheight > 200)
{
localheight = 0;
selectionCenter.setY(localMousePos.y());
}
m_view->ensureVisible(selectionCenter.x(), selectionCenter.y(), localwidth/2 + 20, localheight/2 + 20);
m_canvas->repaint();
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
m_canvas->displayCorrectedXYHUD(m->globalPos(), gx + m_objectDeltaPos.x(), gy + m_objectDeltaPos.y());
}
}
}
if ((!m_canvas->m_viewMode.m_MouseButtonPressed) && (m_doc->appMode != modeDrawBezierLine))
{
if (m_doc->m_Selection->isMultipleSelection())
{
// QRect mpo = QRect(qRound(m->x()/m_canvas->scale())-m_doc->guidesPrefs().grabRad, qRound(m->y()/m_canvas->scale())-m_doc->guidesPrefs().grabRad, m_doc->guidesPrefs().grabRad*2, m_doc->guidesPrefs().grabRad*2);
// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x()), qRound(m_doc->minCanvasCoordinate.y()));
double gx, gy, gh, gw;
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), QRectF(gx, gy, gw, gh));
// if ((QRect(static_cast<int>(gx), static_cast<int>(gy), static_cast<int>(gw), static_cast<int>(gh)).intersects(mpo))
if (how >= 0)
{
if (how > 0)
{
setResizeCursor(how);
}
else
{
qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
}
}
else
{
setModeCursor();
}
return;
}
for (int a = 0; a < m_doc->m_Selection->count(); ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
if (currItem->locked())
break;
QTransform p;
m_canvas->Transform(currItem, p);
QRect mpo = QRect(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
if ((QRegion(p.map(QPolygon(QRect(-3, -3, static_cast<int>(currItem->width()+6), static_cast<int>(currItem->height()+6))))).contains(mpo)))
{
QRect tx = p.mapRect(QRect(0, 0, static_cast<int>(currItem->width()), static_cast<int>(currItem->height())));
if ((tx.intersects(mpo)) && (!currItem->locked()))
{
qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
if (!currItem->sizeLocked())
m_view->HandleCurs(currItem, mpo);
}
}
else
{
// setModeCursor();
}
}
if (GetItem(&currItem) && m_doc->appMode == modeNormal)
{
int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
if (how > 0)
{
if(currItem->asLine())
qApp->changeOverrideCursor(QCursor(Qt::SizeAllCursor));
else if(!currItem->locked() && !currItem->sizeLocked())
setResizeCursor(how, currItem->rotation());
}
else if (how == 0)
qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
else
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
}
}
}
else
{
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
m_mouseSavedPoint.setXY(newX, newY);
QPoint startP = m_canvas->canvasToGlobal(m_mousePressPoint);
m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
if (!m_view->redrawMarker->isVisible())
m_view->redrawMarker->show();
m_view->HaveSelRect = true;
return;
}
}
}
 
void CanvasMode_Normal::mousePressEvent(QMouseEvent *m)
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
PageItem *currItem;
 
m_objectDeltaPos = FPoint(0, 0);
m_mousePressPoint = m_mouseCurrentPoint = mousePointDoc;
m_mouseSavedPoint = mousePointDoc;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
m_view->registerMousePress(m->globalPos());
QRect mpo(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
// mpo.moveBy(qRound(m_doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(m_doc->minCanvasCoordinate.y() * m_canvas->scale()));
 
if (m->button() == Qt::MidButton)
{
m_view->MidButt = true;
if (m->modifiers() & Qt::ControlModifier)
m_view->DrawNew();
return;
}
 
if ((GetItem(&currItem)) && (!m_lastPosWasOverGuide))
{
if