r14300 by fschmid - Gradient Masks Part 4: GUI to edit that stuff.
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 17 16:36:28 CET 2009
Revision: 14300
Author: fschmid
Date: 2009-11-17T07:12:04.463107Z
Commit message: Gradient Masks Part 4: GUI to edit that stuff.
Changeset:
M /trunk/Scribus/scribus/scpainter.cpp
M /trunk/Scribus/scribus/ui/propertiespalette.cpp
M /trunk/Scribus/scribus/scribusXml.cpp
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/CMakeLists.txt
M /trunk/Scribus/scribus/ui/propertiespalette.h
A /trunk/Scribus/scribus/ui/transparencypalette.ui
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/canvasmode_editgradient.cpp
A /trunk/Scribus/scribus/ui/transparencypalette.cpp
M /trunk/Scribus/scribus/plugins/xarimplugin/importxar.cpp
M /trunk/Scribus/scribus/scribusdoc.h
M /trunk/Scribus/scribus/scribusview.cpp
M /trunk/Scribus/scribus/ui/colorpalette.ui
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
A /trunk/Scribus/scribus/ui/transparencypalette.h
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/scribusview.h
M /trunk/Scribus/scribus/canvas.cpp
A /trunk/Scribus/scribus/ui/gradientvectordialog.cpp
M /trunk/Scribus/scribus/ui/cpalette.cpp
M /trunk/Scribus/scribus/scribus.h
A /trunk/Scribus/scribus/ui/gradientvectordialog.h
M /trunk/Scribus/scribus/ui/cpalette.h
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Diffs:
Index: scribus/canvasmode_editgradient.cpp
===================================================================
--- scribus/canvasmode_editgradient.cpp (revision 14299)
+++ scribus/canvasmode_editgradient.cpp (revision 14300)
@@ -179,7 +179,7 @@
// double dx = fabs(Mxp - newX) + 5.0 / m_canvas->scale();
// double dy = fabs(Myp - newY) + 5.0 / m_canvas->scale();
FPoint np(Mxp - newX, Myp - newY, 0, 0, currItem->rotation(), 1, 1, true);
- if (m_view->editStrokeGradient)
+ if (m_view->editStrokeGradient == 1)
{
if (m_gradientPoint == useGradientStart)
{
@@ -250,6 +250,77 @@
}
}
}
+ else if (m_view->editStrokeGradient == 2)
+ {
+ if (m_gradientPoint == useGradientStart)
+ {
+ currItem->GrMaskStartX -= np.x();
+ currItem->GrMaskStartY -= np.y();
+ currItem->GrMaskFocalX -= np.x();
+ currItem->GrMaskFocalY -= np.y();
+ if (currItem->GrMask == 2)
+ {
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double radFoc = distance(currItem->GrMaskFocalX - currItem->GrMaskStartX, currItem->GrMaskFocalY - currItem->GrMaskStartY);
+ if (radFoc >= radEnd)
+ {
+ currItem->GrMaskStartX += np.x(); // (Mxp - newX); // / m_canvas->scale();
+ currItem->GrMaskStartY += np.y(); // (Myp - newY); // / m_canvas->scale();
+ currItem->GrMaskFocalX += np.x(); // (Mxp - newX); // / m_canvas->scale();
+ currItem->GrMaskFocalY += np.y(); // (Myp - newY); // / m_canvas->scale();
+ }
+ }
+ }
+ if (m_gradientPoint == useGradientFocal)
+ {
+ currItem->GrMaskFocalX -= np.x();
+ currItem->GrMaskFocalY -= np.y();
+ if (currItem->GrMask == 2)
+ {
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double radFoc = distance(currItem->GrMaskFocalX - currItem->GrMaskStartX, currItem->GrMaskFocalY - currItem->GrMaskStartY);
+ if (radFoc >= radEnd)
+ {
+ currItem->GrMaskFocalX += np.x(); // (Mxp - newX); // / m_canvas->scale();
+ currItem->GrMaskFocalY += np.y(); // (Myp - newY); // / m_canvas->scale();
+ }
+ }
+ }
+ if (m_gradientPoint == useGradientSkew)
+ {
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double rotEnd = xy2Deg(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ QTransform m;
+ m.translate(currItem->GrMaskStartX, currItem->GrMaskStartY);
+ m.rotate(rotEnd);
+ m.rotate(-90);
+ m.rotate(currItem->GrMaskSkew);
+ m.translate(radEnd * currItem->GrMaskScale, 0);
+ QPointF shP = m.map(QPointF(0,0));
+ QPointF shR = QPointF(shP.x() -np.x(), shP.y() - np.y());
+ double radNew = distance(shR.x() - currItem->GrMaskStartX, shR.y() - currItem->GrMaskStartY);
+ double rotNew = xy2Deg(shR.x() - currItem->GrMaskStartX, shR.y() - currItem->GrMaskStartY) + 90;
+ currItem->GrMaskSkew = rotNew - rotEnd;
+ double newScale = radNew / radEnd;
+ if ((newScale > 0) && (newScale <= 1))
+ currItem->GrMaskScale = newScale;
+ }
+ if (m_gradientPoint == useGradientEnd)
+ {
+ currItem->GrMaskEndX -= np.x();
+ currItem->GrMaskEndY -= np.y();
+ if (currItem->GrMask == 2)
+ {
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double radFoc = distance(currItem->GrMaskFocalX - currItem->GrMaskStartX, currItem->GrMaskFocalY - currItem->GrMaskStartY);
+ if (radFoc >= radEnd)
+ {
+ currItem->GrMaskEndX += np.x(); // (Mxp - newX); // / m_canvas->scale();
+ currItem->GrMaskEndY += np.y(); // (Myp - newY); // / m_canvas->scale();
+ }
+ }
+ }
+ }
else
{
if (m_gradientPoint == useGradientStart)
@@ -327,7 +398,7 @@
m_ScMW->propertiesPalette->updateColorSpecialGradient();
currItem->update();
QRectF upRect;
- if (m_view->editStrokeGradient)
+ if (m_view->editStrokeGradient == 1)
{
upRect = QRectF(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY));
double radEnd = distance(currItem->GrStrokeEndX - currItem->GrStrokeStartX, currItem->GrStrokeEndY - currItem->GrStrokeStartY);
@@ -344,6 +415,23 @@
upRect |= QRectF(shP, QPointF(0, 0)).normalized();
upRect |= QRectF(shP, QPointF(currItem->width(), currItem->height())).normalized();
}
+ else if (m_view->editStrokeGradient == 2)
+ {
+ upRect = QRectF(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY));
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double rotEnd = xy2Deg(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ QTransform m;
+ m.translate(currItem->GrMaskStartX, currItem->GrMaskStartY);
+ m.rotate(rotEnd);
+ m.rotate(-90);
+ m.rotate(currItem->GrMaskSkew);
+ m.translate(radEnd * currItem->GrMaskScale, 0);
+ QPointF shP = m.map(QPointF(0,0));
+ upRect |= upRect.united(QRectF(shP, QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY)).normalized());
+ upRect |= upRect.united(QRectF(shP, QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY)).normalized());
+ upRect |= QRectF(shP, QPointF(0, 0)).normalized();
+ upRect |= QRectF(shP, QPointF(currItem->width(), currItem->height())).normalized();
+ }
else
{
upRect = QRectF(QPointF(currItem->GrStartX, currItem->GrStartY), QPointF(currItem->GrEndX, currItem->GrEndY));
@@ -393,7 +481,7 @@
itemMatrix.translate(currItem->xPos(), currItem->yPos());
itemMatrix.rotate(currItem->rotation());
QPointF gradientStart, gradientEnd, gradientFocal, gradientScale;
- if (m_view->editStrokeGradient)
+ if (m_view->editStrokeGradient == 1)
{
gradientStart = QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY);
gradientEnd = QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY);
@@ -408,6 +496,21 @@
m.translate(radEnd * currItem->GrStrokeScale, 0);
gradientScale = m.map(QPointF(0,0));
}
+ else if (m_view->editStrokeGradient == 2)
+ {
+ gradientStart = QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY);
+ gradientEnd = QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY);
+ gradientFocal = QPointF(currItem->GrMaskFocalX, currItem->GrMaskFocalY);
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double rotEnd = xy2Deg(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ QTransform m;
+ m.translate(currItem->GrMaskStartX, currItem->GrMaskStartY);
+ m.rotate(rotEnd);
+ m.rotate(-90);
+ m.rotate(currItem->GrMaskSkew);
+ m.translate(radEnd * currItem->GrMaskScale, 0);
+ gradientScale = m.map(QPointF(0,0));
+ }
else
{
gradientStart = QPointF(currItem->GrStartX, currItem->GrStartY);
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14299)
+++ scribus/scribusdoc.cpp (revision 14300)
@@ -5719,6 +5719,26 @@
}
}
+void ScribusDoc::itemSelection_SetItemGradMask(int typ)
+{
+ uint selectedItemCount=m_Selection->count();
+ if (selectedItemCount != 0)
+ {
+ m_updateManager.setUpdatesDisabled();
+ PageItem *currItem;
+ for (uint a = 0; a < selectedItemCount; ++a)
+ {
+ currItem = m_Selection->itemAt(a);
+ currItem->GrMask = typ;
+ if ((typ > 0) && (typ < 4))
+ currItem->updateGradientVectors();
+ currItem->update();
+ }
+ m_updateManager.setUpdatesEnabled();
+ changed();
+ }
+}
+
void ScribusDoc::itemSelection_SetItemGradStroke(int typ)
{
uint selectedItemCount=m_Selection->count();
Index: scribus/scribusview.h
===================================================================
--- scribus/scribusview.h (revision 14299)
+++ scribus/scribusview.h (revision 14300)
@@ -159,7 +159,7 @@
bool Magnify;
bool storedFramesShown;
bool storedShowControls;
- bool editStrokeGradient;
+ int editStrokeGradient;
int redrawMode;
int redrawCount;
PageItem *redrawItem;
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp (revision 14299)
+++ scribus/scribusXml.cpp (revision 14300)
@@ -216,10 +216,9 @@
OB->GrStrokeSkew = attrAsDbl(attrs, "GRSKEWS", 1.0);
}
OB->GrMask = attrAsInt(attrs, "GRTYPM" , 0);
- if (OB->GrMask == 1)
+ if ((OB->GrMask == 1) || (OB->GrMask == 2))
{
- int grM = attrAsInt(attrs, "GRMK", 0);
- if (grM == 0)
+ if (OB->GrMask == 1)
OB->mask_gradient = VGradient(VGradient::linear);
else
OB->mask_gradient = VGradient(VGradient::radial);
@@ -233,7 +232,7 @@
OB->GrMaskScale = attrAsDbl(attrs, "GRSCALEM", 1.0);
OB->GrMaskSkew = attrAsDbl(attrs, "GRSKEWM", 1.0);
}
- if (OB->GrMask == 2)
+ if (OB->GrMask == 3)
{
OB->patternMaskVal = attrAsString(attrs, "patternM", "");
OB->patternMaskScaleX = attrAsDbl(attrs, "pScaleXM", 100.0);
@@ -603,6 +602,7 @@
writer.writeAttribute("SHADE2" ,item->lineShade());
writer.writeAttribute("GRTYP" ,item->GrType);
writer.writeAttribute("GRTYPS" ,item->GrTypeStroke);
+ writer.writeAttribute("GRTYPM" ,item->GrMask);
writer.writeAttribute("ROT" ,item->rotation());
writer.writeAttribute("PLINEART" ,item->PLineArt);
writer.writeAttribute("PLINEEND" ,item->PLineEnd);
@@ -2570,10 +2570,6 @@
}
else
writer.writeAttribute("GRNAMEM" , item->gradientMask());
- if (item->mask_gradient.type() == VGradient::radial)
- writer.writeAttribute("GRMK", 1);
- else
- writer.writeAttribute("GRMK", 0);
writer.writeAttribute("GRSTARTXM", item->GrMaskStartX);
writer.writeAttribute("GRSTARTYM", item->GrMaskStartY);
writer.writeAttribute("GRENDXM", item->GrMaskEndX);
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp (revision 14299)
+++ scribus/canvas.cpp (revision 14300)
@@ -1162,7 +1162,7 @@
psx->rotate(currItem->rotation());
psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
psx->setBrush(Qt::NoBrush);
- if (m_view->editStrokeGradient)
+ if (m_view->editStrokeGradient == 1)
{
psx->drawLine(QPointF(currItem->GrStrokeStartX, currItem->GrStrokeStartY), QPointF(currItem->GrStrokeEndX, currItem->GrStrokeEndY));
psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
@@ -1184,6 +1184,28 @@
psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
psx->drawPoint(shP);
}
+ else if (m_view->editStrokeGradient == 2)
+ {
+ psx->drawLine(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY));
+ psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ psx->drawPoint(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY));
+ psx->drawPoint(QPointF(currItem->GrMaskEndX, currItem->GrMaskEndY));
+ if (currItem->GrMask == 2)
+ psx->drawPoint(QPointF(currItem->GrMaskFocalX, currItem->GrMaskFocalY));
+ double radEnd = distance(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ double rotEnd = xy2Deg(currItem->GrMaskEndX - currItem->GrMaskStartX, currItem->GrMaskEndY - currItem->GrMaskStartY);
+ QTransform m;
+ m.translate(currItem->GrMaskStartX, currItem->GrMaskStartY);
+ m.rotate(rotEnd);
+ m.rotate(-90);
+ m.rotate(currItem->GrMaskSkew);
+ m.translate(radEnd * currItem->GrMaskScale, 0);
+ QPointF shP = m.map(QPointF(0,0));
+ psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+ psx->drawLine(QPointF(currItem->GrMaskStartX, currItem->GrMaskStartY), shP);
+ psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ psx->drawPoint(shP);
+ }
else
{
psx->drawLine(QPointF(currItem->GrStartX, currItem->GrStartY), QPointF(currItem->GrEndX, currItem->GrEndY));
@@ -1205,8 +1227,6 @@
psx->drawLine(QPointF(currItem->GrStartX, currItem->GrStartY), shP);
psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
psx->drawPoint(shP);
-
-
}
}
Index: scribus/scpainter.cpp
===================================================================
--- scribus/scpainter.cpp (revision 14299)
+++ scribus/scpainter.cpp (revision 14300)
@@ -1106,10 +1106,12 @@
double y1 = mask_gradient.origin().y();
double x2 = mask_gradient.vector().x();
double y2 = mask_gradient.vector().y();
+ double fx = mask_gradient.focalPoint().x();
+ double fy = mask_gradient.focalPoint().y();
if (mask_gradient.type() == VGradient::linear)
pat = cairo_pattern_create_linear (x1, y1, x2, y2);
else
- pat = cairo_pattern_create_radial (x1, y1, 0, x1, y1, sqrt(pow(x2 - x1, 2) + pow(y2 - y1,2)));
+ pat = cairo_pattern_create_radial (fx, fy, 0, x1, y1, sqrt(pow(x2 - x1, 2) + pow(y2 - y1,2)));
QList<VColorStop*> colorStops = mask_gradient.colorStops();
QColor qStopColor;
for( int offset = 0 ; offset < colorStops.count() ; offset++ )
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14299)
+++ scribus/pageitem.cpp (revision 14300)
@@ -1251,11 +1251,15 @@
if (lineBlendmode() == 0)
p->setPenOpacity(1.0 - lineTransparency());
p->setFillRule(fillRule);
- if (GrMask == 1)
+ if ((GrMask == 1) || (GrMask == 2))
{
p->setMaskMode(1);
+ if ((!gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientMaskVal)))
+ gradientMaskVal = "";
+ if (!(gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(gradientMaskVal)))
+ mask_gradient = m_Doc->docGradients[gradientMaskVal];
p->mask_gradient = mask_gradient;
- if (mask_gradient.type() == VGradient::linear)
+ if (GrMask == 1)
p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew);
else
p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew);
@@ -4365,7 +4369,7 @@
lists.collectColor(cstops.at(cst)->name);
}
}
- if (GrMask == 1)
+ if ((GrMask == 1) || (GrMask == 2))
{
QList<VColorStop*> cstops = mask_gradient.colorStops();
for (uint cst = 0; cst < mask_gradient.Stops(); ++cst)
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 14299)
+++ scribus/scribusdoc.h (revision 14300)
@@ -1221,6 +1221,7 @@
void itemSelection_SetItemGradStroke(int typ);
void itemSelection_SetItemBrush(QString farbe);
void itemSelection_SetItemBrushShade(int sha);
+ void itemSelection_SetItemGradMask(int typ);
void itemSelection_SetItemGradFill(int typ);
void itemSelection_SetItemPatternFill(QString pattern);
void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp (revision 14299)
+++ scribus/scribusview.cpp (revision 14300)
@@ -3896,7 +3896,7 @@
currItem->GrMaskScale = Buffer->GrMaskScale;
currItem->GrMaskSkew = Buffer->GrMaskSkew;
}
- else if (currItem->GrMask == 2)
+ else if (currItem->GrMask == 3)
{
currItem->setPatternMask(Buffer->patternMaskVal);
currItem->setMaskTransform(Buffer->patternMaskScaleX, Buffer->patternMaskScaleY, Buffer->patternMaskOffsetX, Buffer->patternMaskOffsetY, Buffer->patternMaskRotation, Buffer->patternMaskSkewX, Buffer->patternMaskSkewY);
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp (revision 14299)
+++ scribus/ui/cpalette.cpp (revision 14300)
@@ -61,150 +61,6 @@
#include "util.h"
#include "util_math.h"
-GradientVectorDialog::GradientVectorDialog(QWidget* parent) : ScrPaletteBase( parent, "GradientVectorPalette", false, 0 )
-{
- freeGradientLayout = new QGridLayout(this);
- freeGradientLayout->setMargin(5);
- freeGradientLayout->setSpacing(5);
- GTextX1 = new QLabel("X1:", this );
- freeGradientLayout->addWidget( GTextX1, 0, 0 );
- GTextY1 = new QLabel("Y1:", this );
- freeGradientLayout->addWidget( GTextY1, 0, 2 );
- gX1 = new ScrSpinBox( -3000, 3000, this, 0);
- freeGradientLayout->addWidget( gX1, 0, 1 );
- gY1 = new ScrSpinBox( -3000, 3000, this, 0);
- freeGradientLayout->addWidget( gY1, 0, 3 );
- GTextX2 = new QLabel("X2:", this );
- freeGradientLayout->addWidget( GTextX2, 1, 0 );
- GTextY2 = new QLabel("Y2:", this );
- freeGradientLayout->addWidget( GTextY2, 1, 2 );
- gX2 = new ScrSpinBox( -3000, 3000, this, 0);
- freeGradientLayout->addWidget( gX2, 1, 1 );
- gY2 = new ScrSpinBox( -3000, 3000, this, 0);
- freeGradientLayout->addWidget( gY2, 1, 3 );
- GTextFX = new QLabel("FX:", this );
- freeGradientLayout->addWidget( GTextFX, 2, 0 );
- GTextFY = new QLabel("FY:", this );
- freeGradientLayout->addWidget( GTextFY, 2, 2 );
- gFX = new ScrSpinBox( -3000, 3000, this, 0);
- freeGradientLayout->addWidget( gFX, 2, 1 );
- gFY = new ScrSpinBox( -3000, 3000, this, 0);
- freeGradientLayout->addWidget( gFY, 2, 3 );
- GTextSK = new QLabel("Skew:", this );
- freeGradientLayout->addWidget( GTextSK, 3, 0, 1, 2 );
- gSk = new ScrSpinBox( -89, 89, this, 6);
- gSk->setValue( 0 );
- freeGradientLayout->addWidget( gSk, 3, 2, 1, 2 );
- GTextSC = new QLabel("Factor:", this );
- freeGradientLayout->addWidget( GTextSC, 4, 0, 1, 2 );
- gSc = new ScrSpinBox( 0.01, 100, this, 0);
- gSc->setSuffix(" %");
- gSc->setValue( 100 );
- freeGradientLayout->addWidget( gSc, 4, 2, 1, 2 );
- connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- languageChange();
-}
-
-void GradientVectorDialog::changeEvent(QEvent *e)
-{
- if (e->type() == QEvent::LanguageChange)
- {
- languageChange();
- }
- else
- QWidget::changeEvent(e);
-}
-
-void GradientVectorDialog::hideExtraWidgets()
-{
- GTextFX->hide();
- GTextFY->hide();
- GTextSC->hide();
- gFX->hide();
- gFY->hide();
- gSc->hide();
- resize(minimumSizeHint());
-}
-
-void GradientVectorDialog::showExtraWidgets()
-{
- GTextFX->show();
- GTextFY->show();
- GTextSC->show();
- gFX->show();
- gFY->show();
- gSc->show();
- resize(minimumSizeHint());
-}
-
-void GradientVectorDialog::languageChange()
-{
- setWindowTitle( tr( "Gradient Vector" ));
- resize(minimumSizeHint());
-}
-
-void GradientVectorDialog::setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
-{
- disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- gX1->setValue(x1);
- gX2->setValue(x2);
- gY1->setValue(y1);
- gY2->setValue(y2);
- gFX->setValue(fx);
- gFY->setValue(fy);
- gSk->setValue(sk);
- gSc->setValue(sg * 100.0);
- connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
-}
-
-void GradientVectorDialog::changeSpecial()
-{
- emit NewSpecial(gX1->value(), gY1->value(), gX2->value(), gY2->value(), gFX->value(), gFY->value(), gSc->value() / 100.0, gSk->value());
-}
-
-void GradientVectorDialog::unitChange(int unitIndex)
-{
- disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- gX1->setNewUnit(unitIndex);
- gY1->setNewUnit(unitIndex);
- gX2->setNewUnit(unitIndex);
- gY2->setNewUnit(unitIndex);
- gFX->setNewUnit(unitIndex);
- gFY->setNewUnit(unitIndex);
- connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
- connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
-}
-
PatternPropsDialog::PatternPropsDialog(QWidget* parent, int unitIndex) : QDialog( parent )
{
setModal(true);
@@ -416,10 +272,6 @@
editFillColorSelector->setIcon(QIcon(loadIcon("16/color-fill.png")));
connect(editLineColorSelector, SIGNAL(clicked()), this, SLOT(editLineColorSelectorButton()));
connect(editFillColorSelector, SIGNAL(clicked()), this, SLOT(editFillColorSelectorButton()));
- connect(strokeOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransS(int)));
- connect(fillOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransF(int)));
- connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int)));
- connect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
connect(fillShade, SIGNAL(valueChanged(int)), this, SIGNAL(NewBrushShade(int)));
connect(strokeShade, SIGNAL(valueChanged(int)), this, SIGNAL(NewPenShade(int)));
@@ -481,8 +333,8 @@
disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
disconnect(gradEditStroke, SIGNAL(gradientChanged()), this, SIGNAL(strokeGradientChanged()));
updateCList();
- setActTrans(currentItem->fillTransparency(), currentItem->lineTransparency());
- setActBlend(currentItem->fillBlendmode(), currentItem->lineBlendmode());
+// setActTrans(currentItem->fillTransparency(), currentItem->lineTransparency());
+// setActBlend(currentItem->fillBlendmode(), currentItem->lineBlendmode());
if (currentItem->doOverprint)
setActOverprint(1);
else
@@ -577,7 +429,7 @@
updateFromItem();
}
}
-
+/*
void Cpalette::setActTrans(double val, double val2)
{
disconnect(strokeOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransS(int)));
@@ -597,7 +449,7 @@
connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int)));
connect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
}
-
+*/
void Cpalette::setActOverprint(int val)
{
disconnect(overPrintCombo, SIGNAL(activated(int)), this, SIGNAL(NewOverprint(int)));
@@ -658,7 +510,7 @@
return;
emit NewBrush(sFarbe);
}
-
+/*
void Cpalette::slotTransS(int val)
{
emit NewTransS(static_cast<double>(100 - val) / 100.0);
@@ -668,7 +520,7 @@
{
emit NewTrans(static_cast<double>(100 - val) / 100.0);
}
-
+*/
void Cpalette::SetColors(ColorList newColorList)
{
colorList.clear();
@@ -1007,7 +859,7 @@
{
CGradDia->hide();
}
- editStrokeGradient = false;
+ editStrokeGradient = 0;
emit editGradient(editStrokeGradient);
}
@@ -1027,7 +879,7 @@
{
CGradDia->hide();
}
- editStrokeGradient = true;
+ editStrokeGradient = 1;
emit editGradient(editStrokeGradient);
}
@@ -1035,7 +887,7 @@
{
if (!active)
{
- if (editStrokeGradient)
+ if (editStrokeGradient == 1)
gradEditButtonStroke->setChecked(false);
else
gradEditButton->setChecked(false);
Index: scribus/ui/transparencypalette.ui
===================================================================
--- scribus/ui/transparencypalette.ui (revision 0)
+++ scribus/ui/transparencypalette.ui (revision 14300)
@@ -0,0 +1,533 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>transparencyPalette</class>
+ <widget class="QWidget" name="transparencyPalette">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>236</width>
+ <height>335</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QToolButton" name="editLineSelector">
+ <property name="toolTip">
+ <string>Edit Line Color Properties</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="editFillSelector">
+ <property name="toolTip">
+ <string>Edit Fill Color Properties</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <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>
+ <widget class="QStackedWidget" name="stackedWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="pageS">
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>5</number>
+ </property>
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Opacity:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="strokeOpacity">
+ <property name="toolTip">
+ <string>Set the transparency for the color selected</string>
+ </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>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Blend Mode:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="ScComboBox" name="blendModeStroke">
+ <item>
+ <property name="text">
+ <string>Normal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Darken</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lighten</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Screen</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Overlay</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hard Light</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Soft Light</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Difference</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Exclusion</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Color Dodge</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Color Burn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hue</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Saturation</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Color</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Luminosity</string>
+ </property>
+ </item>
+ </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>240</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tabSolid">
+ <attribute name="title">
+ <string>Solid</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>5</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Opacity:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="fillOpacity">
+ <property name="toolTip">
+ <string>Set the transparency for the color selected</string>
+ </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>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>195</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabGradient">
+ <attribute name="title">
+ <string>Gradient</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>5</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QComboBox" name="gradientType">
+ <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="gradEditButton">
+ <property name="toolTip">
+ <string>Move the start of the gradient vector with the left mouse button pressed and move the end of the gradient vector with the right mouse button pressed</string>
+ </property>
+ <property name="text">
+ <string>Move Vector</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="GradientEditor" name="gradEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>173</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="ScComboBox" name="namedGradient"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tabPattern">
+ <attribute name="title">
+ <string>Pattern</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>5</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_2">
+ <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>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Blend Mode:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="ScComboBox" name="blendModeFill">
+ <item>
+ <property name="text">
+ <string>Normal</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Darken</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Lighten</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multiply</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Screen</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Overlay</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hard Light</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Soft Light</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Difference</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Exclusion</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Color Dodge</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Color Burn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hue</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Saturation</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Color</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Luminosity</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </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>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Index: scribus/ui/transparencypalette.h
===================================================================
--- scribus/ui/transparencypalette.h (revision 0)
+++ scribus/ui/transparencypalette.h (revision 14300)
@@ -0,0 +1,103 @@
+/*
+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.
+*/
+/***************************************************************************
+ transparencypalette.h - description
+ -------------------
+ begin : Tue Nov 17 2009
+ copyright : (C) 2009 by Franz Schmid
+ email : Franz.Schmid at 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 TPALETTE_H
+#define TPALETTE_H
+
+#include <QWidget>
+#include <QPointer>
+#include <QGroupBox>
+#include <QPushButton>
+#include <QToolButton>
+#include "scribusapi.h"
+#include "gradienteditor.h"
+#include "scribusdoc.h"
+#include "ui/scrpalettebase.h"
+#include "ui_transparencypalette.h"
+#include "ui/gradientvectordialog.h"
+
+class PageItem;
+class ColorListBox;
+class ScrSpinBox;
+class ScComboBox;
+class ScPattern;
+class LinkButton;
+
+/**
+ *@author Franz Schmid
+ */
+
+class SCRIBUS_API Tpalette : public QWidget, Ui::transparencyPalette
+{
+ Q_OBJECT
+
+ friend class PropertiesPalette;
+
+public:
+ Tpalette(QWidget* parent);
+ ~Tpalette() {};
+
+ virtual void changeEvent(QEvent *e);
+
+ void setDocument(ScribusDoc* doc);
+ void setCurrentItem(PageItem* item);
+ void updateFromItem();
+
+public slots:
+ void editLineSelectorButton();
+ void editFillSelectorButton();
+ void updateCList();
+ void updateGradientList();
+ void SetGradients(QMap<QString, VGradient> *docGradients);
+ void SetColors(ColorList newColorList);
+ void slotGrad(int nr);
+ void slotGradType(int type);
+ void setNamedGradient(const QString &name);
+ void editGradientVector();
+ void setActiveGradDia(bool active);
+ void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
+ void setActTrans(double, double);
+ void setActBlend(int, int);
+ void slotTransS(int val);
+ void slotTransF(int val);
+
+signals:
+ void NewTrans(double);
+ void NewTransS(double);
+ void NewBlend(int);
+ void NewBlendS(int);
+ void gradientChanged();
+ void editGradient();
+ void NewGradient(int);
+ void NewSpecial(double, double, double, double, double, double, double, double);
+
+protected:
+ GradientVectorDialog* TGradDia;
+ QPointer<ScribusDoc> currentDoc;
+ PageItem* currentItem;
+ ColorList colorList;
+ int currentUnit;
+ QMap<QString, ScPattern> *patternList;
+ QMap<QString, VGradient> *gradientList;
+};
+#endif
Index: scribus/ui/colorpalette.ui
===================================================================
--- scribus/ui/colorpalette.ui (revision 14299)
+++ scribus/ui/colorpalette.ui (revision 14300)
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>228</width>
- <height>389</height>
+ <height>343</height>
</rect>
</property>
<property name="windowTitle">
@@ -72,7 +72,7 @@
<item row="1" column="0" colspan="2">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="pageStroke">
<layout class="QGridLayout" name="gridLayout_3">
@@ -263,123 +263,6 @@
</widget>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Opacity:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="strokeOpacity">
- <property name="toolTip">
- <string>Set the transparency for the color selected</string>
- </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>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Blend Mode:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="ScComboBox" name="blendModeStroke">
- <item>
- <property name="text">
- <string>Normal</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Darken</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Lighten</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Multiply</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Screen</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Overlay</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hard Light</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Soft Light</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Difference</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Exclusion</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Color Dodge</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Color Burn</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hue</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Saturation</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Color</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Luminosity</string>
- </property>
- </item>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="pageFill">
@@ -571,123 +454,6 @@
</widget>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Opacity:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="fillOpacity">
- <property name="toolTip">
- <string>Set the transparency for the color selected</string>
- </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>
- <item row="2" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Blend Mode:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="ScComboBox" name="blendModeFill">
- <item>
- <property name="text">
- <string>Normal</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Darken</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Lighten</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Multiply</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Screen</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Overlay</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hard Light</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Soft Light</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Difference</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Exclusion</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Color Dodge</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Color Burn</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hue</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Saturation</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Color</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Luminosity</string>
- </property>
- </item>
- </widget>
- </item>
</layout>
</widget>
</widget>
@@ -735,16 +501,16 @@
<header>ui/sccombobox.h</header>
</customwidget>
<customwidget>
- <class>ColorListBox</class>
- <extends>QListWidget</extends>
- <header>ui/colorlistbox.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>
</customwidgets>
<resources/>
<connections/>
Index: scribus/ui/gradientvectordialog.cpp
===================================================================
--- scribus/ui/gradientvectordialog.cpp (revision 0)
+++ scribus/ui/gradientvectordialog.cpp (revision 14300)
@@ -0,0 +1,168 @@
+/*
+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.
+*/
+/***************************************************************************
+ gradientvectordialog.cpp - description
+ -------------------
+ begin : Tue Nov 17 2009
+ copyright : (C) 2009 by Franz Schmid
+ email : Franz.Schmid at 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 "gradientvectordialog.h"
+
+GradientVectorDialog::GradientVectorDialog(QWidget* parent) : ScrPaletteBase( parent, "GradientVectorPalette", false, 0 )
+{
+ freeGradientLayout = new QGridLayout(this);
+ freeGradientLayout->setMargin(5);
+ freeGradientLayout->setSpacing(5);
+ GTextX1 = new QLabel("X1:", this );
+ freeGradientLayout->addWidget( GTextX1, 0, 0 );
+ GTextY1 = new QLabel("Y1:", this );
+ freeGradientLayout->addWidget( GTextY1, 0, 2 );
+ gX1 = new ScrSpinBox( -3000, 3000, this, 0);
+ freeGradientLayout->addWidget( gX1, 0, 1 );
+ gY1 = new ScrSpinBox( -3000, 3000, this, 0);
+ freeGradientLayout->addWidget( gY1, 0, 3 );
+ GTextX2 = new QLabel("X2:", this );
+ freeGradientLayout->addWidget( GTextX2, 1, 0 );
+ GTextY2 = new QLabel("Y2:", this );
+ freeGradientLayout->addWidget( GTextY2, 1, 2 );
+ gX2 = new ScrSpinBox( -3000, 3000, this, 0);
+ freeGradientLayout->addWidget( gX2, 1, 1 );
+ gY2 = new ScrSpinBox( -3000, 3000, this, 0);
+ freeGradientLayout->addWidget( gY2, 1, 3 );
+ GTextFX = new QLabel("FX:", this );
+ freeGradientLayout->addWidget( GTextFX, 2, 0 );
+ GTextFY = new QLabel("FY:", this );
+ freeGradientLayout->addWidget( GTextFY, 2, 2 );
+ gFX = new ScrSpinBox( -3000, 3000, this, 0);
+ freeGradientLayout->addWidget( gFX, 2, 1 );
+ gFY = new ScrSpinBox( -3000, 3000, this, 0);
+ freeGradientLayout->addWidget( gFY, 2, 3 );
+ GTextSK = new QLabel("Skew:", this );
+ freeGradientLayout->addWidget( GTextSK, 3, 0, 1, 2 );
+ gSk = new ScrSpinBox( -89, 89, this, 6);
+ gSk->setValue( 0 );
+ freeGradientLayout->addWidget( gSk, 3, 2, 1, 2 );
+ GTextSC = new QLabel("Factor:", this );
+ freeGradientLayout->addWidget( GTextSC, 4, 0, 1, 2 );
+ gSc = new ScrSpinBox( 0.01, 100, this, 0);
+ gSc->setSuffix(" %");
+ gSc->setValue( 100 );
+ freeGradientLayout->addWidget( gSc, 4, 2, 1, 2 );
+ connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ languageChange();
+}
+
+void GradientVectorDialog::changeEvent(QEvent *e)
+{
+ if (e->type() == QEvent::LanguageChange)
+ {
+ languageChange();
+ }
+ else
+ QWidget::changeEvent(e);
+}
+
+void GradientVectorDialog::hideExtraWidgets()
+{
+ GTextFX->hide();
+ GTextFY->hide();
+ GTextSC->hide();
+ gFX->hide();
+ gFY->hide();
+ gSc->hide();
+ resize(minimumSizeHint());
+}
+
+void GradientVectorDialog::showExtraWidgets()
+{
+ GTextFX->show();
+ GTextFY->show();
+ GTextSC->show();
+ gFX->show();
+ gFY->show();
+ gSc->show();
+ resize(minimumSizeHint());
+}
+
+void GradientVectorDialog::languageChange()
+{
+ setWindowTitle( tr( "Gradient Vector" ));
+ resize(minimumSizeHint());
+}
+
+void GradientVectorDialog::setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
+{
+ disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ gX1->setValue(x1);
+ gX2->setValue(x2);
+ gY1->setValue(y1);
+ gY2->setValue(y2);
+ gFX->setValue(fx);
+ gFY->setValue(fy);
+ gSk->setValue(sk);
+ gSc->setValue(sg * 100.0);
+ connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gSk, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gSc, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+}
+
+void GradientVectorDialog::changeSpecial()
+{
+ emit NewSpecial(gX1->value(), gY1->value(), gX2->value(), gY2->value(), gFX->value(), gFY->value(), gSc->value() / 100.0, gSk->value());
+}
+
+void GradientVectorDialog::unitChange(int unitIndex)
+{
+ disconnect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ disconnect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ gX1->setNewUnit(unitIndex);
+ gY1->setNewUnit(unitIndex);
+ gX2->setNewUnit(unitIndex);
+ gY2->setNewUnit(unitIndex);
+ gFX->setNewUnit(unitIndex);
+ gFY->setNewUnit(unitIndex);
+ connect(gX1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gX2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gY1, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gY2, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gFX, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+ connect(gFY, SIGNAL(valueChanged(double)), this, SLOT(changeSpecial()));
+}
Index: scribus/ui/cpalette.h
===================================================================
--- scribus/ui/cpalette.h (revision 14299)
+++ scribus/ui/cpalette.h (revision 14300)
@@ -34,6 +34,7 @@
#include "scribusdoc.h"
#include "ui/scrpalettebase.h"
#include "ui_colorpalette.h"
+#include "ui/gradientvectordialog.h"
class PageItem;
class ColorListBox;
@@ -46,46 +47,6 @@
*@author Franz Schmid
*/
-class SCRIBUS_API GradientVectorDialog : public ScrPaletteBase
-{
- Q_OBJECT
-
-public:
- GradientVectorDialog( QWidget* parent);
- ~GradientVectorDialog() {};
- virtual void changeEvent(QEvent *e);
- void hideExtraWidgets();
- void showExtraWidgets();
-
-public slots:
- void languageChange();
- void setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
- void changeSpecial();
- void unitChange(int unitIndex);
-
-signals:
- void NewSpecial(double, double, double, double, double, double, double, double);
-
-protected:
- QGridLayout* freeGradientLayout;
- QLabel* GTextX1;
- QLabel* GTextY1;
- QLabel* GTextX2;
- QLabel* GTextY2;
- QLabel* GTextFX;
- QLabel* GTextFY;
- QLabel* GTextSK;
- QLabel* GTextSC;
- ScrSpinBox* gY1;
- ScrSpinBox* gX2;
- ScrSpinBox* gX1;
- ScrSpinBox* gY2;
- ScrSpinBox* gFX;
- ScrSpinBox* gFY;
- ScrSpinBox* gSk;
- ScrSpinBox* gSc;
-};
-
class SCRIBUS_API PatternPropsDialog : public QDialog
{
Q_OBJECT
@@ -158,11 +119,11 @@
void editLineColorSelectorButton();
void editFillColorSelectorButton();
void SetColors(ColorList newColorList);
- void setActTrans(double, double);
- void setActBlend(int, int);
+// void setActTrans(double, double);
+// void setActBlend(int, int);
void setActOverprint(int);
- void slotTransS(int val);
- void slotTransF(int val);
+// void slotTransS(int val);
+// void slotTransF(int val);
void updateCList();
void ToggleColorDisplay();
void SetPatterns(QMap<QString, ScPattern> *docPatterns);
@@ -203,14 +164,14 @@
void NewPatternS(QString);
void NewPatternPropsS(double, double, double, double, double, double, double, bool, bool);
void NewSpecial(double, double, double, double, double, double, double, double);
- void NewTrans(double);
- void NewTransS(double);
- void NewBlend(int);
- void NewBlendS(int);
+// void NewTrans(double);
+// void NewTransS(double);
+// void NewBlend(int);
+// void NewBlendS(int);
void NewOverprint(int);
void gradientChanged();
void strokeGradientChanged();
- void editGradient(bool);
+ void editGradient(int);
protected:
GradientVectorDialog* CGradDia;
@@ -239,7 +200,7 @@
bool m_Pattern_mirrorXS;
bool m_Pattern_mirrorYS;
int currentUnit;
- bool editStrokeGradient;
+ int editStrokeGradient;
};
#endif
Index: scribus/ui/gradientvectordialog.h
===================================================================
--- scribus/ui/gradientvectordialog.h (revision 0)
+++ scribus/ui/gradientvectordialog.h (revision 14300)
@@ -0,0 +1,78 @@
+/*
+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.
+*/
+/***************************************************************************
+ gradientvectordialog.h - description
+ -------------------
+ begin : Tue Nov 17 2009
+ copyright : (C) 2009 by Franz Schmid
+ email : Franz.Schmid at 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 GRADVECTOR_H
+#define GRADVECTOR_H
+
+#include <QWidget>
+#include <QLayout>
+#include <QLabel>
+#include <QEvent>
+#include "scribusapi.h"
+#include "ui/scrpalettebase.h"
+#include "scrspinbox.h"
+
+/**
+ *@author Franz Schmid
+ */
+
+class SCRIBUS_API GradientVectorDialog : public ScrPaletteBase
+{
+ Q_OBJECT
+
+public:
+ GradientVectorDialog( QWidget* parent);
+ ~GradientVectorDialog() {};
+ virtual void changeEvent(QEvent *e);
+ void hideExtraWidgets();
+ void showExtraWidgets();
+
+public slots:
+ void languageChange();
+ void setValues(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
+ void changeSpecial();
+ void unitChange(int unitIndex);
+
+signals:
+ void NewSpecial(double, double, double, double, double, double, double, double);
+
+protected:
+ QGridLayout* freeGradientLayout;
+ QLabel* GTextX1;
+ QLabel* GTextY1;
+ QLabel* GTextX2;
+ QLabel* GTextY2;
+ QLabel* GTextFX;
+ QLabel* GTextFY;
+ QLabel* GTextSK;
+ QLabel* GTextSC;
+ ScrSpinBox* gY1;
+ ScrSpinBox* gX2;
+ ScrSpinBox* gX1;
+ ScrSpinBox* gY2;
+ ScrSpinBox* gFX;
+ ScrSpinBox* gFY;
+ ScrSpinBox* gSk;
+ ScrSpinBox* gSc;
+};
+#endif
Index: scribus/ui/propertiespalette.h
===================================================================
--- scribus/ui/propertiespalette.h (revision 14299)
+++ scribus/ui/propertiespalette.h (revision 14300)
@@ -52,6 +52,7 @@
class StyleSelect;
class ScribusDoc;
class Cpalette;
+class Tpalette;
class Autoforms;
class ArrowChooser;
class ScComboBox;
@@ -140,6 +141,7 @@
void updateColorSpecialGradient();
const VGradient getFillGradient();
const VGradient getStrokeGradient();
+ const VGradient getMaskGradient();
void updateColorList();
void setGradientEditMode(bool);
void updateCmsList();
@@ -157,6 +159,7 @@
// commmited
Cpalette *Cpal;
+ Tpalette *Tpal;
Autoforms* SCustom;
Autoforms* SCustom2;
ParaStyleComboBox *paraStyleCombo;
@@ -290,7 +293,9 @@
void MakeIrre(int f, int c, qreal *vals);
void NewTDist();
void NewSpGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
- void toggleGradientEdit(bool);
+ void toggleGradientEdit(int);
+ void NewSpGradientM(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
+ void toggleGradientEditM();
void DoRevert();
void doClearCStyle();
void doClearPStyle();
@@ -351,6 +356,7 @@
QVBoxLayout* pageLayout_5a;
QVBoxLayout* pageLayout_5b;
QVBoxLayout* pageLayout_6;
+ QVBoxLayout* pageLayout_7;
// QVBoxLayout* OverPLayout;
QVBoxLayout* TLineLayout;
QHBoxLayout* layout60;
@@ -403,6 +409,7 @@
QWidget* page_5a;
QWidget* page_5b;
QWidget* page_6;
+ QWidget* page_7;
QWidget* page_group;
QLabel* xposLabel;
@@ -642,6 +649,7 @@
int idImageItem;
int idLineItem;
int idColorsItem;
+ int idTransparencyItem;
int idGroupItem;
Selection* tmpSelection;
};
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp (revision 14299)
+++ scribus/ui/propertiespalette.cpp (revision 14300)
@@ -52,6 +52,7 @@
#include "colorlistbox.h"
#include "sccolorengine.h"
#include "cpalette.h"
+#include "transparencypalette.h"
#include "pageitem_textframe.h"
#include "sccombobox.h"
#include "scfonts.h"
@@ -1477,23 +1478,18 @@
pageLayout_6 = new QVBoxLayout( page_6 );
pageLayout_6->setSpacing( 5 );
pageLayout_6->setMargin( 0 );
-
Cpal = new Cpalette(page_6);
pageLayout_6->addWidget( Cpal );
+ idColorsItem = TabStack->addItem(page_6, "&Colors" );
+
+ page_7 = new QWidget( TabStack );
+ pageLayout_7 = new QVBoxLayout( page_7 );
+ pageLayout_7->setSpacing( 5 );
+ pageLayout_7->setMargin( 0 );
+ Tpal = new Tpalette(page_7);
+ pageLayout_7->addWidget( Tpal );
+ idTransparencyItem = TabStack->addItem(page_7, "&Transparency" );
-/* OverP = new QGroupBox( "Overprinting", page_6 );
- OverPLayout = new QVBoxLayout( OverP );
- OverPLayout->setSpacing( 2 );
- OverPLayout->setMargin( 5 );
- OverPLayout->setAlignment( Qt::AlignTop );
- KnockOut = new QRadioButton( "Knockout", OverP );
- OverPLayout->addWidget( KnockOut );
- Overprint = new QRadioButton( "Overprint", OverP );
- OverPLayout->addWidget( Overprint );
- KnockOut->setChecked( true );
- pageLayout_6->addWidget(OverP);
-*/
- idColorsItem = TabStack->addItem(page_6, "&Colors" );
MpalLayout->addWidget( TabStack );
languageChange();
@@ -1590,7 +1586,9 @@
// connect( colgapLabel, SIGNAL( clicked() ), this, SLOT( HandleGapSwitch() ) );
connect(colgapLabel, SIGNAL(activated(int)), this, SLOT(HandleGapSwitch()));
connect( Cpal, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double)), this, SLOT(NewSpGradient(double, double, double, double, double, double, double, double )));
- connect( Cpal, SIGNAL(editGradient(bool)), this, SLOT(toggleGradientEdit(bool)));
+ connect( Cpal, SIGNAL(editGradient(int)), this, SLOT(toggleGradientEdit(int)));
+ connect( Tpal, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double)), this, SLOT(NewSpGradientM(double, double, double, double, double, double, double, double )));
+ connect( Tpal, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM()));
connect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
connect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
// connect(lineSpacingPop, SIGNAL(triggered(QAction *)), this, SLOT(setLspMode(QAction *)));
@@ -1623,7 +1621,7 @@
RoundRect->setValue(0);
TabStack3->setCurrentIndex(0);
TabStack2->setCurrentIndex(0);
- for (int ws = 1; ws < 7; ++ws)
+ for (int ws = 1; ws < 8; ++ws)
TabStack->setItemEnabled(ws, false);
TabStack->setCurrentIndex(0);
TabStack->widget(0)->setEnabled(false);
@@ -1670,6 +1668,7 @@
// connect(this->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke()));
+ connect(this->Tpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradMask()));
connect(DoUnGroup, SIGNAL(clicked()), m_ScMW, SLOT(UnGroupObj()) );
}
@@ -1836,6 +1835,11 @@
textFlowUsesContourLine2->setEnabled(true);
textFlowUsesImageClipping2->setEnabled(false);
}
+ else if (t == idTransparencyItem)
+ {
+ Tpal->setCurrentItem(CurItem);
+ Tpal->updateFromItem();
+ }
#ifdef HAVE_OSG
if (CurItem->asOSGFrame())
{
@@ -1844,6 +1848,7 @@
TabStack->setItemEnabled(idGroupItem, false);
TabStack->setItemEnabled(idLineItem, false);
TabStack->setItemEnabled(idColorsItem, true);
+ TabStack->setItemEnabled(idTransparencyItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
Rotation->setEnabled(false);
@@ -1860,16 +1865,18 @@
if(doc == d || (m_ScMW && m_ScMW->ScriptRunning))
return;
- disconnect(this->Cpal, SIGNAL(NewTrans(double)), 0, 0);
- disconnect(this->Cpal, SIGNAL(NewTransS(double)), 0, 0);
+ disconnect(this->Tpal, SIGNAL(NewTrans(double)), 0, 0);
+ disconnect(this->Tpal, SIGNAL(NewTransS(double)), 0, 0);
+ disconnect(this->Tpal, SIGNAL(NewGradient(int)), 0, 0);
+ disconnect(this->Tpal, SIGNAL(NewBlend(int)), 0, 0);
+ disconnect(this->Tpal, SIGNAL(NewBlendS(int)), 0, 0);
+
disconnect(this->Cpal, SIGNAL(NewPen(QString)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewBrush(QString)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewPenShade(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewBrushShade(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewGradient(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewGradientS(int)), 0, 0);
- disconnect(this->Cpal, SIGNAL(NewBlend(int)), 0, 0);
- disconnect(this->Cpal, SIGNAL(NewBlendS(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewPattern(QString)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewOverprint(int)), 0, 0);
@@ -1880,6 +1887,8 @@
CurItem = NULL;
Cpal->setDocument(doc);
Cpal->setCurrentItem(NULL);
+ Tpal->setDocument(doc);
+ Tpal->setCurrentItem(NULL);
m_unitRatio=doc->unitRatio();
m_unitIndex=doc->unitIndex();
int precision = unitGetPrecisionFromIndex(m_unitIndex);
@@ -1938,10 +1947,12 @@
startArrow->rebuildList(&doc->arrowStyles);
endArrow->rebuildList(&doc->arrowStyles);
- connect(this->Cpal, SIGNAL(NewTrans(double)), doc, SLOT(itemSelection_SetItemFillTransparency(double)));
- connect(this->Cpal, SIGNAL(NewTransS(double)), doc, SLOT(itemSelection_SetItemLineTransparency(double)));
- connect(this->Cpal, SIGNAL(NewBlend(int)), doc, SLOT(itemSelection_SetItemFillBlend(int)));
- connect(this->Cpal, SIGNAL(NewBlendS(int)), doc, SLOT(itemSelection_SetItemLineBlend(int)));
+ connect(this->Tpal, SIGNAL(NewTrans(double)), doc, SLOT(itemSelection_SetItemFillTransparency(double)));
+ connect(this->Tpal, SIGNAL(NewTransS(double)), doc, SLOT(itemSelection_SetItemLineTransparency(double)));
+ connect(this->Tpal, SIGNAL(NewBlend(int)), doc, SLOT(itemSelection_SetItemFillBlend(int)));
+ connect(this->Tpal, SIGNAL(NewBlendS(int)), doc, SLOT(itemSelection_SetItemLineBlend(int)));
+ connect(this->Tpal, SIGNAL(NewGradient(int)), doc, SLOT(itemSelection_SetItemGradMask(int)));
+
connect(this->Cpal, SIGNAL(NewPen(QString)), doc, SLOT(itemSelection_SetItemPen(QString)));
connect(this->Cpal, SIGNAL(NewBrush(QString)), doc, SLOT(itemSelection_SetItemBrush(QString)));
connect(this->Cpal, SIGNAL(NewPenShade(int)), doc, SLOT(itemSelection_SetItemPenShade(int)));
@@ -1963,6 +1974,8 @@
CurItem = NULL;
Cpal->setCurrentItem(NULL);
Cpal->setDocument(NULL);
+ Tpal->setCurrentItem(NULL);
+ Tpal->setDocument(NULL);
Xpos->setConstants(NULL);
Ypos->setConstants(NULL);
Width->setConstants(NULL);
@@ -1988,7 +2001,7 @@
Height->setValue(0);
Rotation->setValue(0);
RoundRect->setValue(0);
- for (int ws = 1; ws < 7; ++ws)
+ for (int ws = 1; ws < 8; ++ws)
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(false);
TabStack->setItemEnabled(idXYZItem, false);
@@ -2000,6 +2013,7 @@
HaveItem=false;
CurItem = NULL;
Cpal->setCurrentItem(NULL);
+ Tpal->setCurrentItem(NULL);
dashEditor->hide();
NewSel(-1);
}
@@ -2072,6 +2086,8 @@
Cpal->setCurrentItem(CurItem);
Cpal->updateFromItem();
+ Tpal->setCurrentItem(CurItem);
+ Tpal->updateFromItem();
/* if (TabStack->currentIndex() == idColorsItem)
Cpal->setActGradient(CurItem->GrType);
updateColorSpecialGradient();
@@ -2472,6 +2488,7 @@
TabStack->setItemEnabled(idGroupItem, false);
TabStack->setItemEnabled(idLineItem, false);
TabStack->setItemEnabled(idColorsItem, true);
+ TabStack->setItemEnabled(idTransparencyItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
Rotation->setEnabled(false);
@@ -2529,13 +2546,14 @@
Height->setEnabled(true);
Rotation->setEnabled(true);
// TabStack->setCurrentIndex(0);
- for (int ws = 1; ws < 7; ++ws)
+ for (int ws = 1; ws < 8; ++ws)
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(true);
TabStack->setItemEnabled(idXYZItem, true);
NameEdit->setEnabled(false);
TabStack->setItemEnabled(idLineItem, false);
TabStack->setItemEnabled(idColorsItem, true);
+ TabStack->setItemEnabled(idTransparencyItem, true);
if (HaveItem && CurItem)
{
if ((CurItem->isGroupControl) || ((CurItem->Groups.count() != 0) && (!CurItem->isSingleSel)))
@@ -2578,6 +2596,7 @@
TabStack->widget(0)->setEnabled(true);
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idColorsItem, true);
+ TabStack->setItemEnabled(idTransparencyItem, true);
/*
disconnect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
disconnect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
@@ -2620,7 +2639,7 @@
Height->setValue(0);
Rotation->setValue(0);
RoundRect->setValue(0);
- for (int ws = 1; ws < 7; ++ws)
+ for (int ws = 1; ws < 8; ++ws)
TabStack->setItemEnabled(ws, false);
// TabStack->setCurrentIndex(0);
TabStack->widget(0)->setEnabled(false);
@@ -2638,6 +2657,7 @@
TabStack->setItemEnabled(idGroupItem, false);
TabStack->setItemEnabled(idLineItem, false);
TabStack->setItemEnabled(idColorsItem, true);
+ TabStack->setItemEnabled(idTransparencyItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
Rotation->setEnabled(false);
@@ -4595,7 +4615,7 @@
if ((HaveDoc) && (HaveItem))
{
QRectF upRect;
- if (m_ScMW->view->editStrokeGradient)
+ if (m_ScMW->view->editStrokeGradient == 1)
{
CurItem->GrStrokeStartX = x1 / m_unitRatio;
CurItem->GrStrokeStartY = y1 / m_unitRatio;
@@ -4663,14 +4683,14 @@
}
}
-void PropertiesPalette::toggleGradientEdit(bool stroke)
+void PropertiesPalette::toggleGradientEdit(int stroke)
{
if (!m_ScMW || m_ScMW->ScriptRunning)
return;
if ((HaveDoc) && (HaveItem))
{
m_ScMW->view->editStrokeGradient = stroke;
- if (stroke)
+ if (stroke == 1)
{
if (Cpal->gradEditButtonStroke->isChecked())
m_ScMW->view->requestMode(modeEditGradientVectors);
@@ -4688,6 +4708,61 @@
}
}
+void PropertiesPalette::NewSpGradientM(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
+{
+ if (!m_ScMW || m_ScMW->ScriptRunning)
+ return;
+ if ((HaveDoc) && (HaveItem))
+ {
+ QRectF upRect;
+ CurItem->GrMaskStartX = x1 / m_unitRatio;
+ CurItem->GrMaskStartY = y1 / m_unitRatio;
+ CurItem->GrMaskEndX = x2 / m_unitRatio;
+ CurItem->GrMaskEndY = y2 / m_unitRatio;
+ CurItem->GrMaskFocalX = fx / m_unitRatio;
+ CurItem->GrMaskFocalY = fy / m_unitRatio;
+ CurItem->GrMaskScale = sg;
+ CurItem->GrMaskSkew = sk;
+ if (CurItem->GrMask == 1)
+ {
+ CurItem->GrMaskFocalX = CurItem->GrMaskStartX;
+ CurItem->GrMaskFocalY = CurItem->GrMaskStartY;
+ }
+ CurItem->update();
+ upRect = QRectF(QPointF(CurItem->GrMaskStartX, CurItem->GrMaskStartY), QPointF(CurItem->GrMaskEndX, CurItem->GrMaskEndY));
+ double radEnd = distance(CurItem->GrMaskEndX - CurItem->GrMaskStartX, CurItem->GrMaskEndY - CurItem->GrMaskStartY);
+ double rotEnd = xy2Deg(CurItem->GrMaskEndX - CurItem->GrMaskStartX, CurItem->GrMaskEndY - CurItem->GrMaskStartY);
+ QTransform m;
+ m.translate(CurItem->GrMaskStartX, CurItem->GrMaskStartY);
+ m.rotate(rotEnd);
+ m.rotate(-90);
+ m.rotate(CurItem->GrMaskSkew);
+ m.translate(radEnd * CurItem->GrMaskScale, 0);
+ QPointF shP = m.map(QPointF(0,0));
+ upRect |= QRectF(shP, QPointF(CurItem->GrMaskEndX, CurItem->GrMaskEndY)).normalized();
+ upRect |= QRectF(shP, QPointF(CurItem->GrMaskStartX, CurItem->GrMaskStartY)).normalized();
+ upRect |= QRectF(shP, QPointF(0, 0)).normalized();
+ upRect |= QRectF(shP, QPointF(CurItem->width(), CurItem->height())).normalized();
+ upRect.translate(CurItem->xPos(), CurItem->yPos());
+ doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
+ emit DocChanged();
+ }
+}
+
+void PropertiesPalette::toggleGradientEditM()
+{
+ if (!m_ScMW || m_ScMW->ScriptRunning)
+ return;
+ if ((HaveDoc) && (HaveItem))
+ {
+ m_ScMW->view->editStrokeGradient = 2;
+ if (Tpal->gradEditButton->isChecked())
+ m_ScMW->view->requestMode(modeEditGradientVectors);
+ else
+ m_ScMW->view->requestMode(modeNormal);
+ }
+}
+
void PropertiesPalette::NewTFont(QString c)
{
if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->ScriptRunning)
@@ -4771,6 +4846,8 @@
Cpal->SetColors(doc->PageColors);
Cpal->SetPatterns(&doc->docPatterns);
Cpal->SetGradients(&doc->docGradients);
+ Tpal->SetColors(doc->PageColors);
+ Tpal->SetGradients(&doc->docGradients);
assert (doc->PageColors.document());
TxFill->updateBox(doc->PageColors, ColorCombo::fancyPixmaps, true);
TxStroke->updateBox(doc->PageColors, ColorCombo::fancyPixmaps, false);
@@ -5653,6 +5730,11 @@
return Cpal->gradEditStroke->gradient();
}
+const VGradient PropertiesPalette::getMaskGradient()
+{
+ return Tpal->gradEdit->gradient();
+}
+
void PropertiesPalette::setGradientEditMode(bool on)
{
Cpal->gradEditButton->setChecked(on);
@@ -5667,7 +5749,14 @@
double dur=doc->unitRatio();
PageItem *currItem=doc->m_Selection->itemAt(0);
if (currItem)
- Cpal->setSpecialGradient(currItem->GrStartX * dur, currItem->GrStartY * dur, currItem->GrEndX * dur, currItem->GrEndY * dur, currItem->GrFocalX * dur, currItem->GrFocalY * dur, currItem->GrScale, currItem->GrSkew);
+ {
+ if (m_ScMW->view->editStrokeGradient == 0)
+ Cpal->setSpecialGradient(currItem->GrStartX * dur, currItem->GrStartY * dur, currItem->GrEndX * dur, currItem->GrEndY * dur, currItem->GrFocalX * dur, currItem->GrFocalY * dur, currItem->GrScale, currItem->GrSkew);
+ else if (m_ScMW->view->editStrokeGradient == 1)
+ Cpal->setSpecialGradient(currItem->GrStrokeStartX * dur, currItem->GrStrokeStartY * dur, currItem->GrStrokeEndX * dur, currItem->GrStrokeEndY * dur, currItem->GrStrokeFocalX * dur, currItem->GrStrokeFocalY * dur, currItem->GrStrokeScale, currItem->GrStrokeSkew);
+ else
+ Tpal->setSpecialGradient(currItem->GrMaskStartX * dur, currItem->GrMaskStartY * dur, currItem->GrMaskEndX * dur, currItem->GrMaskEndY * dur, currItem->GrMaskFocalX * dur, currItem->GrMaskFocalY * dur, currItem->GrMaskScale, currItem->GrMaskSkew);
+ }
}
void PropertiesPalette::updateSpinBoxConstants()
Index: scribus/ui/transparencypalette.cpp
===================================================================
--- scribus/ui/transparencypalette.cpp (revision 0)
+++ scribus/ui/transparencypalette.cpp (revision 14300)
@@ -0,0 +1,306 @@
+/*
+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.
+*/
+/***************************************************************************
+ transparencypalette.cpp - description
+ -------------------
+ begin : Tue Nov 17 2009
+ copyright : (C) 2009 by Franz Schmid
+ email : Franz.Schmid at 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 "transparencypalette.h"
+#include "sccolorengine.h"
+#include "scpainter.h"
+#include "scpattern.h"
+#include "util_icon.h"
+#include "util.h"
+
+Tpalette::Tpalette(QWidget* parent) : QWidget(parent)
+{
+ currentItem = NULL;
+ patternList = NULL;
+ TGradDia = NULL;
+ TGradDia = new GradientVectorDialog(this->parentWidget());
+ TGradDia->hide();
+ setupUi(this);
+ editLineSelector->setIcon(QIcon(loadIcon("16/color-stroke.png")));
+ editFillSelector->setIcon(QIcon(loadIcon("16/color-fill.png")));
+ editFillSelector->setChecked(true);
+ editFillSelectorButton();
+ connect(editLineSelector, SIGNAL(clicked()), this, SLOT(editLineSelectorButton()));
+ connect(editFillSelector, SIGNAL(clicked()), this, SLOT(editFillSelectorButton()));
+ connect(strokeOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransS(int)));
+ connect(fillOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransF(int)));
+ connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int)));
+ connect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
+ connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+ connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
+ connect(gradEditButton, SIGNAL(clicked()), this, SLOT(editGradientVector()));
+ connect(TGradDia, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double)), this, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double)));
+ connect(TGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool)));
+ connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
+ connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
+ tabWidget->setTabEnabled(2, false);
+}
+
+void Tpalette::setCurrentItem(PageItem* item)
+{
+ currentItem = item;
+}
+
+void Tpalette::setDocument(ScribusDoc* doc)
+{
+ currentDoc = doc;
+ if (doc != NULL)
+ {
+ gradEdit->setColors(doc->PageColors);
+ currentUnit = doc->unitIndex();
+ }
+}
+
+void Tpalette::updateFromItem()
+{
+ if (currentItem == NULL)
+ return;
+ if (!currentDoc)
+ return;
+ setActTrans(currentItem->fillTransparency(), currentItem->lineTransparency());
+ setActBlend(currentItem->fillBlendmode(), currentItem->lineBlendmode());
+ disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
+ disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+ disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
+ disconnect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
+ gradEdit->setGradient(currentItem->mask_gradient);
+ if (!currentItem->gradientMask().isEmpty())
+ {
+ setCurrentComboItem(namedGradient, currentItem->gradientMask());
+ gradEdit->setGradientEditable(false);
+ }
+ else
+ {
+ namedGradient->setCurrentIndex(0);
+ gradEdit->setGradientEditable(true);
+ }
+ if (currentItem->GrMask == 0)
+ tabWidget->setCurrentIndex(0);
+ else if ((currentItem->GrMask == 1) || (currentItem->GrMask == 2))
+ tabWidget->setCurrentIndex(1);
+ else
+ tabWidget->setCurrentIndex(2);
+ connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
+ connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+ connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
+ connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
+}
+
+void Tpalette::updateCList()
+{
+ gradEdit->setColors(colorList);
+}
+
+void Tpalette::updateGradientList()
+{
+ disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+ namedGradient->clear();
+ namedGradient->setIconSize(QSize(48, 12));
+ namedGradient->addItem( tr("Custom"));
+ for (QMap<QString, VGradient>::Iterator it = gradientList->begin(); it != gradientList->end(); ++it)
+ {
+ QImage pixm(48, 12, QImage::Format_ARGB32);
+ QPainter pb;
+ QBrush b(QColor(205,205,205), loadIcon("testfill.png"));
+ pb.begin(&pixm);
+ pb.fillRect(0, 0, 48, 12, b);
+ pb.end();
+ ScPainter *p = new ScPainter(&pixm, 48, 12);
+ p->setPen(Qt::black);
+ p->setLineWidth(1);
+ p->setFillMode(2);
+ p->fill_gradient = it.value();
+ p->setGradient(VGradient::linear, FPoint(0,6), FPoint(48, 6), FPoint(0,0), 1, 0);
+ p->drawRect(0, 0, 48, 12);
+ p->end();
+ delete p;
+ QPixmap pm;
+ pm = QPixmap::fromImage(pixm);
+ namedGradient->addItem(pm, it.key());
+ }
+ connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+}
+
+void Tpalette::SetGradients(QMap<QString, VGradient> *docGradients)
+{
+ gradientList = docGradients;
+ updateGradientList();
+}
+
+void Tpalette::SetColors(ColorList newColorList)
+{
+ colorList.clear();
+ colorList = newColorList;
+ updateCList();
+}
+
+void Tpalette::slotGrad(int number)
+{
+ if (number == 1)
+ {
+ disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+ if (!currentItem->gradientMask().isEmpty())
+ {
+ setCurrentComboItem(namedGradient, currentItem->gradientMask());
+ gradEdit->setGradient(gradientList->value(currentItem->gradientMask()));
+ gradEdit->setGradientEditable(false);
+ }
+ else
+ {
+ namedGradient->setCurrentIndex(0);
+ gradEdit->setGradient(currentItem->mask_gradient);
+ gradEdit->setGradientEditable(true);
+ }
+ if (gradientType->currentIndex() == 0)
+ emit NewGradient(1);
+ else
+ emit NewGradient(2);
+ connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+ }
+ else if (number == 2)
+ emit NewGradient(3);
+ else
+ emit NewGradient(0);
+}
+
+void Tpalette::slotGradType(int type)
+{
+ if (type == 0)
+ emit NewGradient(1);
+ else
+ emit NewGradient(2);
+}
+
+void Tpalette::setNamedGradient(const QString &name)
+{
+ if (namedGradient->currentIndex() == 0)
+ {
+ gradEdit->setGradient(currentItem->mask_gradient);
+ currentItem->setGradient("");
+ gradEdit->setGradientEditable(true);
+ }
+ else
+ {
+ gradEdit->setGradient(gradientList->value(name));
+ gradEdit->setGradientEditable(false);
+ currentItem->setGradient(name);
+ }
+ if (gradientType->currentIndex() == 0)
+ emit NewGradient(1);
+ else
+ emit NewGradient(2);
+}
+
+void Tpalette::editGradientVector()
+{
+ if (gradEditButton->isChecked())
+ {
+ TGradDia->unitChange(currentDoc->unitIndex());
+ TGradDia->setValues(currentItem->GrMaskStartX, currentItem->GrMaskStartY, currentItem->GrMaskEndX, currentItem->GrMaskEndY, currentItem->GrMaskFocalX, currentItem->GrMaskFocalY, currentItem->GrMaskScale, currentItem->GrMaskSkew);
+ if (currentItem->GrMask == 1)
+ TGradDia->hideExtraWidgets();
+ else
+ TGradDia->showExtraWidgets();
+ TGradDia->show();
+ }
+ else
+ {
+ TGradDia->hide();
+ }
+ emit editGradient();
+}
+
+void Tpalette::setActiveGradDia(bool active)
+{
+ if (!active)
+ {
+ gradEditButton->setChecked(false);
+ emit editGradient();
+ }
+}
+
+void Tpalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
+{
+ if (TGradDia)
+ TGradDia->setValues(x1, y1, x2, y2, fx, fy, sg, sk);
+}
+
+void Tpalette::setActTrans(double val, double val2)
+{
+ disconnect(strokeOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransS(int)));
+ disconnect(fillOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransF(int)));
+ strokeOpacity->setValue(qRound(100 - (val2 * 100)));
+ fillOpacity->setValue(qRound(100 - (val * 100)));
+ connect(strokeOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransS(int)));
+ connect(fillOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotTransF(int)));
+}
+
+void Tpalette::setActBlend(int val, int val2)
+{
+ disconnect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int)));
+ disconnect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
+ blendModeFill->setCurrentIndex(val);
+ blendModeStroke->setCurrentIndex(val2);
+ connect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int)));
+ connect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
+}
+
+void Tpalette::slotTransS(int val)
+{
+ emit NewTransS(static_cast<double>(100 - val) / 100.0);
+}
+
+void Tpalette::slotTransF(int val)
+{
+ emit NewTrans(static_cast<double>(100 - val) / 100.0);
+}
+
+void Tpalette::editLineSelectorButton()
+{
+ if (editLineSelector->isChecked())
+ {
+ stackedWidget->setCurrentIndex(0);
+ editFillSelector->setChecked(false);
+ }
+ updateFromItem();
+}
+
+void Tpalette::editFillSelectorButton()
+{
+ if (editFillSelector->isChecked())
+ {
+ stackedWidget->setCurrentIndex(1);
+ editLineSelector->setChecked(false);
+ }
+ updateFromItem();
+}
+
+void Tpalette::changeEvent(QEvent *e)
+{
+ if (e->type() == QEvent::LanguageChange)
+ {
+ languageChange();
+ }
+ else
+ QWidget::changeEvent(e);
+}
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14299)
+++ scribus/scribus.cpp (revision 14300)
@@ -7419,6 +7419,14 @@
VGradient vg(propertiesPalette->getStrokeGradient());
doc->itemSelection_SetLineGradient(vg);
}
+
+void ScribusMainWindow::updtGradMask()
+{
+ if (!HaveDoc)
+ return;
+ VGradient vg(propertiesPalette->getMaskGradient());
+ doc->itemSelection_SetMaskGradient(vg);
+}
/*
//CB-->Doc
void ScribusMainWindow::GetBrushPen()
Index: scribus/plugins/xarimplugin/importxar.cpp
===================================================================
--- scribus/plugins/xarimplugin/importxar.cpp (revision 14299)
+++ scribus/plugins/xarimplugin/importxar.cpp (revision 14300)
@@ -710,9 +710,15 @@
ts >> p >> p1;
}
if (linear)
+ {
+ gc->GradMask = 1;
gc->MaskGradient = VGradient(VGradient::linear);
+ }
else
+ {
+ gc->GradMask = 2;
gc->MaskGradient = VGradient(VGradient::radial);
+ }
gc->MaskGradient.clearStops();
gc->MaskGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors["Black"], m_Doc), 0.0, 0.5, 1.0 - transStart / 255.0, "Black", 100 );
gc->MaskGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors["Black"], m_Doc), 1.0, 0.5, 1.0 - transEnd / 255.0, "Black", 100 );
@@ -720,7 +726,6 @@
gc->GradMaskY1 = (docHeight - bly) + baseY + m_Doc->currentPage()->yOffset();
gc->GradMaskX2 = brx + baseX + m_Doc->currentPage()->xOffset();
gc->GradMaskY2 = (docHeight - bry) + baseY + m_Doc->currentPage()->yOffset();
- gc->GradMask = 1;
}
void XarPlug::handleSimpleGradientTransparencySkewed(QDataStream &ts, quint32 dataLen)
@@ -782,7 +787,7 @@
gc->GradMaskY1 = (docHeight - bly) + baseY + m_Doc->currentPage()->yOffset();
gc->GradMaskX2 = brx + baseX + m_Doc->currentPage()->xOffset();
gc->GradMaskY2 = (docHeight - bry) + baseY + m_Doc->currentPage()->yOffset();
- gc->GradMask = 1;
+ gc->GradMask = 2;
}
int XarPlug::convertBlendMode(int val)
@@ -1674,9 +1679,9 @@
item->fill_gradient = gc->FillGradient;
item->setGradientVector(gc->GradFillX1 - item->xPos(), gc->GradFillY1 - item->yPos(), gc->GradFillX2 - item->xPos(), gc->GradFillY2 - item->yPos(), gc->GradFillX1 - item->xPos(), gc->GradFillY1 - item->yPos(), gc->GrScale, gc->GrSkew);
}
- if (gc->GradMask == 1)
+ if (gc->GradMask > 0)
{
- item->GrMask = 1;
+ item->GrMask = gc->GradMask;
item->mask_gradient = gc->MaskGradient;
item->setMaskVector(gc->GradMaskX1 - item->xPos(), gc->GradMaskY1 - item->yPos(), gc->GradMaskX2 - item->xPos(), gc->GradMaskY2 - item->yPos(), gc->GradMaskX1 - item->xPos(), gc->GradMaskY1 - item->yPos(), gc->GradMaskScale, gc->GradMaskSkew);
}
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14299)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14300)
@@ -1229,13 +1229,9 @@
docu.writeAttribute("pMirrorXS" , mirrorX);
docu.writeAttribute("pMirrorYS" , mirrorY);
}
+ docu.writeAttribute("GRTYPM", item->GrMask);
if (item->GrMask > 0)
{
- docu.writeAttribute("GRTYPM", item->GrMask);
- if (item->mask_gradient.type() == VGradient::radial)
- docu.writeAttribute("GRMK", 1);
- else
- docu.writeAttribute("GRMK", 0);
docu.writeAttribute("GRSTARTXM", item->GrMaskStartX);
docu.writeAttribute("GRSTARTYM", item->GrMaskStartY);
docu.writeAttribute("GRENDXM", item->GrMaskEndX);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14299)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14300)
@@ -2865,13 +2865,12 @@
bool mirrorXm = attrs.valueAsBool("pMirrorXM", false);
bool mirrorYm = attrs.valueAsBool("pMirrorYM", false);
currItem->setMaskFlip(mirrorXm, mirrorYm);
- int grM = attrs.valueAsInt("GRMK", 0);
- if (grM == 0)
+ currItem->GrMask = attrs.valueAsInt("GRTYPM", 0);
+ if (currItem->GrMask == 1)
currItem->mask_gradient = VGradient(VGradient::linear);
else
currItem->mask_gradient = VGradient(VGradient::radial);
currItem->mask_gradient.clearStops();
- currItem->GrMask = attrs.valueAsInt("GRTYPM", 0);
currItem->GrMaskStartX = attrs.valueAsDouble("GRSTARTXM", 0.0);
currItem->GrMaskStartY = attrs.valueAsDouble("GRSTARTYM", 0.0);
currItem->GrMaskEndX = attrs.valueAsDouble("GRENDXM", 0.0);
Index: scribus/scribus.h
===================================================================
--- scribus/scribus.h (revision 14299)
+++ scribus/scribus.h (revision 14300)
@@ -453,6 +453,7 @@
*/
void updtGradFill();
void updtGradStroke();
+ void updtGradMask();
/*
// Setzt die Pen-Farbe
void setPenFarbe(QString farbe);
Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt (revision 14299)
+++ scribus/CMakeLists.txt (revision 14300)
@@ -139,6 +139,7 @@
ui/tabprinter.ui
ui/tabscrapbook.ui
ui/tocindexprefs.ui
+ ui/transparencypalette.ui
ui/copypagetomasterpage.ui
ui/createrange.ui
ui/helpbrowser.ui
@@ -214,6 +215,7 @@
ui/gradientaddedit.h
ui/gradienteditor.h
ui/gradientmanager.h
+ ui/gradientvectordialog.h
ui/gradientpreview.h
ui/gtdialogs.h
ui/gtfiledialog.h
@@ -388,6 +390,7 @@
ui/tabtypography.h
tocgenerator.h
ui/tocindexprefs.h
+ ui/transparencypalette.h
tt/simpletreemodel/treemodel.h
ui/copypagetomasterpagedialog.h
ui/createrange.h
@@ -499,6 +502,7 @@
ui/gradientaddedit.cpp
ui/gradienteditor.cpp
ui/gradientmanager.cpp
+ ui/gradientvectordialog.cpp
ui/gradientpreview.cpp
gtaction.cpp
ui/gtdialogs.cpp
@@ -748,6 +752,7 @@
tocgenerator.cpp
ui/tocindexprefs.cpp
transaction.cpp
+ ui/transparencypalette.cpp
tt/simpletreemodel/treeitem.cpp
tt/simpletreemodel/treemodel.cpp
ui/copypagetomasterpagedialog.cpp
More information about the scribus-commit
mailing list