Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 212 → Rev 213

/trunk/Scribus/ChangeLogCVS
1,5 → 1,8
Changes since Version 1.1.5
25.02.2004 Included a Patch from Allessandro Rimoldini for the main.cpp file.
27.02.2004 Improved the PrintPreview, it now remembers the last used Settings.
Added some new Commands to the Scripter.
 
25.02.2004 Included a Patch from Alessandro Rimoldini for the main.cpp file.
Included a Patch from Mathy Vanvoorden for the Story Editor.
Fixed bugs with Textframes.
Display of Textframes should look now the same in all Magnifications.
/trunk/Scribus/scribus/util.cpp
31,6 → 31,7
#include <qmessagebox.h>
#include <cstdlib>
#include <cmath>
#include <unistd.h>
#include "md5.h"
#include <setjmp.h>
#include "qprocess.h"
/trunk/Scribus/scribus/scribusdoc.h
438,6 → 438,14
double DGap;
QString DColorSet;
QStringList CustomColorSets;
bool PrPr_Mode;
bool PrPr_AlphaText;
bool PrPr_AlphaGraphics;
bool PrPr_Transparency;
bool PrPr_C;
bool PrPr_M;
bool PrPr_Y;
bool PrPr_K;
};
/**
* the Document Class
/trunk/Scribus/scribus/scribusview.cpp
39,6 → 39,7
extern void Level2Layer(ScribusDoc *doc, struct Layer *ll, int Level);
extern double Cwidth(ScribusDoc *doc, QString name, QString ch, int Siz, QString ch2 = " ");
extern ScribusApp* ScApp;
extern void ReOrderText(ScribusDoc *doc, ScribusView *view);
 
ScribusView::ScribusView(QWidget *parent, ScribusDoc *doc, preV *prefs)
: QScrollView(parent, "s", WRepaintNoErase | WNorthWestGravity)
625,34 → 626,6
return cc;
}
 
void ScribusView::RecalcTextPos()
{
Doc->RePos = true;
QPixmap pgPix(10, 10);
QRect rd = QRect(0,0,9,9);
ScPainter *painter = new ScPainter(&pgPix, pgPix.width(), pgPix.height());
for (uint az=0; az<MasterPages.count(); az++)
{
for (uint azz=0; azz<MasterPages.at(az)->Items.count(); ++azz)
{
PageItem *ite = MasterPages.at(az)->Items.at(azz);
if (ite->PType == 4)
ite->DrawObj(painter, rd);
}
}
for (uint az=0; az<Pages.count(); az++)
{
for (uint azz=0; azz<Pages.at(az)->Items.count(); ++azz)
{
PageItem *ite = Pages.at(az)->Items.at(azz);
if (ite->PType == 4)
ite->DrawObj(painter, rd);
}
}
delete painter;
Doc->RePos = false;
}
 
void ScribusView::RecalcPictures(ProfilesL *Pr, QProgressBar *dia)
{
uint a, i;
919,7 → 892,7
int sepac;
double wideR;
bool multiPath = false;
RecalcTextPos();
ReOrderText(Doc, this);
p->PS_set_Info("Author", Doc->DocAutor);
p->PS_set_Info("Title", Doc->DocTitel);
if (!farb)
/trunk/Scribus/scribus/libabout/about.cpp
54,7 → 54,7
tabLayout1->addWidget( PixmapLabel1 );
BuildID = new QLabel( tab, "BB" );
BuildID->setAlignment(Qt::AlignCenter);
QString bu = tr("%1. %2 %3 ").arg(25).arg("February").arg(2004);
QString bu = tr("%1. %2 %3 ").arg(27).arg("February").arg(2004);
#ifdef HAVE_CMS
bu += "C";
#else
83,12 → 83,12
TextView1 = new QTextView( tab_2, "TextView1" );
TextView1->setText(QString::fromUtf8("<table><tr><td><b>" + tr("Programming:").utf8() + "</b></td><td> </td></tr>" +
"<tr><td>Franz Schmid</td><td>Franz.Schmid@altmuehlnet.de</td></tr>" +
"<tr><td>Paul F. Johnson</td><td>paul@all-the-johnsons.co.uk</td></tr>" +
"<tr><td>Craig Bradney</td><td>cbradney@zip.com.au</td></tr>" +
"<tr><td>Petr Vaněk</td><td>subzero@py.cz</td></tr>" +
"<tr><td> </td><td> </td></tr>" +
"<tr><td><b>" + tr("Contributions from:").utf8() + "</b></td><td></td></tr>" +
"<tr><td>Paul F. Johnson</td><td>paul@all-the-johnsons.co.uk</td></tr>" +
"<tr><td>Craig Bradney</td><td>cbradney@zip.com.au</td></tr>" +
"<tr><td>Alessandro Rimoldi</td><td>http://ideale.ch/contact</td></tr>" +
"<tr><td>Petr Vaněk</td><td>subzero@py.cz</td></tr>" +
"<tr><td>Jean-Jacques Sarton</td><td>jj.sarton@t-online.de</td></tr>" +
"<tr><td>Christian Töpp</td><td>mr-ct@gmx.de</td></tr>" +
"<tr><td>Alastair Robinson</td><td>blackfive@fakenhamweb.co.uk</td></tr>" +
/trunk/Scribus/scribus/scribus.cpp
366,6 → 366,14
PDef.Pname = "";
PDef.Dname = "";
PDef.Command = "";
Prefs.PrPr_Mode = false;
Prefs.PrPr_AlphaText = false;
Prefs.PrPr_AlphaGraphics = false;
Prefs.PrPr_Transparency = false;
Prefs.PrPr_C = true;
Prefs.PrPr_M = true;
Prefs.PrPr_Y = true;
Prefs.PrPr_K = true;
PrinterUsed = false;
resize(610, 600);
QVBox* vb = new QVBox( this );
/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
13,19 → 13,19
int i = GetItem(QString(Name));
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if (it->HasSel)
{
for (uint b = 0; b < it->Ptext.count(); b++)
{
for (uint b = 0; b < it->Ptext.count(); b++)
{
if (it->Ptext.at(b)->cselect)
return PyFloat_FromDouble(static_cast<double>(it->Ptext.at(b)->csize / 10.0));
}
}
}
else
return PyFloat_FromDouble(static_cast<long>(it->ISize / 10.0));
}
}
return PyFloat_FromDouble(0.0);
}
 
39,19 → 39,19
int i = GetItem(QString(Name));
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if (it->HasSel)
{
for (uint b = 0; b < it->Ptext.count(); b++)
{
for (uint b = 0; b < it->Ptext.count(); b++)
{
if (it->Ptext.at(b)->cselect)
return PyString_FromString(it->Ptext.at(b)->cfont);
}
}
}
else
return PyString_FromString(it->IFont);
}
}
return PyString_FromString("");
}
 
64,8 → 64,8
return PyInt_FromLong(0L);
int i = GetItem(QString(Name));
return i != -1 ?
PyInt_FromLong(static_cast<long>(Carrier->doc->ActPage->Items.at(i)->Ptext.count())) :
PyInt_FromLong(0L);
PyInt_FromLong(static_cast<long>(Carrier->doc->ActPage->Items.at(i)->Ptext.count())) :
PyInt_FromLong(0L);
}
 
PyObject *scribus_getcolumns(PyObject *self, PyObject* args)
77,8 → 77,8
return PyInt_FromLong(0L);
int i = GetItem(QString(Name));
return i != -1 ?
PyInt_FromLong(static_cast<long>(Carrier->doc->ActPage->Items.at(i)->Cols)) :
PyInt_FromLong(0L);
PyInt_FromLong(static_cast<long>(Carrier->doc->ActPage->Items.at(i)->Cols)) :
PyInt_FromLong(0L);
}
 
PyObject *scribus_getlinespace(PyObject *self, PyObject* args)
90,8 → 90,8
return PyFloat_FromDouble(0.0);
int i = GetItem(QString(Name));
return i != -1 ?
PyFloat_FromDouble(static_cast<double>(Carrier->doc->ActPage->Items.at(i)->LineSp)) :
PyFloat_FromDouble(0.0);
PyFloat_FromDouble(static_cast<double>(Carrier->doc->ActPage->Items.at(i)->LineSp)) :
PyFloat_FromDouble(0.0);
}
 
PyObject *scribus_getcolumngap(PyObject *self, PyObject* args)
103,8 → 103,8
return PyFloat_FromDouble(0.0);
int i = GetItem(QString(Name));
return i != -1 ?
PyFloat_FromDouble(static_cast<double>(Carrier->doc->ActPage->Items.at(i)->ColGap)) :
PyFloat_FromDouble(0.0);
PyFloat_FromDouble(static_cast<double>(Carrier->doc->ActPage->Items.at(i)->ColGap)) :
PyFloat_FromDouble(0.0);
}
 
PyObject *scribus_getframetext(PyObject *self, PyObject* args)
118,20 → 118,20
QString text = "";
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
for (uint a = 0; a < it->Ptext.count(); a++)
{
if (it->HasSel)
{
if (it->HasSel)
{
if (it->Ptext.at(a)->cselect)
text += it->Ptext.at(a)->ch;
}
}
else
text += it->Ptext.at(a)->ch;
}
}
return PyString_FromString(text);
}
}
else
return PyString_FromString("");
}
148,40 → 148,40
PageItem *it;
PageItem *is;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
while (it->BackBox != 0)
{
{
is = Carrier->doc->ActPage->Items.at(it->BackBox->ItemNr);
it = is;
}
}
for (uint a = 0; a < it->Ptext.count(); a++)
{
if (it->HasSel)
{
if (it->HasSel)
{
if (it->Ptext.at(a)->cselect)
text += it->Ptext.at(a)->ch;
}
}
else
text += it->Ptext.at(a)->ch;
}
}
while (it->NextBox != 0)
{
{
is = Carrier->doc->ActPage->Items.at(it->NextBox->ItemNr);
it = is;
for (uint a = 0; a < it->Ptext.count(); a++)
{
if (it->HasSel)
{
if (it->HasSel)
{
if (it->Ptext.at(a)->cselect)
text += it->Ptext.at(a)->ch;
}
}
else
text += it->Ptext.at(a)->ch;
}
}
}
return PyString_FromString(text);
}
}
else
return PyString_FromString("");
}
200,23 → 200,23
PageItem *it;
QString Daten = QString(Text);
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if (it->NextBox != 0)
{
{
PageItem *nb = it->NextBox;
while (nb != 0)
{
{
nb->Ptext.clear();
nb->CPos = 0;
nb->Dirty = true;
nb = nb->NextBox;
}
}
}
it->Ptext.clear();
it->CPos = 0;
for (uint a = 0; a < Daten.length(); ++a)
{
{
struct Pti *hg = new Pti;
hg->ch = Daten.at(a);
if (hg->ch == QChar(10))
233,7 → 233,7
hg->cextra = 0;
hg->cselect = false;
hg->cstyle = 0;
hg->cab = Carrier->doc->CurrentABStil;
hg->cab = Carrier->doc->CurrentABStil;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
240,8 → 240,8
hg->PtransX = 0;
hg->PtransY = 0;
it->Ptext.append(hg);
}
}
}
return Py_None;
}
 
259,18 → 259,18
PageItem *it;
QString Daten = QString(Text);
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if ((pos < 0) && (pos > static_cast<int>(it->Ptext.count())))
return Py_None;
for (uint a = 0; a < Daten.length(); ++a)
{
{
struct Pti *hg = new Pti;
hg->ch = Daten.at(Daten.length()-1-a);
if (hg->ch == QChar(10))
hg->ch = QChar(13);
if (hg->ch == QChar(9))
hg->ch = " ";
hg->ch = " ";
hg->cfont = it->IFont;
hg->csize = it->ISize;
hg->ccolor = it->TxtFill;
281,7 → 281,7
hg->cextra = 0;
hg->cselect = false;
hg->cstyle = 0;
hg->cab = Carrier->doc->CurrentABStil;
hg->cab = Carrier->doc->CurrentABStil;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
288,11 → 288,11
hg->PtransX = 0;
hg->PtransY = 0;
it->Ptext.insert(pos, hg);
}
}
it->CPos = pos + Daten.length();
it->Dirty = true;
it->paintObj();
}
it->Dirty = true;
it->paintObj();
}
return Py_None;
}
 
309,7 → 309,7
if ((size > 3) || (size < 0))
return Py_None;
if ((i != -1) && (Carrier->doc->ActPage->Items.at(i)->PType == 4))
{
{
int Apm = Carrier->doc->AppMode;
Carrier->doc->ActPage->SelItem.clear();
Carrier->doc->ActPage->SelItem.append(Carrier->doc->ActPage->Items.at(i));
318,7 → 318,7
Carrier->setNewAbStyle(size);
Carrier->doc->AppMode = Apm;
Carrier->doc->ActPage->Deselect();
}
}
return Py_None;
}
 
335,7 → 335,7
if ((size > 512) || (size < 1))
return Py_None;
if ((i != -1) && (Carrier->doc->ActPage->Items.at(i)->PType == 4))
{
{
int Apm = Carrier->doc->AppMode;
Carrier->doc->ActPage->SelItem.clear();
Carrier->doc->ActPage->SelItem.append(Carrier->doc->ActPage->Items.at(i));
344,7 → 344,7
Carrier->doc->ActPage->chFSize(qRound(size * 10.0));
Carrier->doc->AppMode = Apm;
Carrier->doc->ActPage->Deselect();
}
}
return Py_None;
}
 
359,9 → 359,9
return Py_None;
int i = GetItem(QString(Name));
if ((i != -1) && (Carrier->doc->ActPage->Items.at(i)->PType == 4))
{
if (Carrier->Prefs.AvailFonts.find(QString(Font)))
{
if (Carrier->Prefs.AvailFonts.find(QString(Font)))
{
int Apm = Carrier->doc->AppMode;
Carrier->doc->ActPage->SelItem.clear();
Carrier->doc->ActPage->SelItem.append(Carrier->doc->ActPage->Items.at(i));
370,8 → 370,8
Carrier->SetNewFont(QString(Font));
Carrier->doc->AppMode = Apm;
Carrier->doc->ActPage->Deselect();
}
}
}
return Py_None;
}
 
430,9 → 430,9
if (!Carrier->HaveDoc)
return Py_None;
int i = GetItem(QString(Name));
PageItem *it;
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if ((start < 0) || ((start + ende) > static_cast<int>(it->Ptext.count()-1)))
return Py_None;
439,15 → 439,15
for (uint a = 0; a < it->Ptext.count(); ++a)
it->Ptext.at(a)->cselect = false;
if (ende == 0)
{
{
it->HasSel = false;
return Py_None;
}
}
for (int aa = start; aa < (start + ende); ++aa)
it->Ptext.at(aa)->cselect = true;
it->HasSel = true;
return Py_None;
}
}
else
return Py_None;
}
463,16 → 463,16
int i = GetItem(QString(Name));
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if (it->HasSel)
Carrier->DeleteSel(it);
else
{
{
it->Ptext.clear();
it->CPos = 0;
}
}
}
return Py_None;
}
 
486,25 → 486,25
if (!Carrier->HaveDoc)
return Py_None;
int i = GetItem(QString(Name));
PageItem *it;
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if ((it->PType == 4) || (it->PType == 8))
{
for (uint b = 0; b < it->Ptext.count(); b++)
{
for (uint b = 0; b < it->Ptext.count(); b++)
if (it->HasSel)
{
if (it->HasSel)
{
if (it->Ptext.at(b)->cselect)
it->Ptext.at(b)->ccolor = QString(Color);
}
}
else
it->Ptext.at(b)->ccolor = QString(Color);
}
}
it->TxtFill = QString(Color);
}
}
}
return Py_None;
}
 
518,25 → 518,25
if (!Carrier->HaveDoc)
return Py_None;
int i = GetItem(QString(Name));
PageItem *it;
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if ((it->PType == 4) || (it->PType == 8))
{
for (uint b = 0; b < it->Ptext.count(); b++)
{
for (uint b = 0; b < it->Ptext.count(); b++)
if (it->HasSel)
{
if (it->HasSel)
{
if (it->Ptext.at(b)->cselect)
it->Ptext.at(b)->cstroke = QString(Color);
}
}
else
it->Ptext.at(b)->cstroke = QString(Color);
}
}
it->TxtStroke = QString(Color);
}
}
}
return Py_None;
}
 
550,25 → 550,121
if ((!Carrier->HaveDoc) || ((w < 0) || (w > 100)))
return Py_None;
int i = GetItem(QString(Name));
PageItem *it;
PageItem *it;
if (i != -1)
{
{
it = Carrier->doc->ActPage->Items.at(i);
if ((it->PType == 4) || (it->PType == 8))
{
for (uint b = 0; b < it->Ptext.count(); ++b)
{
for (uint b = 0; b < it->Ptext.count(); ++b)
if (it->HasSel)
{
if (it->HasSel)
{
if (it->Ptext.at(b)->cselect)
it->Ptext.at(b)->cshade = w;
}
}
else
it->Ptext.at(b)->cshade = w;
}
}
}
it->ShTxtFill = w;
}
}
return Py_None;
}
 
PyObject *scribus_linktextframes(PyObject *self, PyObject* args)
{
char *name1;
char *name2;
 
if (!PyArg_ParseTuple(args, "ss", &name1, &name2))
return NULL;
 
Py_INCREF(Py_None);
if (!Carrier->HaveDoc)
return Py_None;
 
int id1 = GetItem(QString(name1));
int id2 = GetItem(QString(name2));
 
PageItem *item1 = Carrier->doc->ActPage->Items.at(id1);
PageItem *item2 = Carrier->doc->ActPage->Items.at(id2);
 
/* only empty textframe, only not linked and selfhate :) */
if ((item2->Ptext.count() == 0) && (item2->NextBox == 0)
&& (item2->BackBox == 0) && (item1 != item2))
{
// references to the others boxes
item1->NextBox = item2;
item2->BackBox = item1;
// linked hs to be younger && same page
if ((item2->ItemNr < item1->ItemNr)
&& (item2->OwnPage == item1->OwnPage))
{
 
Carrier->doc->ActPage->Items.insert(item1->ItemNr+1, item2);
item2 = Carrier->doc->ActPage->Items.take(item2->ItemNr);
// redistribute item's numbers
for (uint i = 0; i<Carrier->doc->ActPage->Items.count(); ++i)
{
Carrier->doc->ActPage->Items.at(i)->ItemNr = i;
// handles bookmarks (was SIGNAL(NewBMNr(int, int)))
if (Carrier->doc->ActPage->Items.at(i)->isBookmark)
Carrier->BookPal->BView->ChangeItem(
Carrier->doc->ActPage->Items.at(i)->BMnr,
i);
} // for i
 
} // if younger
 
item1->OwnPage->repaint();
// enable 'save icon' stuff
Carrier->slotDocCh();
 
} // if empty
 
