scribus-bleeds.diff (6,434 bytes)
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 16868)
+++ scribus/scribusdoc.cpp (working copy)
@@ -1849,10 +1849,12 @@
// PDF_Options.BleedBottom = pageMargins.Bottom;
}
-void ScribusDoc::resetPage(int fp, MarginStruct* newMargins)
+void ScribusDoc::resetPage(int fp, MarginStruct* newMargins, MarginStruct* newBleeds)
{
if (newMargins!=0)
docPrefsData.docSetupPrefs.margins = *newMargins;
+ if (newBleeds!=0)
+ docPrefsData.docSetupPrefs.bleeds = *newBleeds;
docPrefsData.docSetupPrefs.pagePositioning = fp;
}
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 16868)
+++ scribus/scribusdoc.h (working copy)
@@ -130,7 +130,7 @@
bool isModified() const;
/** Setzt die Seitenattribute */
void setPage(double w, double h, double t, double l, double r, double b, double sp, double ab, bool atf, int fp);
- void resetPage(int fp, MarginStruct* newMargins=0);
+ void resetPage(int fp, MarginStruct* newMargins=0, MarginStruct* newBleeds=0);
/**
* @brief Return the view associated with the document
Index: scribus/plugins/scriptplugin/cmddoc.h
===================================================================
--- scribus/plugins/scriptplugin/cmddoc.h (revision 16868)
+++ scribus/plugins/scriptplugin/cmddoc.h (working copy)
@@ -185,6 +185,27 @@
PyObject *scribus_setmargins(PyObject * /*self*/, PyObject* args);
/*! docstring */
+PyDoc_STRVAR(scribus_getbleeds__doc__,
+QT_TR_NOOP("getBleeds()\n\
+\n\
+Returns the document bleeds as a (top, left, right, bottom) tuple in the document's current\n\
+units. See UNIT_<type> constants.\n\
+"));
+/** Gets document bleeds - left, right, top and bottom. */
+PyObject *scribus_getbleeds(PyObject * /*self*/);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_setbleeds__doc__,
+QT_TR_NOOP("setBleeds(lr, rr, tr, br)\n\
+\n\
+Sets the bleeds of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\
+bleeds are given in the measurement units of the document - see UNIT_<type>\n\
+constants.\n\
+"));
+/** Sets document bleeds - left, right, top and bottom. */
+PyObject *scribus_setbleeds(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
PyDoc_STRVAR(scribus_setbaseline__doc__,
QT_TR_NOOP("setBaseLine(grid, offset)\n\
\n\
Index: scribus/plugins/scriptplugin/cmddoc.cpp
===================================================================
--- scribus/plugins/scriptplugin/cmddoc.cpp (revision 16868)
+++ scribus/plugins/scriptplugin/cmddoc.cpp (working copy)
@@ -128,6 +128,36 @@
Py_RETURN_NONE;
}
+PyObject *scribus_getbleeds(PyObject * /*self*/)
+{
+ PyObject *bleeds = NULL;
+ if(!checkHaveDocument())
+ return NULL;
+ bleeds = Py_BuildValue("ffff", PointToValue(ScCore->primaryMainWindow()->doc->bleeds()->Top),
+ PointToValue(ScCore->primaryMainWindow()->doc->bleeds()->Left),
+ PointToValue(ScCore->primaryMainWindow()->doc->bleeds()->Right),
+ PointToValue(ScCore->primaryMainWindow()->doc->bleeds()->Bottom));
+ return bleeds;
+}
+
+PyObject *scribus_setbleeds(PyObject* /* self */, PyObject* args)
+{
+ double lr, tpr, btr, rr;
+ if (!PyArg_ParseTuple(args, "dddd", &lr, &rr, &tpr, &btr))
+ return NULL;
+ if(!checkHaveDocument())
+ return NULL;
+ MarginStruct bleeds(ValueToPoint(tpr), ValueToPoint(lr), ValueToPoint(btr), ValueToPoint(rr));
+ ScCore->primaryMainWindow()->doc->resetPage(ScCore->primaryMainWindow()->doc->pagePositioning(), 0, &bleeds);
+ ScCore->primaryMainWindow()->view->reformPages();
+ ScCore->primaryMainWindow()->doc->setModified(true);
+ ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber());
+ ScCore->primaryMainWindow()->view->DrawNew();
+// Py_INCREF(Py_None);
+// return Py_None;
+ Py_RETURN_NONE;
+}
+
PyObject *scribus_setbaseline(PyObject* /* self */, PyObject* args)
{
double grid, offset;
@@ -394,5 +424,5 @@
void cmddocdocwarnings()
{
QStringList s;
- s << scribus_newdocument__doc__ << scribus_newdoc__doc__ << scribus_closedoc__doc__ << scribus_havedoc__doc__ << scribus_opendoc__doc__ << scribus_savedoc__doc__ << scribus_getdocname__doc__ << scribus_savedocas__doc__ << scribus_setinfo__doc__ <<scribus_setmargins__doc__ <<scribus_setunit__doc__ <<scribus_getunit__doc__ <<scribus_loadstylesfromfile__doc__ <<scribus_setdoctype__doc__ <<scribus_closemasterpage__doc__ <<scribus_masterpagenames__doc__ <<scribus_editmasterpage__doc__ <<scribus_createmasterpage__doc__ <<scribus_deletemasterpage__doc__ << scribus_setbaseline__doc__;
+ s << scribus_newdocument__doc__ << scribus_newdoc__doc__ << scribus_closedoc__doc__ << scribus_havedoc__doc__ << scribus_opendoc__doc__ << scribus_savedoc__doc__ << scribus_getdocname__doc__ << scribus_savedocas__doc__ << scribus_setinfo__doc__ <<scribus_setmargins__doc__ <<scribus_setunit__doc__ <<scribus_getunit__doc__ <<scribus_loadstylesfromfile__doc__ <<scribus_setdoctype__doc__ <<scribus_closemasterpage__doc__ <<scribus_masterpagenames__doc__ <<scribus_editmasterpage__doc__ <<scribus_createmasterpage__doc__ <<scribus_deletemasterpage__doc__ << scribus_setbaseline__doc__ << scribus_setbleeds__doc__ << scribus_getbleeds__doc__;
}
Index: scribus/plugins/scriptplugin/scriptplugin.cpp
===================================================================
--- scribus/plugins/scriptplugin/scriptplugin.cpp (revision 16868)
+++ scribus/plugins/scriptplugin/scriptplugin.cpp (working copy)
@@ -511,6 +511,8 @@
{const_cast<char*>("setLineStyle"), scribus_setlinestyle, METH_VARARGS, tr(scribus_setlinestyle__doc__)},
{const_cast<char*>("setLineWidth"), scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
{const_cast<char*>("setMargins"), scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
+ {const_cast<char*>("getBleeds"), (PyCFunction)scribus_getbleeds, METH_NOARGS, tr(scribus_getbleeds__doc__)},
+ {const_cast<char*>("setBleeds"), scribus_setbleeds, METH_VARARGS, tr(scribus_setbleeds__doc__)},
{const_cast<char*>("setBaseLine"), scribus_setbaseline, METH_VARARGS, tr(scribus_setbaseline__doc__)},
{const_cast<char*>("setMultiLine"), scribus_setmultiline, METH_VARARGS, tr(scribus_setmultiline__doc__)},
// duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"},