Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
cmdgetprop.cpp File Reference
#include "cmdgetprop.h"
#include "cmdutil.h"
#include "scribuscore.h"

Go to the source code of this file.

Functions

PyObject * scribus_getfillcolor (PyObject *, PyObject *args)
 Returns fill color of the object.
PyObject * scribus_getfilltrans (PyObject *, PyObject *args)
 Returns fill transparency of the object.
PyObject * scribus_getfillblend (PyObject *, PyObject *args)
 Returns fill blendmode of the object.
PyObject * scribus_getlinecolor (PyObject *, PyObject *args)
 Returns color of the line.
PyObject * scribus_getlinetrans (PyObject *, PyObject *args)
 Returns line transparency of the object.
PyObject * scribus_getlineblend (PyObject *, PyObject *args)
 Returns line blendmode of the object.
PyObject * scribus_getlinewidth (PyObject *, PyObject *args)
 Returns width of the line.
PyObject * scribus_getlineshade (PyObject *, PyObject *args)
 Returns shading of the line.
PyObject * scribus_getlinejoin (PyObject *, PyObject *args)
 Returns join type of the line.
PyObject * scribus_getlineend (PyObject *, PyObject *args)
 Returns cap type of the line.
PyObject * scribus_getlinestyle (PyObject *, PyObject *args)
 Returns style type of the line.
PyObject * scribus_getfillshade (PyObject *, PyObject *args)
 Returns fill shade of the object.
PyObject * scribus_getcornerrad (PyObject *, PyObject *args)
 Returns corner radius of the object.
PyObject * scribus_getimgscale (PyObject *, PyObject *args)
 Returns image scale of the object.
PyObject * scribus_getimgname (PyObject *, PyObject *args)
 Returns image name of the object.
PyObject * scribus_getposi (PyObject *, PyObject *args)
 Returns position of the object.
PyObject * scribus_getsize (PyObject *, PyObject *args)
 Returns size of the object.
PyObject * scribus_getrotation (PyObject *, PyObject *args)
 Returns rotation of the object.
PyObject * scribus_getallobj (PyObject *, PyObject *args)
 Returns a list with all objects in page.
void cmdgetpropdocwarnings ()
 HACK: this removes "warning: 'blah' defined but not used" compiler warnings with header files structure untouched (docstrings are kept near declarations) PV.

Function Documentation

HACK: this removes "warning: 'blah' defined but not used" compiler warnings with header files structure untouched (docstrings are kept near declarations) PV.

Definition at line 294 of file cmdgetprop.cpp.

{
    QStringList s;
    s << scribus_getfillcolor__doc__ <<scribus_getfilltrans__doc__ << scribus_getfillblend__doc__ << scribus_getlinecolor__doc__ << scribus_getlinetrans__doc__ << scribus_getlineblend__doc__ << scribus_getlinewidth__doc__ << scribus_getlineshade__doc__ <<scribus_getlinejoin__doc__ <<scribus_getlineend__doc__ <<scribus_getlinestyle__doc__ <<scribus_getfillshade__doc__ <<scribus_getcornerrad__doc__ <<scribus_getimgscale__doc__ <<scribus_getimgname__doc__ <<scribus_getposi__doc__ <<scribus_getsize__doc__ <<scribus_getrotation__doc__ <<  scribus_getallobj__doc__;
}
PyObject* scribus_getallobj ( PyObject *  ,
PyObject *  args 
)

Returns a list with all objects in page.

Definition at line 239 of file cmdgetprop.cpp.

{
       PyObject *l;
       int typ = -1;
       uint counter = 0;
       uint counter2 = 0;
       uint pageNr = ScCore->primaryMainWindow()->doc->currentPageNumber();
       if (!PyArg_ParseTuple(args, "|i", &typ))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       // have doc already
       if (typ != -1)
       {
              for (uint lam2 = 0; lam2 < ScCore->primaryMainWindow()->doc->Items->count(); ++lam2)
              {
                     if ((ScCore->primaryMainWindow()->doc->Items->at(lam2)->itemType() == typ) && (pageNr == static_cast<uint>(ScCore->primaryMainWindow()->doc->Items->at(lam2)->OwnPage)))
                            counter++;
              }
       }
       else
       {
              for (uint lam2 = 0; lam2 < ScCore->primaryMainWindow()->doc->Items->count(); ++lam2)
              {
                     if (pageNr == static_cast<uint>(ScCore->primaryMainWindow()->doc->Items->at(lam2)->OwnPage))
                            counter++;
              }
       }

       l = PyList_New(counter);
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Items->count(); ++lam)
       {
              if  (pageNr == static_cast<uint>(ScCore->primaryMainWindow()->doc->Items->at(lam)->OwnPage))
              {
                     if (typ != -1)
                     {
                            if (ScCore->primaryMainWindow()->doc->Items->at(lam)->itemType() == typ)
                            {
                                   PyList_SetItem(l, counter2, PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().utf8()));
                                   counter2++;
                            }
                     }
                     else
                     {
                            PyList_SetItem(l, counter2, PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().utf8()));
                            counter2++;
                     }
              }
       }
       return l;
}