return Py_None;
}
 
PyObject *scribus_unlinktextframes(PyObject * self, PyObject* args)
{
char *name;
 
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
 
Py_INCREF(Py_None);
if (!Carrier->HaveDoc)
return Py_None;
 
int id = GetItem(QString(name));
PageItem *item = Carrier->doc->ActPage->Items.at(id);
 
// only linked
if (item->BackBox != 0)
{
// is not last one.
if (item->NextBox != 0)
{
PageItem* nextbox = item->NextBox;
while (nextbox != 0)
{
uint a = nextbox->Ptext.count();
for (uint s=0; s<a; ++s)
item->Ptext.append(nextbox->Ptext.take(0));
nextbox = nextbox->NextBox;
} // while
} // if nextBox
uint a2 = item->Ptext.count();
for (uint s = 0; s < a2; ++s)
item->BackBox->Ptext.append(item->Ptext.take(0));
item->BackBox->NextBox = 0;
item->BackBox = 0;
} // if
 
// enable 'save icon' stuff
Carrier->slotDocCh();
item->OwnPage->repaint();
return Py_None;
}
 
/trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.h
5,6 → 5,11
/** Other Commands */
PyObject *scribus_setredraw(PyObject *self, PyObject* args);
PyObject *scribus_fontnames(PyObject *self, PyObject* args);
/**
return a list of the tuples with
Scribus name, Family, Real name, subset (1|0), embed PS (1|0), font file
*/
PyObject *scribus_xfontnames(PyObject *self, PyObject* args);
PyObject *scribus_renderfont(PyObject *self, PyObject* args);
PyObject *scribus_getlayers(PyObject *self, PyObject* args);
PyObject *scribus_setactlayer(PyObject *self, PyObject* args);
/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
23,6 → 23,13
PyObject *scribus_settextfill(PyObject *self, PyObject* args);
PyObject *scribus_settextstroke(PyObject *self, PyObject* args);
PyObject *scribus_settextshade(PyObject *self, PyObject* args);
/**
(Un)Link text frames via Scripter.
02/22/04 (petr vanek)
TODO: PDF bookmarks handling
*/
PyObject *scribus_linktextframes(PyObject *self, PyObject* args);
PyObject *scribus_unlinktextframes(PyObject * self, PyObject* args);
 
