Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
cmdmisc.cpp File Reference
#include "cmdmisc.h"
#include "cmdutil.h"
#include "qbuffer.h"
#include "qpixmap.h"
#include "scribuscore.h"
#include "fonts/scfontmetrics.h"
#include "prefsmanager.h"

Go to the source code of this file.

Functions

PyObject * scribus_setredraw (PyObject *, PyObject *args)
 Enable/disable page redrawing.
PyObject * scribus_fontnames (PyObject *)
 simple list of font names.
PyObject * scribus_xfontnames (PyObject *)
 return a list of the tuples with Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file
PyObject * scribus_renderfont (PyObject *, PyObject *args, PyObject *kw)
 Font example to image.
PyObject * scribus_getlayers (PyObject *)
 List of the layers.
PyObject * scribus_setactlayer (PyObject *, PyObject *args)
 Move into layer.
PyObject * scribus_getactlayer (PyObject *)
 Get layer name.
PyObject * scribus_senttolayer (PyObject *, PyObject *args)
 Move object from one layer to other one.
PyObject * scribus_layervisible (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_layerprint (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_layerlock (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_layeroutline (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_layerflow (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_layerblend (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_layertrans (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_glayervisib (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_glayerprint (PyObject *, PyObject *args)
 Set layer printable.
PyObject * scribus_glayerlock (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_glayeroutline (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_glayerflow (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_glayerblend (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_glayertrans (PyObject *, PyObject *args)
 Set layer visible.
PyObject * scribus_removelayer (PyObject *, PyObject *args)
 Remove layer.
PyObject * scribus_createlayer (PyObject *, PyObject *args)
 New layer.
PyObject * scribus_getlanguage (PyObject *)
 Language of the GUI.
void cmdmiscdocwarnings ()
 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 761 of file cmdmisc.cpp.

{
    QStringList s;
    s << scribus_setredraw__doc__ <<scribus_fontnames__doc__ << scribus_xfontnames__doc__ <<scribus_renderfont__doc__ << scribus_getlayers__doc__ << scribus_setactlayer__doc__ << scribus_getactlayer__doc__ << scribus_senttolayer__doc__ <<scribus_layervisible__doc__ <<scribus_layerprint__doc__ <<scribus_layerlock__doc__ <<scribus_layeroutline__doc__ <<scribus_layerflow__doc__ <<scribus_layerblend__doc__ <<scribus_layertrans__doc__ <<scribus_glayervisib__doc__ <<scribus_glayerprint__doc__ <<scribus_glayerlock__doc__ <<scribus_glayeroutline__doc__ <<scribus_glayerflow__doc__ <<scribus_glayerblend__doc__ <<scribus_glayertrans__doc__ <<scribus_removelayer__doc__ <<scribus_createlayer__doc__ <<scribus_getlanguage__doc__;
}
PyObject* scribus_createlayer ( PyObject *  ,
PyObject *  args 
)

New layer.

Definition at line 734 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot create layer without a name.","python error"));
              return NULL;
       }
       ScCore->primaryMainWindow()->doc->addLayer(QString::fromUtf8(Name), true);
       ScCore->primaryMainWindow()->changeLayer(ScCore->primaryMainWindow()->doc->activeLayer());
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_fontnames ( PyObject *  )

simple list of font names.

Definition at line 30 of file cmdmisc.cpp.

{
       int cc2 = 0;
       SCFontsIterator it2(PrefsManager::instance()->appPrefs.AvailFonts);
       for ( ; it2.hasNext() ; it2.next())
       {
              if (it2.current().usable())
                     cc2++;
       }
       PyObject *l = PyList_New(cc2);
       SCFontsIterator it(PrefsManager::instance()->appPrefs.AvailFonts);
       int cc = 0;
       for ( ; it.hasNext() ; it.next())
       {
              if (it.current().usable())
              {
                     PyList_SetItem(l, cc, PyString_FromString(it.currentKey().utf8()));
                     cc++;
              }
       }
       return l;
}

Here is the call graph for this function:

PyObject* scribus_getactlayer ( PyObject *  )

Get layer name.

Definition at line 182 of file cmdmisc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       return PyString_FromString(ScCore->primaryMainWindow()->doc->activeLayerName().utf8());
}

Here is the call graph for this function:

PyObject* scribus_getlanguage ( PyObject *  )

Language of the GUI.

Definition at line 753 of file cmdmisc.cpp.

{
       return PyString_FromString(ScCore->getGuiLanguage().utf8());
}

Here is the call graph for this function:

PyObject* scribus_getlayers ( PyObject *  )

List of the layers.

Definition at line 146 of file cmdmisc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       PyObject *l;
       l = PyList_New(ScCore->primaryMainWindow()->doc->Layers.count());
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
              PyList_SetItem(l, lam, PyString_FromString(ScCore->primaryMainWindow()->doc->Layers[lam].Name.utf8()));
       return l;
}

Here is the call graph for this function:

PyObject* scribus_glayerblend ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 615 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       int i = 0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = ScCore->primaryMainWindow()->doc->Layers[lam].blendMode;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(i));
}

Here is the call graph for this function:

PyObject* scribus_glayerflow ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 584 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       int i = 0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].flowControl);
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(i));
}

Here is the call graph for this function:

PyObject* scribus_glayerlock ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 522 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       int i = 0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].isEditable);
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(i));
}

