Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 13181 → Rev 13182

/trunk/Scribus/scribus/doc/en/scripterapi-setobjprop.html
52,6 → 52,10
<dd><code>setGradientFill(type, "color1", shade1, "color2", shade2, ["name"])</code>
<p>Sets the gradient fill of the object "name" to type. Color descriptions are the same as for <a href="#-setFillColor">setFillColor</a>() and <a href="#-setFillShade">setFillShade</a>(). See the constants for available types (FILL_&lt;type&gt;).</p></dd>
 
<dt><a name="-setGradientStop"><strong>setGradientStop</strong></a>(...)</dt>
<dd><code>setGradientStop("color", shade, opacity, ramppoint, ["name"])</code>
<p>Set or add a gradient stop to the gradient fill of the object \"name\" at position ramppoint. Color descriptions are the same as for <a href="#-setFillColor">setFillColor</a>() and <a href="#-setFillShade">setFillShade</a>(). setGradientFill() must have been called previously for the gradient fill to be visible.</p></dd>
 
<dt><a name="-setLineCap"><strong>setLineCap</strong></a>(...)</dt>
<dd><code>setLineEnd(endtype, ["name"])</code>
<p>Sets the line cap style of the object "name" to the style "cap". If "name" is not given the currently selected item is used. There are predefined constants for "cap" - CAP_&lt;type&gt;.</p></dd>
/trunk/Scribus/scribus/vgradient.h
109,6 → 109,7
const QList<VColorStop*>& colorStops() const;
void addStop( const VColorStop& colorStop );
void addStop( const QColor &color, double rampPoint, double midPoint, double opa, QString name = "", int shade = 100 );
void setStop( const QColor &color, double rampPoint, double midPoint, double opa, QString name = "", int shade = 100 );
void removeStop( VColorStop& colorStop );
void removeStop( uint n );
void clearStops();
/trunk/Scribus/scribus/vgradient.cpp
142,6 → 142,20
inSort( new VColorStop( rampPoint, midPoint, color, opa, name, shade ) );
}
 
void
VGradient::setStop( const QColor &color, double rampPoint, double midPoint, double opa, QString name, int shade )
{
for (int i = 0; i < m_colorStops.count(); ++i)
{
if (m_colorStops.at(i)->rampPoint == rampPoint)
{
delete m_colorStops.takeAt(i);
break;
}
}
addStop(color, rampPoint, midPoint, opa, name, shade);
}
 
void VGradient::removeStop( VColorStop& colorstop )
{
int n = m_colorStops.indexOf(&colorstop);
/trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
18,6 → 18,11
return NULL;
if(!checkHaveDocument())
return NULL;
if ((shade1 < 0) || (shade1 > 100) || (shade2 < 0) || (shade2 > 100))
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Stop shade out of bounds, must be 0 <= shade <= 100.","python error").toLocal8Bit().constData());
return NULL;
}
PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
if (currItem == NULL)
return NULL;
77,11 → 82,46
//ScCore->primaryMainWindow()->view->updateGradientVectors(currItem);
currItem->updateGradientVectors();
currItem->update();
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
PyObject *scribus_setgradstop(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
char *Color1;
int shade1;
double rampPoint, opacity;
if (!PyArg_ParseTuple(args, "esidd|es", "utf-8", &Color1, &shade1, &opacity, &rampPoint, "utf-8", &Name))
return NULL;
if(!checkHaveDocument())
return NULL;
if ((shade1 < 0) || (shade1 > 100))
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Stop shade out of bounds, must be 0 <= shade <= 100.","python error").toLocal8Bit().constData());
return NULL;
}
if ((rampPoint < 0.0) || (rampPoint > 1.0))
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Ramp point out of bounds, must be 0 <= rampPoint <= 1.","python error").toLocal8Bit().constData());
return NULL;
}
if ((opacity < 0.0) || (opacity > 1.0))
{
PyErr_SetString(PyExc_ValueError, QObject::tr("Opacity out of bounds, must be 0 <= transparency <= 1.","python error").toLocal8Bit().constData());
return NULL;
}
PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
if (currItem == NULL)
return NULL;
QColor tmp;
QString c1 = QString::fromUtf8(Color1);
currItem->SetQColor(&tmp, c1, shade1);
currItem->fill_gradient.setStop(tmp, rampPoint, 0.5, opacity, c1, shade1);
currItem->updateGradientVectors();
currItem->update();
Py_RETURN_NONE;
}
 
