Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 410 → Rev 411

/trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
162,3 → 162,119
} // for
return l;
}
 
PyObject *scribus_getHguides(PyObject *self, PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("GetHGuides()"));
return NULL;
}
int n;
if (!Carrier->HaveDoc || (n = Carrier->doc->ActPage->YGuides.count()) == 0)
{
Py_INCREF(Py_None);
return Py_None;
}
int i;
double tmp;
PyObject *l, *guide;
l = PyList_New(0);
for (i=0; i<n; i++)
{
tmp = Carrier->doc->ActPage->YGuides[i];
guide = Py_BuildValue("d", PointToValue(tmp));
PyList_Append(l, guide);
}
return l;
}
 
PyObject *scribus_setHguides(PyObject *self, PyObject* args)
{
PyObject *l;
if (!PyArg_ParseTuple(args, "O", &l))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("SetHGuides(guides)"));
return NULL;
}
if (!PyList_Check(l))
{
PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
return NULL;
}
Py_INCREF(Py_None);
if (!Carrier->HaveDoc)
return Py_None;
int i, n;
n = PyList_Size(l);
double guide;
Carrier->doc->ActPage->YGuides.clear();
for (i=0; i<n; i++)
{
if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
{
PyErr_SetString(PyExc_TypeError, QString("argument contains no-numeric values: must be list of float values"));
return NULL;
}
Carrier->doc->ActPage->YGuides += ValueToPoint(guide);
}
return Py_None;
}
 
PyObject *scribus_getVguides(PyObject *self, PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("GetVGuides()"));
return NULL;
}
int n;
if (!Carrier->HaveDoc || (n = Carrier->doc->ActPage->XGuides.count()) == 0)
{
Py_INCREF(Py_None);
return Py_None;
}
int i;
double tmp;
PyObject *l, *guide;
l = PyList_New(0);
for (i=0; i<n; i++)
{
tmp = Carrier->doc->ActPage->XGuides[i];
guide = Py_BuildValue("d", PointToValue(tmp));
PyList_Append(l, guide);
}
return l;
}
 
PyObject *scribus_setVguides(PyObject *self, PyObject* args)
{
PyObject *l;
if (!PyArg_ParseTuple(args, "O", &l))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("SetVGuides(guides)"));
return NULL;
}
if (!PyList_Check(l))
{
PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
return NULL;
}
Py_INCREF(Py_None);
if (!Carrier->HaveDoc)
return Py_None;
int i, n;
n = PyList_Size(l);
double guide;
Carrier->doc->ActPage->XGuides.clear();
for (i=0; i<n; i++)
{
if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
{
PyErr_SetString(PyExc_TypeError, QString("argument contains no-numeric values: must be list of float values"));
return NULL;
}
Carrier->doc->ActPage->XGuides += ValueToPoint(guide);
}
return Py_None;
}