#endif
 
/trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
42,6 → 42,30
return l;
}
 
PyObject *scribus_xfontnames(PyObject *self, PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
PyObject *l = PyList_New(Carrier->Prefs.AvailFonts.count());
SCFontsIterator it(Carrier->Prefs.AvailFonts);
int cc = 0;
PyObject *row;
for ( ; it.current() ; ++it)
{
row = Py_BuildValue((char*)"(sssiis)",
it.currentKey().ascii(),// it.currentKey().length(),
it.current()->Family.ascii(),
it.current()->RealName().ascii(),
it.current()->Subset,
it.current()->EmbedPS,
it.current()->Datei.ascii()//, it.current()->Datei.length()
);
PyList_SetItem(l, cc, row);//PyString_FromString(it.currentKey()));
cc++;
} // for
return l;
}
 
PyObject *scribus_renderfont(PyObject *self, PyObject* args)
{
char *Name = "";
56,7 → 80,7
QString ts = QString(Sample);
if ((ts == "") || (QString(FileName) == ""))
return PyInt_FromLong(static_cast<long>(ret));
QString da = Carrier->Prefs.AvailFonts[QString(Name)]->Datei;
QString da = Carrier->Prefs.AvailFonts[QString(Name)]->Datei;
QPixmap pm = FontSample(da, Size, ts, Qt::white);
ret = pm.save(QString(FileName), "PPM");
return PyInt_FromLong(static_cast<long>(ret));
68,13 → 92,13
return NULL;
PyObject *l;
if (Carrier->HaveDoc)
{
{
l = PyList_New(Carrier->doc->Layers.count());
for (uint lam=0; lam < Carrier->doc->Layers.count(); lam++)
{
{
PyList_SetItem(l, lam, PyString_FromString(Carrier->doc->Layers[lam].Name));
}
}
}
else
l = PyList_New(0);
return l;
90,15 → 114,15
return Py_None;
int i = -1;
for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
i = static_cast<int>(lam);
Carrier->doc->ActiveLayer = i;
Carrier->changeLayer(i);
break;
}
}
}
return Py_None;
}
 
