Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
cmdpage.h File Reference
#include "cmdvar.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 PyDoc_STRVAR (scribus_newpage__doc__, QT_TR_NOOP("newPage(where [,\"masterpage\"])\n\ \n\ Creates a new page. If \"where\" is -1 the new Page is appended to the\n\ document, otherwise the new page is inserted before \"where\". Page numbers are\n\ counted from 1 upwards, no matter what the displayed first page number of your\n\ document is. The optional parameter \"masterpage\" specifies the name of the\n\ master page for the new page.\n\ \n\ May raise IndexError if the page number is out of range\n\ "))
 Page related Commands.
PyObject * scribus_newpage (PyObject *, PyObject *args)
 new page
 PyDoc_STRVAR (scribus_actualpage__doc__, QT_TR_NOOP("currentPage() -> integer\n\ \n\ Returns the number of the current working page. Page numbers are counted from 1\n\ upwards, no matter what the displayed first page number of your document is.\n\ "))
 docstring
PyObject * scribus_actualpage (PyObject *)
 get actual page
 PyDoc_STRVAR (scribus_redraw__doc__, QT_TR_NOOP("redrawAll()\n\ \n\ Redraws all pages.\n\ "))
 docstring
PyObject * scribus_redraw (PyObject *)
 redraw all
 PyDoc_STRVAR (scribus_pageposition__doc__, QT_TR_NOOP("getPageType() -> integer\n\ \n\ Returns the type of the Page, 0 means left Page, 1 is a middle Page and 2 is a right Page\n\ "))
 docstring
PyObject * scribus_pageposition (PyObject *, PyObject *args)
 Go to page.
 PyDoc_STRVAR (scribus_savepageeps__doc__, QT_TR_NOOP("savePageAsEPS(\"name\")\n\ \n\ Saves the current page as an EPS to the file \"name\".\n\ \n\ May raise ScribusError if the save failed.\n\ "))
 docstring
PyObject * scribus_savepageeps (PyObject *, PyObject *args)
 Export page as EPS file.
 PyDoc_STRVAR (scribus_deletepage__doc__, QT_TR_NOOP("deletePage(nr)\n\ \n\ Deletes the given page. Does nothing if the document contains only one page.\n\ Page numbers are counted from 1 upwards, no matter what the displayed first\n\ page number is.\n\ \n\ May raise IndexError if the page number is out of range\n\ "))
 docstring
PyObject * scribus_deletepage (PyObject *, PyObject *args)
 Delete page.
 PyDoc_STRVAR (scribus_gotopage__doc__, QT_TR_NOOP("gotoPage(nr)\n\ \n\ Moves to the page \"nr\" (that is, makes the current page \"nr\"). Note that\n\ gotoPage doesn't (curently) change the page the user's view is displaying, it\n\ just sets the page that script commands will operates on.\n\ \n\ May raise IndexError if the page number is out of range.\n\ "))
 docstring
PyObject * scribus_gotopage (PyObject *, PyObject *args)
 Go to page.
 PyDoc_STRVAR (scribus_pagecount__doc__, QT_TR_NOOP("pageCount() -> integer\n\ \n\ Returns the number of pages in the document.\n\ "))
 docstring
PyObject * scribus_pagecount (PyObject *)
 Go to page.
 PyDoc_STRVAR (scribus_getHguides__doc__, QT_TR_NOOP("getHGuides() -> list\n\ \n\ Returns a list containing positions of the horizontal guides. Values are in the\n\ document's current units - see UNIT_<type> constants.\n\ "))
 docstring
PyObject * scribus_getHguides (PyObject *)
 get H guides
 PyDoc_STRVAR (scribus_setHguides__doc__, QT_TR_NOOP("setHGuides(list)\n\ \n\ Sets horizontal guides. Input parameter must be a list of guide positions\n\ measured in the current document units - see UNIT_<type> constants.\n\ \n\ Example: setHGuides(getHGuides() + [200.0, 210.0] # add new guides without any lost\n\ setHGuides([90,250]) # replace current guides entirely\n\ "))
 docstring
PyObject * scribus_setHguides (PyObject *, PyObject *args)
 set H guides
 PyDoc_STRVAR (scribus_getVguides__doc__, QT_TR_NOOP("getVGuides()\n\ \n\ See getHGuides.\n\ "))
 docstring
PyObject * scribus_getVguides (PyObject *)
 get V guides
 PyDoc_STRVAR (scribus_setVguides__doc__, QT_TR_NOOP("setVGuides()\n\ \n\ See setHGuides.\n\ "))
 docstring
PyObject * scribus_setVguides (PyObject *, PyObject *args)
 set V guides
 PyDoc_STRVAR (scribus_pagedimension__doc__, QT_TR_NOOP("getPageSize() -> tuple\n\ \n\ Returns a tuple with page dimensions measured in the document's current units.\n\ See UNIT_<type> constants and getPageMargins()\n\ "))
 docstring
PyObject * scribus_pagedimension (PyObject *)
 returns a tuple with page domensions in used system e.g.
 PyDoc_STRVAR (scribus_getpageitems__doc__, QT_TR_NOOP("getPageItems() -> list\n\ \n\ Returns a list of tuples with items on the current page. The tuple is:\n\ (name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]\n\ means that object named 'Text1' is a text frame (type 4) and is the first at\n\ the page...\n\ "))
 docstring
PyObject * scribus_getpageitems (PyObject *)
 returns a list of tuples with items on the actual page TODO: solve utf/iso chars in object names (Petr Vanek 03/02/2004)
 PyDoc_STRVAR (scribus_getpagemargins__doc__, QT_TR_NOOP("getPageMargins()\n\ \n\ Returns the page margins as a (top, left, right, bottom) tuple in the current\n\ units. See UNIT_<type> constants and getPageSize().\n\ "))
 docstring
PyObject * scribus_getpagemargins (PyObject *)
 returns a tuple with page margins Craig Ringer, Petr Vanek 09/25/2004

Function Documentation

PyDoc_STRVAR ( scribus_newpage__doc__  ,
QT_TR_NOOP("newPage(where [,\"masterpage\"])\n\\n\Creates a new page. If \"where\" is -1 the new Page is appended to the\n\document, otherwise the new page is inserted before \"where\". Page numbers are\n\counted from 1 upwards, no matter what the displayed first page number of your\n\document is. The optional parameter \"masterpage\" specifies the name of the\n\master page for the new page.\n\\n\May raise IndexError if the page number is out of range\n\")   
)

Page related Commands.

docstring

PyDoc_STRVAR ( scribus_actualpage__doc__  ,
QT_TR_NOOP("currentPage() -> integer\n\\n\Returns the number of the current working page. Page numbers are counted from 1\n\upwards, no matter what the displayed first page number of your document is.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_redraw__doc__  ,
QT_TR_NOOP("redrawAll()\n\\n\Redraws all pages.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_pageposition__doc__  ,
QT_TR_NOOP("getPageType() -> integer\n\\n\Returns the type of the Page, 0 means left Page, 1 is a middle Page and 2 is a right Page\n\")   
)

docstring

PyDoc_STRVAR ( scribus_savepageeps__doc__  ,
QT_TR_NOOP("savePageAsEPS(\"name\")\n\\n\Saves the current page as an EPS to the file \"name\".\n\\n\May raise ScribusError if the save failed.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_deletepage__doc__  ,
QT_TR_NOOP("deletePage(nr)\n\\n\Deletes the given page. Does nothing if the document contains only one page.\n\Page numbers are counted from 1 upwards, no matter what the displayed first\n\page number is.\n\\n\May raise IndexError if the page number is out of range\n\")   
)

docstring

PyDoc_STRVAR ( scribus_gotopage__doc__  ,
QT_TR_NOOP("gotoPage(nr)\n\\n\Moves to the page \"nr\" (that is, makes the current page \"nr\"). Note that\n\gotoPage doesn't (curently) change the page the user's view is displaying, it\n\just sets the page that script commands will operates on.\n\\n\May raise IndexError if the page number is out of range.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_pagecount__doc__  ,
QT_TR_NOOP("pageCount() -> integer\n\\n\Returns the number of pages in the document.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_getHguides__doc__  ,
QT_TR_NOOP("getHGuides() -> list\n\\n\Returns a list containing positions of the horizontal guides. Values are in the\n\document's current units - see UNIT_<type> constants.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_setHguides__doc__  )

docstring

PyDoc_STRVAR ( scribus_getVguides__doc__  ,
QT_TR_NOOP("getVGuides()\n\\n\See getHGuides.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_setVguides__doc__  ,
QT_TR_NOOP("setVGuides()\n\\n\See setHGuides.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_pagedimension__doc__  ,
QT_TR_NOOP("getPageSize() -> tuple\n\\n\Returns a tuple with page dimensions measured in the document's current units.\n\See UNIT_<type> constants and getPageMargins()\n\")   
)

docstring

PyDoc_STRVAR ( scribus_getpageitems__doc__  ,
QT_TR_NOOP("getPageItems() -> list\n\\n\Returns a list of tuples with items on the current page. The tuple is:\n\(name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)]\n\means that object named 'Text1' is a text frame (type 4) and is the first at\n\the page...\n\")   
)

docstring

PyDoc_STRVAR ( scribus_getpagemargins__doc__  ,
QT_TR_NOOP("getPageMargins()\n\\n\Returns the page margins as a (top, left, right, bottom) tuple in the current\n\units. See UNIT_<type> constants and getPageSize().\n\")   
)

docstring

PyObject* scribus_actualpage ( PyObject *  )

get actual page

Definition at line 14 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->currentPageNumber() + 1));
}

Here is the call graph for this function:

PyObject* scribus_deletepage ( PyObject *  ,
PyObject *  args 
)

Delete page.

Definition at line 65 of file cmdpage.cpp.

{
       int e;
       if (!PyArg_ParseTuple(args, "i", &e))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       e--;
       if ((e < 0) || (e > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count())-1))
       {
              PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
              return NULL;
       }
       ScCore->primaryMainWindow()->DeletePage2(e);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_getHguides ( PyObject *  )

get H guides

Definition at line 206 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       Guides g = ScCore->primaryMainWindow()->doc->currentPage()->guides.horizontals(GuideManagerCore::Standard);
       int n = g.count();//ScCore->primaryMainWindow()->doc->currentPage->YGuides.count();
       if (n == 0)
              return Py_BuildValue((char*)"[]");
       int i;
       double tmp;
       PyObject *l, *guide;
       l = PyList_New(0);
       for (i=0; i<n; i++)
       {
              tmp = g[i];
              guide = Py_BuildValue("d", PointToValue(tmp));
              PyList_Append(l, guide);
       }
       return l;
}

Here is the call graph for this function:

PyObject* scribus_getpageitems ( PyObject *  )

returns a list of tuples with items on the actual page TODO: solve utf/iso chars in object names (Petr Vanek 03/02/2004)

Definition at line 174 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       if (ScCore->primaryMainWindow()->doc->Items->count() == 0)
              return Py_BuildValue((char*)"[]");
       uint counter = 0;
       int pageNr = ScCore->primaryMainWindow()->doc->currentPageNumber();
       for (uint lam2 = 0; lam2 < ScCore->primaryMainWindow()->doc->Items->count(); ++lam2)
       {
              if (pageNr == ScCore->primaryMainWindow()->doc->Items->at(lam2)->OwnPage)
                     counter++;
       }
       PyObject *l = PyList_New(counter);
       PyObject *row;
       counter = 0;
       for (uint i = 0; i<ScCore->primaryMainWindow()->doc->Items->count(); ++i)
       {
              if (pageNr == ScCore->primaryMainWindow()->doc->Items->at(i)->OwnPage)
              {
                     row = Py_BuildValue((char*)"(sii)",
                                         ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().ascii(),
                                         ScCore->primaryMainWindow()->doc->Items->at(i)->itemType(),
                                         ScCore->primaryMainWindow()->doc->Items->at(i)->ItemNr
                                        );
                     PyList_SetItem(l, counter, row);
                     counter++;
              }
       } // for
       return l;
}

Here is the call graph for this function:

PyObject* scribus_getpagemargins ( PyObject *  )

returns a tuple with page margins Craig Ringer, Petr Vanek 09/25/2004

Definition at line 308 of file cmdpage.cpp.

{
       PyObject *margins = NULL;
       if(!checkHaveDocument())
              return NULL;
       margins = Py_BuildValue("ffff", PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Top),
                                                               PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Left),
                                                               PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Right),
                                                               PointToValue(ScCore->primaryMainWindow()->doc->pageMargins.Bottom));
       return margins;
}

Here is the call graph for this function:

PyObject* scribus_getVguides ( PyObject *  )

get V guides

Definition at line 257 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       Guides g = ScCore->primaryMainWindow()->doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
       int n = g.count();//ScCore->primaryMainWindow()->doc->currentPage->XGuides.count();
       if (n == 0)
              return Py_BuildValue((char*)"[]");
       int i;
       double tmp;
       PyObject *l, *guide;
       l = PyList_New(0);
       for (i=0; i<n; i++)
       {
              tmp = g[i];
              guide = Py_BuildValue("d", PointToValue(tmp));
              PyList_Append(l, guide);
       }
       return l;
}

Here is the call graph for this function:

PyObject* scribus_gotopage ( PyObject *  ,
PyObject *  args 
)

Go to page.

Definition at line 84 of file cmdpage.cpp.

{
       int e;
       if (!PyArg_ParseTuple(args, "i", &e))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       e--;
       if ((e < 0) || (e > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count())-1))
       {
              PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
              return NULL;
       }
       ScCore->primaryMainWindow()->view->GotoPage(e);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_newpage ( PyObject *  ,
PyObject *  args 
)

new page

Definition at line 103 of file cmdpage.cpp.

{
       int e;
       char *name = const_cast<char*>("");
       QString qName(CommonStrings::trMasterPageNormal);
       if (!PyArg_ParseTuple(args, "i|es", &e, "utf-8", &name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;

       int loc = (e > -1) ? e : ScCore->primaryMainWindow()->doc->Pages->count();
       if (ScCore->primaryMainWindow()->doc->pageSets[ScCore->primaryMainWindow()->doc->currentPageLayout].Columns != 1)
       {
              switch (ScCore->primaryMainWindow()->doc->locationOfPage(loc))
              {
                     case LeftPage:
                            qName = CommonStrings::trMasterPageNormalLeft;
                            break;
                     case RightPage:
                            qName = CommonStrings::trMasterPageNormalRight;
                            break;
                     case MiddlePage:
                            qName = CommonStrings::trMasterPageNormalMiddle;
                            break;
              }
       }
       if (QString(name).length() != 0)
              qName = QString::fromUtf8(name);

       if (!ScCore->primaryMainWindow()->doc->MasterNames.contains(qName))
       {
              PyErr_SetString(PyExc_IndexError, QObject::tr("Given master page name does not match any existing.","python error"));
              return NULL;
       }
       if (e < 0)
              ScCore->primaryMainWindow()->slotNewPageP(loc, qName);
       else
       {
              e--;
              if ((e < 0) || (e > static_cast<int>(loc - 1)))
              {
                     PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
                     return NULL;
              }
              ScCore->primaryMainWindow()->slotNewPageP(e, qName);
       }
//     Py_INCREF(Py_None);
 //    return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_pagecount ( PyObject *  )

Go to page.

Definition at line 154 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->Pages->count()));
}

Here is the call graph for this function:

PyObject* scribus_pagedimension ( PyObject *  )

returns a tuple with page domensions in used system e.g.

when is the doc in picas returns picas ;) (Petr Vanek 02/17/04)

Definition at line 161 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       PyObject *t;
       t = Py_BuildValue(
                     "(dd)",
                     PointToValue(ScCore->primaryMainWindow()->doc->pageWidth), // it's just view scale... * ScCore->primaryMainWindow()->doc->Scale),
                     PointToValue(ScCore->primaryMainWindow()->doc->pageHeight)  // * ScCore->primaryMainWindow()->doc->Scale)
              );
       return t;
}

Here is the call graph for this function:

PyObject* scribus_pageposition ( PyObject *  ,
PyObject *  args 
)

Go to page.

Definition at line 31 of file cmdpage.cpp.

{
       int e;
       if (!PyArg_ParseTuple(args, "i", &e))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       e--;
       if ((e < 0) || (e > static_cast<int>(ScCore->primaryMainWindow()->doc->Pages->count())-1))
       {
              PyErr_SetString(PyExc_IndexError, QObject::tr("Page number out of range.","python error"));
              return NULL;
       }
       return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->locationOfPage(e)));
}

Here is the call graph for this function:

PyObject* scribus_redraw ( PyObject *  )

redraw all

Definition at line 21 of file cmdpage.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->view->DrawNew();
 //    Py_INCREF(Py_None);
 //    return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_savepageeps ( PyObject *  ,
PyObject *  args 
)

Export page as EPS file.

Definition at line 47 of file cmdpage.cpp.

{
       char *Name;
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       bool ret = ScCore->primaryMainWindow()->DoSaveAsEps(QString::fromUtf8(Name));
       if (!ret)
       {
              PyErr_SetString(ScribusException, QObject::tr("Failed to save EPS.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_True); // return True not None for backward compat
//     return Py_True;
       Py_RETURN_TRUE;
}

Here is the call graph for this function:

PyObject* scribus_setHguides ( PyObject *  ,
PyObject *  args 
)

set H guides

Definition at line 227 of file cmdpage.cpp.

{
       PyObject *l;
       if (!PyArg_ParseTuple(args, "O", &l))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (!PyList_Check(l))
       {
              PyErr_SetString(PyExc_TypeError, QObject::tr("argument is not list: must be list of float values.","python error"));
              return NULL;
       }
       int i, n;
       n = PyList_Size(l);
       double guide;
       ScCore->primaryMainWindow()->doc->currentPage()->guides.clearHorizontals(GuideManagerCore::Standard);
       for (i=0; i<n; i++)
       {
              if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
              {
                     PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains non-numeric values: must be list of float values.","python error"));
                     return NULL;
              }
              ScCore->primaryMainWindow()->doc->currentPage()->guides.addHorizontal(ValueToPoint(guide), GuideManagerCore::Standard);
       }
       Py_INCREF(Py_None);
       return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_setVguides ( PyObject *  ,
PyObject *  args 
)

set V guides

Definition at line 278 of file cmdpage.cpp.

{
       PyObject *l;
       if (!PyArg_ParseTuple(args, "O", &l))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (!PyList_Check(l))
       {
              PyErr_SetString(PyExc_TypeError, QObject::tr("argument is not list: must be list of float values.","python error"));
              return NULL;
       }
       int i, n;
       n = PyList_Size(l);
       double guide;
       ScCore->primaryMainWindow()->doc->currentPage()->guides.clearVerticals(GuideManagerCore::Standard);
       for (i=0; i<n; i++)
       {
              if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
              {
                     PyErr_SetString(PyExc_TypeError, QObject::tr("argument contains no-numeric values: must be list of float values.","python error"));
                     return NULL;
              }
              ScCore->primaryMainWindow()->doc->currentPage()->guides.addVertical(ValueToPoint(guide), GuideManagerCore::Standard);
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function: