Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 1387 → Rev 1384

/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
872,7 → 872,6
// duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"},
{const_cast<char*>("setRedraw"), scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)},
// missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."},
{const_cast<char*>("setScaleImageToFrame"), (PyCFunction)scribus_setscaleimagetoframe, METH_KEYWORDS, tr(scribus_setscaleimagetoframe__doc__)},
{const_cast<char*>("setStyle"), scribus_setstyle, METH_VARARGS, tr(scribus_setstyle__doc__)},
{const_cast<char*>("setTextAlignment"), scribus_setalign, METH_VARARGS, tr(scribus_setalign__doc__)},
{const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)},
/trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
301,36 → 301,3
return PyBool_FromLong(1);
return PyBool_FromLong(0);
}
 
PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kw)
{
char *name = const_cast<char*>("");
long int scaleToFrame = 0;
long int proportional = 1;
char* kwargs[] = {"scaletoframe", "proportional", "name", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kw, "i|ies", kwargs, &scaleToFrame, &proportional, "utf-8", &name))
return NULL;
if(!checkHaveDocument())
return NULL;
PageItem *item = GetUniqueItem(QString::fromUtf8(name));
if (item == NULL)
return NULL;
if (item->PType != FRAME_IMAGE)
{
PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error"));
return NULL;
}
// Set the item to scale if appropriate. ScaleType 1 is free
// scale, 0 is scale to frame.
item->ScaleType = scaleToFrame == 0;
// Now, if the user has chosen to set the proportional mode,
// set it. 1 is proportional, 0 is free aspect.
if (proportional != -1)
item->AspectRatio = proportional > 0;
// Force the braindead app to notice the changes
item->OwnPage->AdjustPictScale(item);
item->OwnPage->AdjustPreview(item, false);
item->OwnPage->RefreshItem(item);
Py_INCREF(Py_None);
return Py_None;
}
/trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.h
182,15 → 182,4
/*! Status of locking 2004/7/10 pv.*/
PyObject *scribus_islocked(PyObject */*self*/, PyObject* args);
 
PyDoc_STRVAR(scribus_setscaleimagetoframe__doc__,
QT_TR_NOOP("setScaleImageToFrame(scaletoframe, proportional=None, name=<selection>)\n\
\n\
Sets the scale to frame on the selected or specified image frame to `scaletoframe'.\n\
If `proportional' is specified, set fixed aspect ratio scaling to `proportional'.\n\
Both `scaletoframe' and `proportional' are boolean.\n\
\n\
May raise WrongFrameTypeError.\n\
"));
PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kwargs);
 
#endif