122,18 → 146,18
return Py_None;
int i = GetItem(QString(Name));
if (i != -1)
{
{
PageItem *b = Carrier->doc->ActPage->Items.at(i);
Carrier->doc->ActPage->SelectItemNr(i);
for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
{
if (Carrier->doc->Layers[lam].Name == QString(Layer))
{
if (Carrier->doc->Layers[lam].Name == QString(Layer))
{
b->LayerNr = static_cast<int>(lam);
break;
}
}
}
}
return Py_None;
}
 
147,13 → 171,13
if ((!Carrier->HaveDoc) || (Name == ""))
return Py_None;
for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
Carrier->doc->Layers[lam].Sichtbar = vis;
break;
}
}
}
return Py_None;
}
 
167,13 → 191,13
if ((!Carrier->HaveDoc) || (Name == ""))
return Py_None;
for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
Carrier->doc->Layers[lam].Drucken = vis;
break;
}
}
}
return Py_None;
}
 
186,13 → 210,13
return PyInt_FromLong(0L);
int i = 0;
for (uint lam=0; lam < Carrier->doc->Layers.count(); lam++)
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
i = static_cast<int>(Carrier->doc->Layers[lam].Sichtbar);
break;
}
}
}
return PyInt_FromLong(static_cast<long>(i));
}
 
205,13 → 229,13
return PyInt_FromLong(0L);
int i = 0;
for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
i = static_cast<int>(Carrier->doc->Layers[lam].Drucken);
break;
}
}
}
return PyInt_FromLong(static_cast<long>(i));
}
 
224,9 → 248,9
if ((!Carrier->HaveDoc) || (Name == "") || (Carrier->doc->Layers.count() == 1))
return Py_None;
for (uint lam=0; lam < Carrier->doc->Layers.count(); ++lam)
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
if (Carrier->doc->Layers[lam].Name == QString(Name))
{
QValueList<Layer>::iterator it2 = Carrier->doc->Layers.at(lam);
int num2 = (*it2).LNr;
if (!num2)
235,17 → 259,17
Carrier->doc->Layers.remove(it2);
QValueList<Layer>::iterator it;
for (uint l = 0; l < Carrier->doc->Layers.count(); l++)
{
{
it = Carrier->doc->Layers.at(l);
if ((*it).Level > num)
(*it).Level -= 1;
}
}
Carrier->LayerRemove(num2);
Carrier->doc->ActiveLayer = 0;
Carrier->changeLayer(0);
break;
}
}
}
return Py_None;
}
 
/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
366,6 → 366,10
}
 
static PyMethodDef scribus_methods[] = {
// petr's stuff
{"GetXFontNames", scribus_xfontnames, METH_VARARGS},
{"LinkTextFrames", scribus_linktextframes, METH_VARARGS},
{"UnlinkTextFrames", scribus_unlinktextframes, METH_VARARGS},
{"ProgressReset", scribus_progressreset, METH_VARARGS},
{"ProgressTotal", scribus_progresssettotalsteps, METH_VARARGS},
{"ProgressSet", scribus_progresssetprogress, METH_VARARGS},
/trunk/Scribus/scribus/plugins/printpreview/preview.cpp
18,6 → 18,7
#include "preview.moc"
#include <qimage.h>
#include <cstdlib>
#include <qcursor.h>
 
extern QPixmap loadIcon(QString nam);
extern void ReOrderText(ScribusDoc *doc, ScribusView *view);
60,10 → 61,20
void Run(QWidget *d, ScribusApp *plug)
{
if (plug->HaveDoc)
{
PPreview *dia = new PPreview(d, plug);
dia->exec();
delete dia;
{
PPreview *dia = new PPreview(d, plug);
dia->exec();
plug->Prefs.PrPr_Mode = dia->EnableCMYK->isChecked();
plug->Prefs.PrPr_AlphaText = dia->AliasText->isChecked();
plug->Prefs.PrPr_AlphaGraphics = dia->AliasGr->isChecked();
plug->Prefs.PrPr_Transparency = dia->AliasTr->isChecked();
plug->Prefs.PrPr_C = dia->EnableCMYK_C->isChecked();
plug->Prefs.PrPr_M = dia->EnableCMYK_M->isChecked();
plug->Prefs.PrPr_Y = dia->EnableCMYK_Y->isChecked();
plug->Prefs.PrPr_K = dia->EnableCMYK_K->isChecked();
delete dia;
system("rm -f "+plug->PrefsPfad+"/tmp.ps");
system("rm -f "+plug->PrefsPfad+"/sc.png");
}
}
 
81,8 → 92,11
QString tmp;
setCaption( tr("Print Preview"));
app = pl;
APage = 0;
APage = -1;
MPage = app->doc->PageC;
CMode = false;
TxtAl = false;
GrAl = false;
setIcon(loadIcon("AppIcon.png"));
PLayout = new QVBoxLayout(this, 0, 0, "PLayout");
Layout5 = new QHBoxLayout;
110,38 → 124,38
Layout3->setMargin(0);
AliasText = new QCheckBox(this, "TextAntiAlias");
AliasText->setText( tr("Anti-alias Text"));
AliasText->setChecked(false);
AliasText->setChecked(app->Prefs.PrPr_AlphaText);
Layout2->addWidget(AliasText);
AliasGr = new QCheckBox(this, "GraphicsAntiAlias");
AliasGr->setText( tr("Anti-alias Graphics"));
AliasGr->setChecked(false);
AliasGr->setChecked(app->Prefs.PrPr_AlphaGraphics);
Layout2->addWidget(AliasGr);
AliasTr = new QCheckBox(this, "DisplayTransparency");
AliasTr->setText( tr("Display Transparency"));
AliasTr->setChecked(false);
AliasTr->setChecked(app->Prefs.PrPr_Transparency);
Layout2->addWidget(AliasTr);
EnableCMYK = new QCheckBox(this, "DisplayCMYK");
EnableCMYK->setText( tr("Display CMYK"));
EnableCMYK->setChecked(false);
EnableCMYK->setChecked(app->Prefs.PrPr_Mode);
Layout2->addWidget(EnableCMYK);
EnableCMYK_C = new QCheckBox(this, "DisplayCMYK_C");
EnableCMYK_C->setText( tr("C"));
EnableCMYK_C->setChecked(true);
EnableCMYK_C->setChecked(app->Prefs.PrPr_C);
EnableCMYK_C->setEnabled(false);
Layout3->addWidget(EnableCMYK_C);
EnableCMYK_M = new QCheckBox(this, "DisplayCMYK_M");
EnableCMYK_M->setText( tr("M"));
EnableCMYK_M->setChecked(true);
EnableCMYK_M->setChecked(app->Prefs.PrPr_M);
EnableCMYK_M->setEnabled(false);
Layout3->addWidget(EnableCMYK_M);
EnableCMYK_Y = new QCheckBox(this, "DisplayCMYK_Y");
EnableCMYK_Y->setText( tr("Y"));
EnableCMYK_Y->setChecked(true);
EnableCMYK_Y->setChecked(app->Prefs.PrPr_Y);
EnableCMYK_Y->setEnabled(false);
Layout3->addWidget(EnableCMYK_Y);
EnableCMYK_K = new QCheckBox(this, "DisplayCMYK_K");
EnableCMYK_K->setText( tr("K"));
EnableCMYK_K->setChecked(true);
EnableCMYK_K->setChecked(app->Prefs.PrPr_K);
EnableCMYK_K->setEnabled(false);
Layout3->addWidget(EnableCMYK_K);
Layout5->addLayout(Layout2);
178,7 → 192,6
int n = num-1;
if (n == APage)
return;
APage = n;
Anz->setPixmap(CreatePreview(n, 72));
}
 
236,7 → 249,6
EnableCMYK_M->setEnabled(c);
EnableCMYK_Y->setEnabled(c);
EnableCMYK_K->setEnabled(c);
AliasTr->setEnabled(!c);
Anz->setPixmap(CreatePreview(APage, 72));
}
 
255,33 → 267,35
}
 
/*!
\fn QPixmap PPreview::CreatePreview(int Seite, int Res)
\fn void PPreview::RenderPreview(int Seite, int Res)
\author Franz Schmid
\date
\brief
\brief Renders the Preview to a file on Disk
\param Seite int page number
\param Res int
\retval Bild QPixmap print preview
\retval bool Flag indicating succsess
*/
QPixmap PPreview::CreatePreview(int Seite, int Res)
int PPreview::RenderPreview(int Seite, int Res)
{
int ret = -1;
bool ret = -1;
QString cmd1, cmd2, tmp, tmp2, tmp3;
QMap<QString,QFont> ReallyUsed;
QPixmap Bild;
ReOrderText(app->doc, app->view);
ReallyUsed.clear();
app->GetUsedFonts(&ReallyUsed);
PSLib *dd = app->getPSDriver(true, app->Prefs.AvailFonts, ReallyUsed, app->doc->PageColors, false);
if (dd != NULL)
// Recreate Postscript-File only when the actual Page has changed
if (Seite != APage)
{
dd->PS_set_file(app->PrefsPfad+"/tmp.ps");
app->view->CreatePS(dd, Seite, Seite+1, 1, false, tr("All"), true, false, false, false);
delete dd;
app->closePSDriver();
ReallyUsed.clear();
app->GetUsedFonts(&ReallyUsed);
PSLib *dd = app->getPSDriver(true, app->Prefs.AvailFonts, ReallyUsed, app->doc->PageColors, false);
if (dd != NULL)
{
dd->PS_set_file(app->PrefsPfad+"/tmp.ps");
app->view->CreatePS(dd, Seite, Seite+1, 1, false, tr("All"), true, false, false, false);
delete dd;
app->closePSDriver();
}
else
return ret;
}
else
return Bild;
double b = app->doc->PageB * Res / 72;
double h = app->doc->PageH * Res / 72;
cmd1 = "gs -q -dNOPAUSE -r"+tmp.setNum(Res)+" -g"+tmp2.setNum(qRound(b))+"x"+tmp3.setNum(qRound(h));
288,9 → 302,7
if (EnableCMYK->isChecked())
cmd1 += " -sDEVICE=bitcmyk -dGrayValues=256";
else
{
cmd1 += AliasTr->isChecked() ? " -sDEVICE=pngalpha" : " -sDEVICE=png16m";
}
cmd1 += " -sDEVICE=png16m";
if (AliasText->isChecked())
cmd1 += " -dTextAlphaBits=4";
if (AliasGr->isChecked())
298,33 → 310,62
cmd1 += " -sOutputFile="+app->PrefsPfad+"/sc.png ";
cmd2 = " -c showpage -c quit";
ret = system(cmd1 + app->PrefsPfad+"/tmp.ps" + cmd2);
if (ret == 0)
return ret;
}
 
/*!
\fn QPixmap PPreview::CreatePreview(int Seite, int Res)
\author Franz Schmid
\date
\brief Creates the Preview of the Actual Page
\param Seite int page number
\param Res int
\retval Bild QPixmap print preview
*/
QPixmap PPreview::CreatePreview(int Seite, int Res)
{
int ret = -1;
QPixmap Bild;
double b = app->doc->PageB * Res / 72;
double h = app->doc->PageH * Res / 72;
qApp->setOverrideCursor(QCursor(waitCursor), true);
if ((Seite != APage) || (EnableCMYK->isChecked() != CMode) || (AliasText->isChecked() != TxtAl) || (AliasGr->isChecked() != GrAl))
{
QImage image;
if (EnableCMYK->isChecked())
ret = RenderPreview(Seite, Res);
if (ret != 0)
{
int w = qRound(b);
int w2 = 4*w;
int h2 = qRound(h);
int cyan, magenta, yellow, black;
uint *p;
QByteArray imgc(w2*h2);
image = QImage(w, h2, 32);
QFile f(app->PrefsPfad+"/sc.png");
if (f.open(IO_ReadOnly))
Bild.resize(1,1);
qApp->setOverrideCursor(QCursor(arrowCursor), true);
return Bild;
}
}
APage = Seite;
CMode = EnableCMYK->isChecked();
TxtAl = AliasText->isChecked();
GrAl = AliasGr->isChecked();
QImage image;
if (EnableCMYK->isChecked())
{
int w = qRound(b);
int w2 = 4*w;
int h2 = qRound(h);
int cyan, magenta, yellow, black, alpha;
uint *p;
QByteArray imgc(w2);
image = QImage(w, h2, 32);
QFile f(app->PrefsPfad+"/sc.png");
if (f.open(IO_ReadOnly))
{
for (int y=0; y < h2; ++y )
{
f.readBlock(imgc.data(), w2*h2);
f.close();
}
for (int y=0; y < h2; ++y )
{
p = (uint *)image.scanLine( y );
f.readBlock(imgc.data(), w2);
for (int x=0; x < w2; x += 4 )
{
cyan = uchar(imgc[(y * w2) + x]);
magenta = uchar(imgc[(y * w2) + x + 1]);
yellow = uchar(imgc[(y * w2) + x + 2]);
black = uchar(imgc[(y * w2)+ x + 3]);
cyan = uchar(imgc[x]);
magenta = uchar(imgc[x + 1]);
yellow = uchar(imgc[x + 2]);
black = uchar(imgc[x + 3]);
if (!EnableCMYK_C->isChecked())
cyan = 0;
if (!EnableCMYK_M->isChecked())
333,20 → 374,40
yellow = 0;
if (!EnableCMYK_K->isChecked())
black = 0;
*p = qRgba(255-QMIN(255, cyan+black), 255-QMIN(255,magenta+black), 255-QMIN(255,yellow+black), 255);
if (AliasTr->isChecked() && ((cyan == 0) && (magenta == 0) && (yellow == 0 ) && (black == 0)))
alpha = 0;
else
alpha = 255;
*p = qRgba(255-QMIN(255, cyan+black), 255-QMIN(255,magenta+black), 255-QMIN(255,yellow+black), alpha);
p++;
}
}
f.close();
}
else
}
else
{
image.load(app->PrefsPfad+"/sc.png");
image = image.convertDepth(32);
if (AliasTr->isChecked())
{
image.load(app->PrefsPfad+"/sc.png");
image = image.convertDepth(32);
int wi = image.width();
int hi = image.height();
for( int yi=0; yi < hi; ++yi )
{
QRgb *s = (QRgb*)(image.scanLine( yi ));
for(int xi=0; xi < wi; ++xi )
{
if((*s) == 0xffffffff)
(*s) &= 0x00ffffff;
s++;
}
}
}
Bild.convertFromImage(image);
system("rm -f "+app->PrefsPfad+"/sc.png");
}
system("rm -f "+app->PrefsPfad+"/tmp.ps");
}
image.setAlphaBuffer(true);
Bild.convertFromImage(image);
qApp->setOverrideCursor(QCursor(arrowCursor), true);
return Bild;
}
 
