Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 3828 → Rev 3829

/branches/Version13x/Scribus/scribus/pdflib.cpp
113,7 → 113,7
KeyGen[a] = kg_array[a];
}
 
bool PDFlib::doExport(QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2)
bool PDFlib::doExport(const QString& fn, const QString& nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2)
{
QPixmap pm;
bool ret = false;
160,13 → 160,13
return ret;
}
 
QString PDFlib::FToStr(double c)
QString PDFlib::FToStr(const double c)
{
QString cc;
return cc.sprintf("%.5f", c);
}
 
QString PDFlib::IToStr(int c)
QString PDFlib::IToStr(const int c)
{
QString cc;
return cc.setNum(c);
174,10 → 174,11
 
void PDFlib::PutDoc(QString in)
{
QTextStream t(&Spool);
t.writeRawBytes(in.latin1(), in.length());
//QTextStream t(&Spool); //CB replaced with member t.
uint inlen=in.length();
t.writeRawBytes(in.latin1(), inlen);
Spool.flush();
Dokument += in.length();
Dokument += inlen;
}
 
void PDFlib::PutPage(QString in)
396,19 → 397,21
}
}
 
QByteArray PDFlib::ComputeMD5(QString in)
QByteArray PDFlib::ComputeMD5(const QString& in)
{
QByteArray TBytes(in.length());
for (uint a = 0; a < in.length(); ++a)
uint inlen=in.length();
QByteArray TBytes(inlen);
for (uint a = 0; a < inlen; ++a)
TBytes[a] = static_cast<uchar>(QChar(in.at(a)));
return ComputeMD5Sum(&TBytes);
}
 
bool PDFlib::PDF_Begin_Doc(QString fn, PDFOptions *opts, SCFonts &AllFonts, QMap<QString,int> DocFonts, BookMView* vi)
bool PDFlib::PDF_Begin_Doc(const QString& fn, PDFOptions *opts, SCFonts &AllFonts, QMap<QString,int> DocFonts, BookMView* vi)
{
Spool.setName(fn);
if (!Spool.open(IO_WriteOnly))
return false;
t.setDevice(&Spool);
QString tmp;
QString ok = "";
QString uk = "";
463,7 → 466,7
PutDoc("/ViewerPreferences\n<<\n/PageDirection ");
PutDoc( Options->Binding == 0 ? "/L2R\n" : "/R2L\n");
PutDoc(" >>\n>>\nendobj\n");
QString IDg = Datum;
QString IDg(Datum);
IDg += Options->Datei;
IDg += "Scribus "+QString(VERSION);
IDg += "Libpdf for Scribus "+QString(VERSION);
578,7 → 581,7
Foi::FontFormat fformat = AllFonts[it.key()]->formatCode;
if ((AllFonts[it.key()]->isOTF) || (!AllFonts[it.key()]->HasNames) || (AllFonts[it.key()]->Subset) || (Options->SubsetList.contains(it.key())))
{
QString fon = "";
QString fon("");
QMap<uint,FPointArray>::Iterator ig;
for (ig = AllFonts[it.key()]->RealGlyphs.begin(); ig != AllFonts[it.key()]->RealGlyphs.end(); ++ig)
{
637,7 → 640,7
UsedFontsP.insert(it.key(), "/Fo"+IToStr(a));
if ((fformat == Foi::PFB) && (Options->EmbedList.contains(it.key())))
{
QString fon = "";
QString fon("");
StartObj(ObjCounter);
QByteArray bb;
AllFonts[it.key()]->RawData(bb);
684,9 → 687,9
}
if ((fformat == Foi::PFA) && (Options->EmbedList.contains(it.key())))
{
QString fon = "";
QString fon2 = "";
QString tm = "";
QString fon("");
QString fon2("");
QString tm("");
uint value;
bool ok = true;
StartObj(ObjCounter);
722,7 → 725,7
}
if ((fformat == Foi::SFNT || fformat == Foi::TTCF) && (Options->EmbedList.contains(it.key())))
{
QString fon = "";
QString fon("");
StartObj(ObjCounter);
QByteArray bb;
AllFonts[it.key()]->RawData(bb);
878,7 → 881,7
{
PutDoc("/"+itlp.key()+"\n<<\n/Type /Halftone\n/HalftoneType 1\n/Frequency ");
PutDoc(IToStr(itlp.data().Frequency)+"\n/Angle "+IToStr(itlp.data().Angle)+"\n/SpotFunction ");
QString func = "";
QString func ("");
switch (itlp.data().SpotFunc)
{
case 0:
981,10 → 984,11
ll.isPrintable = false;
ll.LNr = 0;
int Lnr = 0;
QString ocgNam = "oc";
for (uint la = 0; la < doc->Layers.count(); ++la)
QString ocgNam("oc");
uint docLayersCount=doc->Layers.count();
for (uint la = 0; la < docLayersCount; ++la)
{
QString tmp = "";
QString tmp("");
Level2Layer(doc, &ll, Lnr);
ocg.Name = ocgNam+tmp.setNum(ll.LNr);
ocg.ObjNum = ObjCounter;
2495,7 → 2499,7
return tmp;
}
 
QString PDFlib::putColor(QString color, int shade, bool fill)
QString PDFlib::putColor(const QString& color, int shade, bool fill)
{
QString tmp = "";
QString colString = SetFarbe(color, shade);
3162,7 → 3166,7
}
}
 
QString PDFlib::SetFarbe(QString farbe, int Shade)
QString PDFlib::SetFarbe(const QString& farbe, int Shade)
{
QString tmp;
ScColor tmpC;
3416,7 → 3420,7
return PDF_DoLinGradient(currItem, StopVec, TransVec, Gcolors);
}
 
QString PDFlib::PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, QStringList Colors)
QString PDFlib::PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, const QStringList& Colors)
{
QString tmp = "";
bool first = true;
3425,7 → 3429,8
double w2 = QMIN(QMAX(currItem->GrStartX, 0), currItem->Width);
double h2 = -1.0 * QMIN(QMAX(currItem->GrStartY, 0), currItem->Height);
QString TRes = "";
for (uint c = 0; c < Colors.count()-1; ++c)
uint colorsCountm1=Colors.count()-1;
for (uint c = 0; c < colorsCountm1; ++c)
{
if ((Options->Version >= 14) && (((*Trans.at(c+1)) != 1) || ((*Trans.at(c)) != 1)))
{
4102,7 → 4107,7
Seite.XObjects[ResNam+IToStr(ResCount)] = ObjCounter-1;
}
 
void PDFlib::PDF_Form(QString im)
void PDFlib::PDF_Form(QString& im)
{
StartObj(ObjCounter);
ObjCounter++;
4127,7 → 4132,7
BookMinUse = true;
}
 
QString PDFlib::PDF_Image(PageItem* c, QString fn, double sx, double sy, double x, double y, bool fromAN, QString Profil, bool Embedded, int Intent)
QString PDFlib::PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN, const QString& Profil, bool Embedded, int Intent)
{
QFileInfo fi = QFileInfo(fn);
QString ext = fi.extension(false).lower();
4230,7 → 4235,7
}
if (!found)
{
if (tmp.startsWith("%%BoundingBox"))
if (tmp.startsWith("%%BoundingBox"))
{
found = true;
BBox = tmp.remove("%%BoundingBox");
4611,7 → 4616,7
return "";
}
 
void PDFlib::PDF_End_Doc(QString PrintPr, QString Name, int Components)
void PDFlib::PDF_End_Doc(const QString& PrintPr, const QString& Name, int Components)
{
QString tmp;
uint StX;
/branches/Version13x/Scribus/scribus/pageitem.h
243,6 → 243,7
void getBoundingRect(double *x1, double *y1, double *x2, double *y2);
void copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer);
virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
250,7 → 251,6
double SetZeichAttr(struct ScText *hl, int *chs, QString *chx);
void SetFarbe(QColor *tmp, QString farbe, int shad);
void DrawZeichenS(ScPainter *p, struct ZZ *hl);
/branches/Version13x/Scribus/scribus/pageitem.cpp
3420,3 → 3420,6
SetPolyClip(static_cast<int>(asce+BaseOffs));
}
 
void PageItem::handleModeEditKey(QKeyEvent *k, bool &keyRepeat)
{
}
/branches/Version13x/Scribus/scribus/pdflib.h
47,13 → 47,13
public:
PDFlib(ScribusDoc *docu);
~PDFlib() {};
bool doExport(QString fn, QString nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2);
bool PDF_Begin_Doc(QString fn, PDFOptions *opts, SCFonts &AllFonts, QMap<QString,int> DocFonts, BookMView* vi);
bool doExport(const QString& fn, const QString& nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2);
bool PDF_Begin_Doc(const QString& fn, PDFOptions *opts, SCFonts &AllFonts, QMap<QString,int> DocFonts, BookMView* vi);
void PDF_Begin_Page(Page* pag, QPixmap pm = 0);
void PDF_End_Page();
void PDF_TemplatePage(Page* pag, bool clip = false);
void PDF_ProcessPage(Page* pag, uint PNr, bool clip = false);
void PDF_End_Doc(QString PrintPr = "", QString Name = "", int Components = 0);
void PDF_End_Doc(const QString& PrintPr = "", const QString& Name = "", int Components = 0);
struct GlNamInd
{
uint Code;
74,8 → 74,8
QString SetClipPathArray(FPointArray *ite, bool poly = true);
QString SetClipPathImage(PageItem *ite);
QString SetClipPath(PageItem *ite, bool poly = true);
QString SetFarbe(QString farbe, int Shade);
QString putColor(QString color, int Shade, bool fill);
QString SetFarbe(const QString& farbe, int Shade);
QString putColor(const QString& color, int Shade, bool fill);
QString PDF_ProcessItem(PageItem* ite, Page* pag, uint PNr, bool embedded = false);
QString setTextSt(PageItem *ite, uint PNr, Page* pag);
void setTextCh(PageItem *ite, uint PNr, uint d, QString &tmp, QString &tmp2, struct ScText *hl, Page* pag);
84,15 → 84,15
void StartObj(int nr);
void WritePDFStream(QString *cc);
QString PDFEncode(QString in);
QByteArray ComputeMD5(QString in);
QByteArray ComputeMD5(const QString& in);
void PDF_Bookmark(int nr, double ypos);
QString PDF_Gradient(PageItem *currItem);
QString PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, QStringList Colors);
QString PDF_DoLinGradient(PageItem *currItem, QValueList<double> Stops, QValueList<double> Trans, const QStringList& Colors);
QString PDF_Transparenz(PageItem *currItem);
void PDF_Annotation(PageItem *ite, uint PNr);
void PDF_Form(QString im);
void PDF_Form(QString& im);
void PDF_xForm(double w, double h, QString im);
QString PDF_Image(PageItem* c, QString fn, double sx, double sy, double x, double y, bool fromAN = false, QString Profil = "", bool Embedded = false, int Intent = 1);
QString PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN = false, const QString& Profil = "", bool Embedded = false, int Intent = 1);
QString Inhalt;
ScribusDoc* doc;
Page* ActPageP;
205,6 → 205,7
QMap<QString, SpotC> spotMap;
QString spotNam;
int spotCount;
QTextStream t;
};
 
#endif
/branches/Version13x/Scribus/scribus/pageitem_textframe.cpp
30,6 → 30,7
#include <cmath>
#include <cassert>
 
#include "hyphenator.h"
#include "mpalette.h"
#include "page.h"
#include "pageitem.h"
54,6 → 55,9
PageItem_TextFrame::PageItem_TextFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline)
: PageItem(pa, PageItem::TextFrame, x, y, w, h, w2, fill, outline)
{
unicodeTextEditMode = false;
unicodeInputCount = 0;
unicodeInputString = "";
}
 
void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRect e, double sc)
2006,3 → 2010,616
nextItem = nextItem->NextBox;
}
}
 
/**
* Handle keyboard interaction with the text frame while in edit mode
* @param k
*/
void PageItem_TextFrame::handleModeEditKey(QKeyEvent *k, bool& keyRepeat)
{
int oldPos = CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key
struct ScText *hg;
int kk = k->key();
int as = k->ascii();
double altx, alty;
QString uc = k->text();
QString cr, Tcha, Twort;
uint Tcoun;
int len, pos, c;
int KeyMod;
ButtonState buttonState = k->state();
switch (buttonState)
{
case ShiftButton:
KeyMod = SHIFT;
break;
case AltButton:
KeyMod = ALT;
break;
case ControlButton:
KeyMod = CTRL;
break;
default:
KeyMod = 0;
break;
}
 
ScApp->view->slotDoCurs(false);
switch (kk)
{
case Key_Prior:
case Key_Next:
case Key_End:
case Key_Home:
case Key_Right:
case Key_Left:
case Key_Up:
case Key_Down:
if ( (buttonState & ShiftButton) == 0 )
ScApp->view->deselectAll(this);
}
//<< ISO 14755
//if ((buttonState & ControlButton) && (buttonState & ShiftButton))
//{
// if (!unicodeTextEditMode)
// {
// unicodeTextEditMode=true;
// unicodeInputCount = 0;
// unicodeInputString = "";
// keyrep = false;
// }
// qDebug(QString("%1 %2 %3 %4 %5").arg("uni").arg("c+s").arg(uc).arg(kk).arg(as));
//}
//>>
if (unicodeTextEditMode)
{
int conv = 0;
bool ok = false;
unicodeInputString += uc;
conv = unicodeInputString.toInt(&ok, 16);
if (!ok)
{
unicodeTextEditMode = false;
unicodeInputCount = 0;
unicodeInputString = "";
keyRepeat = false;
return;
}
unicodeInputCount++;
if (unicodeInputCount == 4)
{
unicodeTextEditMode = false;
unicodeInputCount = 0;
unicodeInputString = "";
if (ok)
{
if (HasSel)
deleteSelectedTextFromFrame();
if (conv < 31)
conv = 32;
hg = new ScText;
hg->ch = QString(QChar(conv));
Doc->setScTextDefaultsFromDoc(hg);
hg->cselect = false;
hg->cextra = 0;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
hg->PtransX = 0;
hg->PtransY = 0;
hg->cembedded = 0;
itemText.insert(CPos, hg);
CPos += 1;
Tinput = true;
ScApp->setTBvals(this);
ScApp->view->RefreshItem(this);
keyRepeat = false;
return;
}
}
else
{
keyRepeat = false;
return;
}
}
switch (kk)
{
case Key_F12:
unicodeTextEditMode = true;
unicodeInputCount = 0;
unicodeInputString = "";
keyRepeat = false;
return;
break;
case Key_Home:
// go to begin of line
if ( (pos = CPos) == 0 )
break; // at begin of frame
len = static_cast<int>(itemText.count());
if ( pos == len )
pos--;
if ( (buttonState & ControlButton) == 0 )
{
alty = itemText.at(pos)->yp;
c = itemText.at(pos)->ch.at(0).latin1();
if ( c == 13 ) // new line, position is wrong
if ( --pos > 0 )
alty = itemText.at(pos)->yp;
// check for yp at actual position
if ( pos < len )
{
altx = itemText.at(pos)->yp;
if ( altx > alty )
{
// we was at begin of line
break;
}
}
while ( pos > 0 && itemText.at(pos-1)->yp == alty )
--pos;
if ( itemText.at(pos)->ch.at(0).latin1() == 13 )
++pos;
}
else
{
// paragraph begin
if ( pos < len &&
itemText.at(pos)->ch.at(0).latin1() == 13 )
--pos;
while(pos > 0 )
if ( itemText.at(pos)->ch.at(0).latin1() == 13 )
{
++pos;
break;
}
else
--pos;
}
CPos = pos;
if ( buttonState & ShiftButton )
ScApp->view->ExpandSel(this, -1, oldPos);
break;
case Key_End:
// go to end of line
len = static_cast<int>(itemText.count());
if ( CPos >= len )
break; // at end of frame
if ( (buttonState & ControlButton) == 0 )
{
if ((CPos < len) && ((itemText.at(CPos)->ch.at(0).latin1() == 13) || (itemText.at(CPos)->ch.at(0).latin1() == 28)))
{
// at end of paragraph and therefore line
break;
}
QString nextCh = itemText.at(CPos)->ch;
int nextChs = itemText.at(CPos)->csize;
alty = itemText.at(CPos)->yp - SetZeichAttr(itemText.at(CPos), &nextChs, &nextCh);
double nextY;
while (CPos < len-1)
{
nextCh = itemText.at(CPos+1)->ch;
nextChs = itemText.at(CPos+1)->csize;
nextY = itemText.at(CPos+1)->yp - SetZeichAttr(itemText.at(CPos+1), &nextChs, &nextCh);
if (fabs(nextY - alty) > 1.0)
break;
CPos++;
if ( CPos == len-1)
break;
}
if ( CPos < len -1 )
c = itemText.at(CPos+1)->ch.at(0).latin1();
else if ( CPos == len - 1 )
c = 13;
else
c = 0;
if (( c == 13 ) || (c = 28))
CPos++;
}
else
{
// go to end of paragraph
if ( itemText.at(CPos)->ch.at(0).latin1() == 13 )
{
break;
}
pos = CPos;
while ( pos < len )
{
if ( itemText.at(pos)->ch.at(0).latin1() == 13 )
break;
else
++pos;
}
CPos = pos;
}
if ( buttonState & ShiftButton )
ScApp->view->ExpandSel(this, 1, oldPos);
break;
case Key_Down:
if (CPos != static_cast<int>(itemText.count()))
{
alty = itemText.at(CPos)->yp;
altx = itemText.at(CPos)->xp;
do
{
CPos += 1;
if (CPos == static_cast<int>(itemText.count()))
break;
if (itemText.at(CPos)->yp > alty)
{
if (itemText.at(CPos)->xp >= altx)
break;
}
}
while (CPos < static_cast<int>(itemText.count()));
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
CPos = itemText.count();
ScApp->view->ExpandSel(this, 1, oldPos);
}
else
if (CPos == static_cast<int>(itemText.count()))
if (NextBox != 0)
{
if (NextBox->itemText.count() != 0)
{
ScApp->view->Deselect(true);
NextBox->CPos = 0;
ScApp->view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
}
}
else
{
if (NextBox != 0)
{
if (NextBox->itemText.count() != 0)
{
ScApp->view->Deselect(true);
NextBox->CPos = 0;
ScApp->view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
}
}
if ( this->HasSel )
ScApp->view->RefreshItem(this);
ScApp->setTBvals(this);
break;
case Key_Up:
if (CPos > 0)
{
if (CPos == static_cast<int>(itemText.count()))
--CPos;
alty = itemText.at(CPos)->yp;
altx = itemText.at(CPos)->xp;
if (CPos > 0)
{
do
{
--CPos;
if (CPos == 0)
break;
if ( itemText.at(CPos)->ch.at(0).latin1() == 13 )
break;
if (itemText.at(CPos)->yp < alty)
{
if (itemText.at(CPos)->xp <= altx)
break;
}
}
while (CPos > 0);
}
if ( buttonState & ShiftButton )
{
if ( buttonState & AltButton )
CPos = 0;
ScApp->view->ExpandSel(this, -1, oldPos);
}
else
if (CPos == 0)
{
if (BackBox != 0)
{
ScApp->view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
ScApp->view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
}
}
}
else
{
CPos = 0;
if (BackBox != 0)
{
ScApp->view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
ScApp->view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
}
}
if ( this->HasSel )
ScApp->view->RefreshItem(this);
ScApp->setTBvals(this);
break;
case Key_Prior:
CPos = 0;
if ( buttonState & ShiftButton )
ScApp->view->ExpandSel(this, -1, oldPos);
ScApp->setTBvals(this);
break;
case Key_Next:
CPos = static_cast<int>(itemText.count());
if ( buttonState & ShiftButton )
ScApp->view->ExpandSel(this, 1, oldPos);
ScApp->setTBvals(this);
break;
case Key_Left:
if ( buttonState & ControlButton )
{
ScApp->view->setNewPos(this, oldPos, itemText.count(),-1);
if ( buttonState & ShiftButton )
ScApp->view->ExpandSel(this, -1, oldPos);
}
else if ( buttonState & ShiftButton )
{
--CPos;
if ( CPos < 0 )
CPos = 0;
else
ScApp->view->ExpandSel(this, -1, oldPos);
}
else
{
--CPos;
if (CPos < 0)
{
CPos = 0;
if (BackBox != 0)
{
ScApp->view->Deselect(true);
BackBox->CPos = BackBox->itemText.count();
ScApp->view->SelectItemNr(BackBox->ItemNr);
//currItem = currItem->BackBox;
}
}
}
if ((CPos > 0) && (CPos == static_cast<int>(itemText.count())))
{
if (itemText.at(CPos-1)->cstyle & 4096)
{
--CPos;
while ((CPos > 0) && (itemText.at(CPos)->cstyle & 4096))
{
--CPos;
if (CPos == 0)
break;
}
}
}
else
{
while ((CPos > 0) && (itemText.at(CPos)->cstyle & 4096))
{
--CPos;
if (CPos == 0)
break;
}
}
if ( HasSel )
ScApp->view->RefreshItem(this);
ScApp->setTBvals(this);
break;
case Key_Right:
if ( buttonState & ControlButton )
{
ScApp->view->setNewPos(this, oldPos, itemText.count(),1);
if ( buttonState & ShiftButton )
ScApp->view->ExpandSel(this, 1, oldPos);
}
else if ( buttonState & ShiftButton )
{
++CPos;
if ( CPos > static_cast<int>(itemText.count()) )
--CPos;
else
ScApp->view->ExpandSel(this, 1, oldPos);
}
else
{
++CPos; // new position within text ?
if (CPos > static_cast<int>(itemText.count()))
{
--CPos;
if (NextBox != 0)
{
if (NextBox->itemText.count() != 0)
{
ScApp->view->Deselect(true);
NextBox->CPos = 0;
ScApp->view->SelectItemNr(NextBox->ItemNr);
//currItem = currItem->NextBox;
}
}
}
}
if ( HasSel )
ScApp->view->RefreshItem(this);
ScApp->setTBvals(this);
break;
case Key_Delete:
if (CPos == static_cast<int>(itemText.count()))
{
if (HasSel)
{
deleteSelectedTextFromFrame();
ScApp->setTBvals(this);
ScApp->view->RefreshItem(this);
}
keyRepeat = false;
return;
}
if (itemText.count() == 0)
{
keyRepeat = false;
return;
}
cr = itemText.at(CPos)->ch;
if (!HasSel)
itemText.at(CPos)->cselect = true;
deleteSelectedTextFromFrame();
Tinput = false;
if ((cr == QChar(13)) && (itemText.count() != 0))
{
ScApp->view->chAbStyle(this, itemText.at(QMAX(CPos-1,0))->cab);
Tinput = false;
}
ScApp->setTBvals(this);
ScApp->view->RefreshItem(this);
break;
case Key_Backspace:
if (CPos == 0)
{
if (HasSel)
{
deleteSelectedTextFromFrame();
ScApp->setTBvals(this);
ScApp->view->RefreshItem(this);
}
break;
}
if (itemText.count() == 0)
break;
cr = itemText.at(QMAX(CPos-1,0))->ch;
if (!HasSel)
{
--CPos;
itemText.at(CPos)->cselect = true;
}
deleteSelectedTextFromFrame();
Tinput = false;
if ((cr == QChar(13)) && (itemText.count() != 0))
{
ScApp->view->chAbStyle(this, itemText.at(QMAX(CPos-1,0))->cab);
Tinput = false;
}
ScApp->setTBvals(this);
ScApp->view->RefreshItem(this);
break;
default:
if ((HasSel) && (kk < 0x1000))
deleteSelectedTextFromFrame();
//if ((kk == Key_Tab) || ((kk == Key_Return) && (buttonState & ShiftButton)))
if (kk == Key_Tab)
{
hg = new ScText;
// if (kk == Key_Return)
// hg->ch = QString(QChar(28));
if (kk == Key_Tab)
hg->ch = QString(QChar(9));
Doc->setScTextDefaultsFromDoc(hg);
hg->cselect = false;
hg->cextra = 0;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
hg->PtransX = 0;
hg->PtransY = 0;
hg->cembedded = 0;
itemText.insert(CPos, hg);
CPos += 1;
Tinput = true;
ScApp->view->RefreshItem(this);
break;
}
if (((uc[0] > QChar(31)) || (as == 13) || (as == 30)) && ((*Doc->AllFonts)[Doc->CurrFont]->CharWidth.contains(uc[0].unicode())))
{
hg = new ScText;
hg->ch = uc;
Doc->setScTextDefaultsFromDoc(hg);
hg->cextra = 0;
hg->cselect = false;
hg->xp = 0;
hg->yp = 0;
hg->PRot = 0;
hg->PtransX = 0;
hg->PtransY = 0;
hg->cembedded = 0;
itemText.insert(CPos, hg);
CPos += 1;
if ((Doc->docHyphenator->AutoCheck) && (CPos > 1))
{
Twort = "";
Tcoun = 0;
for (int hych = CPos-1; hych > -1; hych--)
{
Tcha = itemText.at(hych)->ch;
if (Tcha == " ")
{
Tcoun = hych+1;
break;
}
Twort.prepend(Tcha);
}
if (!Twort.isEmpty())
{
if (Doc->docHyphenator->Language != Language)
Doc->docHyphenator->slotNewDict(Language);
Doc->docHyphenator->slotHyphenateWord(this, Twort, Tcoun);
}
}
Tinput = true;
ScApp->view->RefreshItem(this);
}
break;
}
ScApp->view->slotDoCurs(true);
if ((kk == Key_Left) || (kk == Key_Right) || (kk == Key_Up) || (kk == Key_Down))
{
keyRepeat = false;
return;
}
}
 
void PageItem_TextFrame::deleteSelectedTextFromFrame()
{
int firstSelection = 0;
bool first = false;
for (ScText *it = itemText.first(); it != 0; it = itemText.next())
{
if (it->cselect)
{
first = true;
if ((it->ch == QChar(25)) && (it->cembedded != 0))
{
Doc->FrameItems.remove(it->cembedded);
delete it->cembedded;
}
itemText.remove();
it = itemText.prev();
if (it == 0)
it = itemText.first();
}
if (!first)
firstSelection++;
}
if (itemText.count() != 0)
{
if (itemText.first()->cselect)
{
itemText.remove();
CPos = 0;
}
else
CPos = firstSelection;
}
else
CPos = 0;
HasSel = false;
Doc->updateFrameItems();
ScApp->DisableTxEdit();
}
/branches/Version13x/Scribus/scribus/scribus.cpp
109,6 → 109,7
#include "tabpdfoptions.h"
#include "docitemattrprefs.h"
#include "pageitemattributes.h"
#include "pageitem_textframe.h"
#include "tocindexprefs.h"
#include "tocgenerator.h"
#include "collect4output.h"
430,9 → 431,9
view = NULL;
doc = NULL;
Buffer2 = "";
unicodeTextEditMode = false;
unicodeInputCount = 0;
unicodeInputString = "";
//unicodeTextEditMode = false;
//unicodeInputCount = 0;
//unicodeInputString = "";
DispX = 10;
DispY = 10;
DocNr = 1;
1009,6 → 1010,7
mainWindowYPosDataLabel->setText(tmp.setNum(qRound(yn*doc->unitRatio() * multiplier) / divisor, 'f', precision) + suffix);
}
 
/*
void ScribusApp::deleteSelectedTextFromFrame(PageItem *currItem)
{
int firstSelection = 0;
1047,6 → 1049,7
doc->updateFrameItems();
DisableTxEdit();
}
*/
 
void ScribusApp::setTBvals(PageItem *currItem)
{
1243,6 → 1246,7
if (keyrep)
return;
keyrep = true;
int KeyMod;
switch (k->state())
{
case ShiftButton:
1258,6 → 1262,7
KeyMod = 0;
break;
}
//User presses escape and we have a doc open, and we have an item selected
if ((kk == Key_Escape) && (HaveDoc))
{
keyrep = false;
1320,8 → 1325,17
return;
}
ButtonState buttonState = k->state();
/**If we have a doc and we are not changing the page or zoom level in the status bar */
if ((HaveDoc) && (!view->zoomSpinBox->hasFocus()) && (!view->pageSelector->hasFocus()))
{
/**
* With no item selected we can:
* - With space, get into panning mode (modePanning)
* - With PageUp, scroll up
* - With PageDown, scroll down
* - With Tab, change active document windowActivated
*/
if ((doc->appMode != modeEdit) && (view->SelItem.count() == 0))
{
switch (kk)
1373,8 → 1387,22
break;
}
}
/** Now if we have an item selected
* - In normal mode we can:
* -- Use backspace or delete to delete the item
* -- Use PageUp to raise an item
* -- Use PageDown to lower an item
* -- Use the arrow keys to move an item or group around, with no meta, by 1.0, Ctrl by 0.1, Shift by 10.0.
*/
if (view->SelItem.count() != 0)
{
double moveBy=1.0;
if (buttonState & ShiftButton)
moveBy=10.0;
else if (buttonState & ControlButton)
moveBy=0.1;
PageItem *currItem = view->SelItem.at(0);
switch (doc->appMode)
{
1413,22 → 1441,12
np = currItem->ContourLine.point(view->ClRe);
else
np = currItem->PoLine.point(view->ClRe);
if ( buttonState & ShiftButton )
np = np - FPoint(10.0, 0);
else if ( buttonState & ControlButton )
np = np - FPoint(0.1, 0);
else
np = np - FPoint(1.0, 0);
np = np - FPoint(moveBy, 0);
view->MoveClipPoint(currItem, np);
}
else
{
if ( buttonState & ShiftButton )
view->moveGroup(-10, 0);
else if ( buttonState & ControlButton )
view->moveGroup(-0.1, 0);
else
view->moveGroup(-1, 0);
view->moveGroup(-moveBy, 0);
}
slotDocCh();
}
1443,22 → 1461,12
np = currItem->ContourLine.point(view->ClRe);
else
np = currItem->PoLine.point(view->ClRe);
if ( buttonState & ShiftButton )
np = np + FPoint(10.0, 0);
else if ( buttonState & ControlButton )
np = np + FPoint(0.1, 0);
else
np = np + FPoint(1.0, 0);
np = np + FPoint(moveBy, 0);
view->MoveClipPoint(currItem, np);
}
else
{
if ( buttonState & ShiftButton )
view->moveGroup(10, 0);
else if ( buttonState & ControlButton )
view->moveGroup(0.1, 0);
else
view->moveGroup(1, 0);
view->moveGroup(moveBy, 0);
}
slotDocCh();
}
1473,22 → 1481,12
np = currItem->ContourLine.point(view->ClRe);
else
np = currItem->PoLine.point(view->ClRe);
if ( buttonState & ShiftButton )
np = np - FPoint(0, 10.0);
else if ( buttonState & ControlButton )
np = np - FPoint(0, 0.1);
else
np = np - FPoint(0, 1.0);
np = np - FPoint(0, moveBy);
view->MoveClipPoint(currItem, np);
}
else
{
if ( buttonState & ShiftButton )
view->moveGroup(0, -10);
else if ( buttonState & ControlButton )
view->moveGroup(0, -0.1);
else
view->moveGroup(0, -1);
view->moveGroup(0, -moveBy);
}
slotDocCh();
}
1503,22 → 1501,12
np = currItem->ContourLine.point(view->ClRe);
else
np = currItem->PoLine.point(view->ClRe);
if ( buttonState & ShiftButton )
np = np + FPoint(0, 10.0);
else if ( buttonState & ControlButton )
np = np + FPoint(0, 0.1);
else
np = np + FPoint(0, 1.0);
np = np + FPoint(0, moveBy);
view->MoveClipPoint(currItem, np);
}
else
{
if ( buttonState & ShiftButton )
view->moveGroup(0, 10);
else if ( buttonState & ControlButton )
view->moveGroup(0, 0.1);
else
view->moveGroup(0, 1);
view->moveGroup(0, moveBy);
}
slotDocCh();
}
1528,15 → 1516,8
}
break;
case modeEdit:
int oldPos = currItem->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key
view->oldCp = currItem->CPos;
if (currItem->asImageFrame() && !currItem->locked())
{
double moveBy=1.0;
if (buttonState & ShiftButton)
moveBy=10.0;
else if (buttonState & ControlButton)
moveBy=0.1;
switch (kk)
{
case Key_Left:
1553,8 → 1534,13
break;
}
}
view->oldCp = currItem->CPos;
if (currItem->itemType() == PageItem::TextFrame)
{
bool kr=keyrep;
currItem->handleModeEditKey(k, keyrep);
keyrep=kr;
/*
view->slotDoCurs(false);
switch (kk)
{
1569,19 → 1555,19
if ( (buttonState & ShiftButton) == 0 )
view->deselectAll(currItem);
}
/* ISO 14755
if ((buttonState & ControlButton) && (buttonState & ShiftButton))
{
if (!unicodeTextEditMode)
{
unicodeTextEditMode=true;
unicodeInputCount = 0;
unicodeInputString = "";
keyrep = false;
}
qDebug(QString("%1 %2 %3 %4 %5").arg("uni").arg("c+s").arg(uc).arg(kk).arg(as));
}
*/
//<< ISO 14755
//if ((buttonState & ControlButton) && (buttonState & ShiftButton))
//{
// if (!unicodeTextEditMode)
// {
// unicodeTextEditMode=true;
// unicodeInputCount = 0;
// unicodeInputString = "";
// keyrep = false;
// }
// qDebug(QString("%1 %2 %3 %4 %5").arg("uni").arg("c+s").arg(uc).arg(kk).arg(as));
//}
//>>
if (unicodeTextEditMode)
{
int conv = 0;
2094,6 → 2080,7
keyrep = false;
return;
}
*/
}
slotDocCh(false);
break;
4708,7 → 4695,7
Buffer2 += QString::number(nextItem->itemText.at(a)->cstrikewidth)+'\n';
}
}
deleteSelectedTextFromFrame(nextItem);
dynamic_cast<PageItem_TextFrame*>(nextItem)->deleteSelectedTextFromFrame();
nextItem = nextItem->NextBox;
}
view->RefreshItem(currItem);
4822,9 → 4809,9
return;
if (doc->appMode == modeEdit)
{
PageItem *currItem = view->SelItem.at(0);
PageItem_TextFrame *currItem = dynamic_cast<PageItem_TextFrame*>(view->SelItem.at(0));
if (currItem->HasSel)
deleteSelectedTextFromFrame(currItem);
currItem->deleteSelectedTextFromFrame();
if (Buffer2.startsWith("<SCRIBUSTEXT>"))
{
QString Buf = Buffer2.mid(13);
9365,3 → 9352,4
return;
ActWin->setCaption(newCaption);
}
 
/branches/Version13x/Scribus/scribus/pageitem_textframe.h
16,17 → 16,18
#ifndef PAGEITEMTEXTFRAME_H
#define PAGEITEMTEXTFRAME_H
 
#include <qevent.h>
#include <qobject.h>
#include <qwidget.h>
 
#include <qpointarray.h>
#include <qptrlist.h>
#include <qpixmap.h>
#include <qrect.h>
#include <qstring.h>
#include <qvaluestack.h>
#include <qvaluelist.h>
#include <qwidget.h>
 
#include <qstring.h>
#include <qrect.h>
 
#include "scribusapi.h"
#include "undoobject.h"
#include "scimage.h"
51,9 → 52,16
virtual PageItem_TextFrame * asTextFrame() { return this; }
virtual void clearContents();
 
virtual void handleModeEditKey(QKeyEvent *k, bool& keyRepeat);
void deleteSelectedTextFromFrame();
protected:
virtual void DrawObj_Item(ScPainter *p, QRect e, double sc);
bool unicodeTextEditMode;
int unicodeInputCount;
QString unicodeInputString;
 
};
 
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
1,5 → 1,6
#include "cmdtext.h"
#include "cmdutil.h"
#include "pageitem_textframe.h"
#include "prefsmanager.h"
 