Here is the call graph for this function:

PyObject* scribus_getcornerrad ( PyObject *  ,
PyObject *  args 
)

Returns corner radius of the object.

Definition at line 170 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->cornerRadius())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getfillblend ( PyObject *  ,
PyObject *  args 
)

Returns fill blendmode of the object.

Definition at line 33 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->fillBlendmode())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getfillcolor ( PyObject *  ,
PyObject *  args 
)

Returns fill color of the object.

Definition at line 11 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyString_FromString(i->fillColor().utf8()) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getfillshade ( PyObject *  ,
PyObject *  args 
)

Returns fill shade of the object.

Definition at line 159 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->fillShade())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getfilltrans ( PyObject *  ,
PyObject *  args 
)

Returns fill transparency of the object.

Definition at line 22 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyFloat_FromDouble(static_cast<double>(1.0 - i->fillTransparency())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getimgname ( PyObject *  ,
PyObject *  args 
)

Returns image name of the object.

Definition at line 192 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyString_FromString(i->Pfile.utf8()) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getimgscale ( PyObject *  ,
PyObject *  args 
)

Returns image scale of the object.

Definition at line 181 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? Py_BuildValue("(ff)", i->imageXScale(), i->imageYScale()) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlineblend ( PyObject *  ,
PyObject *  args 
)

Returns line blendmode of the object.

Definition at line 80 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->lineBlendmode())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlinecolor ( PyObject *  ,
PyObject *  args 
)

Returns color of the line.

Definition at line 44 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       PageItem *it;
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       it = GetUniqueItem(QString::fromUtf8(Name));
       if (it == NULL)
              return NULL;
       if ((it->HasSel) && ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)))
       {
              for (int b = 0; b < it->itemText.length(); ++b)
              {
                     if (it->itemText.selected(b))
                            return PyString_FromString(it->itemText.charStyle(b).fillColor().utf8());
              }
       }
       else
              return PyString_FromString(it->lineColor().utf8());
       PyErr_SetString(NotFoundError, QObject::tr("Color not found - python error", "python error"));
       return NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlineend ( PyObject *  ,
PyObject *  args 
)

Returns cap type of the line.

Definition at line 137 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineEnd)) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlinejoin ( PyObject *  ,
PyObject *  args 
)

Returns join type of the line.

Definition at line 126 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineJoin)) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlineshade ( PyObject *  ,
PyObject *  args 
)

Returns shading of the line.

Definition at line 102 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       PageItem *it;
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       it = GetUniqueItem(QString::fromUtf8(Name));
       if (it == NULL)
              return NULL;
       if ((it->HasSel) && ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)))
       {
              for (int b = 0; b < it->itemText.length(); ++b)
              {
                     if (it->itemText.selected(b))
                            return PyInt_FromLong(static_cast<long>(it->itemText.charStyle(b).fillShade()));
              }
       }
       else
              return PyInt_FromLong(static_cast<long>(it->lineShade()));
       return PyInt_FromLong(0L);
}

Here is the call graph for this function:

PyObject* scribus_getlinestyle ( PyObject *  ,
PyObject *  args 
)

Returns style type of the line.

Definition at line 148 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyInt_FromLong(static_cast<long>(i->PLineArt)) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlinetrans ( PyObject *  ,
PyObject *  args 
)

Returns line transparency of the object.

Definition at line 69 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyFloat_FromDouble(static_cast<double>(1.0 - i->lineTransparency())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getlinewidth ( PyObject *  ,
PyObject *  args 
)

Returns width of the line.

Definition at line 91 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->lineWidth())) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getposi ( PyObject *  ,
PyObject *  args 
)

Returns position of the object.

Definition at line 203 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       if (!i)
              return NULL;
       return Py_BuildValue("(ff)", docUnitXToPageX(i->xPos()),
                                                         docUnitYToPageY(i->yPos()));
}

Here is the call graph for this function:

PyObject* scribus_getrotation ( PyObject *  ,
PyObject *  args 
)

Returns rotation of the object.

Definition at line 228 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return i != NULL ? PyFloat_FromDouble(static_cast<double>(i->rotation() * -1)) : NULL;
}

Here is the call graph for this function:

PyObject* scribus_getsize ( PyObject *  ,
PyObject *  args 
)

Returns size of the object.

Definition at line 217 of file cmdgetprop.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       return (i != NULL) ? Py_BuildValue("(ff)", PointToValue(i->width()), PointToValue(i->height())) : NULL;
}

Here is the call graph for this function: