r20111 by fschmid - Improved DropShadows, all object types can have a drop shadow now.
scribus-commit
scribus-commit at lists.scribus.net
Wed May 20 20:06:19 UTC 2015
Author: fschmid
Date: Wed May 20 20:06:19 2015
New Revision: 20111
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20111
Log:
Improved DropShadows, all object types can have a drop shadow now.
For Objects with no fill (eg Groups) the drop shadow is calculated from the content.
Modified:
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/pdfwriter.cpp
trunk/Scribus/scribus/pdfwriter.h
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
trunk/Scribus/scribus/scpainter.cpp
trunk/Scribus/scribus/scpainter.h
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/ui/propertiespalette.cpp
trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
trunk/Scribus/scribus/ui/propertiespalette_shadow.h
trunk/Scribus/scribus/ui/proptree.cpp
trunk/Scribus/scribus/undomanager.cpp
trunk/Scribus/scribus/undomanager.h
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Wed May 20 20:06:19 2015
@@ -203,6 +203,8 @@
m_softShadowYOffset(other.m_softShadowYOffset),
m_softShadowOpacity(other.m_softShadowOpacity),
m_softShadowBlendMode(other.m_softShadowBlendMode),
+ m_softShadowErasedByObject(other.m_softShadowErasedByObject),
+ m_softShadowHasObjectTransparency(other.m_softShadowHasObjectTransparency),
LeftLink(other.LeftLink),
RightLink(other.RightLink),
TopLink(other.TopLink),
@@ -857,6 +859,8 @@
m_softShadowYOffset = 5.0;
m_softShadowOpacity = 0.0;
m_softShadowBlendMode = 0;
+ m_softShadowErasedByObject = false;
+ m_softShadowHasObjectTransparency = false;
m_groupClips = true;
hatchAngle = 0;
hatchDistance = 2;
@@ -1748,11 +1752,11 @@
return;
}
- if (isGroup())
- return;
if ((hasSoftShadow()) && (m_Doc->appMode != modeEdit))
DrawSoftShadow(p);
+ if (isGroup())
+ return;
p->setBlendModeFill(fillBlendmode());
p->setLineWidth(lwCorr);
if (GrType != 0)
@@ -2317,8 +2321,6 @@
{
if (m_softShadowColor == CommonStrings::None)
return;
- if ((itemType() == PathText) || (itemType() == Symbol) || (itemType() == Group) || (itemType() == Line) || (itemType() == PolyLine) || (itemType() == Spiral))
- return;
double lwCorr = m_lineWidth;
double sc = p->zoomFactor();
if ((m_lineWidth * sc) < 1)
@@ -2331,34 +2333,75 @@
tmp = defect.convertDefect(tmp, m_Doc->previewVisual);
}
p->save();
- FPointArray sh = PoLine.copy();
- sh.translate(m_softShadowXOffset, m_softShadowYOffset);
- p->beginLayer(1.0 - m_softShadowOpacity, m_softShadowBlendMode);
- p->setupPolygon(&sh);
- p->setBrush(tmp);
- p->setFillMode(ScPainter::Solid);
- p->fillPath();
- if (hasStroke())
- {
- p->setStrokeMode(ScPainter::Solid);
- p->setPen(tmp, lwCorr, PLineArt, PLineEnd, PLineJoin);
- p->strokePath();
- }
- p->blur(m_softShadowBlurRadius * sc);
+ if (m_softShadowHasObjectTransparency)
+ p->beginLayer(1.0 - fillTransparency(), m_softShadowBlendMode);
+ else
+ p->beginLayer(1.0 - m_softShadowOpacity, m_softShadowBlendMode);
if (!hasFill())
{
- sh = PoLine.copy();
+ double transF = fillTransparency();
+ double transS = lineTransparency();
+ bool savedShadow = hasSoftShadow();
+ double rotation_Old = m_rotation;
+ setHasSoftShadow(false);
+ m_rotation = 0;
+ isEmbedded = true;
+ invalid = true;
+ setFillTransparency(0.0);
+ setLineTransparency(0.0);
+ p->save();
+ p->translate(m_softShadowXOffset, m_softShadowYOffset);
+ DrawObj(p, QRectF());
+ p->colorizeAlpha(tmp);
+ if (m_softShadowBlurRadius > 0)
+ p->blur(m_softShadowBlurRadius * sc);
+ p->restore();
+ if (m_softShadowErasedByObject)
+ {
+ p->save();
+ FPointArray sh = PoLine.copy();
+ p->beginLayer(1.0, 18, &sh);
+ DrawObj(p, QRectF());
+ p->endLayer();
+ p->restore();
+ }
+ setFillTransparency(transF);
+ setLineTransparency(transS);
+ isEmbedded = false;
+ m_rotation = rotation_Old;
+ setHasSoftShadow(savedShadow);
+ }
+ else
+ {
+ FPointArray sh = PoLine.copy();
+ sh.translate(m_softShadowXOffset, m_softShadowYOffset);
p->setupPolygon(&sh);
p->setBrush(tmp);
p->setFillMode(ScPainter::Solid);
- p->setBlendModeFill(19);
p->fillPath();
if (hasStroke())
{
- p->setBlendModeStroke(19);
p->setStrokeMode(ScPainter::Solid);
p->setPen(tmp, lwCorr, PLineArt, PLineEnd, PLineJoin);
p->strokePath();
+ }
+ if (m_softShadowBlurRadius > 0)
+ p->blur(m_softShadowBlurRadius * sc);
+ if (m_softShadowErasedByObject)
+ {
+ sh = PoLine.copy();
+ p->setupPolygon(&sh);
+ p->setBrush(tmp);
+ p->setFillMode(ScPainter::Solid);
+ p->setBlendModeFill(19);
+ p->fillPath();
+ if (hasStroke())
+ {
+ p->setBlendModeStroke(19);
+ p->setStrokeMode(ScPainter::Solid);
+ p->setPen(tmp, lwCorr, PLineArt, PLineEnd, PLineJoin);
+ p->strokePath();
+ }
}
}
p->endLayer();
@@ -4692,6 +4735,38 @@
undoManager->action(this, ss);
}
m_softShadowBlendMode = val;
+}
+
+void PageItem::setSoftShadowErasedByObject(bool val)
+{
+ if (m_softShadowErasedByObject == val)
+ return;
+
+ if (UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::SoftShadowErase, 0, Um::IGroup);
+ ss->set("SOFT_SHADOW_ERASE", "SOFT_SHADOW_ERASE");
+ ss->set("NEW_VALUE", val);
+ ss->set("OLD_VALUE", m_softShadowErasedByObject);
+ undoManager->action(this, ss);
+ }
+ m_softShadowErasedByObject = val;
+}
+
+void PageItem::setSoftShadowHasObjectTransparency(bool val)
+{
+ if (m_softShadowHasObjectTransparency == val)
+ return;
+
+ if (UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::SoftShadowObjectTrans, 0, Um::IGroup);
+ ss->set("SOFT_SHADOW_OBJTRANS", "SOFT_SHADOW_OBJTRANS");
+ ss->set("NEW_VALUE", val);
+ ss->set("OLD_VALUE", m_softShadowHasObjectTransparency);
+ undoManager->action(this, ss);
+ }
+ m_softShadowHasObjectTransparency = val;
}
void PageItem::toggleLock()
@@ -5407,6 +5482,10 @@
restoreSoftShadowOpacity(ss, isUndo);
else if (ss->contains("SOFT_SHADOW_BLEND_MODE"))
restoreSoftShadowBlendMode(ss, isUndo);
+ else if (ss->contains("SOFT_SHADOW_ERASE"))
+ restoreSoftShadowErasedByObject(ss, isUndo);
+ else if (ss->contains("SOFT_SHADOW_OBJTRANS"))
+ restoreSoftShadowHasObjectTransparency(ss, isUndo);
}
}
if (!OnMasterPage.isEmpty())
@@ -5545,6 +5624,24 @@
m_softShadowOpacity = state->getDouble("OLD_VALUE");
else
m_softShadowOpacity = state->getDouble("NEW_VALUE");
+ update();
+}
+
+void PageItem::restoreSoftShadowErasedByObject(SimpleState *state, bool isUndo)
+{
+ if (isUndo)
+ m_softShadowErasedByObject = state->getInt("OLD_VALUE");
+ else
+ m_softShadowErasedByObject = state->getInt("NEW_VALUE");
+ update();
+}
+
+void PageItem::restoreSoftShadowHasObjectTransparency(SimpleState *state, bool isUndo)
+{
+ if (isUndo)
+ m_softShadowHasObjectTransparency = state->getInt("OLD_VALUE");
+ else
+ m_softShadowHasObjectTransparency = state->getInt("NEW_VALUE");
update();
}
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Wed May 20 20:06:19 2015
@@ -690,6 +690,12 @@
void setSoftShadowBlendMode(int val);
double softShadowBlendMode() { return m_softShadowBlendMode; }
+ void setSoftShadowErasedByObject(bool val);
+ bool softShadowErasedByObject() { return m_softShadowErasedByObject; }
+
+ void setSoftShadowHasObjectTransparency(bool val);
+ bool softShadowHasObjectTransparency() { return m_softShadowHasObjectTransparency; }
+
int frameType() const { return FrameType; } ///< rect / oval / round / other
void setFrameType(int val) { FrameType = val; }
//
@@ -1319,6 +1325,8 @@
double m_softShadowYOffset;
double m_softShadowOpacity;
int m_softShadowBlendMode;
+ bool m_softShadowErasedByObject;
+ bool m_softShadowHasObjectTransparency;
/* Additions for Table Support */
/* now deprecated with the new PageItem_Table */
PageItem* LeftLink;
@@ -1618,6 +1626,8 @@
void restoreSoftShadowYOffset(SimpleState *state, bool isUndo);
void restoreSoftShadowOpacity(SimpleState *state, bool isUndo);
void restoreSoftShadowBlendMode(SimpleState *state, bool isUndo);
+ void restoreSoftShadowErasedByObject(SimpleState *state, bool isUndo);
+ void restoreSoftShadowHasObjectTransparency(SimpleState *state, bool isUndo);
/*@}*/
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Wed May 20 20:06:19 2015
@@ -3636,7 +3636,10 @@
writer.startObj(Gobj);
PutDoc("<< /Type /Group\n");
PutDoc("/S /Transparency\n");
- PutDoc("/I false\n");
+ if (controlItem->isGroup())
+ PutDoc("/I true\n");
+ else
+ PutDoc("/I false\n");
PutDoc("/K false\n");
PutDoc(">>");
writer.endObj(Gobj);
@@ -3728,27 +3731,28 @@
{
if (Options.Version < PDFOptions::PDFVersion_14 || !ite->hasSoftShadow() || ite->softShadowColor() == CommonStrings::None || !ite->printEnabled())
return "";
+ double maxSize;
QByteArray tmp("q\n");
double softShadowDPI = Options.Resolution;
int pixelRadius = qRound(ite->softShadowBlurRadius() / 72.0 * softShadowDPI);
- tmp += "1 0 0 1 ";
- tmp += FToStr(ite->softShadowXOffset() - ite->softShadowBlurRadius())+" ";
- tmp += FToStr(-ite->softShadowYOffset() - ite->softShadowBlurRadius())+" cm\n";
- tmp += "1 0 0 1 0 " + FToStr(-(ite->height() + ite->visualLineWidth()))+" cm\n";
- tmp += FToStr(ite->width() + ite->visualLineWidth() + 2 * ite->softShadowBlurRadius()) + " 0 0 " + FToStr(ite->height() + ite->visualLineWidth() + 2 * ite->softShadowBlurRadius())+" 0 0 cm\n" ;
-
- double maxSize = qMax(ite->visualWidth(), ite->visualHeight());
+ tmp += "1 0 0 1 " + FToStr(ite->softShadowXOffset() - ite->softShadowBlurRadius()) + " " + FToStr(-(ite->softShadowYOffset() + ite->softShadowBlurRadius()))+" cm\n";
+ if (ite->isPathText())
+ ite->updatePolyClip();
+ tmp += "1 0 0 1 " + FToStr(-(ite->xPos() - ite->visualXPos())) + " " + FToStr(ite->yPos() - ite->visualYPos())+" cm\n";
+ tmp += "1 0 0 1 0 " + FToStr(-ite->visualHeight())+" cm\n";
+ tmp += FToStr(ite->visualWidth() + 2 * ite->softShadowBlurRadius()) + " 0 0 " + FToStr(ite->visualHeight() + 2 * ite->softShadowBlurRadius())+" 0 0 cm\n" ;
+ maxSize = qMax(ite->visualWidth(), ite->visualHeight());
maxSize = qMin(3000.0, maxSize * (softShadowDPI / 72.0));
bool savedShadow = ite->hasSoftShadow();
ite->setHasSoftShadow(false);
- bool tmpFillNeeded = false;
- if (!ite->hasFill())
- {
- tmpFillNeeded = true;
- ite->setFillColor("White");
- }
- QImage imgC = ite->DrawObj_toImage(maxSize, PageItem::NoRotation);
- imgC = imgC.copy(-pixelRadius,-pixelRadius,imgC.width()+2*pixelRadius,imgC.height()+2*pixelRadius); // Add border
+ double transF = ite->fillTransparency();
+ double transS = ite->lineTransparency();
+ ite->setFillTransparency(0.0);
+ ite->setLineTransparency(0.0);
+ QImage imgA = ite->DrawObj_toImage(maxSize, PageItem::NoRotation);
+ ite->setFillTransparency(transF);
+ ite->setLineTransparency(transS);
+ QImage imgC = imgA.copy(-pixelRadius, -pixelRadius, imgA.width() + 2 * pixelRadius, imgA.height() + 2 * pixelRadius); // Add border
ScPainter *p = new ScPainter(&imgC, imgC.width(), imgC.height(), 1, 0);
p->setZoomFactor(softShadowDPI / 72.0);
p->save();
@@ -3756,42 +3760,20 @@
p->restore();
p->end();
delete p;
- if (tmpFillNeeded)
+ if (ite->softShadowErasedByObject())
{
ScPainter *p = new ScPainter(&imgC, imgC.width(), imgC.height(), 1, 0);
- p->setZoomFactor(softShadowDPI / 72.0);
- p->save();
- FPointArray sh = ite->PoLine.copy();
- p->setupPolygon(&sh);
- p->setBrush(Qt::white);
- p->setFillMode(ScPainter::Solid);
- p->setBlendModeFill(19);
- p->fillPath();
- if (ite->hasStroke())
- {
- p->setBlendModeStroke(19);
- p->setStrokeMode(ScPainter::Solid);
- p->setPen(Qt::white);
- p->setLineWidth(ite->lineWidth());
- p->strokePath();
- }
- p->restore();
+ p->translate(pixelRadius, pixelRadius);
+ p->translate(-ite->softShadowXOffset() * (softShadowDPI / 72.0), -ite->softShadowYOffset() * (softShadowDPI / 72.0));
+ p->beginLayer(1.0, 18);
+ p->drawImage(&imgA);
+ p->endLayer();
p->end();
delete p;
}
ite->setHasSoftShadow(savedShadow);
- if (tmpFillNeeded)
- ite->setFillColor(CommonStrings::None);
ScImage img = imgC.alphaChannel().convertToFormat(QImage::Format_RGB32);
-/*
- ImageEffect eff;
- ScImageEffectList el;
- eff.effectCode = ScImage::EF_BLUR;
- eff.effectParameters = Pdf::toPdf(pixelRadius) + " 1.0";
- el.append(eff);
- img.applyEffect(el,ite->doc()->PageColors,false);
-*/
PdfId maskObj = writer.newObject();
writer.startObj(maskObj);
PutDoc("<<\n/Type /XObject\n/Subtype /Image\n");
@@ -3874,10 +3856,18 @@
QByteArray ShName = ResNam+Pdf::toPdf(ResCount);
ResCount++;
- Transpar[ShName] = writeGState("/ca "+FToStr(1.0 - ite->softShadowOpacity())+"\n"
- + "/AIS false\n/OPM 1\n"
- + "/BM /" + blendMode(ite->softShadowBlendMode()) + "\n");
-
+ if (ite->softShadowHasObjectTransparency())
+ {
+ Transpar[ShName] = writeGState("/ca "+FToStr(1.0 - ite->fillTransparency())+"\n"
+ + "/AIS false\n/OPM 1\n"
+ + "/BM /" + blendMode(ite->softShadowBlendMode()) + "\n");
+ }
+ else
+ {
+ Transpar[ShName] = writeGState("/ca "+FToStr(1.0 - ite->softShadowOpacity())+"\n"
+ + "/AIS false\n/OPM 1\n"
+ + "/BM /" + blendMode(ite->softShadowBlendMode()) + "\n");
+ }
tmp += Pdf::toName(ShName) + " gs\n";
tmp += Pdf::toName(colRes) + " Do Q\n";
@@ -8839,10 +8829,10 @@
writer.startObj(viewObjL);
PutDoc("<<\n/Type /3DView\n");
PutDoc("/MS /M\n");
- PutDoc("/C2W ["+osgframe->getPDFMatrix(itv.key())+" ]\n");
- PutDoc("/LS << /Subtype /" + lightModes[itv.value().illumination] + " >>\n");
+ PutDoc("/C2W ["+osgframe->getPDFMatrix(itv.key()).toLatin1()+" ]\n");
+ PutDoc("/LS << /Subtype /" + lightModes[itv.value().illumination].toLatin1() + " >>\n");
PutDoc("/RM\n<<\n");
- PutDoc("/Subtype /" + renderModes[itv.value().rendermode] + "\n");
+ PutDoc("/Subtype /" + renderModes[itv.value().rendermode].toLatin1() + "\n");
PutDoc("/AC [/DeviceRGB " + FToStr(itv.value().colorAC.redF()) + " " + FToStr(itv.value().colorAC.greenF()) + " " + FToStr(itv.value().colorAC.blueF()) + "]\n");
PutDoc("/FC [/DeviceRGB " + FToStr(itv.value().colorFC.redF()) + " " + FToStr(itv.value().colorFC.greenF()) + " " + FToStr(itv.value().colorFC.blueF()) + "]\n");
PutDoc("/O " + FToStr(1.0 - itv.value().addedTransparency) + "\n");
@@ -8854,8 +8844,8 @@
PutDoc("/BG << /Type /3DBG\n");
PutDoc("/C [ "+SetColor(ite->fillColor(), ite->fillShade())+" ]\n>>\n");
}
- PutDoc("/XN ("+PDFEncode(itv.key())+")\n");
- PutDoc("/IN ("+PDFEncode(itv.key())+")\n");
+ PutDoc("/XN ("+Pdf::toAscii(itv.key())+")\n");
+ PutDoc("/IN ("+Pdf::toAscii(itv.key())+")\n");
PutDoc(">>");
writer.endObj(viewObjL);
}
@@ -8885,7 +8875,7 @@
EncodeArrayToStream(dataP, appearanceObj);
PutDoc("\nendstream");
writer.endObj(appearanceObj);
- PdfId appearanceObj = writer.newObject();
+ PdfId annotationObj = writer.newObject();
writer.startObj(annotationObj);
pageData.AObjects.append(annotationObj);
PutDoc("<<\n/Type /Annot\n");
Modified: trunk/Scribus/scribus/pdfwriter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/pdfwriter.cpp
==============================================================================
--- trunk/Scribus/scribus/pdfwriter.cpp (original)
+++ trunk/Scribus/scribus/pdfwriter.cpp Wed May 20 20:06:19 2015
@@ -758,7 +758,7 @@
void Writer::write(const QByteArray& bytes)
{
outStream.writeRawData(bytes, bytes.size());
- }
+ }
void Writer::write(const ResourceDictionary& dict)
{
@@ -836,7 +836,7 @@
{
assert( CurrentObj == 0);
CurrentObj = id;
- while (XRef.length() <= id)
+ while (static_cast<uint>(XRef.length()) <= id)
XRef.append(0);
XRef[id] = bytesWritten();
write(toPdf(id));
@@ -859,4 +859,4 @@
endObj(id);
}
-} // namespace PDF
+} // namespace PDF
Modified: trunk/Scribus/scribus/pdfwriter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/pdfwriter.h
==============================================================================
--- trunk/Scribus/scribus/pdfwriter.h (original)
+++ trunk/Scribus/scribus/pdfwriter.h Wed May 20 20:06:19 2015
@@ -169,7 +169,7 @@
// writing
void writeHeader(PDFOptions::PDFVersion vers);
void writeXrefAndTrailer();
- void write(const QByteArray& bytes);
+ void write(const QByteArray& bytes);
void write(const Pdf::ResourceDictionary& dict);
void write(const PdfFont font);
@@ -223,4 +223,4 @@
};
}
-#endif
+#endif
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Wed May 20 20:06:19 2015
@@ -5501,6 +5501,8 @@
currItem->setSoftShadowBlurRadius(attrs.valueAsDouble("SOFTSHADOWBLURRADIUS", 5.0));
currItem->setSoftShadowBlendMode(attrs.valueAsInt("SOFTSHADOWBLENDMODE", 0));
currItem->setSoftShadowOpacity(attrs.valueAsDouble("SOFTSHADOWOPACITY", 0.0));
+ currItem->setSoftShadowErasedByObject(attrs.valueAsBool("SOFTSHADOWERASE", false));
+ currItem->setSoftShadowHasObjectTransparency(attrs.valueAsBool("SOFTSHADOWOBJTRANS", false));
//currItem->setRedrawBounding();
//currItem->OwnPage = view->OnPage(currItem);
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Wed May 20 20:06:19 2015
@@ -2761,6 +2761,8 @@
docu.writeAttribute("SOFTSHADOWSHADE",item->softShadowShade());
docu.writeAttribute("SOFTSHADOWBLENDMODE",item->softShadowBlendMode());
docu.writeAttribute("SOFTSHADOWOPACITY",item->softShadowOpacity());
+ docu.writeAttribute("SOFTSHADOWERASE",item->softShadowErasedByObject());
+ docu.writeAttribute("SOFTSHADOWOBJTRANS",item->softShadowHasObjectTransparency());
}
if (item->isTable())
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Wed May 20 20:06:19 2015
@@ -4150,5 +4150,7 @@
item->setSoftShadowShade(100);
item->setSoftShadowOpacity(obState.shadowTrans);
item->setSoftShadowBlendMode(0);
- }
-}
+ item->setSoftShadowErasedByObject(false);
+ item->setSoftShadowHasObjectTransparency(false);
+ }
+}
Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp Wed May 20 20:06:19 2015
@@ -3206,6 +3206,8 @@
ite->setSoftShadowShade(100);
ite->setSoftShadowOpacity(shadowTrans);
ite->setSoftShadowBlendMode(0);
+ ite->setSoftShadowErasedByObject(false);
+ ite->setSoftShadowHasObjectTransparency(false);
}
}
Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.cpp Wed May 20 20:06:19 2015
@@ -1022,6 +1022,8 @@
double shadowBlur = 0.0;
double shadowOpacity = 0.0;
int shadowTint = 100;
+ bool shadowErase = false;
+ bool shadowObjTrans = false;
QString shadowColor = "Black";
StoryText itemText;
itemText.clear();
@@ -1298,6 +1300,10 @@
shadowOffset = parseUnit(spo.text());
else if (spo.tagName() == "uni:softValue")
shadowBlur = parseUnit(spo.text());
+ else if (spo.tagName() == "uni:coverShadow")
+ shadowErase = (spo.text() == "true");
+ else if (spo.tagName() == "uni:applyElementOpacity")
+ shadowObjTrans = (spo.text() == "true");
}
QLineF oLine = QLineF(0, 0, shadowOffset, 0);
oLine.setAngle(shadowAngle - 180.0);
@@ -1633,6 +1639,8 @@
item->setSoftShadowShade(shadowTint);
item->setSoftShadowOpacity(shadowOpacity);
item->setSoftShadowBlendMode(0);
+ item->setSoftShadowErasedByObject(shadowErase);
+ item->setSoftShadowHasObjectTransparency(shadowObjTrans);
}
if (baseType == 1)
{
Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp (original)
+++ trunk/Scribus/scribus/scpainter.cpp Wed May 20 20:06:19 2015
@@ -93,11 +93,6 @@
la.data = cairo_get_group_target(m_cr);
la.fillRule = m_fillRule;
cairo_push_group(m_cr);
-/* if (clipArray != NULL)
- {
- setupPolygon(clipArray);
- setClipPath();
- } */
la.pushed = true;
Layers.push(la);
}
@@ -2073,6 +2068,66 @@
fillPath();
}
+void ScPainter::colorizeAlpha(QColor color)
+{
+ cairo_surface_t *data = cairo_get_group_target(m_cr);
+ cairo_surface_flush(data);
+ int w = cairo_image_surface_get_width(data);
+ int h = cairo_image_surface_get_height(data);
+ int stride = cairo_image_surface_get_stride(data);
+ unsigned char *d = cairo_image_surface_get_data(data);
+ int cr = color.red();
+ int cg = color.green();
+ int cb = color.blue();
+ for(int y = 0; y < h; ++y)
+ {
+ QRgb *dst = (QRgb*)d;
+ for(int x = 0; x < w; ++x)
+ {
+ if (qAlpha(*dst) > 0)
+ *dst = qRgba(cr, cg, cb, qAlpha(*dst));
+ dst++;
+ }
+ d += stride;
+ }
+ cairo_surface_mark_dirty(data);
+}
+
+void ScPainter::colorize(QColor color)
+{
+ cairo_surface_t *data = cairo_get_group_target(m_cr);
+ cairo_surface_flush(data);
+ int w = cairo_image_surface_get_width(data);
+ int h = cairo_image_surface_get_height(data);
+ int stride = cairo_image_surface_get_stride(data);
+ unsigned char *d = cairo_image_surface_get_data(data);
+ int cr = color.red();
+ int cg = color.green();
+ int cb = color.blue();
+ int hu, sa, v;
+ int cc2, cm2, cy2, k2;
+ QColor tmpR;
+ for(int y = 0; y < h; ++y)
+ {
+ QRgb *dst = (QRgb*)d;
+ for(int x = 0; x < w; ++x)
+ {
+ if (qAlpha(*dst) > 0)
+ {
+ k2 = 255 - qMin(qRound(0.3 * qRed(*dst) + 0.59 * qGreen(*dst) + 0.11 * qBlue(*dst)), 255);
+ tmpR.setRgb(cr, cg, cb);
+ tmpR.getHsv(&hu, &sa, &v);
+ tmpR.setHsv(hu, sa * k2 / 255, 255 - ((255 - v) * k2 / 255));
+ tmpR.getRgb(&cc2, &cm2, &cy2);
+ *dst = qRgba(cc2, cm2, cy2, qAlpha(*dst));
+ }
+ dst++;
+ }
+ d += stride;
+ }
+ cairo_surface_mark_dirty(data);
+}
+
void ScPainter::blurAlpha(int radius)
{
if (radius < 1)
Modified: trunk/Scribus/scribus/scpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/scpainter.h
==============================================================================
--- trunk/Scribus/scribus/scpainter.h (original)
+++ trunk/Scribus/scribus/scpainter.h Wed May 20 20:06:19 2015
@@ -99,6 +99,8 @@
virtual void drawText(QRectF area, QString text, bool filled = true, int align = 0);
virtual void drawShadeCircle(const QRectF &re, const QColor color, bool sunken, int lineWidth);
virtual void drawShadePanel(const QRectF &r, const QColor color, bool sunken, int lineWidth);
+ virtual void colorizeAlpha(QColor color);
+ virtual void colorize(QColor color);
virtual void blurAlpha(int radius);
virtual void blur(int radius);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed May 20 20:06:19 2015
@@ -7826,7 +7826,7 @@
}
}
-void ScribusDoc::itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend)
+void ScribusDoc::itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend, bool erase, bool objopa)
{
if (color == CommonStrings::tr_NoneColor)
color = CommonStrings::None;
@@ -7850,6 +7850,8 @@
currItem->setSoftShadowShade(shade);
currItem->setSoftShadowOpacity(opac);
currItem->setSoftShadowBlendMode(blend);
+ currItem->setSoftShadowErasedByObject(erase);
+ currItem->setSoftShadowHasObjectTransparency(objopa);
QRectF newRect = currItem->getVisualBoundingRect().adjusted(-dx, -dy, dx, dy);
currItem->invalidateLayout();
regionsChanged()->update(newRect);
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Wed May 20 20:06:19 2015
@@ -1042,7 +1042,7 @@
void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection=0);
void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection=0);
- void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend);
+ void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend, bool erase, bool objopa);
void itemSelection_SetLineWidth(double w);
void itemSelection_SetLineArt(Qt::PenStyle w);
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Wed May 20 20:06:19 2015
@@ -400,7 +400,7 @@
if ((m_item->isGroup()) && (!m_item->isSingleSel))
{
TabStack->setItemEnabled(idXYZItem, true);
- TabStack->setItemEnabled(idShadowItem, false);
+ TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idGroupItem, true);
TabStack->setItemEnabled(idLineItem, false);
@@ -451,7 +451,7 @@
if (m_item->asSymbolFrame())
{
TabStack->setItemEnabled(idXYZItem, true);
- TabStack->setItemEnabled(idShadowItem, false);
+ TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idGroupItem, true);
TabStack->setItemEnabled(idLineItem, false);
@@ -543,7 +543,7 @@
TabStack->setItemEnabled(idLineItem, true);
break;
case PageItem::Line:
- TabStack->setItemEnabled(idShadowItem, false);
+ TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
@@ -562,14 +562,14 @@
break;
case PageItem::PolyLine:
case PageItem::Spiral:
- TabStack->setItemEnabled(idShadowItem, false);
+ TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
TabStack->setItemEnabled(idLineItem, true);
break;
case PageItem::PathText:
- TabStack->setItemEnabled(idShadowItem, false);
+ TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, true);
TabStack->setItemEnabled(idImageItem, false);
@@ -577,12 +577,12 @@
break;
case PageItem::Symbol:
case PageItem::Group:
- TabStack->setItemEnabled(idShadowItem, false);
+ TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
- TabStack->setItemEnabled(idLineItem, true);
- TabStack->setItemEnabled(idGroupItem, false);
+ TabStack->setItemEnabled(idLineItem, false);
+ TabStack->setItemEnabled(idGroupItem, true);
TabStack->setItemEnabled(idColorsItem, false);
TabStack->setItemEnabled(idTransparencyItem, false);
break;
Modified: trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp Wed May 20 20:06:19 2015
@@ -73,6 +73,12 @@
QStringList modes;
softShadowBlendMode->setComboStrings(modes);
softShadowBlendMode->setStringValue( tr( "Normal"));
+
+ softShadowErase = new PropTreeItem(this, PropTreeItem::CheckBox, tr( "Content covers\nDrop Shadow"));
+ softShadowErase->setBoolValue(false);
+
+ softShadowObjTrans = new PropTreeItem(this, PropTreeItem::CheckBox, tr( "Inherit Object\nTransparency"));
+ softShadowObjTrans->setBoolValue(false);
languageChange();
m_haveItem = false;
@@ -85,6 +91,8 @@
connect(softShadowShade, SIGNAL(valueChanged(double)), this, SLOT(handleNewShade(double)));
connect(softShadowOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleNewOpacity(double)));
connect(softShadowBlendMode, SIGNAL(valueChanged(int)), this, SLOT(handleNewBlendmode(int)));
+ connect(softShadowErase, SIGNAL(valueChanged(bool)), this, SLOT(handleNewErase(bool)));
+ connect(softShadowObjTrans, SIGNAL(valueChanged(bool)), this, SLOT(handleNewObjTrans(bool)));
m_haveItem = false;
}
@@ -200,6 +208,8 @@
softShadowShade->setIntValue(i->softShadowShade());
softShadowOpacity->setDoubleValue(qRound(100 - (i->softShadowOpacity() * 100)));
softShadowBlendMode->setIntValue(i->softShadowBlendMode());
+ softShadowErase->setBoolValue(i->softShadowErasedByObject());
+ softShadowObjTrans->setBoolValue(i->softShadowHasObjectTransparency());
m_haveItem = true;
updateSpinBoxConstants();
}
@@ -248,7 +258,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -268,7 +278,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(value, color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(value, color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -288,7 +298,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -308,7 +318,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -328,7 +338,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -348,7 +358,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -368,7 +378,7 @@
int s = qRound(value);
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -388,7 +398,7 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
}
}
}
@@ -408,7 +418,47 @@
int s = softShadowShade->valueAsInt();
if (m_haveDoc)
{
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b);
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), softShadowObjTrans->valueAsBool());
+ }
+ }
+}
+
+void PropertiesPalette_Shadow::handleNewErase(bool value)
+{
+ if (m_haveItem)
+ {
+ double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
+ double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
+ double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
+ QString color = softShadowColor->valueAsString();
+ if (color == CommonStrings::tr_NoneColor)
+ color = CommonStrings::None;
+ int b = softShadowBlendMode->valueAsInt();
+ double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
+ int s = softShadowShade->valueAsInt();
+ if (m_haveDoc)
+ {
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, value, softShadowObjTrans->valueAsBool());
+ }
+ }
+}
+
+void PropertiesPalette_Shadow::handleNewObjTrans(bool value)
+{
+ if (m_haveItem)
+ {
+ double x = softShadowXOffset->valueAsDouble() / m_unitRatio;
+ double y = softShadowYOffset->valueAsDouble() / m_unitRatio;
+ double r = softShadowBlurRadius->valueAsDouble() / m_unitRatio;
+ QString color = softShadowColor->valueAsString();
+ if (color == CommonStrings::tr_NoneColor)
+ color = CommonStrings::None;
+ int b = softShadowBlendMode->valueAsInt();
+ double o = (100 - softShadowOpacity->valueAsDouble()) / 100.0;
+ int s = softShadowShade->valueAsInt();
+ if (m_haveDoc)
+ {
+ m_doc->itemSelection_SetSoftShadow(hasSoftShadow->valueAsBool(), color, x, y, r, s, o, b, softShadowErase->valueAsBool(), value);
}
}
}
@@ -432,6 +482,8 @@
softShadowColor->setText(0, tr( "Color:"));
softShadowShade->setText(0, tr( "Shade:"));
softShadowOpacity->setText(0, tr( "Opacity:"));
+ softShadowErase->setText(0, tr( "Content covers\nDrop Shadow"));
+ softShadowObjTrans->setText(0, tr( "Inherit Object\nTransparency"));
QStringList modes;
modes.append( tr("Normal"));
modes.append( tr("Darken"));
@@ -464,299 +516,3 @@
// softShadowYOffset->setConstants(&m_doc->constants());
}
-
-/*
-PropertiesPalette_Shadow::PropertiesPalette_Shadow( QWidget* parent) : QWidget(parent)
-{
- m_ScMW = 0;
- m_doc = 0;
- m_haveDoc = false;
- m_haveItem = false;
- m_unitRatio = 1.0;
- setupUi(this);
- setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
- _userActionOn = false;
- userActionSniffer = new UserActionSniffer(this);
- connect(userActionSniffer, SIGNAL(actionStart()), this, SLOT(spinboxStartUserAction()));
- connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(spinboxFinishUserAction()));
-
- installSniffer(softShadowXOffset);
- installSniffer(softShadowYOffset);
- installSniffer(softShadowShade);
- installSniffer(softShadowOpacity);
- installSniffer(softShadowBlurRadius);
-
- languageChange();
-
- connect(softShadowXOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowYOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowShade, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowBlurRadius, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowBlendMode, SIGNAL(activated(int)), this, SLOT(handleNewValues()));
- connect(softShadowColor, SIGNAL(activated(int)), this, SLOT(handleNewValues()));
- connect(hasSoftShadow, SIGNAL(clicked()), this, SLOT(handleNewValues()));
-
- m_haveItem = false;
- softShadowXOffset->showValue(0);
- softShadowYOffset->showValue(0);
- softShadowShade->showValue(100);
- softShadowOpacity->showValue(1);
- softShadowBlurRadius->showValue(5);
-}
-
-void PropertiesPalette_Shadow::setMainWindow(ScribusMainWindow* mw)
-{
- m_ScMW = mw;
- connect(m_ScMW, SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int)));
-}
-
-void PropertiesPalette_Shadow::setDoc(ScribusDoc *d)
-{
- if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
- return;
-
- if (m_doc)
- {
- disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
- disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
- }
-
- m_doc = d;
- m_item = NULL;
- m_unitRatio = m_doc->unitRatio();
- m_unitIndex = m_doc->unitIndex();
- int precision = unitGetPrecisionFromIndex(m_unitIndex);
-//qt4 FIXME here
- double maxXYWHVal = 200 * m_unitRatio;
- double minXYVal = -200 * m_unitRatio;
-
- m_haveDoc = true;
- m_haveItem = false;
-
- QMap<QString, double>* docConstants = m_doc? &m_doc->constants() : NULL;
- softShadowXOffset->setValues( minXYVal, maxXYWHVal, precision, minXYVal);
- softShadowXOffset->setConstants(docConstants);
- softShadowYOffset->setValues( minXYVal, maxXYWHVal, precision, minXYVal);
- softShadowYOffset->setConstants(docConstants);
- softShadowOpacity->setValues(0, 100, 0, 100);
- softShadowBlurRadius->setValues(0, 20, 1, 5);
- softShadowShade->setValues(0, 100, 0, 100);
-
- updateSpinBoxConstants();
- updateColorList();
-
- connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
- connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
-}
-
-void PropertiesPalette_Shadow::unsetDoc()
-{
- if (m_doc)
- {
- disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
- disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
- }
- m_haveDoc = false;
- m_haveItem = false;
- m_doc = NULL;
- m_item = NULL;
- softShadowXOffset->setConstants(NULL);
- softShadowYOffset->setConstants(NULL);
- softShadowXOffset->showValue(0);
- softShadowYOffset->showValue(0);
- softShadowShade->showValue(100);
- softShadowOpacity->showValue(1);
- softShadowBlurRadius->showValue(5);
- setEnabled(false);
-}
-
-void PropertiesPalette_Shadow::unsetItem()
-{
- m_haveItem = false;
- m_item = NULL;
- handleSelectionChanged();
-}
-
-void PropertiesPalette_Shadow::handleUpdateRequest(int updateFlags)
-{
- if (updateFlags & reqColorsUpdate)
- updateColorList();
-}
-
-PageItem* PropertiesPalette_Shadow::currentItemFromSelection()
-{
- PageItem *currentItem = NULL;
- if (m_doc)
- {
- if (m_doc->m_Selection->count() > 1)
- currentItem = m_doc->m_Selection->itemAt(0);
- else if (m_doc->m_Selection->count() == 1)
- currentItem = m_doc->m_Selection->itemAt(0);
- }
- return currentItem;
-}
-
-void PropertiesPalette_Shadow::setCurrentItem(PageItem *i)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- if (!m_doc)
- setDoc(i->doc());
- m_haveItem = false;
- m_item = i;
- disconnect(softShadowXOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- disconnect(softShadowYOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- disconnect(softShadowShade, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- disconnect(softShadowOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- disconnect(softShadowBlurRadius, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- disconnect(softShadowBlendMode, SIGNAL(activated(int)), this, SLOT(handleNewValues()));
- disconnect(softShadowColor, SIGNAL(activated(int)), this, SLOT(handleNewValues()));
- disconnect(hasSoftShadow, SIGNAL(clicked()), this, SLOT(handleNewValues()));
- softShadowXOffset->setValue(i->softShadowXOffset() * m_unitRatio);
- softShadowYOffset->setValue(i->softShadowYOffset() * m_unitRatio);
- softShadowOpacity->setValue(qRound(100 - (i->softShadowOpacity() * 100)));
- softShadowBlurRadius->setValue(i->softShadowBlurRadius() * m_unitRatio);
- softShadowShade->setValue(i->softShadowShade());
- setCurrentComboItem(softShadowColor, i->softShadowColor());
- softShadowBlendMode->setCurrentIndex(i->softShadowBlendMode());
- hasSoftShadow->setChecked(i->hasSoftShadow());
- connect(softShadowXOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowYOffset, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowShade, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowOpacity, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowBlurRadius, SIGNAL(valueChanged(double)), this, SLOT(handleNewValues()));
- connect(softShadowBlendMode, SIGNAL(activated(int)), this, SLOT(handleNewValues()));
- connect(softShadowColor, SIGNAL(activated(int)), this, SLOT(handleNewValues()));
- connect(hasSoftShadow, SIGNAL(clicked()), this, SLOT(handleNewValues()));
- m_haveItem = true;
- updateSpinBoxConstants();
-}
-
-void PropertiesPalette_Shadow::handleSelectionChanged()
-{
- if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
-
- PageItem* currItem = currentItemFromSelection();
- if (currItem)
- setCurrentItem(currItem);
- updateGeometry();
-}
-
-void PropertiesPalette_Shadow::unitChange()
-{
- if (!m_haveDoc)
- return;
- bool tmp = m_haveItem;
- m_haveItem = false;
- m_unitRatio = m_doc->unitRatio();
- m_unitIndex = m_doc->unitIndex();
- softShadowXOffset->setNewUnit( m_unitIndex );
- softShadowYOffset->setNewUnit( m_unitIndex );
- softShadowBlurRadius->setNewUnit( m_unitIndex );
- m_haveItem = tmp;
-}
-
-void PropertiesPalette_Shadow::updateColorList()
-{
- if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
- softShadowColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, false);
-}
-
-void PropertiesPalette_Shadow::handleNewValues()
-{
- if (m_haveItem)
- {
- double x = softShadowXOffset->value() / m_unitRatio;
- double y = softShadowYOffset->value() / m_unitRatio;
- double r = softShadowBlurRadius->value() / m_unitRatio;
- double o = (100 - softShadowOpacity->value()) / 100.0;
- int b = softShadowBlendMode->currentIndex();
- QString color = softShadowColor->currentText();
- if (color == CommonStrings::tr_NoneColor)
- color = CommonStrings::None;
- double s = softShadowShade->value();
- if (m_haveDoc)
- {
- m_doc->itemSelection_SetSoftShadow(hasSoftShadow->isChecked(), color, x, y, r, s, o, b);
- }
- }
-}
-
-void PropertiesPalette_Shadow::installSniffer(ScrSpinBox *spinBox)
-{
- const QList<QObject*> list = spinBox->children();
- if (!list.isEmpty())
- {
- QListIterator<QObject*> it(list);
- QObject *obj;
- while (it.hasNext())
- {
- obj = it.next();
- obj->installEventFilter(userActionSniffer);
- }
- }
-}
-
-bool PropertiesPalette_Shadow::userActionOn()
-{
- return _userActionOn;
-}
-
-void PropertiesPalette_Shadow::spinboxStartUserAction()
-{
- _userActionOn = true;
-}
-
-void PropertiesPalette_Shadow::spinboxFinishUserAction()
-{
- _userActionOn = false;
-
- for (int i = 0; i < m_doc->m_Selection->count(); ++i)
- m_doc->m_Selection->itemAt(i)->checkChanges(true);
- if (m_ScMW->view->groupTransactionStarted())
- {
- m_ScMW->view->endGroupTransaction();
- }
-}
-
-void PropertiesPalette_Shadow::changeEvent(QEvent *e)
-{
- if (e->type() == QEvent::LanguageChange)
- {
- languageChange();
- }
- else
- QWidget::changeEvent(e);
-}
-
-void PropertiesPalette_Shadow::languageChange()
-{
- hasSoftShadow->setText( tr("Object has a drop shadow"));
- label->setText( tr("X-Offset:"));
- label_2->setText( tr("Y-Offset:"));
- label_3->setText( tr("Blur:"));
- label_4->setText( tr("Color:"));
- label_5->setText( tr("Shade:"));
- label_6->setText( tr("Opacity:"));
- label_7->setText( tr("Blendmode:"));
-
- QString ptSuffix = tr(" pt");
- QString ein = (m_haveDoc) ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix;
- softShadowXOffset->setSuffix(ein);
- softShadowYOffset->setSuffix(ein);
- softShadowBlurRadius->setSuffix(ein);
-}
-
-void PropertiesPalette_Shadow::updateSpinBoxConstants()
-{
- if (!m_haveDoc)
- return;
- if(m_doc->m_Selection->count()==0)
- return;
- softShadowXOffset->setConstants(&m_doc->constants());
- softShadowYOffset->setConstants(&m_doc->constants());
-}
-*/
Modified: trunk/Scribus/scribus/ui/propertiespalette_shadow.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/ui/propertiespalette_shadow.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shadow.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shadow.h Wed May 20 20:06:19 2015
@@ -56,6 +56,8 @@
void handleNewShade(double value);
void handleNewOpacity(double value);
void handleNewBlendmode(int value);
+ void handleNewErase(bool value);
+ void handleNewObjTrans(bool value);
protected slots:
void updateSpinBoxConstants();
@@ -70,6 +72,8 @@
PropTreeItem *softShadowShade;
PropTreeItem *softShadowOpacity;
PropTreeItem *softShadowBlendMode;
+ PropTreeItem *softShadowErase;
+ PropTreeItem *softShadowObjTrans;
ScribusMainWindow *m_ScMW;
bool m_haveDoc;
Modified: trunk/Scribus/scribus/ui/proptree.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/ui/proptree.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/proptree.cpp (original)
+++ trunk/Scribus/scribus/ui/proptree.cpp Wed May 20 20:06:19 2015
@@ -97,7 +97,8 @@
painter->setFont(itemOpts.font);
}
QRect textrect = QRect(r.left() + i*2, r.top(), r.width() - (i * 2), r.height());
- QString text = itemOpts.fontMetrics.elidedText(index.model()->data(index, Qt::DisplayRole).toString(), Qt::ElideMiddle, itemOpts.rect.width(), Qt::TextShowMnemonic);
+ // QString text = itemOpts.fontMetrics.elidedText(index.model()->data(index, Qt::DisplayRole).toString(), Qt::ElideMiddle, itemOpts.rect.width(), Qt::TextShowMnemonic);
+ QString text = index.model()->data(index, Qt::DisplayRole).toString();
QApplication::style()->drawItemText(painter, textrect, Qt::AlignVCenter | Qt::AlignLeft | Qt::TextShowMnemonic, itemOpts.palette, (itemOpts.state & QStyle::State_Enabled), text, QPalette::Text);
painter->restore();
}
Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Wed May 20 20:06:19 2015
@@ -1078,6 +1078,8 @@
QString UndoManager::SoftShadowYOffset = "";
QString UndoManager::SoftShadowOpacity = "";
QString UndoManager::SoftShadowBlendMode= "";
+QString UndoManager::SoftShadowErase = "";
+QString UndoManager::SoftShadowObjectTrans = "";
/*** Icons for UndoObjects *******************************************/
QPixmap *UndoManager::IImageFrame = 0;
Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20111&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Wed May 20 20:06:19 2015
@@ -581,6 +581,8 @@
static QString SoftShadowYOffset;
static QString SoftShadowOpacity;
static QString SoftShadowBlendMode;
+ static QString SoftShadowErase;
+ static QString SoftShadowObjectTrans;
/*@}*/
/**
More information about the scribus-commit
mailing list