PyObject *scribus_getfontsize(PyObject* /* self */, PyObject* args)
638,7 → 639,7
return NULL;
}
if (it->HasSel)
ScApp->deleteSelectedTextFromFrame(it);
dynamic_cast<PageItem_TextFrame*>(it)->deleteSelectedTextFromFrame();
else
{
for (ScText *itx = it->itemText.first(); itx != 0; itx = it->itemText.next())
/branches/Version13x/Scribus/scribus/scribus.h
136,7 → 136,8
void keyReleaseEvent(QKeyEvent *k);
void mouseReleaseEvent(QMouseEvent *m);
void wheelEvent(QWheelEvent *w);
void deleteSelectedTextFromFrame(PageItem *currItem);
//CB Moved to pageitem_textframe
//void deleteSelectedTextFromFrame(PageItem *currItem);
void setTBvals(PageItem *currItem);
void ShowSubs();
void applyNewMaster(QString name);
231,8 → 232,8
int HavePngAlpha;
int HaveTiffSep;
bool unicodeTextEditMode;
int unicodeInputCount;
QString unicodeInputString;
//int unicodeInputCount;
//QString unicodeInputString;
 
QMap<QString, QStringList> InstLang;
QMap<QString,QString> LangTransl;
544,7 → 545,6
QToolButton* DatPri;
QToolButton* DatPDF;
QToolButton* DatNeu;
int KeyMod;
int toolbarMenuTools;
int toolbarMenuPDFTools;
int viewToolbars;