/trunk/Scribus/scribus/plugins/printpreview/preview.h
31,6 → 31,7
public:
PPreview( QWidget* parent, ScribusApp *plug );
~PPreview() {};
int RenderPreview(int Seite, int Res);
QPixmap CreatePreview(int Seite, int Res);
PageSelector *PGSel;
QCheckBox* AliasText;
43,10 → 44,12
QCheckBox* EnableCMYK_K;
QScrollView* Anzeige;
QLabel* Anz;
QPixmap* Bild;
ScribusApp *app;
int APage;
int MPage;
bool CMode;
bool TxtAl;
bool GrAl;
 
public slots:
void ToSeite(int num);
/trunk/Scribus/scribus/libpdf/pdflib.cpp
30,6 → 30,7
#include <qtextstream.h>
#include <cstdlib>
#include <cmath>
#include <unistd.h>
#include "rc4.h"
 
extern int callGS(const QStringList & args);
/trunk/Scribus/scribus/scribusview.h
78,7 → 78,6
int CountElements();
QPixmap PageToPixmap(int Nr, int maxGr);
QPixmap MPageToPixmap(QString name, int maxGr);
void RecalcTextPos();
void RecalcPictures(ProfilesL *Pr, QProgressBar *dia = 0);
void CreatePS(PSLib *p, uint von, uint bis, int step, bool sep, QString SepNam, bool farb,
bool Hm, bool Vm, bool Ic);
/trunk/Scribus/scribus/scribusXml.cpp
3229,6 → 3229,16
dc82.setAttribute("FILE",Vor->PrinterFile);
dc82.setAttribute("COMMAND",Vor->PrinterCommand);
elem.appendChild(dc82);
QDomElement dc8Pr=docu.createElement("PRINTPREVIEW");
dc8Pr.setAttribute("Mode", static_cast<int>(Vor->PrPr_Mode));
dc8Pr.setAttribute("AlphaText", static_cast<int>(Vor->PrPr_AlphaText));
dc8Pr.setAttribute("AlphaGraphics", static_cast<int>(Vor->PrPr_AlphaGraphics));
dc8Pr.setAttribute("Transparency", static_cast<int>(Vor->PrPr_Transparency));
dc8Pr.setAttribute("Cyan", static_cast<int>(Vor->PrPr_C));
dc8Pr.setAttribute("Magenta", static_cast<int>(Vor->PrPr_M));
dc8Pr.setAttribute("Yellow", static_cast<int>(Vor->PrPr_Y));
dc8Pr.setAttribute("Black", static_cast<int>(Vor->PrPr_K));
elem.appendChild(dc8Pr);
QDomElement rde=docu.createElement("HYPHEN");
rde.setAttribute("LANG", Vor->Language);
rde.setAttribute("WORDLEN", Vor->MinWordLen);
3483,6 → 3493,17
Vorein->PrinterFile = dc.attribute("FILE");
Vorein->PrinterCommand = dc.attribute("COMMAND");
}
if (dc.tagName()=="PRINTPREVIEW")
{
Vorein->PrPr_Mode = static_cast<bool>(QStoInt(dc.attribute("Mode", "0")));
Vorein->PrPr_AlphaText = static_cast<bool>(QStoInt(dc.attribute("AlphaText", "0")));
Vorein->PrPr_AlphaGraphics = static_cast<bool>(QStoInt(dc.attribute("AlphaGraphics", "0")));
Vorein->PrPr_Transparency = static_cast<bool>(QStoInt(dc.attribute("Transparency", "0")));
Vorein->PrPr_C = static_cast<bool>(QStoInt(dc.attribute("Cyan", "1")));
Vorein->PrPr_M = static_cast<bool>(QStoInt(dc.attribute("Magenta", "1")));
Vorein->PrPr_Y = static_cast<bool>(QStoInt(dc.attribute("Yellow", "1")));
Vorein->PrPr_K = static_cast<bool>(QStoInt(dc.attribute("Black", "1")));
}
if (dc.tagName()=="HYPHEN")
{
if (dc.attribute("LANG", "") != "")
/trunk/Scribus/scribus/qm/scribus.uk.qm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream