~ubuntu-branches/debian/sid/scribus/sid

« back to all changes in this revision

Viewing changes to scribus/plugins/scriptplugin/cmdmisc.cpp

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
//Added by qt3to4:
13
13
#include <QList>
14
14
 
 
15
#include "prefsmanager.h"
15
16
#include "scribuscore.h"
 
17
#include "scribusdoc.h"
 
18
#include "selection.h"
16
19
#include "fonts/scfontmetrics.h"
17
 
#include "prefsmanager.h"
18
20
 
19
21
PyObject *scribus_setredraw(PyObject* /* self */, PyObject* args)
20
22
{
202
204
                PyErr_SetString(PyExc_ValueError, QObject::tr("Cannot have an empty layer name.","python error").toLocal8Bit().constData());
203
205
                return NULL;
204
206
        }
205
 
        PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
206
 
        if (i == NULL)
 
207
        PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 
208
        if (item == NULL)
207
209
                return NULL;
208
 
        ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
209
 
        bool found = false;
210
 
        for (int lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
211
 
        {
212
 
                ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
213
 
                for (int lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
214
 
                        if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Layer))
215
 
                        {
216
 
                                i->LayerNr = static_cast<int>(lam);
217
 
                                found = true;
218
 
                                break;
219
 
                        }
220
 
        }
221
 
        if (!found)
 
210
        ScribusDoc* currentDoc   = ScCore->primaryMainWindow()->doc;
 
211
        ScribusView* currentView = ScCore->primaryMainWindow()->view;
 
212
        const ScLayer *scLayer = currentDoc->Layers.layerByName( QString::fromUtf8(Layer) );
 
213
        if (!scLayer)
222
214
        {
223
215
                PyErr_SetString(ScribusException, QString("Layer not found").toLocal8Bit().constData());
224
216
                return NULL;
225
217
        }
 
218
        // If no name have been specified in args, process whole selection
 
219
        currentView->SelectItemNr(item->ItemNr);
 
220
        if ((Name == EMPTY_STRING) || (item->isGroupControl) || (item->Groups.count() > 0))
 
221
        {
 
222
                for (int i = 0; i < currentDoc->m_Selection->count(); ++i)
 
223
                {
 
224
                        item = currentDoc->m_Selection->itemAt(i);
 
225
                        item->LayerNr = scLayer->LNr;
 
226
                }
 
227
        }
 
228
        else
 
229
        {
 
230
                item->LayerNr = scLayer->LNr;
 
231
        }
226
232
 
227
233
//      Py_INCREF(Py_None);
228
234
//      return Py_None;