Here is the call graph for this function:

PyObject* scribus_glayeroutline ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 553 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       int i = 0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].outlineMode);
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(i));
}

Here is the call graph for this function:

PyObject* scribus_glayerprint ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 491 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       int i = 0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].isPrintable);
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(i));
}

Here is the call graph for this function:

PyObject* scribus_glayertrans ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 646 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       double i = 1.0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = ScCore->primaryMainWindow()->doc->Layers[lam].transparency;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyFloat_FromDouble(i);
}

Here is the call graph for this function:

PyObject* scribus_glayervisib ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 460 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       int i = 0;
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); lam++)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     i = static_cast<int>(ScCore->primaryMainWindow()->doc->Layers[lam].isViewable);
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(i));
}

Here is the call graph for this function:

PyObject* scribus_layerblend ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 394 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       int vis = 0;
       if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].blendMode = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_layerflow ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 361 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       int vis = 1;
       if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].flowControl = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_layerlock ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 295 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       int vis = 1;
       if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].isEditable = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_layeroutline ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 328 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       int vis = 1;
       if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].outlineMode = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_layerprint ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 262 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       int vis = 1;
       if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].isPrintable = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_layertrans ( PyObject *  ,
PyObject *  args 
)

Set layer printable.

Definition at line 427 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       double vis = 1.0;
       if (!PyArg_ParseTuple(args, "esd", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].transparency = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_layervisible ( PyObject *  ,
PyObject *  args 
)

Set layer visible.

Definition at line 229 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       int vis = 1;
       if (!PyArg_ParseTuple(args, "esi", "utf-8", &Name, &vis))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QString("Cannot have an empty layer name"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     ScCore->primaryMainWindow()->doc->Layers[lam].isViewable = vis;
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_removelayer ( PyObject *  ,
PyObject *  args 
)

Remove layer.

Definition at line 677 of file cmdmisc.cpp.

{
//FIXME: Use the docs remove layer code
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       if (ScCore->primaryMainWindow()->doc->Layers.count() == 1)
       {
              PyErr_SetString(ScribusException, QObject::tr("Cannot remove the last layer.","python error"));
              return NULL;
       }
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Name))
              {
                     QValueList<Layer>::iterator it2 = ScCore->primaryMainWindow()->doc->Layers.at(lam);
                     int num2 = (*it2).LNr;
                     if (!num2)
                     {
                            // FIXME: WTF DOES THIS DO?
                            Py_INCREF(Py_None);
                            return Py_None;
                     }
                     int num = (*it2).Level;
                     ScCore->primaryMainWindow()->doc->Layers.remove(it2);
                     QValueList<Layer>::iterator it;
                     for (uint l = 0; l < ScCore->primaryMainWindow()->doc->Layers.count(); l++)
                     {
                            it = ScCore->primaryMainWindow()->doc->Layers.at(l);
                            if ((*it).Level > num)
                                   (*it).Level -= 1;
                     }
                     ScCore->primaryMainWindow()->doc->removeLayer(num2);
                     ScCore->primaryMainWindow()->doc->setActiveLayer(0);
                     ScCore->primaryMainWindow()->changeLayer(0);
                     found = true;
                     break;
              }
       }
       if (!found)
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_renderfont ( PyObject *  ,
PyObject *  args,
PyObject *  kw 
)

Font example to image.

Definition at line 77 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       char *FileName = const_cast<char*>("");
       char *Sample = const_cast<char*>("");
       char *format = NULL;
       int Size;
       bool ret = false;
       char *kwargs[] = {const_cast<char*>("fontname"),
                                     const_cast<char*>("filename"),
                                     const_cast<char*>("sample"),
                                     const_cast<char*>("size"),
                                     const_cast<char*>("format"),
                                     NULL};
       if (!PyArg_ParseTupleAndKeywords(args, kw, "esesesi|es", kwargs,
                            "utf-8", &Name, "utf-8", &FileName, "utf-8", &Sample, &Size, "ascii", &format))
              return NULL;
       if (!PrefsManager::instance()->appPrefs.AvailFonts.contains(QString::fromUtf8(Name)))
       {
              PyErr_SetString(NotFoundError, QObject::tr("Font not found.","python error"));
              return NULL;
       }
       QString ts = QString::fromUtf8(Sample);
       if (ts.isEmpty())
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot render an empty sample.","python error"));
              return NULL;
       }
       if (!format)
              // User specified no format, so use the historical default of PPM format.
              format = "PPM";
       QPixmap pm = FontSample(PrefsManager::instance()->appPrefs.AvailFonts[QString::fromUtf8(Name)], Size, ts, Qt::white);
       // If the user specified an empty filename, return the image data as
       // a string. Otherwise, save it to disk.
       if (QString::fromUtf8(FileName).isEmpty())
       {
              QCString buffer_string = "";
              QBuffer buffer(buffer_string);
              buffer.open(IO_WriteOnly);
              bool ret = pm.save(&buffer, format);
              if (!ret)
              {
                     PyErr_SetString(ScribusException, QObject::tr("Unable to save pixmap","scripter error"));
                     return NULL;
              }
              int bufferSize = buffer.size();
              buffer.close();
              // Now make a Python string from the data we generated
              PyObject* stringPython = PyString_FromStringAndSize(buffer_string,bufferSize);
              // Return even if the result is NULL (error) since an exception will have been
              // set in that case.
              return stringPython;
       }
       else
       // Save the pixmap to a file, since the filename is non-empty
       {
              ret = pm.save(QString::fromUtf8(FileName), format);
              if (!ret)
              {
                     PyErr_SetString(PyExc_Exception, QObject::tr("Unable to save pixmap","scripter error"));
                     return NULL;
              }
              // For historical reasons, we need to return true on success.
//            Py_INCREF(Py_True);
//            return Py_True;
              Py_RETURN_TRUE;
       }
}

Here is the call graph for this function:

PyObject* scribus_senttolayer ( PyObject *  ,
PyObject *  args 
)

Move object from one layer to other one.

Definition at line 189 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       char *Layer = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es|es", "utf-8", &Layer, "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Layer == "")
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
       if (i == NULL)
              return NULL;
       ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
       bool found = false;
       for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
       {
              ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
              for (uint lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
                     if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Layer))
                     {
                            i->LayerNr = static_cast<int>(lam);
                            found = true;
                            break;
                     }
       }
       if (!found)
       {
              PyErr_SetString(ScribusException, QString("Layer not found"));
              return NULL;
       }

//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_setactlayer ( PyObject *  ,
PyObject *  args 
)

Move into layer.

Definition at line 157 of file cmdmisc.cpp.

{
       char *Name = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (Name == 0)
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error"));
              return NULL;
       }
       bool found = ScCore->primaryMainWindow()->doc->setActiveLayer(QString::fromUtf8(Name));
       if (found)
              ScCore->primaryMainWindow()->changeLayer(ScCore->primaryMainWindow()->doc->activeLayer());
       else
       {
              PyErr_SetString(NotFoundError, QObject::tr("Layer not found.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_setredraw ( PyObject *  ,
PyObject *  args 
)

Enable/disable page redrawing.

Definition at line 17 of file cmdmisc.cpp.

{
       int e;
       if (!PyArg_ParseTuple(args, "i", &e))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->doc->DoDrawing = static_cast<bool>(e);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_xfontnames ( PyObject *  )

return a list of the tuples with Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file

Definition at line 53 of file cmdmisc.cpp.

{
       PyObject *l = PyList_New(PrefsManager::instance()->appPrefs.AvailFonts.count());
       SCFontsIterator it(PrefsManager::instance()->appPrefs.AvailFonts);
       int cc = 0;
       PyObject *row;
       for ( ; it.hasNext() ; it.next())
       {
              row = Py_BuildValue((char*)"(sssiis)",
                                                 it.currentKey().utf8().data(),
                                                 it.current().family().utf8().data(),
                                                 it.current().psName().utf8().data(),
                                                 it.current().subset(),
                                                 it.current().embedPs(),
                                                 it.current().fontFilePath().utf8().data()
                                          );
              PyList_SetItem(l, cc, row);
              cc++;
       } // for
       return l;
}