Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 6379 → Rev 6380

/branches/Version13x/Scribus/scribus/patterndialog.cpp
165,6 → 165,8
pat.setDoc(m_doc);
PageItem* currItem = m_doc->Items->at(ac);
pat.pattern = currItem->DrawObj_toImage();
pat.width = currItem->gWidth;
pat.height = currItem->gHeight;
for (uint as = ac; as < ae; ++as)
{
pat.items.append(m_doc->Items->take(ac));
/branches/Version13x/Scribus/scribus/scpattern.h
44,9 → 44,10
double scaleX;
double scaleY;
double rotation;
double height;
double width;
QPtrList<PageItem> items;
ScribusDoc *m_doc;
QString file;
QImage pattern;
};
 
/branches/Version13x/Scribus/scribus/scpattern.cpp
31,8 → 31,6
 
ScPattern::ScPattern()
{
file = "";
// items.setAutoDelete(true);
items.clear();
pattern = QImage();
offsetX = 0.0;
40,6 → 38,8
scaleX = 1.0;
scaleY = 1.0;
rotation = 0.0;
width = 0.0;
height = 0.0;
};
 
void ScPattern::setDoc(ScribusDoc *doc)
68,8 → 68,9
newItem->gYpos = 0.0;
newItem->gWidth = pattern.width();
newItem->gHeight = pattern.height();
width = pattern.width();
height = pattern.height();
items.append(newItem);
file = name;
}
else
pattern = QImage();
/branches/Version13x/Scribus/scribus/pdflib.cpp
3857,14 → 3857,14
PutDoc("/PatternType 1\n");
PutDoc("/PaintType 1\n");
PutDoc("/TilingType 2\n");
PutDoc("/BBox [ 0 0 "+FToStr(pat->getPattern()->width())+" "+FToStr(-pat->getPattern()->height())+" ]\n");
double xdivi = (currItem->xPos() - ActPageP->xOffset()) / static_cast<double>(pat->getPattern()->width());
double xoffs = (xdivi - floor(xdivi)) * pat->getPattern()->width();
double ydivi = (ActPageP->height() - (currItem->yPos() - ActPageP->yOffset())) / static_cast<double>(pat->getPattern()->height());
double yoffs = (ydivi - floor(ydivi)) * pat->getPattern()->height();
PutDoc("/BBox [ 0 0 "+FToStr(pat->width)+" "+FToStr(-pat->height)+" ]\n");
double xdivi = (currItem->xPos() - ActPageP->xOffset()) / static_cast<double>(pat->width);
double xoffs = (xdivi - floor(xdivi)) * pat->width;
double ydivi = (ActPageP->height() - (currItem->yPos() - ActPageP->yOffset())) / static_cast<double>(pat->height);
double yoffs = (ydivi - floor(ydivi)) * pat->height;
PutDoc("/Matrix ["+FToStr(pat->scaleX)+" 0 0 "+FToStr(pat->scaleY)+" "+FToStr(xoffs)+" "+FToStr(yoffs)+"]\n");
PutDoc("/XStep "+FToStr(pat->getPattern()->width())+"\n");
PutDoc("/YStep "+FToStr(pat->getPattern()->height())+"\n");
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)
{
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
55,7 → 55,7
QString readSLA(const QString & fileName);
QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
void WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master);
void WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master);
void WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master, QPtrList<PageItem> *items = 0);
void SetItemProps(QDomElement *ob, PageItem* item, bool newFormat);
QValueList<int> LFrames;
QValueList<ScFace> dummyScFaces;
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
1088,6 → 1088,125
bok.Parent = pg.attribute("Parent").toInt();
m_Doc->BookMarks.append(bok);
}
if(pg.tagName()=="Pattern")
{
ScPattern pat;
QDomNode pa = PAGE.firstChild();
uint ac = m_Doc->Items->count();
while(!pa.isNull())
{
QDomElement pite = pa.toElement();
m_Doc->setMasterPageMode(false);
if ((pite.attribute("NEXTITEM").toInt() != -1) || (static_cast<bool>(pite.attribute("AUTOTEXT").toInt())))
{
if (pite.attribute("BACKITEM").toInt() == -1)
LFrames.append(m_Doc->Items->count());
}
int docGc = m_Doc->GroupCounter;
m_Doc->GroupCounter = 0;
Neu = PasteItem(&pite, m_Doc);
Neu->setRedrawBounding();
Neu->OwnPage = pite.attribute("OwnPage").toInt();
Neu->OnMasterPage = "";
m_Doc->GroupCounter = docGc;
tmpf = pite.attribute("IFONT", m_Doc->toolSettings.defFont);
if ((!m_AvailableFonts->contains(tmpf)) || (!(*m_AvailableFonts)[tmpf].usable()))
{
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!(*m_AvailableFonts)[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
}
else
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.GFontSub[tmpf]);
}
else
{
if (!m_Doc->UsedFonts.contains(tmpf))
m_Doc->AddFont(tmpf, qRound(m_Doc->toolSettings.defSize / 10.0));
}
QDomNode IT=pite.firstChild();
LastStyles * last = new LastStyles();
while(!IT.isNull())
{
QDomElement it=IT.toElement();
if (it.tagName()=="CSTOP")
{
QString name = it.attribute("NAME");
double ramp = it.attribute("RAMP", "0.0").toDouble();
int shade = it.attribute("SHADE", "100").toInt();
double opa = it.attribute("TRANS", "1").toDouble();
Neu->fill_gradient.addStop(SetColor(m_Doc, name, shade), ramp, 0.5, opa, name, shade);
}
if (it.tagName()=="ITEXT")
GetItemText(&it, m_Doc, Neu, last);
if(it.tagName()=="PageItemAttributes")
{
QDomNode PIA = it.firstChild();
ObjAttrVector pageItemAttributes;
while(!PIA.isNull())
{
QDomElement itemAttr = PIA.toElement();
if(itemAttr.tagName() == "ItemAttribute")
{
ObjectAttribute objattr;
objattr.name=itemAttr.attribute("Name");
objattr.type=itemAttr.attribute("Type");
objattr.value=itemAttr.attribute("Value");
objattr.parameter=itemAttr.attribute("Parameter");
objattr.relationship=itemAttr.attribute("Relationship");
objattr.relationshipto=itemAttr.attribute("RelationshipTo");
objattr.autoaddto=itemAttr.attribute("AutoAddTo");
pageItemAttributes.append(objattr);
}
PIA = PIA.nextSibling();
}
Neu->setObjectAttributes(&pageItemAttributes);
}
IT=IT.nextSibling();
}
delete last;
if (Neu->fill_gradient.Stops() == 0)
{
Neu->fill_gradient.addStop(m_Doc->PageColors[m_Doc->toolSettings.dBrush].getRGBColor(), 0.0, 0.5, 1.0, m_Doc->toolSettings.dBrush, 100);
Neu->fill_gradient.addStop(m_Doc->PageColors[m_Doc->toolSettings.dPen].getRGBColor(), 1.0, 0.5, 1.0, m_Doc->toolSettings.dPen, 100);
}
Neu->isAutoText = static_cast<bool>(pite.attribute("AUTOTEXT").toInt());
Neu->isEmbedded = static_cast<bool>(pite.attribute("isInline", "0").toInt());
Neu->gXpos = pite.attribute("gXpos", "0.0").toDouble();
Neu->gYpos = pite.attribute("gYpos", "0.0").toDouble();
QString defaultVal;
defaultVal.setNum(Neu->width());
Neu->gWidth = pite.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pite.attribute("gHeight",defaultVal).toDouble();
Neu->NextIt = pite.attribute("NEXTITEM").toInt();
if (Neu->isTableItem)
{
TableItems.append(Neu);
TableID.insert(pite.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
}
pa = pa.nextSibling();
}
uint ae = m_Doc->Items->count();
pat.setDoc(m_Doc);
PageItem* currItem = m_Doc->Items->at(ac);
pat.pattern = currItem->DrawObj_toImage();
for (uint as = ac; as < ae; ++as)
{
Neu = m_Doc->Items->take(ac);
Neu->ItemNr = pat.items.count();
pat.items.append(Neu);
}
pat.offsetX = pg.attribute("offsetX", "0").toDouble();
pat.offsetY = pg.attribute("offsetY", "0").toDouble();
pat.scaleX = pg.attribute("scaleX", "0").toDouble();
pat.scaleY = pg.attribute("scaleY", "0").toDouble();
pat.rotation = pg.attribute("rotation", "0").toDouble();
pat.width = pg.attribute("width", "0").toDouble();
pat.height = pg.attribute("height", "0").toDouble();
m_Doc->docPatterns.insert(pg.attribute("Name"), pat);
}
PAGE=PAGE.nextSibling();
}
DOC=DOC.nextSibling();
1662,6 → 1781,22
pageSetAttr.appendChild(pgst);
}
dc.appendChild(pageSetAttr);
QMap<QString, ScPattern>::Iterator itPat;
for (itPat = m_Doc->docPatterns.begin(); itPat != m_Doc->docPatterns.end(); ++itPat)
{
QDomElement pat = docu.createElement("Pattern");
pat.setAttribute("Name",itPat.key());
ScPattern pa = itPat.data();
pat.setAttribute("offsetX", pa.offsetX);
pat.setAttribute("offsetY", pa.offsetY);
pat.setAttribute("scaleX", pa.scaleX);
pat.setAttribute("scaleY", pa.scaleY);
pat.setAttribute("rotation", pa.rotation);
pat.setAttribute("width", pa.width);
pat.setAttribute("height", pa.height);
WriteObjects(m_Doc, &docu, &pat, 0, 0, 3, &pa.items);
dc.appendChild(pat);
}
if (m_mwProgressBar != 0)
{
m_mwProgressBar->setTotalSteps(m_Doc->DocPages.count()+m_Doc->MasterPages.count()+m_Doc->DocItems.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count());
3211,7 → 3346,7
}
}
 
void Scribus134Format::WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master)
void Scribus134Format::WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master, QPtrList<PageItem> *items)
{
int te, te2, tsh, tsh2, tst, tst2, tsb, tsb2, tshs, tshs2, tobj, tobj2;
QString text, tf, tf2, tc, tc2, tcs, tcs2, tmp, tmpy, Ndir;
3231,6 → 3366,9
case 2:
objects = doc->FrameItems.count();
break;
case 3:
objects = items->count();
break;
}
for(uint j = 0; j < objects;++j)
{
3251,6 → 3389,10
item = doc->FrameItems.at(j);
ob = docu->createElement("FRAMEOBJECT");
break;
case 3:
item = items->at(j);
ob = docu->createElement("PatternItem");
break;
}
SetItemProps(&ob, item, true);
ob.setAttribute("OnMasterPage", item->OnMasterPage);