PyObject *scribus_setfillcolor(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
94,8 → 134,6
if (i == NULL)
return NULL;
i->setFillColor(QString::fromUtf8(Color));
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
116,8 → 154,6
if (i == NULL)
return NULL;
i->setFillTransparency(1.0 - w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
138,8 → 174,6
if (i == NULL)
return NULL;
i->setFillBlendmode(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
155,8 → 189,6
if (it == NULL)
return NULL;
it->setLineColor(QString::fromUtf8(Color));
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
177,8 → 209,6
if (i == NULL)
return NULL;
i->setLineTransparency(1.0 - w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
199,8 → 229,6
if (i == NULL)
return NULL;
i->setLineBlendmode(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
221,8 → 249,6
if (i == NULL)
return NULL;
i->setLineWidth(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
243,8 → 269,6
if (it == NULL)
return NULL;
it->setLineShade(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
265,8 → 289,6
if (i == NULL)
return NULL;
i->setFillShade(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
282,8 → 304,6
if (i == NULL)
return NULL;
i->PLineJoin = Qt::PenJoinStyle(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
299,8 → 319,6
if (i == NULL)
return NULL;
i->PLineEnd = Qt::PenCapStyle(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
316,8 → 334,6
if (i == NULL)
return NULL;
i->PLineArt = Qt::PenStyle(w);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
342,8 → 358,6
currItem->SetFrameRound();
ScCore->primaryMainWindow()->doc->setRedrawBounding(currItem);
ScCore->primaryMainWindow()->view->SetFrameRounded();
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
364,8 → 378,6
return NULL;
}
currItem->NamedLStyle = QString::fromUtf8(Style);
// Py_INCREF(Py_None);
// return Py_None;
Py_RETURN_NONE;
}
 
375,12 → 387,12
void cmdsetpropdocwarnings()
{
QStringList s;
s << scribus_setgradfill__doc__ << scribus_setfillcolor__doc__
<< scribus_setfilltrans__doc__ << scribus_setfillblend__doc__
<< scribus_setlinecolor__doc__ << scribus_setlinetrans__doc__
<< scribus_setlineblend__doc__ << scribus_setlinewidth__doc__
<< scribus_setlineshade__doc__ << scribus_setlinejoin__doc__
<< scribus_setlineend__doc__ << scribus_setlinestyle__doc__
<< scribus_setfillshade__doc__ << scribus_setcornerrad__doc__
<< scribus_setmultiline__doc__;
s << scribus_setgradfill__doc__ << scribus_setgradstop__doc__
<< scribus_setfillcolor__doc__ << scribus_setfilltrans__doc__
<< scribus_setfillblend__doc__ << scribus_setlinecolor__doc__
<< scribus_setlinetrans__doc__ << scribus_setlineblend__doc__
<< scribus_setlinewidth__doc__ << scribus_setlineshade__doc__
<< scribus_setlinejoin__doc__ << scribus_setlineend__doc__
<< scribus_setlinestyle__doc__ << scribus_setfillshade__doc__
<< scribus_setcornerrad__doc__ << scribus_setmultiline__doc__;
}
/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
427,6 → 427,7
{const_cast<char*>("setFont"), scribus_setfont, METH_VARARGS, tr(scribus_setfont__doc__)},
{const_cast<char*>("setFontSize"), scribus_setfontsize, METH_VARARGS, tr(scribus_setfontsize__doc__)},
{const_cast<char*>("setGradientFill"), scribus_setgradfill, METH_VARARGS, tr(scribus_setgradfill__doc__)},
{const_cast<char*>("setGradientStop"), scribus_setgradstop, METH_VARARGS, tr(scribus_setgradstop__doc__)},
{const_cast<char*>("setHGuides"), scribus_setHguides, METH_VARARGS, tr(scribus_setHguides__doc__)},
{const_cast<char*>("setInfo"), scribus_setinfo, METH_VARARGS, tr(scribus_setinfo__doc__)},
{const_cast<char*>("setLayerPrintable"), scribus_layerprint, METH_VARARGS, tr(scribus_layerprint__doc__)},
/trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
24,6 → 24,17
PyObject *scribus_setgradfill(PyObject * /*self*/, PyObject* args);
 
/*! docstring */
PyDoc_STRVAR(scribus_setgradstop__doc__,
QT_TR_NOOP("setGradientStop(\"color\", shade, opacity, ramppoint, [\"name\"])\n\
\n\
Set or add a gradient stop to the gradient fill of the object \"name\" at position ramppoint.\n\
Color descriptions are the same as for setFillColor() and setFillShade(). setGradientFill()\n\
must have been called previously for the gradient fill to be visible.\n\
"));
/*! Set gradient */
PyObject *scribus_setgradstop(PyObject * /*self*/, PyObject* args);
 
/*! docstring */
PyDoc_STRVAR(scribus_setfillcolor__doc__,
QT_TR_NOOP("setFillColor(\"color\", [\"name\"])\n\
\n\