View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001639 | Scribus | Internal | public | 2005-02-07 07:03 | 2005-02-08 13:11 |
Reporter | Assigned To | cbradney | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | x86 Linux | OS | Fedora Core | OS Version | 3 |
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.3.0cvs | ||||
Summary | 0001639: PATCH: Convert PageItem::PType to a protected enumerated member | ||||
Description | The attached patch converts PageItem::PType to a protected member of a new enum type `PageItem::ItemType'. It converts all usage of the member across the codebase to a new getter function PageItem::itemType() and to the new enums. I also converted CopyPasteBuffer to use the enum for PType, so that there are no hassles with type conversion. This patch obsoletes frame types 1 and 3, which appear to be unused in the code. It would be good if someone could ensure this is in fact correct and that it won't affect the loading of old documents. I'm not sure, and don't know how far back I'd need to go to be able to get type 1 and 3 frames (which appear to be polygon variants, an ellipse and something else) anyway. I've also included a check in tree.cpp for the failure to create a ListViewItem. This resolves the crash I was seeing (and Tsoots was seeing) in the outline palette in current CVS. It doesn't fix the underlying bug - I understand Franz is working on that code so I didn't want to mess with it - but at least stops it crashing, and it's a sanity check that should really be there anyway. | ||||
Tags | No tags attached. | ||||
Patch | |||||
child of | 0001653 | confirmed | Convert all PageItem direct member access to use getters and setters |
2005-02-07 15:13
|
pageitem_ptype_conversion.diff (110,786 bytes)
? Makefile ? Makefile.in ? acinclude.m4 ? aclocal.m4 ? autom4te.cache ? config.h ? config.log ? config.status ? configure ? configure.files ? libtool ? stamp-h1 ? scribus/doc/en/tutorials/Makefile ? scribus/doc/en/tutorials/Makefile.in ? scribus/icons/Makefile ? scribus/icons/Makefile.in ? scribus/plugins/Makefile ? scribus/plugins/Makefile.in ? scribus/plugins/libchar/.deps ? scribus/plugins/libchar/.libs ? scribus/plugins/libchar/Makefile ? scribus/plugins/libchar/Makefile.in ? scribus/plugins/libchar/charselect.lo ? scribus/plugins/libchar/charselect.moc ? scribus/plugins/libchar/libcharselect.la ? scribus/plugins/scriptplugin/samples/Makefile ? scribus/plugins/scriptplugin/samples/Makefile.in ? scribus/plugins/scriptplugin/scripts/Makefile ? scribus/plugins/scriptplugin/scripts/Makefile.in Index: scribus/colorm.cpp =================================================================== RCS file: /cvs/Scribus/scribus/colorm.cpp,v retrieving revision 1.32.2.9 diff -u -r1.32.2.9 colorm.cpp --- scribus/colorm.cpp 2 Feb 2005 19:18:54 -0000 1.32.2.9 +++ scribus/colorm.cpp 7 Feb 2005 15:46:09 -0000 @@ -353,7 +353,7 @@ if (found) break; } - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) { for (uint d=0; d<ite->itemText.count(); ++d) { @@ -387,7 +387,7 @@ if (found) break; } - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) { for (uint d=0; d<ite->itemText.count(); ++d) { Index: scribus/fileloader.cpp =================================================================== RCS file: /cvs/Scribus/scribus/Attic/fileloader.cpp,v retrieving revision 1.1.2.35 diff -u -r1.1.2.35 fileloader.cpp --- scribus/fileloader.cpp 5 Feb 2005 15:06:47 -0000 1.1.2.35 +++ scribus/fileloader.cpp 7 Feb 2005 15:46:10 -0000 @@ -212,7 +212,7 @@ PageItem *it = app->doc->MasterItems.at(d); if ((!app->doc->UsedFonts.contains(it->IFont)) && (it->IFont != "")) it->IFont = ReplacedFonts[it->IFont]; - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { for (uint e = 0; e < it->itemText.count(); ++e) { @@ -226,7 +226,7 @@ PageItem *it = app->doc->DocItems.at(d); if ((!app->doc->UsedFonts.contains(it->IFont)) && (it->IFont != "")) it->IFont = ReplacedFonts[it->IFont]; - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { for (uint e = 0; e < it->itemText.count(); ++e) { Index: scribus/hyphenator.cpp =================================================================== RCS file: /cvs/Scribus/scribus/hyphenator.cpp,v retrieving revision 1.15.2.4 diff -u -r1.15.2.4 hyphenator.cpp --- scribus/hyphenator.cpp 3 Jan 2005 14:08:48 -0000 1.15.2.4 +++ scribus/hyphenator.cpp 7 Feb 2005 15:46:10 -0000 @@ -230,7 +230,7 @@ nb->CPos = 0; nb = nb->NextBox; } - if ((!useAble) || (nb1->PType != 4) || (nb1 ->itemText.count() == 0)) + if ((!useAble) || (nb1->itemType() != PageItem::TextFrame) || (nb1 ->itemText.count() == 0)) return; doc->DoDrawing = false; const char *word; Index: scribus/mpalette.cpp =================================================================== RCS file: /cvs/Scribus/scribus/mpalette.cpp,v retrieving revision 1.110.2.28 diff -u -r1.110.2.28 mpalette.cpp --- scribus/mpalette.cpp 7 Feb 2005 15:13:30 -0000 1.110.2.28 +++ scribus/mpalette.cpp 7 Feb 2005 15:46:11 -0000 @@ -1043,7 +1043,7 @@ SCustom->setPixmap(SCustom->getIconPixmap(1)); if (i->FrameType > 3) SCustom->setPixmap(SCustom->getIconPixmap(i->FrameType-2)); - if ((i->PType == 5) || (i->PType == 7)) + if ((i->itemType() == PageItem::Line) || (i->itemType() == PageItem::PolyLine)) { startArrow->setEnabled(true); endArrow->setEnabled(true); @@ -1155,7 +1155,7 @@ HaveItem = true; return; } - if (i->PType == 8) + if (i->itemType() == PageItem::PathText) { TabStack2->raiseWidget(1); showcurveCheckBox->setChecked(i->PoShow); @@ -1164,17 +1164,19 @@ } else TabStack2->raiseWidget(0); - if (((i->PType == 4) || (i->PType == 2) || (i->PType == 3)) && (!i->ClipEdited)) + // Frame type 3 is obsolete: CR 2005-02-06 + //if (((i->itemType() == PageItem::TextFrame) || (i->itemType() == PageItem::ImageFrame) || (i->itemType() == 3)) && (!i->ClipEdited)) + if (((i->itemType() == PageItem::TextFrame) || (i->itemType() == PageItem::ImageFrame)) && (!i->ClipEdited)) RoundRect->setEnabled(true); else { - if ((i->PType == 6) && ((i->FrameType == 0) || (i->FrameType == 2))) + if ((i->itemType() == PageItem::Polygon) && ((i->FrameType == 0) || (i->FrameType == 2))) RoundRect->setEnabled(true); else RoundRect->setEnabled(false); } - if ((i->PType == 5) && LMode) { + if ((i->itemType() == PageItem::Line) && LMode) { xposLabel->setText( tr( "&X1:" ) ); widthLabel->setText( tr( "X&2:" ) ); yposLabel->setText( tr( "Y&1:" ) ); @@ -1188,7 +1190,7 @@ Rot->setEnabled(true); } - if (i->PType == 5) + if (i->itemType() == PageItem::Line) { Kette2->setEnabled(false); if (LMode) @@ -1199,7 +1201,7 @@ else { Kette2->setEnabled(true); - if (i->PType == 2) + if (i->itemType() == PageItem::ImageFrame) { updateCmsList(); setter = i->ScaleType; @@ -1605,7 +1607,7 @@ HaveItem = false; QWMatrix ma; QPoint dp; - if ((LMode) && (CurItem->PType == 5)) + if ((LMode) && (CurItem->itemType() == PageItem::Line)) { ma.translate(static_cast<double>(Xpos->value()) / UmReFaktor, static_cast<double>(Ypos->value()) / UmReFaktor); ma.rotate(static_cast<double>(Rot->value())*(-1)); @@ -1922,7 +1924,7 @@ } else { - if ((CurItem->PType == 5) && (LMode)) + if ((CurItem->itemType() == PageItem::Line) && (LMode)) { double r = atan2(h-y,w-x)*(180.0/3.1415927); w = sqrt(pow(w-x,2)+pow(h-y,2)); @@ -1979,7 +1981,7 @@ } else { - if ((CurItem->PType == 5) && (LMode)) + if ((CurItem->itemType() == PageItem::Line) && (LMode)) { double r = atan2(h-y,w-x)*(180.0/3.1415927); w = sqrt(pow(w-x,2)+pow(h-y,2)); @@ -2038,7 +2040,7 @@ { CurItem->OldB2 = CurItem->Width; CurItem->OldH2 = CurItem->Height; - if (CurItem->PType == 5) + if (CurItem->itemType() == PageItem::Line) { if (LMode) { @@ -2135,7 +2137,7 @@ { CurItem->OldB2 = CurItem->Width; CurItem->OldH2 = CurItem->Height; - if (CurItem->PType == 5) + if (CurItem->itemType() == PageItem::Line) { if (LMode) { @@ -2525,7 +2527,7 @@ return; if ((HaveDoc) && (HaveItem)) { - if ((CurItem->PType == 2) || (CurItem->PType == 4)) + if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame)) ScApp->view->FlipImageH(); else ScApp->view->MirrorPolyH(); @@ -2539,7 +2541,7 @@ return; if ((HaveDoc) && (HaveItem)) { - if ((CurItem->PType == 2) || (CurItem->PType == 4)) + if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame)) ScApp->view->FlipImageV(); else ScApp->view->MirrorPolyV(); @@ -2748,7 +2750,7 @@ return; if ((HaveDoc) && (HaveItem)) { - if ((CurItem->PType == 7) || (CurItem->PType == 8)) + if ((CurItem->itemType() == PageItem::PolyLine) || (CurItem->itemType() == PageItem::PathText)) return; switch (f) { @@ -2766,9 +2768,9 @@ ScApp->SCustom->setPixmap(ScApp->SCustom->getIconPixmap(f)); ScApp->view->RefreshItem(CurItem); emit DocChanged(); - if ((CurItem->PType == 2) || (CurItem->PType == 4)) + if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame)) return; - CurItem->PType = 6; + CurItem->convertTo(PageItem::Polygon); NewSel(6); TabStack->raiseWidget(1); } @@ -2780,12 +2782,14 @@ return; if ((HaveDoc) && (HaveItem)) { + /* Frame types 1 and 3 are OBSOLETE: CR 2005-02-06 if ((CurItem->PType == 1) || (CurItem->PType == 3)) { CurItem->PType = 6; NewSel(6); TabStack->raiseWidget(1); } + */ emit EditCL(); emit DocChanged(); } Index: scribus/pageitem.cpp =================================================================== RCS file: /cvs/Scribus/scribus/pageitem.cpp,v retrieving revision 1.121.2.61 diff -u -r1.121.2.61 pageitem.cpp --- scribus/pageitem.cpp 5 Feb 2005 21:39:51 -0000 1.121.2.61 +++ scribus/pageitem.cpp 7 Feb 2005 15:46:11 -0000 @@ -53,7 +53,7 @@ extern void BezierPoints(QPointArray *ar, QPoint n1, QPoint n2, QPoint n3, QPoint n4); extern ScribusApp* ScApp; -PageItem::PageItem(ScribusDoc *pa, int art, double x, double y, double w, double h, double w2, QString fill, QString outline) : QObject(pa) +PageItem::PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline) : QObject(pa) { QString tmp; BackBox = 0; @@ -76,12 +76,12 @@ OldH = Height; OldB2 = Width; OldH2 = Height; - PType = art; + itemTypeVal = newType; Rot = 0; oldRot = 0; Doc = pa; fillColorVal = fill; - lineColorVal = PType == 4 ? fill : outline; + lineColorVal = itemTypeVal == PageItem::TextFrame ? fill : outline; TxtFill = Doc->toolSettings.dPenText; TxtStroke = Doc->toolSettings.dStrokeText; ShTxtStroke = 100; @@ -139,13 +139,14 @@ BBoxX = 0; BBoxH = 0; RadRect = 0; - if ((art == 4) || (art == 2)) + if ((itemTypeVal == TextFrame) || (itemTypeVal == ImageFrame)) + // TODO: Frame should become a read-only calculated property Frame = true; else Frame = false; - switch (art) + switch (itemTypeVal) { - case 6: + case Polygon: Clip.setPoints(4, static_cast<int>(w/2), 0, static_cast<int>(w), static_cast<int>(h/2), static_cast<int>(w/2), static_cast<int>(h), 0,static_cast<int>(h/2)); break; @@ -181,29 +182,29 @@ An_V_act = ""; An_C_act = ""; An_Extern = ""; - switch (PType) + switch (itemTypeVal) { - case 2: + case ImageFrame: AnName = tr("Image"); setUPixmap(Um::IImageFrame); break; - case 4: + case TextFrame: AnName = tr("Text"); setUPixmap(Um::ITextFrame); break; - case 5: + case Line: AnName = tr("Line"); setUPixmap(Um::ILine); break; - case 6: + case Polygon: AnName = tr("Polygon"); setUPixmap(Um::IPolygon); break; - case 7: + case PolyLine: AnName = tr("Polyline"); setUPixmap(Um::IPolyline); break; - case 8: + case PathText: AnName = tr("PathText"); setUPixmap(Um::IPathText); break; @@ -400,7 +401,7 @@ if (lineColor() != "None") { SetFarbe(&tmp, lineColor(), lineShade()); - if ((Pwidth == 0) && (PType != 5)) + if ((Pwidth == 0) && (itemType() != Line)) p->setLineWidth(0); else { @@ -413,9 +414,9 @@ p->setLineWidth(0); p->setBrushOpacity(1.0 - fillTransparency()); p->setPenOpacity(1.0 - lineTransparency()); - switch (PType) + switch (itemType()) { - case 2: + case ImageFrame: if (Doc->RePos) break; if ((fillColor() != "None") || (GrType != 0)) @@ -472,7 +473,7 @@ } } break; - case 5: + case Line: if (Doc->RePos) break; doStroke = false; @@ -521,15 +522,17 @@ p->fillPath(); } break; + /* OBSOLETE CR 2005-02-06 case 1: case 3: - case 6: + */ + case Polygon: if (Doc->RePos) break; p->setupPolygon(&PoLine); p->fillPath(); break; - case 7: + case PolyLine: doStroke = false; if (Doc->RePos) break; @@ -640,7 +643,7 @@ } } break; - case 4: + case TextFrame: p->save(); pf2.begin(ScApp->view->viewport()); pf2.translate(Xpos, Ypos); @@ -1723,7 +1726,7 @@ Redrawn = true; p->restore(); break; - case 8: + case PathText: if (!PoShow) doStroke = false; cl = FlattenPath(PoLine, Segments); @@ -1884,7 +1887,7 @@ if (!Doc->RePos) { double scp = QMAX(ScApp->view->Scale, 1); - if ((Frame) && (Doc->guidesSettings.framesShown) && ((PType == 2) || (PType == 4))) + if ((Frame) && (Doc->guidesSettings.framesShown) && ((itemType() == ImageFrame) || (ItemType() == TextFrame))) { p->setPen(black, 1 / scp, DotLine, FlatCap, MiterJoin); if ((isBookmark) || (isAnnotation)) @@ -1975,7 +1978,7 @@ pr.setBrush(red); if ((!Locked) && (!LockRes)) { - if (PType != 5) + if (itemType() != Line) { pr.drawRect(-1, -1, 6, 6); pr.drawRect(static_cast<int>(Width*sc), static_cast<int>(Height*sc), -6, -6); @@ -2882,42 +2885,52 @@ Language = newLanguage; } -int PageItem::frameType() const +PageItem::ItemType PageItem::itemType() const { - return PType; + return itemTypeVal; } -void PageItem::convertTo(int newType) +void PageItem::convertTo(ItemType newType) { - if (PType == newType) + if (itemTypeVal == newType) return; // nothing to do -> return + assert(newType != 1); //DEBUG CR 2005-02-06 + assert(newType != 3); //DEBUG CR 2005-02-06 QString fromType = "", toType = ""; - switch (PType) + switch (itemTypeVal) { - case 2: fromType = Um::ImageFrame; break; - case 4: fromType = Um::TextFrame; break; - case 6: fromType = Um::Polygon; break; - default: fromType = ""; break; + case ImageFrame: + fromType = Um::ImageFrame; + break; + case TextFrame: + fromType = Um::TextFrame; + break; + case Polygon: + fromType = Um::Polygon; + break; + default: + fromType = ""; + break; } switch (newType) { - case 2: + case ImageFrame: toType = Um::ImageFrame; setUPixmap(Um::IImageFrame); break; - case 4: + case TextFrame: toType = Um::TextFrame; setUPixmap(Um::ITextFrame); break; - case 6: + case Polygon: toType = Um::Polygon; setUPixmap(Um::IPolygon); break; - case 7: + case PolyLine: toType = Um::Polyline; setUPixmap(Um::IPolyline); break; - default: + default: toType = ""; setUPixmap(NULL); break; @@ -2927,11 +2940,11 @@ SimpleState *ss = new SimpleState(Um::ConvertTo + " " + toType, QString(Um::FromTo).arg(fromType).arg(toType)); ss->set("CONVERT", "convert"); - ss->set("OLD_TYPE", PType); + ss->set("OLD_TYPE", itemTypeVal); ss->set("NEW_TYPE", newType); undoManager->action(this, ss); } - PType = newType; + itemTypeVal = newType; } void PageItem::checkChanges(bool force) Index: scribus/pageitem.h =================================================================== RCS file: /cvs/Scribus/scribus/pageitem.h,v retrieving revision 1.26.2.37 diff -u -r1.26.2.37 pageitem.h --- scribus/pageitem.h 4 Feb 2005 18:51:11 -0000 1.26.2.37 +++ scribus/pageitem.h 7 Feb 2005 15:46:12 -0000 @@ -85,10 +85,29 @@ * @brief Frame type. * @warning Do not set this property except for testing and debug purposes. */ - Q_PROPERTY(int frameType READ frameType WRITE convertTo DESIGNABLE false) + Q_ENUMS(ItemType) + Q_PROPERTY(ItemType itemType READ itemType WRITE convertTo DESIGNABLE false) -public: - PageItem(ScribusDoc *pa, int art, double x, double y, double w, double h, double w2, QString fill, QString outline); +public: + // Enumerator definitions + + /** @brief Frame Type + * + * Later, frame type will probably go away in favour of using + * subclasses and checking types using more conventional methods + * and using Qt's MetaObject introspection. + */ + enum ItemType { + ImageFrame = 2, + TextFrame = 4, + Line = 5, + Polygon = 6, + PolyLine = 7, + PathText = 8 + }; + + + PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline); ~PageItem() {}; struct ZZ { double xco; @@ -106,6 +125,7 @@ QString Farb2; QString ZFo; }; + /** Zeichnet das Item */ void paintObj(QRect e=QRect(), QPixmap *ppX = 0); void DrawObj(ScPainter *p, QRect e); @@ -133,8 +153,7 @@ double oldHeight; /** Eckrundung von Rechtecken */ double RadRect; - /** Art des Items */ - int PType; + ItemType PType; /** Winkel um den das Item gedreht wird */ double Rot; /** @brief Stores the old rotation value for undo action. Is used to detect rotation actions. */ @@ -173,6 +192,7 @@ bool PoShow; double BaseOffs; bool ClipEdited; + // Don't know exactly what this is, but it's not the same as itemType int FrameType; /** Interne Item-Nummer */ uint ItemNr; @@ -590,12 +610,12 @@ * It's here as an interim step to eliminate direct member access * on PageItems. */ - int frameType() const; + ItemType itemType() const; /** * @brief Convert this PageItem to PageItem type <code>newType</code> * @param newType PageItem type for conversion */ - void convertTo(int newType); + void convertTo(ItemType newType); /** * @brief Check the changes to the item and add undo actions for them. @@ -669,6 +689,14 @@ void select(); // Protected members + + /** + * @brief Frame Type, eg line, text frame, etc. + * + * This will probably go away when pageitem is split into + * subclasses. + */ + ItemType itemTypeVal; /** * @brief Item name. Unicode. User visible (outline, property palette, etc). Index: scribus/picstatus.cpp =================================================================== RCS file: /cvs/Scribus/scribus/picstatus.cpp,v retrieving revision 1.12.2.2 diff -u -r1.12.2.2 picstatus.cpp --- scribus/picstatus.cpp 8 Dec 2004 15:17:25 -0000 1.12.2.2 +++ scribus/picstatus.cpp 7 Feb 2005 15:46:12 -0000 @@ -69,7 +69,7 @@ Zeilen = 0; for (i=0; i < doc->MasterItems.count(); ++i) { - if (doc->MasterItems.at(i)->PType == 2) + if (doc->MasterItems.at(i)->itemType() == PageItem::ImageFrame) { Zeilen++; ItemNrs.append(i); @@ -77,7 +77,7 @@ } for (i=0; i<doc->Items.count(); ++i) { - if (doc->Items.at(i)->PType == 2) + if (doc->Items.at(i)->itemType() == PageItem::ImageFrame) { Zeilen++; ItemNrs.append(i); @@ -87,7 +87,7 @@ int Zeilen2 = 0; for (i=0; i < doc->MasterItems.count(); ++i) { - if (doc->MasterItems.at(i)->PType == 2) + if (doc->MasterItems.at(i)->itemType() == PageItem::ImageFrame) { QFileInfo fi = QFileInfo(doc->MasterItems.at(i)->Pfile); PicTable->setText(Zeilen2, 0, fi.fileName()); @@ -122,7 +122,7 @@ } for (i=0; i< doc->Items.count(); ++i) { - if (doc->Items.at(i)->PType == 2) + if (doc->Items.at(i)->itemType() == PageItem::ImageFrame) { QFileInfo fi = QFileInfo(doc->Items.at(i)->Pfile); PicTable->setText(Zeilen2, 0, fi.fileName()); Index: scribus/scpreview.cpp =================================================================== RCS file: /cvs/Scribus/scribus/scpreview.cpp,v retrieving revision 1.17.2.11 diff -u -r1.17.2.11 scpreview.cpp --- scribus/scpreview.cpp 16 Jan 2005 15:28:40 -0000 1.17.2.11 +++ scribus/scpreview.cpp 7 Feb 2005 15:46:12 -0000 @@ -180,7 +180,8 @@ QString CurDirP = QDir::currentDirPath(); QDir::setCurrent(QDir::homeDirPath()); Segments.clear(); - OB.PType = QStoInt(pg.attribute("PTYPE")); + // TODO: Nicer conversion + OB.PType = static_cast<PageItem::ItemType>(QStoInt(pg.attribute("PTYPE"))); OB.Xpos = QStodouble(pg.attribute("XPOS")) - GrX; OB.Ypos = QStodouble(pg.attribute("YPOS")) - GrY; OB.Width = QStodouble(pg.attribute("WIDTH")); @@ -508,7 +509,7 @@ doStroke = true; switch (OB.PType) { - case 2: + case PageItem::ImageFrame: if ((OB.Pcolor != "None") || (OB.GrType != 0)) { pS->setupPolygon(&OB.PoLine); @@ -542,7 +543,7 @@ } } break; - case 4: + case PageItem::TextFrame: if (Ptexti.count() != 0) { pS->save(); @@ -601,7 +602,7 @@ pS->restore(); } break; - case 5: + case PageItem::Line: if (OB.NamedLStyle == "") pS->drawLine(FPoint(0, 0), FPoint(OB.Width, 0)); else @@ -647,13 +648,15 @@ } doStroke = false; break; + /* OBSOLETE Craig R 2005-02-06 case 1: case 3: - case 6: + */ + case PageItem::Polygon: pS->setupPolygon(&OB.PoLine); pS->drawPolygon(); break; - case 7: + case PageItem::PolyLine: pS->setupPolygon(&OB.PoLine); if (OB.NamedLStyle == "") pS->drawPolyLine(); @@ -720,7 +723,7 @@ } doStroke = false; break; - case 8: + case PageItem::PathText: if (!OB.PoShow) doStroke = false; cl = FlattenPath(OB.PoLine, Segments); Index: scribus/scribus.cpp =================================================================== RCS file: /cvs/Scribus/scribus/scribus.cpp,v retrieving revision 1.228.2.156 diff -u -r1.228.2.156 scribus.cpp --- scribus/scribus.cpp 7 Feb 2005 15:13:30 -0000 1.228.2.156 +++ scribus/scribus.cpp 7 Feb 2005 15:46:16 -0000 @@ -1965,7 +1965,7 @@ } break; default: - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { /* CB TODO if ((kk + KeyMod) == Prefs.KeyActions[59].KeyID) @@ -1995,7 +1995,7 @@ case EditMode: int oldPos = b->CPos; // 15-mar-2004 jjsa for cursor movement with Shift + Arrow key view->oldCp = b->CPos; - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { switch (kk) { @@ -2045,7 +2045,7 @@ break; } } - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { view->slotDoCurs(false); switch (kk) @@ -3088,7 +3088,7 @@ { if (view->SelItem.count() != 0) { - HaveNewSel(view->SelItem.at(0)->PType); + HaveNewSel(view->SelItem.at(0)->itemType()); view->EmitValues(view->SelItem.at(0)); } else @@ -3402,7 +3402,7 @@ scrActions["viewShowTextChain"]->setOn(doc->guidesSettings.linkShown); for (uint b=0; b<doc->Items.count(); ++b) { - if (doc->Items.at(b)->PType == 2) + if (doc->Items.at(b)->itemType() == PageItem::ImageFrame) doc->Items.at(b)->PicArt = doc->guidesSettings.showPic; } view->reformPages(); @@ -3905,7 +3905,7 @@ firstElem = b->Groups.top(); for (uint bx=0; bx<view->SelItem.count(); ++bx) { - if (view->SelItem.at(bx)->PType != 6) + if (view->SelItem.at(bx)->itemType() != PageItem::Polygon) hPoly = false; if (view->SelItem.at(bx)->Groups.count() != 0) { @@ -3919,7 +3919,7 @@ scrActions["itemCombinePolygons"]->setEnabled(hPoly); if (view->SelItem.count() == 2) { - if (((b->PType == 4) || (view->SelItem.at(1)->PType == 4)) && ((b->PType == 7) || (view->SelItem.at(1)->PType == 7))) + if (((b->itemType() == PageItem::TextFrame) || (view->SelItem.at(1)->itemType() == PageItem::TextFrame)) && ((b->itemType() == PageItem::PolyLine) || (view->SelItem.at(1)->itemType() == PageItem::PolyLine))) { PageItem* bx = view->SelItem.at(1); if ((b->NextBox == 0) && (b->BackBox == 0) && (bx->NextBox == 0) && (bx->BackBox == 0) && (b->Groups.count() == 0)) @@ -3944,7 +3944,7 @@ else { scrActions["itemUngroup"]->setEnabled(false); - scrActions["itemSplitPolygons"]->setEnabled( (b->PType == 6) && (b->Segments.count() != 0) ); + scrActions["itemSplitPolygons"]->setEnabled( (b->PType == PageItem::Polygon) && (b->Segments.count() != 0) ); } if (b->locked()) { @@ -4243,7 +4243,7 @@ for (uint azz = cc; azz < doc->Items.count(); ++azz) { PageItem *ite = doc->Items.at(azz); - if ((ite->PType == 4) && (ite->isBookmark)) + if ((ite->itemType() == PageItem::TextFrame) && (ite->isBookmark)) BookPal->BView->AddPageItem(ite); } Mpal->Cpal->SetColors(doc->PageColors); @@ -4566,7 +4566,7 @@ for (uint azz=0; azz<doc->MasterItems.count(); ++azz) { PageItem *ite = doc->MasterItems.at(azz); - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) ite->DrawObj(painter, rd); } // RestoreBookMarks(); @@ -4575,16 +4575,16 @@ PageItem *ite = doc->Items.at(azz); view->setRedrawBounding(ite); ite->OwnPage = view->OnPage(ite); - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) ite->DrawObj(painter, rd); /* if (doc->OldBM) { - if ((ite->PType == 4) && (ite->isBookmark)) + if ((ite->itemType() == PageItem::TextFrame) && (ite->isBookmark)) BookPal->BView->AddPageItem(ite); } else { - if ((ite->PType == 4) && (ite->isBookmark)) + if ((ite->itemType() == PageItem::TextFrame) && (ite->isBookmark)) BookPal->BView->ChangeItem(ite->BMnr, ite->ItemNr); } */ } @@ -4640,7 +4640,7 @@ if (view->SelItem.count() != 0) { PageItem *b = view->SelItem.at(0); - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { QString formats = ""; QString formatD = tr("All Supported Formats")+" ("; @@ -4695,7 +4695,7 @@ slotDocCh(); } } - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { gtGetText* gt = new gtGetText(); gt->run(false); @@ -5497,7 +5497,7 @@ { b = view->SelItem.at(0); view->EmitValues(b); - HaveNewSel(b->PType); + HaveNewSel(b->itemType()); } } } @@ -6051,7 +6051,7 @@ doc->guidesSettings.showPic = !doc->guidesSettings.showPic; for (uint b=0; b<doc->Items.count(); ++b) { - if (doc->Items.at(b)->PType == 2) + if (doc->Items.at(b)->itemType() == PageItem::ImageFrame) doc->Items.at(b)->PicArt = doc->guidesSettings.showPic; } view->DrawNew(); @@ -6195,7 +6195,7 @@ else Npal->EditCont->setEnabled(true); Npal->ResetCont->setEnabled(false); - Npal->PolyStatus(b->PType, b->PoLine.size()); + Npal->PolyStatus(b->itemType(), b->PoLine.size()); } } scrActions["itemShapeEdit"]->setOn(doc->EditClip); @@ -6229,7 +6229,7 @@ view->EditContour = false; if (view->SelItem.count() != 0) { - HaveNewSel(view->SelItem.at(0)->PType); + HaveNewSel(view->SelItem.at(0)->itemType()); view->DrawNew(); } else @@ -6314,7 +6314,7 @@ view->PGS->PageCombo->setFocusPolicy(QWidget::NoFocus); if (b != 0) { - if ((b->PType == 6) || (b->PType == 7) || (b->PType == 8)) + if ((b->itemType() == PageItem::Polygon) || (b->itemType() == PageItem::PolyLine) || (b->itemType() == PageItem::PathText)) { doc->appMode = 1; ToggleFrameEdit(); @@ -6785,7 +6785,7 @@ if (view->SelItem.count() != 0) { PageItem *b = view->SelItem.at(0); - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) view->ItemTextBrush(ColorMenC->text(id)); else view->ItemBrush(ColorMenC->text(id)); @@ -6803,7 +6803,7 @@ PageItem *b = view->SelItem.at(0); if (c != -1) { - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) view->ItemTextBrushS(c); else view->ItemBrushShade(c); @@ -6816,7 +6816,7 @@ c = dia->getEditText().toInt(&ok); if (ok) { - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) view->ItemTextBrushS(c); else view->ItemBrushShade(c); @@ -6837,7 +6837,7 @@ if (view->SelItem.count() != 0) { b = view->SelItem.at(0); - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) { if ((doc->appMode == EditMode) && (b->itemText.count() != 0)) { @@ -6996,7 +6996,7 @@ for (uint d=0; d<doc->DocItems.count(); ++d) { ite = doc->Items.at(d); - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) { for (uint e=0; e<ite->itemText.count(); ++e) { @@ -7042,7 +7042,7 @@ for (uint d=0; d<doc->MasterItems.count(); ++d) { ite = doc->MasterItems.at(d); - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) { for (uint e=0; e<ite->itemText.count(); ++e) { @@ -7240,7 +7240,7 @@ for (c=0; c<doc->DocItems.count(); ++c) { ite = doc->DocItems.at(c); - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) { for (d=0; d<ite->itemText.count(); ++d) { @@ -7271,7 +7271,7 @@ for (c=0; c<doc->MasterItems.count(); ++c) { ite = doc->MasterItems.at(c); - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) { for (d=0; d<ite->itemText.count(); ++d) { @@ -7583,7 +7583,7 @@ Vtv = dia->VerteilenV->isChecked(); view->AlignObj(xa, ya, Vth, Vtv, xdp, ydp, xart, yart); slotDocCh(); - HaveNewSel(view->SelItem.at(0)->PType); + HaveNewSel(view->SelItem.at(0)->itemType()); for (uint i = 0; i < view->SelItem.count(); ++i) view->SelItem.at(i)->checkChanges(true); // force aligned items to check their changes undoManager->commit(); // commit and send the action to the UndoManager @@ -9973,7 +9973,7 @@ for (uint b = 0; b < doc->MasterItems.count(); ++b) { PageItem* ite = doc->MasterItems.at(b); - if (ite->PType == 2) + if (ite->itemType() == PageItem::ImageFrame) { QFileInfo itf = QFileInfo(ite->Pfile); if (itf.exists()) @@ -9984,7 +9984,7 @@ fileWatcher->addFile(s + itf.fileName()); } } - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) { if (ite->isAnnotation) { @@ -10024,7 +10024,7 @@ for (uint b = 0; b < doc->DocItems.count(); ++b) { PageItem* ite = doc->DocItems.at(b); - if (ite->PType == 2) + if (ite->itemType() == PageItem::ImageFrame) { QFileInfo itf = QFileInfo(ite->Pfile); if (itf.exists()) @@ -10035,7 +10035,7 @@ fileWatcher->addFile(s + itf.fileName()); } } - if (ite->PType == 4) + if (ite->itemType() == PageItem::PathText) { if (ite->isAnnotation) { @@ -10106,7 +10106,7 @@ { it = doc->MasterItems.at(d); Really.insert(it->IFont, doc->UsedFonts[it->IFont]); - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { for (uint e = 0; e < it->itemText.count(); ++e) { @@ -10118,7 +10118,7 @@ { it = doc->DocItems.at(d); Really.insert(it->IFont, doc->UsedFonts[it->IFont]); - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { for (uint e = 0; e < it->itemText.count(); ++e) { @@ -10151,7 +10151,7 @@ for (uint d = 0; d < doc->MasterItems.count(); ++d) { it = doc->MasterItems.at(d); - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { for (uint e = 0; e < it->itemText.count(); ++e) { @@ -10189,7 +10189,7 @@ for (uint d = 0; d < doc->Items.count(); ++d) { it = doc->Items.at(d); - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { for (uint e = 0; e < it->itemText.count(); ++e) { @@ -10262,7 +10262,7 @@ itemError.insert(6, 0); if ((it->OwnPage == -1) && (checkerSettings.checkOrphans)) itemError.insert(3, 0); - if (it->PType == 2) + if (it->itemType() == PageItem::ImageFrame) { if ((!it->PicAvail) && (checkerSettings.checkPictures)) itemError.insert(4, 0); @@ -10277,7 +10277,7 @@ itemError.insert(8, 0); } } - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { if ((it->itemText.count() > it->MaxChars) && (checkerSettings.checkOverflow)) itemError.insert(2, 0); @@ -10319,7 +10319,7 @@ itemError.insert(7, 0); if ((it->OwnPage == -1) && (checkerSettings.checkOrphans)) itemError.insert(3, 0); - if (it->PType == 2) + if (it->itemType() == PageItem::ImageFrame) { if ((!it->PicAvail) && (checkerSettings.checkPictures)) itemError.insert(4, 0); @@ -10334,7 +10334,7 @@ itemError.insert(8, 0); } } - if ((it->PType == 4) || (it->PType == 8)) + if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText)) { if ((it->itemText.count() > it->MaxChars) && (checkerSettings.checkOverflow)) itemError.insert(2, 0); @@ -10373,7 +10373,7 @@ if (art && view->SelItem.count() != 0) { PageItem *b = view->SelItem.at(0); - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { scrMenuMgr->clearMenu("Style"); scrMenuMgr->addMenuToMenu("Color","Style"); @@ -10536,7 +10536,7 @@ if ((HaveDoc) && (view->SelItem.count() != 0)) { PageItem *b = view->SelItem.at(0); - if ((b->PType == 4) && (doc->appMode == EditMode)) + if ((b->itemType() == PageItem::TextFrame) && (doc->appMode == EditMode)) { CharSelect *dia = new CharSelect(this, b, this); dia->exec(); Index: scribus/scribusXml.cpp =================================================================== RCS file: /cvs/Scribus/scribus/scribusXml.cpp,v retrieving revision 1.83.2.45 diff -u -r1.83.2.45 scribusXml.cpp --- scribus/scribusXml.cpp 5 Feb 2005 15:06:47 -0000 1.83.2.45 +++ scribus/scribusXml.cpp 7 Feb 2005 15:46:17 -0000 @@ -205,7 +205,7 @@ } if (newFormat) ob->setAttribute("OwnPage", item->OwnPage); - ob->setAttribute("PTYPE",item->PType); + ob->setAttribute("PTYPE",item->itemType()); ob->setAttribute("XPOS",item->Xpos - xo); ob->setAttribute("YPOS",item->Ypos - yo); ob->setAttribute("WIDTH",item->Width); @@ -301,7 +301,7 @@ ob->setAttribute("TEXTRA",item->TExtra); ob->setAttribute("BEXTRA",item->BExtra); ob->setAttribute("REXTRA",item->RExtra); - if (((item->PType == 2) || (item->PType == 4)) && (item->Pfile != "")) + if (((item->itemType() == PageItem::ImageFrame) || (item->itemType() == PageItem::TextFrame)) && (item->Pfile != "")) ob->setAttribute("PFILE",Path2Relative(item->Pfile)); else ob->setAttribute("PFILE",""); @@ -2004,7 +2004,7 @@ vg.BaseAdj = doc->docParagraphStyles[item->textAlignment].BaseAdj; UsedStyles[item->textAlignment] = vg; } - if (((item->PType == 4) || (item->PType == 8)) && (item->itemText.count() != 0)) + if (((item->itemType() == PageItem::TextFrame) || (item->itemType() == PageItem::PathText)) && (item->itemText.count() != 0)) { for (uint tx = 0; tx < item->itemText.count(); ++tx) { Index: scribus/scribusstructs.h =================================================================== RCS file: /cvs/Scribus/scribus/Attic/scribusstructs.h,v retrieving revision 1.1.2.17 diff -u -r1.1.2.17 scribusstructs.h --- scribus/scribusstructs.h 5 Feb 2005 15:36:53 -0000 1.1.2.17 +++ scribus/scribusstructs.h 7 Feb 2005 15:46:18 -0000 @@ -43,7 +43,7 @@ struct CopyPasteBuffer { - int PType; + PageItem::ItemType PType; double Xpos; double Ypos; double Width; @@ -537,6 +537,7 @@ typedef QMap<QString,QString> ProfilesL; typedef QValueVector<SingleLine> multiLine; typedef QMap<int, int> errorCodes; + enum AppMode { NormalMode, Index: scribus/scribusview.cpp =================================================================== RCS file: /cvs/Scribus/scribus/scribusview.cpp,v retrieving revision 1.76.2.99 diff -u -r1.76.2.99 scribusview.cpp --- scribus/scribusview.cpp 7 Feb 2005 14:31:16 -0000 1.76.2.99 +++ scribus/scribusview.cpp 7 Feb 2005 15:46:21 -0000 @@ -293,7 +293,7 @@ b = SelItem.at(0); } if ((((Doc->appMode == LinkFrames) || (Doc->appMode == UnlinkFrames)) - && (b->PType == 4)) || (Doc->guidesSettings.linkShown)) + && (b->itemType() == PageItem::TextFrame)) || (Doc->guidesSettings.linkShown)) { PageItem *nb = b; if (Doc->guidesSettings.linkShown) @@ -608,7 +608,7 @@ if (!((Doc->EditClip) && (Mpressed))) b->DrawObj(painter, clip); b->Redrawn = true; - if ((b->PType == 4) && ((b->NextBox != 0) || (b->BackBox != 0))) + if ((b->itemType() == PageItem::TextFrame) && ((b->NextBox != 0) || (b->BackBox != 0))) { PageItem *nb = b; while (nb != 0) @@ -621,7 +621,7 @@ if (linkedFramesToShow.find(nb) == -1) linkedFramesToShow.append(nb); } - if ((Doc->appMode == EditMode) && (b->Select) && (b->PType == 4)) + if ((Doc->appMode == EditMode) && (b->Select) && (b->itemType() == PageItem::TextFrame)) { HR->ItemPos = b->Xpos - Doc->ScratchLeft; HR->ItemEndPos = (b->Xpos+b->Width) - Doc->ScratchLeft; @@ -954,7 +954,7 @@ /* if ((SeleItemPos(e->pos())) && (!text.startsWith("<SCRIBUSELEM"))) { b = SelItem.at(0); - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { if ((fi.exists()) && (img)) { @@ -1072,7 +1072,7 @@ { bb = pasted.at(dre); b = SelItem.at(dre); - if ((b->PType == 4) && ((b->NextBox != 0) || (b->BackBox != 0))) + if ((b->itemType() == PageItem::TextFrame) && ((b->NextBox != 0) || (b->BackBox != 0))) { if (b->BackBox != 0) { @@ -1139,7 +1139,7 @@ SelItem.append(b); b->isSingleSel = true; b->Select = true; - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); EmitValues(b); b->paintObj(); } @@ -1151,7 +1151,7 @@ } if (GetItem(&b)) { - if ((b->PType == 6) || (b->PType == 7) || (b->PType == 2) || (b->PType == 8)) + if ((b->itemType() == PageItem::Polygon) || (b->itemType() == PageItem::PolyLine) || (b->itemType() == PageItem::ImageFrame) || (b->itemType() == PageItem::PathText)) { if ((b->locked()) || (!b->ScaleType)) { @@ -1161,7 +1161,7 @@ emit Amode(EditMode); } else - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { emit b->isAnnotation ? AnnotProps() : Amode(EditMode); contentsMousePressEvent(m); @@ -1384,7 +1384,7 @@ emit ItemFarben(b->lineColor(), b->fillColor(), b->lineShade(), b->fillShade()); emit ItemGradient(b->GrType); emit ItemTrans(b->fillTransparency(), b->lineTransparency()); - emit HaveSel(7); + emit HaveSel(PageItem::PolyLine); } updateContents(); emit PaintingDone(); @@ -1509,7 +1509,7 @@ QPopupMenu *pmenLevel = new QPopupMenu(); QPopupMenu *pmenPDF = new QPopupMenu(); - if ((b->PType == 4) || (b->PType == 2) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame) || (b->itemType() == PageItem::PathText)) { QButtonGroup *InfoGroup = new QButtonGroup( this, "InfoGroup" ); InfoGroup->setFrameShape( QButtonGroup::NoFrame ); @@ -1533,7 +1533,7 @@ QLabel *CharC = new QLabel(InfoGroup, "cc"); QLabel *PrintCT = new QLabel(InfoGroup, "nt"); // <a.l.e> QLabel *PrintC = new QLabel(InfoGroup, "nc"); // </a.l.e> - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { QFileInfo fi = QFileInfo(b->Pfile); InfoT->setText( tr("Picture")); @@ -1552,7 +1552,7 @@ txtC2.setNum(qRound(72.0 / b->LocalScY))); InfoGroupLayout->addWidget( CharC, 3, 1 ); } - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) { int Parag = 0; int Words = 0; @@ -1560,7 +1560,7 @@ int ParagN = 0; int WordsN = 0; int CharaN = 0; - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if ((b->NextBox != 0) || (b->BackBox != 0)) InfoT->setText( tr("Linked Text")); @@ -1608,7 +1608,7 @@ pmen->insertItem( tr("In&fo"), pmen4); } - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { ScApp->scrActions["fileImportImage"]->addTo(pmen); //pmen->insertItem( tr("&Get Picture..."), this, SIGNAL(LoadPic())); @@ -1621,7 +1621,7 @@ if ((b->PicAvail) && (!b->isTableItem)) pmen->insertItem( tr("&Adjust Frame to Picture"), this, SLOT(FrameToPic())); } - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { ScApp->scrActions["fileImportText"]->addTo(pmen); ScApp->scrActions["fileImportAppendText"]->addTo(pmen); @@ -1644,7 +1644,7 @@ } pmen->insertItem( tr("&PDF Options"), pmenPDF); } - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) pmen->insertItem( tr("Edit Text..."), this, SIGNAL(EditText())); if (!b->locked()) pmen->insertItem( tr("&Lock"), this, SLOT(ToggleLock())); @@ -1669,7 +1669,7 @@ } connect(pmen3, SIGNAL(activated(int)), this, SLOT(sentToLayer(int))); } - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) pmen->insertItem( tr("&Insert Sample Text"), this, SLOT(LoremIpsum())); if (!b->locked()) { @@ -1703,9 +1703,9 @@ pmenLevel->insertItem( tr("&Raise"), this, SLOT(RaiseItem())); } } - if (((b->PType == 4) || (b->PType == 2) || (b->PType == 6)) && (Doc->appMode != EditMode)) + if (((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame) || (b->itemType() == PageItem::Polygon)) && (Doc->appMode != EditMode)) { - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { pmen2->insertItem( tr("&Picture Frame"), this, SLOT(ToPicFrame())); if (!b->isTableItem) @@ -1714,13 +1714,13 @@ pmen2->insertItem( tr("&Outlines"), this, SLOT(TextToPath())); } } - if (b->PType == 2) + if (b->PType == PageItem::ImageFrame) { pmen2->insertItem( tr("&Text Frame"), this, SLOT(ToTextFrame())); if (!b->isTableItem) pmen2->insertItem( tr("Pol&ygon"), this, SLOT(ToPolyFrame())); } - if (b->PType == 6) + if (b->PType == PageItem::Polygon) { pmen2->insertItem( tr("&Text Frame"), this, SLOT(ToTextFrame())); pmen2->insertItem( tr("&Picture Frame"), this, SLOT(ToPicFrame())); @@ -1733,11 +1733,11 @@ ScApp->scrActions["editCut"]->addTo(pmen); if (!(b->isTableItem && b->isSingleSel)) ScApp->scrActions["editCopy"]->addTo(pmen); - if ((Doc->appMode == EditMode) && (ScApp->Buffer2.startsWith("<SCRIBUSTEXT")) && (b->PType == 4)) + if ((Doc->appMode == EditMode) && (ScApp->Buffer2.startsWith("<SCRIBUSTEXT")) && (b->itemType() == PageItem::TextFrame)) ScApp->scrActions["editPaste"]->addTo(pmen); if (!b->locked() && (Doc->appMode != 7) && (!(b->isTableItem && b->isSingleSel))) pmen->insertItem( tr("&Delete"), this, SLOT(DeleteItem())); - if ((b->PType == 2) || (b->PType == 4)) + if ((b->itemType() == PageItem::ImageFrame) || (b->itemType() == PageItem::TextFrame)) pmen->insertItem( tr("C&lear Contents"), this, SLOT(ClearItem())); pmen->insertSeparator(); if (!ScApp->Mpal->isVisible()) @@ -1904,14 +1904,14 @@ } else npx = ApplyGridF(transformPointI(FPoint(nx, ny), b->Xpos, b->Ypos, b->Rot, 1, 1)); - if ((HowTo == 1) && (b->PType != 5) && (Doc->SnapGuides)) + if ((HowTo == 1) && (b->itemType() != PageItem::Line) && (Doc->SnapGuides)) SizeItem(npx.x(), npx.y(), b->ItemNr); bool sav = Doc->SnapGuides; Doc->SnapGuides = false; switch (HowTo) { case 1: - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { if (b->isTableItem) { @@ -2009,7 +2009,7 @@ b->Sizing = false; break; case 2: - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { if (b->isTableItem) { @@ -2361,7 +2361,7 @@ MoveItemI(0, (b->Height - b->OldH2)/b->LocalScY, b->ItemNr, false); break; } - if ((b->PType == 4) && (m->state() & ShiftButton) && (m->state() & ControlButton)) + if ((b->itemType() == PageItem::TextFrame) && (m->state() & ShiftButton) && (m->state() & ControlButton)) { double scx = b->Width / b->OldB2; double scy = b->Height / b->OldH2; @@ -2384,7 +2384,7 @@ } } } - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { AdjustPictScale(b); AdjustPreview(b, false); @@ -2426,7 +2426,7 @@ else { b = SelItem.at(0); - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { if (fabs(b->Width) < 5) b->Width = 5; @@ -2509,7 +2509,7 @@ { setGroupRect(); paintGroupRect(); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); double x, y, w, h; getGroupRect(&x, &y, &w, &h); emit ItemPos(x, y); @@ -2517,7 +2517,7 @@ } else { - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); EmitValues(b); } } @@ -2526,7 +2526,7 @@ { b = SelItem.at(0); uint a; - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if (oldCp == b->CPos) { @@ -2962,13 +2962,13 @@ } if (Mpressed && (Doc->appMode == EditMode) && (!HanMove)) { - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { MoveItemI((newX-Mxp)/b->LocalScX, (newY-Myp)/b->LocalScY, b->ItemNr); Mxp = newX; Myp = newY; } - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { for (a = 0; a < b->itemText.count(); ++a) b->itemText.at(a)->cselect = false; @@ -3179,7 +3179,7 @@ nx = np.x(); ny = np.y(); p.end(); - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { if ((Doc->useRaster) && (OnPage(b) != -1)) { @@ -3224,7 +3224,7 @@ } break; case 2: - if (b->PType == 5) + if (b->itemType() == PageItem::Line) { p.begin(viewport()); Transform(b, &p); @@ -3508,9 +3508,9 @@ qApp->setOverrideCursor(QCursor(loadIcon("Rotieren2.xpm")), true); if (Doc->appMode == EditMode) { - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) qApp->setOverrideCursor(QCursor(ibeamCursor), true); - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) qApp->setOverrideCursor(QCursor(loadIcon("HandC.xpm")), true); } if (!b->sizeLocked()) @@ -3704,7 +3704,7 @@ return; if (ClRe != -1) { - if (b->PType == 6) + if (b->itemType() == PageItem::Polygon) { if ((ClRe != 0) && (ClRe != static_cast<int>(EndInd-2))) { @@ -3760,13 +3760,13 @@ b->ClipEdited = true; edited = true; Doc->EditClipMode = 0; - b->PType = 7; + b->convertTo(PageItem::PolyLine); SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1))); emit PolyOpen(); } else { - if ((b->PType == 7) || (b->PType == 8)) + if ((b->itemType() == PageItem::PolyLine) || (b->itemType() == PageItem::PathText)) { if ((ClRe > 1) && (ClRe < static_cast<int>(Clip.size()-2))) { @@ -3797,7 +3797,7 @@ { if (!EdPoints) return; - if ((b->PType == 6) || (b->PType == 4) || (b->PType == 2)) + if ((b->itemType() == PageItem::Polygon) || (b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame)) { if ((b->Segments.count() == 0) && (Clip.size() < 13)) return; @@ -3817,7 +3817,7 @@ { if (ClRe == static_cast<int>(StartInd)) { - if ((b->PType == 6) || (b->PType == 4) || (b->PType == 2)) + if ((b->itemType() == PageItem::Polygon) || (b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame)) { FPoint kp = Clip.point(EndInd-3); cli.putPoints(0, StartInd, Clip); @@ -3864,11 +3864,11 @@ } if (edited) { - if (b->PType != 7) + if (b->itemType() != PageItem::PolyLine) b->Clip = FlattenPath(b->PoLine, b->Segments); AdjustItemSize(b); updateContents(); - emit PStatus(b->PType, b->PoLine.size()); + emit PStatus(b->itemType(), b->PoLine.size()); emit DocChanged(); qApp->setOverrideCursor(QCursor(pointingHandCursor), true); } @@ -3963,7 +3963,7 @@ HandleSizer(&p, b, mpo, m); if (HowTo != 0) { - if (b->PType != 5) + if (b->itemType() != PageItem::Line) b->Sizing = true; mCG = true; } @@ -4016,19 +4016,19 @@ SetupDraw(z); break; } - emit HaveSel(6); + emit HaveSel(PageItem::Polygon); break; case DrawPicture: selectPage(m); z = PaintPict(Rxp, Ryp, 1+Rxpd, 1+Rypd); SetupDraw(z); - emit HaveSel(2); + emit HaveSel(PageItem::ImageFrame); break; case DrawText: selectPage(m); z = PaintText(Rxp, Ryp, 1+Rxpd, 1+Rypd, Doc->toolSettings.dWidth, Doc->toolSettings.dPenText); SetupDraw(z); - emit HaveSel(4); + emit HaveSel(PageItem::TextFrame); break; case Magnifier: Mpressed = true; @@ -4067,13 +4067,13 @@ b = SelItem.at(0); oldCp = b->CPos; slotDoCurs(true); - if ((!inText) && ((b->PType == 4) || (b->PType == 2))) + if ((!inText) && ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame))) { Deselect(true); if (SeleItem(m)) { b = SelItem.at(0); - if ((b->PType == 4) || (b->PType == 2)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame)) emit Amode(EditMode); else { @@ -4089,7 +4089,7 @@ } else { - if ((m->button() == MidButton) && (b->PType == 4)) + if ((m->button() == MidButton) && (b->itemType() == PageItem::TextFrame)) { Mpressed = false; MidButt = false; @@ -4135,7 +4135,7 @@ emit ItemFarben(b->lineColor(), b->fillColor(), b->lineShade(), b->fillShade()); emit ItemGradient(b->GrType); emit ItemTrans(b->fillTransparency(), b->lineTransparency()); - emit HaveSel(5); + emit HaveSel(PageItem::Line); break; case Rotation: if (GetItem(&b)) @@ -4278,7 +4278,7 @@ emit ItemFarben(b->lineColor(), b->fillColor(), b->lineShade(), b->fillShade()); emit ItemGradient(b->GrType); emit ItemTrans(b->fillTransparency(), b->lineTransparency()); - emit HaveSel(6); + emit HaveSel(PageItem::Polygon); break; } case DrawBezierLine: @@ -4321,7 +4321,7 @@ emit ItemFarben(b->lineColor(), b->fillColor(), b->lineShade(), b->fillShade()); emit ItemGradient(b->GrType); emit ItemTrans(b->fillTransparency(), b->lineTransparency()); - emit HaveSel(7); + emit HaveSel(PageItem::PolyLine); break; case InsertPDFButton: case InsertPDFTextfield: @@ -4364,7 +4364,7 @@ break; } SetupDraw(z); - emit HaveSel(4); + emit HaveSel(PageItem::TextFrame); break; case DrawFreehandLine: RecordP.resize(0); @@ -4459,7 +4459,7 @@ b->Ypos = page->YGuides[yg]+page->Yoffset; break; } - if (b->PType == 5) + if (b->itemType() == PageItem::Line) { QWMatrix ma; ma.translate(b->Xpos, b->Ypos); @@ -4491,7 +4491,7 @@ b->Xpos = page->XGuides[xg]+page->Xoffset; break; } - if (b->PType == 5) + if (b->itemType() == PageItem::Line) { QWMatrix ma; ma.translate(b->Xpos, b->Ypos); @@ -4619,7 +4619,7 @@ getBoundingRect(b, &b->BoundingX, &b->BoundingY, &bw, &bh); b->BoundingW = bw - b->BoundingX; b->BoundingH = bh - b->BoundingY; - if (b->PType == 5) + if (b->itemType() == PageItem::Line) b->BoundingH = QMAX(b->BoundingH, 1); } @@ -4826,15 +4826,15 @@ if (Doc->appMode == DrawBezierLine) return; int ph = static_cast<int>(QMAX(1.0, b->Pwidth / 2.0)); - switch (b->PType) + switch (b->itemType()) { - case 5: + case PageItem::Line: b->Clip.setPoints(4, -ph,-ph, static_cast<int>(b->Width+ph),-ph, static_cast<int>(b->Width+ph),static_cast<int>(b->Height+ph), -ph,static_cast<int>(b->Height+ph)); break; default: - if (((!b->ClipEdited) || (b->FrameType < 3)) && (b->PType != 8)) + if (((!b->ClipEdited) || (b->FrameType < 3)) && (b->itemType() != PageItem::PathText)) { switch (b->FrameType) { @@ -4868,7 +4868,7 @@ { b->PoLine.map(ma); b->ContourLine.map(ma); - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) UpdatePolyClip(b); else b->Clip = FlattenPath(b->PoLine, b->Segments); @@ -4915,7 +4915,7 @@ b->GrEndY = gr.point(1).y(); b->PoLine.map(ma); b->ContourLine.map(ma); - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) UpdatePolyClip(b); else b->Clip = FlattenPath(b->PoLine, b->Segments); @@ -5109,7 +5109,7 @@ ma.scale(-1, 1); b->PoLine.map(ma); b->PoLine.translate(b->Width, 0); - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) UpdatePolyClip(b); else b->Clip = FlattenPath(b->PoLine, b->Segments); @@ -5142,7 +5142,7 @@ ma.scale(1, -1); b->PoLine.map(ma); b->PoLine.translate(0, b->Height); - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) UpdatePolyClip(b); else b->Clip = FlattenPath(b->PoLine, b->Segments); @@ -5268,7 +5268,7 @@ double x = ma2.m11() * n.x() + ma2.m21() * n.y() + ma2.dx(); double y = ma2.m22() * n.y() + ma2.m12() * n.x() + ma2.dy(); MoveItem(x-oldPos.x(), y-oldPos.y(), b); - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) UpdatePolyClip(b); setRedrawBounding(b); RefreshItem(b); @@ -5444,7 +5444,7 @@ Clip.setPoint(ClRe-2, np); } if (((ClRe == static_cast<int>(StartInd)) || (ClRe == static_cast<int>(EndInd-2))) && - ((b->PType == 6) || (b->PType == 4) || (b->PType == 2))) + ((b->itemType() == PageItem::Polygon) || (b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame))) { if (ClRe == static_cast<int>(StartInd)) { @@ -5466,7 +5466,7 @@ } } if (((ClRe == static_cast<int>(StartInd+1)) || (ClRe == static_cast<int>(EndInd-1))) && - ((b->PType == 6) || (b->PType == 4) || (b->PType == 2)) && (MoveSym)) + ((b->itemType() == PageItem::Polygon) || (b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame)) && (MoveSym)) { uint kon = 0; if (ClRe == static_cast<int>(StartInd+1)) @@ -5527,7 +5527,7 @@ return false; QPainter p; QRect oldR = getRedrawBounding(b); - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { newX = QMAX(newX, 1); newY = QMAX(newY, 1); @@ -5558,12 +5558,12 @@ } } b->RadRect = QMIN(b->RadRect, QMIN(b->Width,b->Height)/2); - if ((b->PType == 2) && (!b->Sizing) && (!Doc->EditClip)) + if ((b->itemType() == PageItem::ImageFrame) && (!b->Sizing) && (!Doc->EditClip)) { AdjustPictScale(b); AdjustPreview(b, false); } - if (b->PType == 5) + if (b->itemType() == PageItem::Line) { if (!fromMP) { @@ -5584,9 +5584,9 @@ emit ItemRadius(b->RadRect); b->FrameOnly = true; b->Tinput = true; - if ((HowTo == 1) && (b->PType != 5)) + if ((HowTo == 1) && (b->itemType() != PageItem::Line)) b->paintObj(); - if ((b->FrameType == 0) || (b->PType == 5) || (HowTo != 1)) + if ((b->FrameType == 0) || (b->itemType() == PageItem::Line) || (HowTo != 1)) return true; QPainter p; p.begin(viewport()); @@ -5659,7 +5659,7 @@ { PageItem *b = Doc->Items.at(ite); QRect oldR = getRedrawBounding(b); - if (b->PType == 5) + if (b->itemType() == PageItem::Line) { QWMatrix ma; ma.translate(b->Xpos, b->Ypos); @@ -5737,7 +5737,7 @@ p.setRasterOp(XorROP); p.setBrush(NoBrush); p.setPen(QPen(white, 1, DotLine, FlatCap, MiterJoin)); - if ((b->PType != 5) && (b->FrameType != 0) || (b->PType == 7)) + if ((b->itemType() != PageItem::Line) && (b->FrameType != 0) || (b->itemType() == PageItem::PolyLine)) b->DrawPolyL(&p, b->Clip); else p.drawRect(0, 0, static_cast<int>(b->Width)+1, static_cast<int>(b->Height)+1); @@ -5754,7 +5754,7 @@ p.setRasterOp(XorROP); p.setBrush(NoBrush); p.setPen(QPen(white, 1, DotLine, FlatCap, MiterJoin)); - if ((b->PType != 5) && (b->FrameType != 0) || (b->PType == 7)) + if ((b->itemType() != PageItem::Line) && (b->FrameType != 0) || (b->itemType() == PageItem::PolyLine)) b->DrawPolyL(&p, b->Clip); else p.drawRect(0, 0, static_cast<int>(b->Width)+1, static_cast<int>(b->Height)+1); @@ -5855,7 +5855,7 @@ h -= g; h1 = transformPoint(h, 0, 0, 0, scx, scy); bb->Pwidth = QMAX(bb->Pwidth*((scx+scy)/2), 0.01); - if (bb->PType == 5) + if (bb->itemType() == PageItem::Line) { bb->Rot = atan2(t1.y()-b1.y(),t1.x()-b1.x())*(180.0/M_PI); bb->Width = sqrt(pow(t1.x()-b1.x(),2)+pow(t1.y()-b1.y(),2)); @@ -5897,7 +5897,7 @@ bb->LineSp = ((bb->ISize / 10.0) * static_cast<double>(Doc->typographicSetttings.autoLineSpacing) / 100) + (bb->ISize / 10.0); for (aa = 0; aa < bb->itemText.count(); ++aa) bb->itemText.at(aa)->csize = QMAX(qRound(bb->itemText.at(aa)->csize*((scx+scy)/2)), 1); - if (bb->PType == 8) + if (bb->itemType() == PageItem::PathText) UpdatePolyClip(bb); } bb->LocalX = oldLocalX; @@ -5937,7 +5937,7 @@ return; FPoint n; QRect oldR = getRedrawBounding(b); - if ((Doc->RotMode != 0) && (b->PType != 5)) + if ((Doc->RotMode != 0) && (b->itemType() != PageItem::Line)) { QWMatrix ma; ma.translate(b->Xpos, b->Ypos); @@ -6010,7 +6010,7 @@ SizeItem(tp.x(), tp.y(), b->ItemNr, true, false); b->ClipEdited = true; b->PoLine = Clip.copy(); - if (b->PType == 7) + if (b->itemType() == PageItem::PolyLine) SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1))); else b->Clip = FlattenPath(b->PoLine, b->Segments); @@ -6223,7 +6223,7 @@ int xP, yP; xP = qRound(x / Scale); yP = qRound(y / Scale); - if (!((b->PType == 4) || (b->PType == 2))) + if (!((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::ImageFrame))) return false; QPainter p; QString chx; @@ -6234,7 +6234,7 @@ if ((QRegion(p.xForm(QPointArray(QRect(0, 0, static_cast<int>(b->Width), static_cast<int>(b->Height))))).contains(mpo)) || (QRegion(p.xForm(b->Clip)).contains(mpo))) { - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) return true; TransformM(b, &p); uint a, i; @@ -6358,7 +6358,7 @@ PageItem *b; if (GetItem(&b)) { - if (b->PType != 4) + if (b->itemType() != PageItem::TextFrame) return; QPainter p; QString chx; @@ -6736,7 +6736,7 @@ } else EmitValues(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); } } @@ -6917,14 +6917,14 @@ getGroupRect(&x, &y, &w, &h); emit ItemPos(x, y); emit ItemGeom(w, h); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); } else { EmitValues(b); - if (b->PType == 5) + if (b->itemType() == PageItem::Line) emit ItemGeom(b->Width, b->Height); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); } p.end(); if (!b->ChangedMasterItem) @@ -7053,15 +7053,15 @@ getGroupRect(&x, &y, &w, &h); emit ItemPos(x, y); emit ItemGeom(w, h); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); } else { EmitValues(b); b->paintObj(); - if (b->PType == 5) + if (b->itemType() == PageItem::Line) emit ItemGeom(b->Width, b->Height); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); } if (SelItem.count() == 1) { @@ -7141,7 +7141,7 @@ d1 = sqrt(pow(n1.x() * Scale - m->x(),2)+pow(n1.y() * Scale - m->y(),2)); if (d1 < Doc->guidesSettings.grabRad) distance.insert(d1, 2); - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { n1 = transformPoint( FPoint(b->Width, 0), b->Xpos, b->Ypos, b->Rot, 1, 1); d1 = sqrt(pow(n1.x() * Scale - m->x(),2)+pow(n1.y() * Scale - m->y(),2)); @@ -7174,7 +7174,7 @@ HandleCurs(p, b, mpo); if (HowTo != 0) { - if (b->PType != 5) + if (b->itemType() != PageItem::Line) b->Sizing = true; mCG = true; } @@ -7206,9 +7206,9 @@ for (uint a = 0; a < SelItem.count(); ++a) { b = SelItem.at(a); - if ((b->PType == 4) && (b->isBookmark)) + if ((b->itemType() == PageItem::TextFrame) && (b->isBookmark)) emit ChBMText(b); - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) AdjustPreview(b, !Doc->DragP); b->Select = false; b->isSingleSel = false; @@ -7297,7 +7297,7 @@ Imoved = true; Doc->appMode = NormalMode; emit DocChanged(); - b->Sizing = b->PType == 5 ? false : true; + b->Sizing = b->itemType() == PageItem::Line ? false : true; EmitValues(b); } @@ -7386,7 +7386,7 @@ b->PicAvail = false; b->pixm = QImage(); b->pixmOrg = QImage(); -/* if (b->PType == 2) +/* if (b->itemType() == PageItem::ImageFrame) emit UpdtObj(Doc->currentPage->PageNr, b->ItemNr); */ } } @@ -7514,7 +7514,7 @@ { SelItem.at(a)->toggleLock(); RefreshItem(SelItem.at(a)); - emit HaveSel(SelItem.at(a)->PType); + emit HaveSel(SelItem.at(a)->itemType()); } emit DocChanged(); if (SelItem.count() > 1) @@ -7539,7 +7539,7 @@ { SelItem.at(a)->toggleSizeLock(); RefreshItem(SelItem.at(a)); - emit HaveSel(SelItem.at(a)->PType); + emit HaveSel(SelItem.at(a)->itemType()); } emit DocChanged(); if (SelItem.count() > 1) @@ -7782,10 +7782,10 @@ { emit Amode(1); PageItem *b = SelItem.at(0); - b->convertTo(2); + b->convertTo(PageItem::ImageFrame); b->Frame = true; RefreshItem(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); if (!Doc->loading) emit UpdtObj(Doc->currentPage->PageNr, b->ItemNr); EmitValues(b); @@ -7796,14 +7796,14 @@ { emit Amode(1); PageItem *b = SelItem.at(0); - b->convertTo(6); + b->convertTo(PageItem::Polygon); b->Frame = false; b->ClipEdited = true; b->FrameType = 3; b->Clip = FlattenPath(b->PoLine, b->Segments); b->ContourLine = b->PoLine.copy(); RefreshItem(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); if (!Doc->loading) emit UpdtObj(Doc->currentPage->PageNr, b->ItemNr); EmitValues(b); @@ -7814,10 +7814,10 @@ { emit Amode(1); PageItem *b = SelItem.at(0); - b->convertTo(4); + b->convertTo(PageItem::TextFrame); b->Frame = true; RefreshItem(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); if (!Doc->loading) emit UpdtObj(Doc->currentPage->PageNr, b->ItemNr); EmitValues(b); @@ -7828,12 +7828,12 @@ { emit Amode(1); PageItem *b = SelItem.at(0); - b->PType = 7; + b->convertTo(PageItem::PolyLine); b->ClipEdited = true; SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1))); AdjustItemSize(b); RefreshItem(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); if (!Doc->loading) emit UpdtObj(Doc->currentPage->PageNr, b->ItemNr); EmitValues(b); @@ -7843,7 +7843,7 @@ void ScribusView::Bezier2Poly() { PageItem *b = SelItem.at(0); - b->PType = 6; + b->convertTo(PageItem::Polygon); b->Frame = false; b->ClipEdited = true; b->FrameType = 3; @@ -7854,7 +7854,7 @@ b->Clip = FlattenPath(b->PoLine, b->Segments); b->ContourLine = b->PoLine.copy(); RefreshItem(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); if (!Doc->loading) emit UpdtObj(Doc->currentPage->PageNr, b->ItemNr); EmitValues(b); @@ -7867,9 +7867,9 @@ if (SelItem.count() != 0) { b = SelItem.at(0); - if ((b->PType == 2) || (b->PType == 4)) + if ((b->itemType() == PageItem::ImageFrame) || (b->itemType() == PageItem::TextFrame)) { - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if ((b->itemText.count() != 0) && ((b->NextBox == 0) || (b->BackBox == 0))) { @@ -7894,13 +7894,13 @@ nb = nb->NextBox; } } - if ((b->PType == 2) && ((ScApp->fileWatcher->files().contains(b->Pfile) != 0) && (b->PicAvail))) + if ((b->itemType() == PageItem::ImageFrame) && ((ScApp->fileWatcher->files().contains(b->Pfile) != 0) && (b->PicAvail))) ScApp->fileWatcher->removeFile(b->Pfile); b->Pfile = ""; b->PicAvail = false; b->pixm = QImage(); b->pixmOrg = QImage(); - if (b->PType == 2) + if (b->itemType() == PageItem::ImageFrame) { b->LocalScX = 1; b->LocalScY = 1; @@ -7961,9 +7961,9 @@ for (uint de = 0; de < anz; ++de) { b = delItems.at(0); - if ((b->PType == 2) && ((ScApp->fileWatcher->files().contains(b->Pfile) != 0) && (b->PicAvail))) + if ((b->itemType() == PageItem::ImageFrame) && ((ScApp->fileWatcher->files().contains(b->Pfile) != 0) && (b->PicAvail))) ScApp->fileWatcher->removeFile(b->Pfile); - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if ((b->NextBox != 0) || (b->BackBox != 0)) { @@ -8053,7 +8053,7 @@ if (SelItem.count() == 0) emit HaveSel(-1); else - emit HaveSel(SelItem.at(0)->PType); + emit HaveSel(SelItem.at(0)->itemType()); emit DocChanged(); } } @@ -8715,7 +8715,7 @@ for (uint i=0; i < Doc->Items.count(); i++) { it = Doc->Items.at(i); - if ((it->PType == 2) && (it->PicAvail)) + if ((it->itemType() == PageItem::ImageFrame) && (it->PicAvail)) { if (Pr->contains(it->IProfile)) LoadPict(it->Pfile, i); @@ -9075,7 +9075,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 6, x, y, b, h, w, fill, outline); + PageItem* ite = new PageItem(Doc, PageItem::Polygon, x, y, b, h, w, fill, outline); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9117,7 +9117,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 2, x, y, b, h, 1, Doc->toolSettings.dBrushPict, "None"); + PageItem* ite = new PageItem(Doc, PageItem::ImageFrame, x, y, b, h, 1, Doc->toolSettings.dBrushPict, "None"); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9163,7 +9163,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 6, x, y, b, h, w, fill, outline); + PageItem* ite = new PageItem(Doc, PageItem::Polygon, x, y, b, h, w, fill, outline); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9205,7 +9205,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 6, x, y, b, h, w, fill, outline); + PageItem* ite = new PageItem(Doc, PageItem::Polygon, x, y, b, h, w, fill, outline); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9247,7 +9247,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 7, x, y, b, h, w, fill, outline); + PageItem* ite = new PageItem(Doc, PageItem::PolyLine, x, y, b, h, w, fill, outline); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9288,7 +9288,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 4, x, y, b, h, w, "None", outline); + PageItem* ite = new PageItem(Doc, PageItem::TextFrame, x, y, b, h, w, "None", outline); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9329,7 +9329,7 @@ _itemCreationTransactionStarted = true; undoManager->beginTransaction(); } - PageItem* ite = new PageItem(Doc, 5, x, y, b, h, w, "None", outline); + PageItem* ite = new PageItem(Doc, PageItem::Line, x, y, b, h, w, "None", outline); Doc->Items.append(ite); if (Doc->MasterP) Doc->MasterItems = Doc->Items; @@ -9382,9 +9382,9 @@ PageItem *b = SelItem.at(a); b->OldPwidth = b->Pwidth; b->setLineWidth(w); - if (b->PType == 7) + if (b->itemType() == PageItem::PolyLine) SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1))); - if (b->PType == 5) + if (b->itemType() == PageItem::Line) { int ph = static_cast<int>(QMAX(1.0, w / 2.0)); b->Clip.setPoints(4, -ph,-ph, static_cast<int>(b->Width+ph),-ph, @@ -9520,7 +9520,7 @@ { for (uint a = 0; a < b->itemText.count(); ++a) b->itemText.at(a)->cfont = fon; - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) { UpdatePolyClip(b); AdjustItemSize(b); @@ -9561,7 +9561,7 @@ for (uint a = 0; a < SelItem.count(); ++a) { i = SelItem.at(a); - if ((i->PType == 5) && (farbe == "None")) + if ((i->itemType() == PageItem::Line) && (farbe == "None")) continue; i->setLineColor(farbe); RefreshItem(i); @@ -9585,7 +9585,7 @@ for (uint a = 0; a < SelItem.count(); ++a) { b = SelItem.at(a); - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) { if (Doc->appMode != EditMode) b->setFontFillColor(farbe); @@ -9619,7 +9619,7 @@ for (uint a = 0; a < SelItem.count(); ++a) { b = SelItem.at(a); - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if (Doc->appMode != EditMode) b->setFontFillShade(sha); @@ -9655,7 +9655,7 @@ for (uint a = 0; a < SelItem.count(); ++a) { b = SelItem.at(a); - if ((b->PType == 4) || (b->PType == 8)) + if ((b->itemType() == PageItem::TextFrame) || (b->itemType() == PageItem::PathText)) { if (Doc->appMode != EditMode) b->setFontStrokeColor(farbe); @@ -9688,7 +9688,7 @@ for (uint a = 0; a < SelItem.count(); ++a) { b = SelItem.at(a); - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if (Doc->appMode != EditMode) b->setFontStrokeShade(sha); @@ -9721,7 +9721,7 @@ for (uint a = 0; a < SelItem.count(); ++a) { b = SelItem.at(a); - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) { if (Doc->appMode != EditMode) b->setFontWidth(sha); @@ -10111,7 +10111,7 @@ b->itemText.at(a)->csize = size; } } - if (b->PType == 8) + if (b->itemType() == PageItem::PathText) { UpdatePolyClip(b); AdjustItemSize(b); @@ -10648,10 +10648,12 @@ struct ScText *hg; switch (Buffer->PType) { + /* OBSOLETE CR 2005-02-06 case 1: z = PaintEllipse(x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2); break; - case 2: + */ + case PageItem::ImageFrame: z = PaintPict(x, y, w, h); Doc->Items.at(z)->LocalScX = Buffer->LocalScX; Doc->Items.at(z)->LocalScY = Buffer->LocalScY; @@ -10673,11 +10675,13 @@ Doc->Items.at(z)->AspectRatio = Buffer->AspectRatio; Doc->Items.at(z)->Pwidth = Buffer->Pwidth; break; + /* OBSOLETE CR 2005-02-06 case 3: z = PaintRect(x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2); break; - case 8: - case 4: + */ + case PageItem::PathText: + case PageItem::TextFrame: z = PaintText(x, y, w, h, pw, Buffer->Pcolor); if ((Buffer->isAnnotation) && (Buffer->AnUseIcons)) { @@ -10751,15 +10755,15 @@ } } Doc->Items.at(z)->LineSp = Buffer->LineSp; - Doc->Items.at(z)->PType = Buffer->PType; + Doc->Items.at(z)->convertTo(Buffer->PType); break; - case 5: + case PageItem::Line: z = PaintLine(x, y, w, h, pw, Buffer->Pcolor2); break; - case 6: + case PageItem::Polygon: z = PaintPoly(x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2); break; - case 7: + case PageItem::PolyLine: z = PaintPolyLine(x, y, w, h, pw, Buffer->Pcolor, Buffer->Pcolor2); break; } @@ -10896,11 +10900,13 @@ b->ContourLine = b->PoLine.copy(); else b->ContourLine = Buffer->ContourLine.copy(); - if (b->PType != 5) + if (b->itemType() != PageItem::Line) { + /* OBSOLETE CR 2005-02-06 if ((b->PoLine.size() == 0) && (b->PType != 1)) ConvertClip(b); else + */ b->Clip = FlattenPath(b->PoLine, b->Segments); } else @@ -10913,13 +10919,16 @@ -ph,static_cast<int>(b->Height+ph)); b->Height = 1; } + /* OBSOLETE CR 2005-02-06 if (b->PType == 1) SetOvalFrame(b); - if (b->PType == 8) + */ + if (b->itemType() == PageItem::PathText) { b->Frame = false; UpdatePolyClip(b); } + /* OBSOLETE CR 2005-02-06 if (b->PType == 3) { if (b->RadRect != 0) @@ -10928,12 +10937,13 @@ SetRectFrame(b); b->ClipEdited = true; } - if (b->PType == 2) + */ + if (b->itemType() == PageItem::ImageFrame) { AdjustPictScale(b); AdjustPreview(b, false); } - if ((b->PType != 4) && (b->PType != 8)) + if ((b->itemType() != PageItem::TextFrame) && (b->itemType() != PageItem::PathText)) b->IFont = Doc->toolSettings.defFont; if (Buffer->GrType != 0) { @@ -10974,7 +10984,7 @@ { b->Select = true; SelItem.append(b); - emit HaveSel(b->PType); + emit HaveSel(b->itemType()); EmitValues(b); emit DocChanged(); updateContents(); @@ -11231,18 +11241,18 @@ { PageItem *b = SelItem.at(0); PageItem *bb; - if (b->PType == 4) + if (b->itemType() == PageItem::TextFrame) bb = SelItem.at(1); else { bb = SelItem.at(0); b = SelItem.at(1); } - if (bb->PType != 7) + if (bb->itemType() != PageItem::PolyLine) return; b->Frame = false; b->ClipEdited = true; - b->PType = 8; + b->convertTo(PageItem::PathText); b->PoLine = bb->PoLine.copy(); b->Pwidth = bb->Pwidth; b->setLineColor(bb->lineColor()); @@ -11278,7 +11288,7 @@ bb->Rot = b->Rot; SetPolyClip(bb, qRound(QMAX(bb->Pwidth / 2, 1))); AdjustItemSize(bb); - b->PType = 4; + b->convertTo(PageItem::TextFrame); b->setLineColor("None"); b->Frame = true; SetRectFrame(b); Index: scribus/tree.cpp =================================================================== RCS file: /cvs/Scribus/scribus/tree.cpp,v retrieving revision 1.24.2.7 diff -u -r1.24.2.7 tree.cpp --- scribus/tree.cpp 7 Feb 2005 15:13:31 -0000 1.24.2.7 +++ scribus/tree.cpp 7 Feb 2005 15:46:21 -0000 @@ -8,7 +8,9 @@ #include <qimage.h> #include <qpixmap.h> #include <qmessagebox.h> + #include "scribus.h" + extern QPixmap loadIcon(QString nam); Tree::Tree( QWidget* parent, ScribusApp* scApp ) : QWidget( parent, "Tree") @@ -257,7 +259,7 @@ pgItem = document->DocItems.at(Nr); if ((pgItem->Groups.count() != 0) && (!pgItem->isSingleSel)) return; - setItemIcon(item, pgItem->PType); + setItemIcon(item, pgItem->itemType()); /* QString cc, xp, yp, fon, GroupTxt; if ((vie->Doc->TemplateMode) || (vie->Doc->loading)) return; @@ -311,22 +313,22 @@ { switch (typ) { - case 2: + case PageItem::ImageFrame: item->setPixmap( 0, imageIcon ); break; - case 4: + case PageItem::TextFrame: item->setPixmap( 0, textIcon ); break; - case 5: + case PageItem::Line: item->setPixmap( 0, lineIcon ); break; - case 6: + case PageItem::Polygon: item->setPixmap( 0, polygonIcon ); break; - case 7: + case PageItem::PolyLine: item->setPixmap( 0, polylineIcon ); break; - case 8: + case PageItem::PathText: item->setPixmap( 0, textIcon ); break; default: @@ -545,7 +547,7 @@ templateItemMap.insert(object, pgItem->ItemNr); templateItemMapRev.insert(pgItem->ItemNr, object); object->setText(0, pgItem->itemName()); - setItemIcon(object, pgItem->PType); + setItemIcon(object, pgItem->itemType()); pgItem->Dirty = true; } else @@ -587,7 +589,7 @@ { QListViewItem * object = new QListViewItem( page, 0 ); object->setText(0, pgItem->itemName()); - setItemIcon(object, pgItem->PType); + setItemIcon(object, pgItem->itemType()); itemMap.insert(object, pgItem->ItemNr); itemMapRev.insert(pgItem->ItemNr, object); pgItem->Dirty = true; @@ -634,7 +636,7 @@ { QListViewItem * object = new QListViewItem( page, 0 ); object->setText(0, pgItem->itemName()); - setItemIcon(object, pgItem->PType); + setItemIcon(object, pgItem->itemType()); pgItem->Dirty = true; itemMap.insert(object, pgItem->ItemNr); itemMapRev.insert(pgItem->ItemNr, object); @@ -684,7 +686,7 @@ { QListViewItem *grp = new QListViewItem( object, 0 ); grp->setText(0, pgItem->itemName()); - setItemIcon(grp, pgItem->PType); + setItemIcon(grp, pgItem->itemType()); if (onTemplate) { templateItemMap.insert(grp, pgItem->ItemNr); Index: scribus/util.cpp =================================================================== RCS file: /cvs/Scribus/scribus/util.cpp,v retrieving revision 1.52.2.18 diff -u -r1.52.2.18 util.cpp --- scribus/util.cpp 2 Feb 2005 19:18:59 -0000 1.52.2.18 +++ scribus/util.cpp 7 Feb 2005 15:46:22 -0000 @@ -1777,7 +1777,7 @@ void CopyPageItem(struct CopyPasteBuffer *Buffer, PageItem *b) { uint a; - Buffer->PType = b->PType; + Buffer->PType = b->itemType(); Buffer->Xpos = b->Xpos; Buffer->Ypos = b->Ypos; Buffer->Width = b->Width; @@ -2028,13 +2028,13 @@ for (uint azz=0; azz<currentDoc->MasterItems.count(); ++azz) { PageItem *ite = currentDoc->MasterItems.at(azz); - if (ite->PType == 8) + if (ite->itemType() == PageItem::PathText) ite->DrawObj(painter, rd); } for (uint azz=0; azz<currentDoc->Items.count(); ++azz) { PageItem *ite = currentDoc->Items.at(azz); - if ((ite->PType == 4) || (ite->PType == 8)) + if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) ite->DrawObj(painter, rd); } currentDoc->RePos = false; @@ -2079,7 +2079,7 @@ QString tmp; int x, y; double xf, yf; - OB->PType = QStoInt(obj->attribute("PTYPE")); + OB->PType = static_cast<PageItem::ItemType>(QStoInt(obj->attribute("PTYPE"))); OB->Width=QStodouble(obj->attribute("WIDTH")); OB->Height=QStodouble(obj->attribute("HEIGHT")); OB->RadRect = QStodouble(obj->attribute("RADRECT","0")); Index: scribus/libpdf/pdflib.cpp =================================================================== RCS file: /cvs/Scribus/scribus/libpdf/pdflib.cpp,v retrieving revision 1.78.2.24 diff -u -r1.78.2.24 pdflib.cpp --- scribus/libpdf/pdflib.cpp 2 Feb 2005 19:18:53 -0000 1.78.2.24 +++ scribus/libpdf/pdflib.cpp 7 Feb 2005 15:46:24 -0000 @@ -517,7 +517,7 @@ for (uint c = 0; c < doc->MasterItems.count(); ++c) { pgit = doc->MasterItems.at(c); - if ((pgit->PType == 4) || (pgit->PType == 8)) + if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) { for (uint e = 0; e < pgit->itemText.count(); ++e) { @@ -528,7 +528,7 @@ for (uint d = 0; d < doc->Items.count(); ++d) { pgit = doc->Items.at(d); - if ((pgit->PType == 4) || (pgit->PType == 8)) + if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText)) { for (uint e = 0; e < pgit->itemText.count(); ++e) { @@ -922,7 +922,7 @@ PDF_Transparenz(ite); if ((ite->isBookmark) && (Options->Bookmarks)) PDF_Bookmark(ite->BMnr, doc->PageH - ite->Ypos); - if (!ite->isPrintable || ((ite->PType == 4) && (pag->PageNam != ""))) + if (!ite->isPrintable || ((ite->itemType() == PageItem::TextFrame) && (pag->PageNam != ""))) { PutPage("Q\n"); continue; @@ -1040,9 +1040,9 @@ sr = 0; PutPage(FToStr(cr)+" "+FToStr(sr)+" "+FToStr(-sr)+" "+FToStr(cr)+" 0 0 cm\n"); } - switch (ite->PType) + switch (ite->itemType()) { - case 2: + case PageItem::ImageFrame: if ((ite->fillColor() != "None") || (ite->GrType != 0)) { if (ite->GrType != 0) @@ -1085,9 +1085,9 @@ } } break; - case 4: + case PageItem::TextFrame: break; - case 5: + case PageItem::Line: if (ite->NamedLStyle == "") { PutPage("0 0 m\n"); @@ -1195,9 +1195,11 @@ PutPage("h\nf*\n"); } break; + /* OBSOLETE CR 2005-02-06 case 1: case 3: - case 6: + */ + case PageItem::Polygon: if (ite->GrType != 0) PDF_Gradient(ite); else @@ -1227,7 +1229,7 @@ } } break; - case 7: + case PageItem::PolyLine: if ((ite->PoLine.size() > 3) && ((ite->PoLine.point(0) != ite->PoLine.point(1)) || (ite->PoLine.point(2) != ite->PoLine.point(3)))) { if (ite->GrType != 0) @@ -1370,7 +1372,7 @@ } } break; - case 8: + case PageItem::PathText: if (ite->PoShow) { if (ite->PoLine.size() > 3) @@ -1632,7 +1634,7 @@ if ((pag->PageNam != "") && (ite->OwnPage != static_cast<int>(pag->PageNr)) && (ite->OwnPage != -1)) continue; QString name = "/"+pag->MPageNam.simplifyWhiteSpace().replace( QRegExp("\\s"), "" ) + IToStr(ite->ItemNr); - if (ite->PType != 4) + if (ite->itemType() != PageItem::TextFrame) PutPage(name+" Do\n"); else { @@ -1999,7 +2001,7 @@ PDF_Transparenz(ite); if ((ite->isBookmark) && (Options->Bookmarks)) PDF_Bookmark(ite->BMnr, doc->PageH - ite->Ypos); - if (!ite->isPrintable || ((ite->PType == 4) && (pag->PageNam != ""))) + if (!ite->isPrintable || ((ite->itemType() == PageItem::TextFrame) && (pag->PageNam != ""))) { PutPage("Q\n"); continue; @@ -2117,9 +2119,9 @@ sr = 0; PutPage(FToStr(cr)+" "+FToStr(sr)+" "+FToStr(-sr)+" "+FToStr(cr)+" 0 0 cm\n"); } - switch (ite->PType) + switch (ite->itemType()) { - case 2: + case PageItem::ImageFrame: if ((ite->fillColor() != "None") || (ite->GrType != 0)) { if (ite->GrType != 0) @@ -2162,7 +2164,7 @@ } } break; - case 4: + case PageItem::TextFrame: if ((ite->isAnnotation) && (Options->Version != 12)) { PDF_Annotation(ite, PNr); @@ -2204,7 +2206,7 @@ } } break; - case 5: + case PageItem::Line: if (ite->NamedLStyle == "") { PutPage("0 0 m\n"); @@ -2312,9 +2314,11 @@ PutPage("h\nf*\n"); } break; + /* OBSOLETE 2005-02-06 CR case 1: case 3: - case 6: + */ + case PageItem::Polygon: if (ite->GrType != 0) PDF_Gradient(ite); else @@ -2344,7 +2348,7 @@ } } break; - case 7: + case PageItem::PolyLine: if ((ite->PoLine.size() > 3) && ((ite->PoLine.point(0) != ite->PoLine.point(1)) || (ite->PoLine.point(2) != ite->PoLine.point(3)))) { if (ite->GrType != 0) @@ -2487,7 +2491,7 @@ } } break; - case 8: + case PageItem::PathText: if (ite->PoShow) { if (ite->PoLine.size() > 3) @@ -2773,7 +2777,7 @@ QString tmp2 = ""; QString FillColor = ""; QString StrokeColor = ""; - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) tmp += "BT\n"; for (uint d = 0; d < ite->MaxChars; ++d) { @@ -2782,7 +2786,7 @@ continue; if (hl->cstyle & 256) continue; - if (ite->PType == 8) + if (ite->itemType() == PageItem::PathText) { tmp += "q\n"; tmp += "1 0 0 1 "+FToStr(hl->PtransX)+" "+FToStr(-hl->PtransY)+" cm\n"; @@ -2896,7 +2900,7 @@ if (hl->ccolor != "None") tmp2 += FillColor; tmp2 += "q\n"; - if (ite->PType == 8) + if (ite->itemType() == PageItem::PathText) { tmp2 += "1 0 0 1 "+FToStr(hl->PtransX)+" "+FToStr(-hl->PtransY)+" cm\n"; double sr = sin(-hl->PRot* 3.1415927 / 180.0); @@ -3116,13 +3120,13 @@ tmp2 += FToStr(hl->xp+Ulen)+" "+FToStr(-hl->yp+Upos)+" l\n"; tmp2 += "S\n"; } - if (ite->PType == 8) + if (ite->itemType() == PageItem::PathText) { tmp += "ET\nQ\n"+tmp2; tmp2 = ""; } } - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) tmp += "ET\n"+tmp2; return tmp; } @@ -4798,7 +4802,7 @@ for (uint ele = 0; ele < doc->Items.count(); ++ele) { PageItem* tel = doc->Items.at(ele); - if ((tel->PType == 4) && (tel->BackBox == 0) && (tel->NextBox != 0) && + if ((tel->itemType() == PageItem::TextFrame) && (tel->BackBox == 0) && (tel->NextBox != 0) && (!tel->Redrawn)) { StartObj(ObjCounter); Index: scribus/libpostscript/pslib.cpp =================================================================== RCS file: /cvs/Scribus/scribus/libpostscript/pslib.cpp,v retrieving revision 1.24.2.17 diff -u -r1.24.2.17 pslib.cpp --- scribus/libpostscript/pslib.cpp 2 Feb 2005 19:18:54 -0000 1.24.2.17 +++ scribus/libpostscript/pslib.cpp 7 Feb 2005 15:46:25 -0000 @@ -1071,7 +1071,7 @@ continue; if ((it->OwnPage != static_cast<int>(Doc->MasterPages.at(ap)->PageNr)) && (it->OwnPage != -1)) continue; - if ((it->PType == 2) && (it->PicAvail) && (it->Pfile != "") && (it->isPrintable) && (!sep) && (farb)) + if ((it->itemType() == PageItem::ImageFrame) && (it->PicAvail) && (it->Pfile != "") && (it->isPrintable) && (!sep) && (farb)) PS_ImageData(it->InvPict, it->Pfile, it->itemName(), it->IProfile, it->UseEmbedded, Ic); PS_TemplateStart(Doc->MasterPages.at(ap)->PageNam + tmps.setNum(it->ItemNr), Doc->PageB, Doc->PageH); ProcessItem(Doc, Doc->MasterPages.at(ap), it, ap+1, sep, farb, Ic, gcr, true); @@ -1144,9 +1144,9 @@ PageItem *ite = Doc->Pages.at(a)->FromMaster.at(am); if ((ite->LayerNr != ll.LNr) || (!ite->isPrintable)) continue; - if ((ite->PType != 4) && (ite->PType != 2)) + if ((ite->itemType() != PageItem::TextFrame) && (ite->itemType() != PageItem::ImageFrame)) PS_UseTemplate(Doc->Pages.at(a)->MPageNam + tmps.setNum(ite->ItemNr)); - else if (ite->PType == 2) + else if (ite->itemType() == PageItem::ImageFrame) { PS_save(); PS_translate(ite->Xpos - mPage->Xoffset, Doc->PageH -(ite->Ypos) - mPage->Yoffset); @@ -1216,7 +1216,7 @@ } PS_restore(); } - else if (ite->PType == 4) + else if (ite->itemType() == PageItem::TextFrame) { double savScale = view->Scale; view->Scale = 1.0; @@ -1623,9 +1623,9 @@ PS_translate(c->Xpos - a->Xoffset, Doc->PageH - (c->Ypos - a->Yoffset)); if (c->Rot != 0) PS_rotate(-c->Rot); - switch (c->PType) + switch (c->itemType()) { - case 2: + case PageItem::ImageFrame: if (master) break; if ((c->fillColor() != "None") || (c->GrType != 0)) @@ -1691,7 +1691,7 @@ } } break; - case 4: + case PageItem::TextFrame: if (master) break; if (c->isBookmark) @@ -2002,7 +2002,7 @@ } } break; - case 5: + case PageItem::Line: if ((c->NamedLStyle == "") && (c->Pwidth != 0.0)) { PS_moveto(0, 0); @@ -2054,9 +2054,11 @@ PS_fill(); } break; + /* OBSOLETE CR 2005-02-06 case 1: case 3: - case 6: + */ + case PageItem::Polygon: if ((c->fillColor() != "None") || (c->GrType != 0)) { SetClipPath(&c->PoLine); @@ -2091,7 +2093,7 @@ } } break; - case 7: + case PageItem::PolyLine: if ((c->fillColor() != "None") || (c->GrType != 0)) { SetClipPath(&c->PoLine); @@ -2172,7 +2174,7 @@ } } break; - case 8: + case PageItem::PathText: if (c->PoShow) { if (c->PoLine.size() > 3) @@ -2311,9 +2313,9 @@ c = PItems.at(b); if (c->LayerNr != ll.LNr) continue; - if ((a->PageNam != "") && (c->PType == 4)) + if ((a->PageNam != "") && (c->itemType() == PageItem::TextFrame)) continue; - if ((a->PageNam != "") && (c->PType == 2) && ((sep) || (!farb))) + if ((a->PageNam != "") && (c->itemType() == PageItem::ImageFrame) && ((sep) || (!farb))) continue; if ((!Art) && (view->SelItem.count() != 0) && (!c->Select)) continue; @@ -2339,9 +2341,9 @@ c = PItems.at(b); if (c->LayerNr != ll.LNr) continue; - if ((a->PageNam != "") && (c->PType == 4)) + if ((a->PageNam != "") && (c->itemType() == PageItem::TextFrame)) continue; - if ((a->PageNam != "") && (c->PType == 2) && ((sep) || (!farb))) + if ((a->PageNam != "") && (c->itemType() == PageItem::ImageFrame) && ((sep) || (!farb))) continue; int x = static_cast<int>(a->Xoffset); int y = static_cast<int>(a->Yoffset); Index: scribus/plugins/fileloader/oodraw/oodrawimp.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/fileloader/oodraw/oodrawimp.cpp,v retrieving revision 1.1.2.23 diff -u -r1.1.2.23 oodrawimp.cpp --- scribus/plugins/fileloader/oodraw/oodrawimp.cpp 6 Feb 2005 00:18:03 -0000 1.1.2.23 +++ scribus/plugins/fileloader/oodraw/oodrawimp.cpp 7 Feb 2005 15:46:25 -0000 @@ -548,7 +548,7 @@ PageItem* ite = Doku->Items.at(z); ite->PoLine.resize(0); if (parseSVG( b.attribute( "svg:d" ), &ite->PoLine )) - ite->PType = 7; + ite->convertTo(PageItem::PolyLine); if (ite->PoLine.size() < 4) { Prog->view->SelItem.append(ite); @@ -628,8 +628,8 @@ ss->GetText(ite, AbsStyle, Doku->toolSettings.defFont, FontSize*10, firstPa); delete ss; firstPa = true; - if (ite->PType != 7) - ite->PType = 4; + if (ite->itemType() != PageItem::PolyLine) + ite->convertTo(PageItem::TextFrame); } ite->setFillTransparency(FillTrans); ite->setLineTransparency(StrokeTrans); Index: scribus/plugins/scriptplugin/cmdgetprop.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp,v retrieving revision 1.8.2.15 diff -u -r1.8.2.15 cmdgetprop.cpp --- scribus/plugins/scriptplugin/cmdgetprop.cpp 2 Feb 2005 19:18:54 -0000 1.8.2.15 +++ scribus/plugins/scriptplugin/cmdgetprop.cpp 7 Feb 2005 15:46:25 -0000 @@ -23,7 +23,7 @@ it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT))) + if ((it->HasSel) && ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))) { for (uint b = 0; b < it->itemText.count(); ++b) { @@ -59,7 +59,7 @@ it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->HasSel) && ((it->PType == FRAME_TEXT) || (it->PType == FRAME_PATHTEXT))) + if ((it->HasSel) && ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))) { for (uint b = 0; b < it->itemText.count(); ++b) { @@ -197,7 +197,7 @@ { for (uint lam2 = 0; lam2 < Carrier->doc->Items.count(); ++lam2) { - if (Carrier->doc->Items.at(lam2)->PType == typ) + if (Carrier->doc->Items.at(lam2)->itemType() == typ) counter++; } } @@ -209,7 +209,7 @@ { if (typ != -1) { - if (Carrier->doc->Items.at(lam)->PType == typ) + if (Carrier->doc->Items.at(lam)->itemType() == typ) { PyList_SetItem(l, counter2, PyString_FromString(Carrier->doc->Items.at(lam)->itemName().utf8())); counter2++; Index: scribus/plugins/scriptplugin/cmdmani.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v retrieving revision 1.7.2.19 diff -u -r1.7.2.19 cmdmani.cpp --- scribus/plugins/scriptplugin/cmdmani.cpp 4 Feb 2005 18:52:46 -0000 1.7.2.19 +++ scribus/plugins/scriptplugin/cmdmani.cpp 7 Feb 2005 15:46:25 -0000 @@ -12,7 +12,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(Name)); if (item == NULL) return NULL; - if (item->PType != FRAME_IMAGE) + if (item->itemType() != PageItem::ImageFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error")); return NULL; @@ -33,7 +33,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(Name)); if (item == NULL) return NULL; - if (item->PType != FRAME_IMAGE) + if (item->itemType() != PageItem::ImageFrame) { PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error")); return NULL; @@ -333,7 +333,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(name)); if (item == NULL) return NULL; - if (item->PType != FRAME_IMAGE) + if (item->itemType() != PageItem::ImageFrame) { PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error")); return NULL; Index: scribus/plugins/scriptplugin/cmdobj.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp,v retrieving revision 1.11.2.20 diff -u -r1.11.2.20 cmdobj.cpp --- scribus/plugins/scriptplugin/cmdobj.cpp 2 Feb 2005 19:18:54 -0000 1.11.2.20 +++ scribus/plugins/scriptplugin/cmdobj.cpp 7 Feb 2005 15:46:26 -0000 @@ -489,7 +489,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(name)); if (item == NULL) return NULL; - if ((item->PType == FRAME_TEXT) || (item->PType == FRAME_PATHTEXT)) + if ((item->itemType() == PageItem::TextFrame) || (item->itemType() == PageItem::PathText)) { /* * First, find the style number associated with the requested style @@ -552,19 +552,4 @@ } } return styleList; -} - -/*! 2004-12-08 CR - * Return the internal frame type number for a frame. - */ -PyObject* scribus_getframetype(PyObject */*self*/, PyObject* args, PyObject* kw) -{ - char* frameName = const_cast<char*>(""); - char* kwds[] = {const_cast<char*>("name"), NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kw, "|es", kwds, "utf-8", &frameName)) - return NULL; - PageItem *it = GetUniqueItem(QString(frameName)); - if (it == NULL) - return NULL; - return PyInt_FromLong( (long)(it->PType) ); } Index: scribus/plugins/scriptplugin/cmdpage.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp,v retrieving revision 1.11.2.15 diff -u -r1.11.2.15 cmdpage.cpp --- scribus/plugins/scriptplugin/cmdpage.cpp 1 Feb 2005 10:41:40 -0000 1.11.2.15 +++ scribus/plugins/scriptplugin/cmdpage.cpp 7 Feb 2005 15:46:26 -0000 @@ -126,7 +126,7 @@ { row = Py_BuildValue((char*)"(sii)", Carrier->doc->Items.at(i)->itemName().ascii(), - Carrier->doc->Items.at(i)->PType, + Carrier->doc->Items.at(i)->itemType(), Carrier->doc->Items.at(i)->ItemNr ); PyList_SetItem(l, i, row); Index: scribus/plugins/scriptplugin/cmdsetprop.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp,v retrieving revision 1.8.2.12 diff -u -r1.8.2.12 cmdsetprop.cpp --- scribus/plugins/scriptplugin/cmdsetprop.cpp 2 Feb 2005 19:18:54 -0000 1.8.2.12 +++ scribus/plugins/scriptplugin/cmdsetprop.cpp 7 Feb 2005 15:46:26 -0000 @@ -188,18 +188,12 @@ PageItem *b = GetUniqueItem(QString::fromUtf8(Name)); if (b == NULL) return NULL; - // What the heck is a type 3 frame? // FIXME: Doesn't seem to work, at least on rect/polygon frames - if ((b->PType == FRAME_IMAGE) || (b->PType == 3) || (b->PType == FRAME_TEXT)) + if ((b->itemType() == PageItem::ImageFrame) || (b->itemType() == PageItem::TextFrame)) { - if ((b->PType == 2) || (b->PType == 3) || (b->PType == 4)) - { - b->RadRect = w; - if (w > 0) - Carrier->view->SetFrameRound(b); - } - else - Carrier->view->SetRectFrame(b); + b->RadRect = w; + if (w > 0) + Carrier->view->SetFrameRound(b); } else Carrier->view->SetRectFrame(b); Index: scribus/plugins/scriptplugin/cmdtext.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp,v retrieving revision 1.19.2.17 diff -u -r1.19.2.17 cmdtext.cpp --- scribus/plugins/scriptplugin/cmdtext.cpp 4 Feb 2005 17:56:40 -0000 1.19.2.17 +++ scribus/plugins/scriptplugin/cmdtext.cpp 7 Feb 2005 15:46:26 -0000 @@ -11,7 +11,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get font size of non-text frame.","python error")); return NULL; @@ -37,7 +37,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get font of non-text frame.","python error")); return NULL; @@ -63,7 +63,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT)) + if ((i->itemType() != PageItem::TextFrame) && (i->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text size of non-text frame.","python error")); return NULL; @@ -81,7 +81,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get column count of non-text frame.","python error")); return NULL; @@ -99,7 +99,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get line space of non-text frame.","python error")); return NULL; @@ -117,7 +117,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get column gap of non-text frame.","python error")); return NULL; @@ -136,7 +136,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text of non-text frame.","python error")); return NULL; @@ -167,7 +167,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get text of non-text frame.","python error")); return NULL; @@ -243,7 +243,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set text of non-text frame.","python error")); return NULL; @@ -302,7 +302,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot insert text into non-text frame.","python error")); return NULL; @@ -360,7 +360,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text alignment on a non-text frame","python error")); return NULL; @@ -394,7 +394,7 @@ if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font size on a non-text frame","python error")); return NULL; @@ -422,7 +422,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if ((i->PType != FRAME_TEXT) && (i->PType != FRAME_PATHTEXT)) + if ((i->itemType() != PageItem::TextFrame) && (i->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set font on a non-text frame","python error")); return NULL; @@ -463,7 +463,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't line spacing on a non-text frame","python error")); return NULL; @@ -489,7 +489,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't column gap on a non-text frame","python error")); return NULL; @@ -515,7 +515,7 @@ PageItem *i = GetUniqueItem(QString::fromUtf8(Name)); if (i == NULL) return NULL; - if (i->PType != FRAME_TEXT) + if (i->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't number of columns on a non-text frame","python error")); return NULL; @@ -550,7 +550,7 @@ PyErr_SetString(PyExc_IndexError, QObject::tr("Selection index out of bounds", "python error")); return NULL; } - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't select text in a non-text frame", "python error")); return NULL; @@ -587,7 +587,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't delete text from a non-text frame","python error")); return NULL; @@ -614,7 +614,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text fill on a non-text frame","python error")); return NULL; @@ -648,7 +648,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text stroke on a non-text frame","python error")); return NULL; @@ -687,7 +687,7 @@ PageItem *it = GetUniqueItem(QString::fromUtf8(Name)); if (it == NULL) return NULL; - if ((it->PType != FRAME_TEXT) && (it->PType != FRAME_PATHTEXT)) + if ((it->itemType() != PageItem::TextFrame) && (it->itemType() != PageItem::PathText)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't set text shade on a non-text frame","python error")); return NULL; @@ -725,7 +725,7 @@ PageItem *toitem = GetUniqueItem(QString::fromUtf8(name2)); if (toitem == NULL) return NULL; - if ((fromitem->PType != FRAME_TEXT) || (toitem->PType != FRAME_TEXT)) + if ((fromitem->itemType() != PageItem::TextFrame) || (toitem->itemType() != PageItem::TextFrame)) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can only link text frames","python error")); return NULL; @@ -770,7 +770,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(name)); if (item == NULL) return NULL; - if (item->PType != FRAME_TEXT) + if (item->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't unlink a non-text frame","python error")); return NULL; @@ -822,7 +822,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(name)); if (item == NULL) return NULL; - if (item->PType != FRAME_TEXT) + if (item->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Can't convert a non-text frame to outlines","python error")); return NULL; @@ -844,7 +844,7 @@ PageItem *item = GetUniqueItem(QString::fromUtf8(name)); if (item == NULL) return NULL; - if (item->PType != FRAME_TEXT) + if (item->itemType() != PageItem::TextFrame) { PyErr_SetString(WrongFrameTypeError, QObject::tr("Only text frames can be checked for overflowing", "python error")); return NULL; Index: scribus/plugins/scriptplugin/cmdutil.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp,v retrieving revision 1.6.2.12 diff -u -r1.6.2.12 cmdutil.cpp --- scribus/plugins/scriptplugin/cmdutil.cpp 4 Feb 2005 19:47:21 -0000 1.6.2.12 +++ scribus/plugins/scriptplugin/cmdutil.cpp 7 Feb 2005 15:46:26 -0000 @@ -90,7 +90,7 @@ for (uint c = 0; c < Carrier->doc->Items.count(); c++) { PageItem *ite = Carrier->doc->Items.at(c); - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) { for (uint d = 0; d < ite->itemText.count(); d++) { @@ -118,7 +118,7 @@ for (uint c = 0; c < Carrier->doc->MasterItems.count(); c++) { PageItem *ite = Carrier->doc->MasterItems.at(c); - if (ite->PType == 4) + if (ite->itemType() == PageItem::TextFrame) { for (uint d = 0; d < ite->itemText.count(); d++) { Index: scribus/plugins/scriptplugin/cmdvar.h =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdvar.h,v retrieving revision 1.6.2.8 diff -u -r1.6.2.8 cmdvar.h --- scribus/plugins/scriptplugin/cmdvar.h 4 Feb 2005 19:47:21 -0000 1.6.2.8 +++ scribus/plugins/scriptplugin/cmdvar.h 7 Feb 2005 15:46:26 -0000 @@ -8,14 +8,6 @@ #include <Python.h> #include "scribus.h" -/* These will go away in 1.3, but help readability in 1.2.1 code a LOT */ -#define FRAME_IMAGE 2 -#define FRAME_TEXT 4 -#define FRAME_LINE 5 -#define FRAME_VECTOR 6 -#define FRAME_POLYLINE 7 -#define FRAME_PATHTEXT 8 - /* Static global Variables */ extern ScribusApp* Carrier; Index: scribus/plugins/short-words/parse.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/short-words/parse.cpp,v retrieving revision 1.1.2.5 diff -u -r1.1.2.5 parse.cpp --- scribus/plugins/short-words/parse.cpp 28 Jan 2005 21:38:02 -0000 1.1.2.5 +++ scribus/plugins/short-words/parse.cpp 7 Feb 2005 15:46:26 -0000 @@ -44,7 +44,7 @@ QRegExp rx(" "); // just textframes processed - if (aFrame->PType != 4) + if (aFrame->itemType() != PageItem::TextFrame) return; // an ugly hack to get the language code from the item language property Index: scribus/plugins/svgexplugin/svgexplugin.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp,v retrieving revision 1.25.2.7 diff -u -r1.25.2.7 svgexplugin.cpp --- scribus/plugins/svgexplugin/svgexplugin.cpp 2 Feb 2005 19:18:54 -0000 1.25.2.7 +++ scribus/plugins/svgexplugin/svgexplugin.cpp 7 Feb 2005 15:46:27 -0000 @@ -409,21 +409,23 @@ } gr = docu->createElement("g"); gr.setAttribute("transform", trans); - if (Item->PType != 4) + if (Item->itemType() != PageItem::TextFrame) { if (Item->NamedLStyle == "") { - if ((Item->PType == 5) || (Item->PType == 7) || (Item->PType == 8)) + if ((Item->itemType() == PageItem::Line) || (Item->itemType() == PageItem::PolyLine) || (Item->itemType() == PageItem::PathText)) gr.setAttribute("style", "fill:none; "+stroke+" "+strokeW+" "+strokeLC+" "+strokeLJ+" "+strokeDA); else gr.setAttribute("style", fill+" "+stroke+" "+strokeW+" "+strokeLC+" "+strokeLJ+" "+strokeDA); } } - switch (Item->PType) + switch (Item->itemType()) { + /* Item types 3 and 1 are OBSOLETE: CR 2005-02-06 case 1: case 3: - case 6: + */ + case PageItem::Polygon: if (Item->NamedLStyle == "") { ob = docu->createElement("path"); @@ -445,7 +447,7 @@ } } break; - case 2: + case PageItem::ImageFrame: if ((Item->fillColor() != "None") || (Item->GrType != 0)) { ob = docu->createElement("path"); @@ -494,7 +496,7 @@ } } break; - case 7: + case PageItem::PolyLine: if (Item->NamedLStyle == "") { ob = docu->createElement("path"); @@ -512,7 +514,7 @@ } } break; - case 4: + case PageItem::TextFrame: if ((Item->fillColor() != "None") || (Item->GrType != 0)) { ob = docu->createElement("path"); @@ -541,7 +543,7 @@ ob.appendChild(tp); } break; - case 5: + case PageItem::Line: if (Item->NamedLStyle == "") { ob = docu->createElement("path"); @@ -559,7 +561,7 @@ } } break; - case 8: + case PageItem::PathText: if (Item->PoShow) { if (Item->NamedLStyle == "") Index: scribus/plugins/svgimplugin/svgplugin.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp,v retrieving revision 1.31.2.24 diff -u -r1.31.2.24 svgplugin.cpp --- scribus/plugins/svgimplugin/svgplugin.cpp 6 Feb 2005 00:18:03 -0000 1.31.2.24 +++ scribus/plugins/svgimplugin/svgplugin.cpp 7 Feb 2005 15:46:27 -0000 @@ -462,7 +462,7 @@ PageItem* ite = Doku->Items.at(z); ite->PoLine.resize(0); if (parseSVG( b.attribute( "d" ), &ite->PoLine )) - ite->PType = 7; + ite->convertTo(PageItem::PolyLine); if (ite->PoLine.size() < 4) { Prog->view->SelItem.append(ite); @@ -510,7 +510,7 @@ if( STag == "polygon" ) svgClosePath(&ite->PoLine); else - ite->PType = 7; + ite->convertTo(PageItem::PolyLine); } else if( STag == "text" ) { @@ -550,9 +550,9 @@ setupTransform( b ); SvgStyle *gc = m_gc.current(); PageItem* ite = Doku->Items.at(z); - switch (ite->PType) + switch (ite->itemType()) { - case 2: + case PageItem::ImageFrame: { QWMatrix mm = gc->matrix; ite->Xpos += mm.dx(); @@ -570,7 +570,7 @@ } break; } - case 4: + case PageItem::TextFrame: { QWMatrix mm = gc->matrix; ite->Pwidth = ite->Pwidth * ((mm.m11() + mm.m22()) / 2.0); |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-02-07 07:03 |
|
New Issue | |
2005-02-07 15:13 |
|
File Added: pageitem_ptype_conversion.diff | |
2005-02-08 12:49 | cbradney | Status | new => assigned |
2005-02-08 12:49 | cbradney | Assigned To | => cbradney |
2005-02-08 13:08 | cbradney | Status | assigned => resolved |
2005-02-08 13:08 | cbradney | Fixed in Version | => 1.3.0cvs |
2005-02-08 13:08 | cbradney | Resolution | open => fixed |
2005-02-08 13:11 | cbradney | Status | resolved => closed |
2005-02-09 05:59 |
|
Relationship added | related to 0001653 |
2005-02-09 05:59 |
|
Relationship replaced | child of 0001653 |