r15363 by jghali - #9288: PDF icon button does not appear
scribus-commit
scribus-commit at lists.scribus.net
Mon Jul 19 21:24:38 CEST 2010
Revision: 15363
Author: jghali
Date: 2010-07-19T19:00:22.049899Z
Commit message: #9288: PDF icon button does not appear
Changeset:
M /branches/Version135/Scribus/scribus/pdflib_core.cpp
M /branches/Version135/Scribus/scribus/pageitem.cpp
M /branches/Version135/Scribus/scribus/fonts/scface.cpp
M /branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /branches/Version135/Scribus/scribus/fonts/scface.h
M /branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
Diffs:
Index: scribus/fonts/scface.cpp
===================================================================
--- scribus/fonts/scface.cpp (revision 15362)
+++ scribus/fonts/scface.cpp (revision 15363)
@@ -208,6 +208,45 @@
return NONE;
}
+QString ScFace::ascentAsString() const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->ascentAsString();
+}
+
+QString ScFace::descentAsString() const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->descentAsString();
+}
+QString ScFace::capHeightAsString() const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->capHeightAsString();
+}
+
+QString ScFace::fontBBoxAsString() const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->FontBBoxAsString();
+}
+
+QString ScFace::italicAngleAsString() const
+{
+ if (m->status == ScFace::UNKNOWN) {
+ m->load();
+ }
+ return m->ItalicAngleAsString();
+}
+
qreal ScFace::ascent(qreal sz) const
{
if (m->status == ScFace::UNKNOWN) {
Index: scribus/fonts/scface.h
===================================================================
--- scribus/fonts/scface.h (revision 15362)
+++ scribus/fonts/scface.h (revision 15363)
@@ -308,11 +308,11 @@
QString variant() const { return m->variant; }
// font metrics
- QString ascentAsString() const { return m->ascentAsString() ; }
- QString descentAsString() const { return m->descentAsString() ; }
- QString capHeightAsString() const { return m->capHeightAsString() ; }
- QString FontBBoxAsString() const { return m->FontBBoxAsString() ; }
- QString ItalicAngleAsString() const { return m->ItalicAngleAsString() ; }
+ QString ascentAsString() const;
+ QString descentAsString() const;
+ QString capHeightAsString() const;
+ QString fontBBoxAsString() const;
+ QString italicAngleAsString() const;
qreal ascent(qreal sz=1.0) const;
qreal descent(qreal sz=1.0) const;
qreal xHeight(qreal sz=1.0) const;
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 15362)
+++ scribus/pageitem.cpp (revision 15363)
@@ -4687,7 +4687,9 @@
bool PageItem::loadImage(const QString& filename, const bool reload, const int gsResolution, bool showMsg)
{
- if (! asImageFrame())
+ bool useImage = (asImageFrame() != NULL);
+ useImage |= (isAnnotation() && annotation().UseIcons());
+ if (!useImage)
return false;
QFileInfo fi(filename);
QString clPath(pixm.imgInfo.usedPath);
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 15362)
+++ scribus/pdflib_core.cpp (revision 15363)
@@ -1350,7 +1350,7 @@
// TODO: think about QByteArray ScFace::getFontDescriptor() -- AV
PutDoc("<<\n/Type /FontDescriptor\n");
PutDoc("/FontName /"+AllFonts[it.key()].psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+"\n");
- PutDoc("/FontBBox [ "+AllFonts[it.key()].FontBBoxAsString()+" ]\n");
+ PutDoc("/FontBBox [ "+AllFonts[it.key()].fontBBoxAsString()+" ]\n");
PutDoc("/Flags ");
//FIXME: isItalic() should be queried from ScFace, not from Qt -- AV
//QFontInfo fo = QFontInfo(it.data());
@@ -1358,7 +1358,7 @@
if (AllFonts[it.key()].isFixedPitch())
pfl = pfl ^ 1;
//if (fo.italic())
- if (AllFonts[it.key()].ItalicAngleAsString() != "0")
+ if (AllFonts[it.key()].italicAngleAsString() != "0")
pfl = pfl ^ 64;
// pfl = pfl ^ 4;
pfl = pfl ^ 32;
@@ -1366,7 +1366,7 @@
PutDoc("/Ascent "+AllFonts[it.key()].ascentAsString()+"\n");
PutDoc("/Descent "+AllFonts[it.key()].descentAsString()+"\n");
PutDoc("/CapHeight "+AllFonts[it.key()].capHeightAsString()+"\n");
- PutDoc("/ItalicAngle "+AllFonts[it.key()].ItalicAngleAsString()+"\n");
+ PutDoc("/ItalicAngle "+AllFonts[it.key()].italicAngleAsString()+"\n");
// PutDoc("/Ascent "+QString::number(static_cast<int>(AllFonts[it.key()].ascent()))+"\n");
// PutDoc("/Descent "+QString::number(static_cast<int>(AllFonts[it.key()].descent()))+"\n");
// PutDoc("/CapHeight "+QString::number(static_cast<int>(AllFonts[it.key()].capHeight()))+"\n");
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 15362)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 15363)
@@ -2131,56 +2131,12 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
- UndoManager::instance()->setUndoEnabled(false);
- if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
- {
- currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
- currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
- currItem->setImageXYScale(scx, scy);
- currItem->setImageXYOffset(offsX, offsY);
- currItem->Pfile = Relative2Path(obj->attribute("PFILE" ,""), baseDir);
- currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
- currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
- currItem->IProfile = obj->attribute("PRFILE","");
- currItem->EmProfile = obj->attribute("EPROF","");
- currItem->IRender = obj->attribute("IRENDER", "1").toInt();
- currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
- doc->LoadPict(currItem->Pfile, z);
- currItem->setImageXYScale(scx, scy);
- currItem->setImageShown(obj->attribute("PICART").toInt());
-/* currItem->BBoxX = obj->attribute("BBOXX").toDouble();
- currItem->BBoxH = obj->attribute("BBOXH").toDouble(); */
- }
- //currItem->convertTo(pt);
- UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::TextFrame:
z = doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor, true);
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
- UndoManager::instance()->setUndoEnabled(false);
- if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
- {
- currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
- currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
- currItem->setImageXYScale(scx, scy);
- currItem->setImageXYOffset(offsX, offsY);
- currItem->Pfile = Relative2Path(obj->attribute("PFILE" ,""), baseDir);
- currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
- currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
- currItem->IProfile = obj->attribute("PRFILE","");
- currItem->EmProfile = obj->attribute("EPROF","");
- currItem->IRender = obj->attribute("IRENDER", "1").toInt();
- currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
- doc->LoadPict(currItem->Pfile, z);
- currItem->setImageXYScale(scx, scy);
- currItem->setImageShown(obj->attribute("PICART").toInt());
-/* currItem->BBoxX = obj->attribute("BBOXX").toDouble();
- currItem->BBoxH = obj->attribute("BBOXH").toDouble(); */
- }
- //currItem->convertTo(pt);
- UndoManager::instance()->setUndoEnabled(true);
break;
case PageItem::Line:
z = doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Pcolor2, true);
@@ -2338,6 +2294,7 @@
currItem->AutoName = false;
}
}
+
currItem->annotation().setAction(obj->attribute("ANACTION",""));
currItem->annotation().setE_act(obj->attribute("ANEACT",""));
currItem->annotation().setX_act(obj->attribute("ANXACT",""));
@@ -2375,6 +2332,33 @@
currItem->annotation().setBorderColor(obj->attribute("ANBCOL", CommonStrings::None));
currItem->annotation().setIPlace(obj->attribute("ANPLACE", "1").toInt());
currItem->annotation().setScaleW(obj->attribute("ANSCALE", "0").toInt());
+
+ if (currItem->asTextFrame() || currItem->asPathText())
+ {
+ UndoManager::instance()->setUndoEnabled(false);
+ if (currItem->isAnnotation() && currItem->annotation().UseIcons())
+ {
+ currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
+ currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
+ currItem->setImageXYScale(scx, scy);
+ currItem->setImageXYOffset(offsX, offsY);
+ currItem->Pfile = Relative2Path(obj->attribute("PFILE" ,""), baseDir);
+ currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
+ currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
+ currItem->IProfile = obj->attribute("PRFILE","");
+ currItem->EmProfile = obj->attribute("EPROF","");
+ currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+ currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
+ doc->LoadPict(currItem->Pfile, z);
+ currItem->setImageXYScale(scx, scy);
+ currItem->setImageShown(obj->attribute("PICART").toInt());
+/* currItem->BBoxX = obj->attribute("BBOXX").toDouble();
+ currItem->BBoxH = obj->attribute("BBOXH").toDouble(); */
+ }
+ //currItem->convertTo(pt);
+ UndoManager::instance()->setUndoEnabled(true);
+ }
+
currItem->TopLine = static_cast<bool>(obj->attribute("TopLine", "0").toInt());
currItem->LeftLine = static_cast<bool>(obj->attribute("LeftLine", "0").toInt());
currItem->RightLine = static_cast<bool>(obj->attribute("RightLine", "0").toInt());
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 15362)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 15363)
@@ -2247,27 +2247,6 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
- UndoManager::instance()->setUndoEnabled(false);
- if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
- {
- currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
- currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
- currItem->setImageXYScale(scx, scy);
- currItem->setImageXYOffset(ScCLocale::toDoubleC(obj->attribute("LOCALX")), ScCLocale::toDoubleC(obj->attribute("LOCALY")));
- currItem->Pfile = Relative2Path(obj->attribute("PFILE","") , baseDir);
- currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
- currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
- currItem->IProfile = obj->attribute("PRFILE","");
- currItem->EmProfile = obj->attribute("EPROF","");
- currItem->IRender = obj->attribute("IRENDER", "1").toInt();
- currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
- doc->LoadPict(currItem->Pfile, z);
- currItem->setImageXYScale(scx, scy);
- currItem->setImageShown(obj->attribute("PICART").toInt());
-/* currItem->BBoxX = ScCLocale::toDoubleC( obj->attribute("BBOXX"));
- currItem->BBoxH = ScCLocale::toDoubleC( obj->attribute("BBOXH")); */
- }
- UndoManager::instance()->setUndoEnabled(true);
//currItem->convertTo(pt);
break;
case PageItem::TextFrame:
@@ -2275,27 +2254,6 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
- UndoManager::instance()->setUndoEnabled(false);
- if ((obj->attribute("ANNOTATION", "0").toInt()) && (static_cast<bool>(obj->attribute("ANICON", "0").toInt())))
- {
- currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
- currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
- currItem->setImageXYScale(scx, scy);
- currItem->setImageXYOffset(ScCLocale::toDoubleC(obj->attribute("LOCALX")), ScCLocale::toDoubleC(obj->attribute("LOCALY")));
- currItem->Pfile = Relative2Path(obj->attribute("PFILE","") , baseDir);
- currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
- currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
- currItem->IProfile = obj->attribute("PRFILE","");
- currItem->EmProfile = obj->attribute("EPROF","");
- currItem->IRender = obj->attribute("IRENDER", "1").toInt();
- currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
- doc->LoadPict(currItem->Pfile, z);
- currItem->setImageXYScale(scx, scy);
- currItem->setImageShown(obj->attribute("PICART").toInt());
-/* currItem->BBoxX = ScCLocale::toDoubleC( obj->attribute("BBOXX"));
- currItem->BBoxH = ScCLocale::toDoubleC( obj->attribute("BBOXH")); */
- }
- UndoManager::instance()->setUndoEnabled(true);
//currItem->convertTo(pt);
break;
case PageItem::Line:
@@ -2447,6 +2405,7 @@
currItem->AutoName = false;
}
}
+
currItem->annotation().setAction(obj->attribute("ANACTION",""));
currItem->annotation().setE_act(obj->attribute("ANEACT",""));
currItem->annotation().setX_act(obj->attribute("ANXACT",""));
@@ -2481,6 +2440,32 @@
currItem->annotation().setBorderColor(obj->attribute("ANBCOL", CommonStrings::None));
currItem->annotation().setIPlace(obj->attribute("ANPLACE", "1").toInt());
currItem->annotation().setScaleW(obj->attribute("ANSCALE", "0").toInt());
+
+ if (currItem->asTextFrame() || currItem->asPathText())
+ {
+ UndoManager::instance()->setUndoEnabled(false);
+ if (currItem->isAnnotation() && currItem->annotation().UseIcons())
+ {
+ currItem->ScaleType = obj->attribute("SCALETYPE", "1").toInt();
+ currItem->AspectRatio = obj->attribute("RATIO", "0").toInt();
+ currItem->setImageXYScale(scx, scy);
+ currItem->setImageXYOffset(ScCLocale::toDoubleC(obj->attribute("LOCALX")), ScCLocale::toDoubleC(obj->attribute("LOCALY")));
+ currItem->Pfile = Relative2Path(obj->attribute("PFILE","") , baseDir);
+ currItem->Pfile2 = Relative2Path(obj->attribute("PFILE2",""), baseDir);
+ currItem->Pfile3 = Relative2Path(obj->attribute("PFILE3",""), baseDir);
+ currItem->IProfile = obj->attribute("PRFILE","");
+ currItem->EmProfile = obj->attribute("EPROF","");
+ currItem->IRender = obj->attribute("IRENDER", "1").toInt();
+ currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
+ doc->LoadPict(currItem->Pfile, z);
+ currItem->setImageXYScale(scx, scy);
+ currItem->setImageShown(obj->attribute("PICART").toInt());
+/* currItem->BBoxX = ScCLocale::toDoubleC( obj->attribute("BBOXX"));
+ currItem->BBoxH = ScCLocale::toDoubleC( obj->attribute("BBOXH")); */
+ }
+ UndoManager::instance()->setUndoEnabled(true);
+ }
+
currItem->TopLine = static_cast<bool>(obj->attribute("TopLine", "0").toInt());
currItem->LeftLine = static_cast<bool>(obj->attribute("LeftLine", "0").toInt());
currItem->RightLine = static_cast<bool>(obj->attribute("RightLine", "0").toInt());
@@ -2526,6 +2511,7 @@
currItem->ColGap = ScCLocale::toDoubleC( obj->attribute("COLGAP"), 0.0);
if (obj->attribute("LAYER", "0").toInt() != -1)
currItem->LayerNr = obj->attribute("LAYER", "0").toInt();
+
tmp = "";
if ((obj->hasAttribute("GROUPS")) && (obj->attribute("NUMGROUP", "0").toInt() != 0))
{
More information about the scribus-commit
mailing list