r16159 by fschmid - - More work on removing now deprecate pageitem properties.
scribus-commit
scribus-commit at lists.scribus.net
Thu Dec 23 14:13:38 CET 2010
Author: fschmid
Date: Thu Dec 23 13:13:38 2010
New Revision: 16159
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16159
Log:
- More work on removing now deprecate pageitem properties.
- Made "Copy Page" working without the Serializer.
- Made "Copy Layer" working without the Serializer.
Removed the now deprecated and never working 100% ok pageitem_desaxe.cpp from the build.
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/annotation.cpp
trunk/Scribus/scribus/annotation.h
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/serializer.cpp
trunk/Scribus/scribus/serializer.h
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Thu Dec 23 13:13:38 2010
@@ -426,7 +426,7 @@
SET(SCRIBUS_SOURCES
actionmanager.cpp
- annotation.cpp
+# annotation.cpp
canvas.cpp
canvasgesture_linemove.cpp
canvasgesture_pan.cpp
@@ -504,7 +504,7 @@
nfttemplate.cpp
page.cpp
pageitem.cpp
- pageitem_desaxe.cpp
+# pageitem_desaxe.cpp
pageitem_group.cpp
pageitem_imageframe.cpp
pageitem_latexframe.cpp
Modified: trunk/Scribus/scribus/annotation.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/annotation.cpp
==============================================================================
--- trunk/Scribus/scribus/annotation.cpp (original)
+++ trunk/Scribus/scribus/annotation.cpp Thu Dec 23 13:13:38 2010
@@ -9,7 +9,7 @@
#include "util.h"
#include "util_text.h"
#include "util_math.h"
-
+/*
void Annotation::saxx(SaxHandler& handler, const Xml_string& elemtag) const
{
Xml_attr att;
@@ -108,3 +108,4 @@
ruleset.addRule(annPrefix, Factory<Annotation>());
ruleset.addRule(annPrefix, ParseAnnotation());
}
+*/
Modified: trunk/Scribus/scribus/annotation.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/annotation.h
==============================================================================
--- trunk/Scribus/scribus/annotation.h (original)
+++ trunk/Scribus/scribus/annotation.h Thu Dec 23 13:13:38 2010
@@ -28,12 +28,12 @@
#include <QString>
#include "scribusapi.h"
-#include "desaxe/saxio.h"
+//#include "desaxe/saxio.h"
//FIXME: Someone please fix these variable names..
//They are simply moved here, not all fixed.
//TODO make the usage in various places a little simpler
-class SCRIBUS_API Annotation : public SaxIO
+class SCRIBUS_API Annotation // : public SaxIO
{
public:
//Do we need a null or an empty QString for these? Remove the qstring initialisations if null is ok.
@@ -47,11 +47,11 @@
{
}
- static const Xml_string saxxDefaultElem;
- static void desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
+// static const Xml_string saxxDefaultElem;
+// static void desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
- virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
- virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
+// virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
+// virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
void setType(int newType) { AnType=newType; }
void setAction(const QString& newAction) { AnAction=newAction; }
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Thu Dec 23 13:13:38 2010
@@ -247,16 +247,8 @@
for (uint a=0; a<docSelectionCount; ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
- if( currItem->Groups.count() > 0)
- {
- if(! currItem->controlsGroup() )
- continue;
- else
- {
- if(currItem->Groups.count() > 1)
- continue;
- }
- }
+ if (!m_doc->Items->contains(currItem))
+ continue;
psx->save();
psx->setPen(m_pen["selection-group-inside"]);
psx->setBrush(m_brush["selection-group-inside"]);
@@ -451,18 +443,8 @@
for (uint a=0; a<docSelectionCount; ++a)
{
currItem = m_doc->m_Selection->itemAt(a);
-
- //Try to detect if the pageitem is a top level item.
- if( currItem->Groups.count() > 0)
- {
- if(! currItem->controlsGroup() )
- continue;
- else
- {
- if(currItem->Groups.count() > 1)
- continue;
- }
- }
+ if (!m_doc->Items->contains(currItem))
+ continue;
p->save();
if (docSelectionCount < m_canvas->moveWithFullOutlinesThreshold /*&& currItem->rotation() == 0*/)
{
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Dec 23 13:13:38 2010
@@ -63,6 +63,7 @@
#include "selection.h"
#include "sclimits.h"
#include "text/nlsconfig.h"
+#include "text/storytext.h"
#include "undomanager.h"
#include "undostate.h"
#include "util.h"
@@ -3807,7 +3808,7 @@
if (isLocked != m_Locked)
toggleLock();
}
-
+/*
void PageItem::setGroupsLastItem(PageItem* item)
{
if (UndoManager::undoEnabled())
@@ -3819,7 +3820,7 @@
}
groupsLastItem = item;
}
-
+*/
QList<PageItem*> PageItem::getItemList()
{
QList<PageItem*> ret;
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Thu Dec 23 13:13:38 2010
@@ -232,11 +232,11 @@
delete tempImageFile;
}
- static const Xml_string saxxDefaultElem;
- static void desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
-
- virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
- virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
+// static const Xml_string saxxDefaultElem;
+// static void desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
+
+ void saxx(SaxHandler& handler, const Xml_string& elemtag) const {};
+ void saxx(SaxHandler& handler) const {}
/**
* @brief Clear the contents of a frame.
@@ -543,12 +543,12 @@
bool ScaleType;
bool AspectRatio;
QStack<int> Groups;
- const QStack<int>& groups() const { return Groups; }
- QStack<int>& groups() { return Groups; }
- void setGroups( QStack<int> val) { Groups = val; }
-
- bool controlsGroup() const { return isGroupControl; }
- void setControlsGroup(bool val) { isGroupControl = val; }
+// const QStack<int>& groups() const { return Groups; }
+// QStack<int>& groups() { return Groups; }
+// void setGroups( QStack<int> val) { Groups = val; }
+
+// bool controlsGroup() const { return isGroupControl; }
+// void setControlsGroup(bool val) { isGroupControl = val; }
QVector<double> DashValues;
double DashOffset;
@@ -586,7 +586,7 @@
bool isSingleSel;
bool isGroupControl;
PageItem *groupsLastItem;
- void setGroupsLastItem(PageItem* item);
+// void setGroupsLastItem(PageItem* item);
QList<PageItem*> groupItemList;
virtual QList<PageItem*> getItemList();
double groupWidth;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Dec 23 13:13:38 2010
@@ -179,8 +179,8 @@
LayerToPaste = toLayer;
Xp = Xp_in;
Yp = Yp_in;
- GrX = 0.0;
- GrY = 0.0;
+// GrX = 0.0;
+// GrY = 0.0;
QMap<int,int> TableID;
QMap<int,int> TableIDM;
@@ -2562,7 +2562,10 @@
if ((tagName == "PAGEOBJECT") || (tagName == "ITEM"))
newItem->OnMasterPage = "";
if (tagName == "ITEM")
+ {
newItem->LayerID = LayerToPaste;
+ newItem->OwnPage = doc->OnPage(newItem);
+ }
QString tmpf = attrs.valueAsString("IFONT", doc->itemToolPrefs().textFont);
m_AvailableFonts->findFont(tmpf, doc);
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Dec 23 13:13:38 2010
@@ -2372,7 +2372,7 @@
slotDocCh(false);
else
{
- bool setter = doc->Pages->count() > 1 ? true : false;
+ bool setter = doc->DocPages.count() > 1 ? true : false;
scrActions["pageDelete"]->setEnabled(setter);
scrActions["pageMove"]->setEnabled(setter);
}
@@ -2486,7 +2486,7 @@
scrActions["toolsPDFAnnot3D"]->setEnabled(true);
#endif
- bool setter = doc->Pages->count() > 1 ? true : false;
+ bool setter = doc->DocPages.count() > 1 ? true : false;
scrActions["pageDelete"]->setEnabled(setter);
scrActions["pageMove"]->setEnabled(setter);
scrActions["pageInsert"]->setEnabled(true);
@@ -3197,17 +3197,18 @@
updateActiveWindowCaption(doc->DocName + "*");
// scrActions["fileSave"]->setEnabled(true);
// scrActions["fileSaveAs"]->setEnabled(true);
- if (!doc->symbolEditMode())
- scrActions["fileCollect"]->setEnabled(true);
- else if (!doc->masterPageMode())
- {
+ if (!doc->masterPageMode())
+ {
+ if (!doc->symbolEditMode())
+ {
+ if (doc->hasName)
+ scrActions["fileRevert"]->setEnabled(true);
+ bool multiPages = doc->DocPages.count() > 1;
+ scrActions["pageDelete"]->setEnabled(multiPages);
+ scrActions["pageMove"]->setEnabled(multiPages);
+ scrActions["fileCollect"]->setEnabled(true);
+ }
scrActions["fileClose"]->setEnabled(true);
- if (doc->hasName)
- scrActions["fileRevert"]->setEnabled(true);
-
- bool multiPages = doc->Pages->count() > 1;
- scrActions["pageDelete"]->setEnabled(multiPages);
- scrActions["pageMove"]->setEnabled(multiPages);
}
if (outlinePalette->isVisible())
@@ -4934,7 +4935,7 @@
{
if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
return;
-
+/*
// new version:
std::ostringstream xmlString;
SaxXML xmlStream(xmlString);
@@ -4955,7 +4956,18 @@
mimeData->setScribusFragment ( QByteArray(xml.c_str(), xml.length()) );
mimeData->setText( QString::fromUtf8(xml.c_str(), xml.length()) );
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
-
+*/
+ ScriXmlDoc ss;
+ QString BufferS = ss.WriteElem(doc, doc->m_Selection);
+ if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy))
+ {
+ scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName());
+ rebuildRecentPasteMenu();
+ }
+ ScElemMimeData* mimeData = new ScElemMimeData();
+ mimeData->setScribusElem(BufferS);
+ mimeData->setText(BufferS);
+ QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
for (int i=0; i < doc->m_Selection->count(); ++i)
{
PageItem* frame = doc->m_Selection->itemAt(i);
@@ -5035,7 +5047,6 @@
scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName());
rebuildRecentPasteMenu();
}
-
ScElemMimeData* mimeData = new ScElemMimeData();
mimeData->setScribusElem(BufferS);
mimeData->setText(BufferS);
@@ -6902,8 +6913,7 @@
view->Deselect(true);
view->DrawNew();
pagePalette->rebuildPages();
- if (outlinePalette->isVisible())
- outlinePalette->BuildTree();
+ slotDocCh();
}
delete dia;
}
@@ -8660,7 +8670,7 @@
scrActions["pageImport"]->setEnabled(true);
scrActions["pageApplyMasterPage"]->setEnabled(true);
scrActions["pageCopyToMasterPage"]->setEnabled(true);
- bool setter = doc->Pages->count() > 1 ? true : false;
+ bool setter = doc->DocPages.count() > 1 ? true : false;
scrActions["pageDelete"]->setEnabled(setter);
scrActions["pageMove"]->setEnabled(setter);
scrActions["toolsPDFPushButton"]->setEnabled(true);
@@ -8761,7 +8771,7 @@
scrActions["pageImport"]->setEnabled(true);
scrActions["pageApplyMasterPage"]->setEnabled(true);
scrActions["pageCopyToMasterPage"]->setEnabled(true);
- bool setter = doc->Pages->count() > 1 ? true : false;
+ bool setter = doc->DocPages.count() > 1 ? true : false;
scrActions["pageDelete"]->setEnabled(setter);
scrActions["pageMove"]->setEnabled(setter);
scrActions["toolsPDFPushButton"]->setEnabled(true);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Dec 23 13:13:38 2010
@@ -39,7 +39,7 @@
#include "colorblind.h"
#include "commonstrings.h"
#include "desaxe/digester.h"
-#include "desaxe/saxXML.h"
+//#include "desaxe/saxXML.h"
#include "fileloader.h"
#include "filewatcher.h"
#include "ui/guidemanager.h"
@@ -1997,21 +1997,21 @@
if(!setActiveLayer(whereToInsert))
return;
Selection sourceSelection(this);
- for (int ite(0); ite < Items->count(); ++ite)
+ for (int ite = 0; ite < Items->count(); ++ite)
{
PageItem *itemToCopy = Items->at(ite);
if (itemToCopy->LayerID == layerIDToCopy)
{
sourceSelection.addItem(itemToCopy);
}
- }
- if (sourceSelection.count() > 0)
- {
- Selection targetSelection(Serializer(*this).cloneObjects(sourceSelection));
- for(int si(0); si < targetSelection.count(); ++si)
- {
- targetSelection.itemAt(si)->setLayer(whereToInsert);
- }
+ if (sourceSelection.count() != 0)
+ {
+ ScriXmlDoc *ss = new ScriXmlDoc();
+ QString dataS = ss->WriteElem(this, &sourceSelection);
+ ss->ReadElemToLayer(dataS, appPrefsData.fontPrefs.AvailFonts, this, Pages->at(0)->xOffset(), Pages->at(0)->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, whereToInsert);
+ delete ss;
+ }
+ sourceSelection.clear();
}
}
@@ -5973,42 +5973,39 @@
Page* lastDest = NULL;
uint oldItems = Items->count();
- QList<QByteArray> itemBuffer;
+ QList<QString> itemBuffer;
+ Selection tempSelection(this, false);
m_Selection->clear();
- m_Selection->delaySignalsOn();
+ tempSelection.delaySignalsOn();
if (oldItems>0)
{
- ScLayers::iterator it;
if (Layers.count()!= 0)
{
int currActiveLayer = activeLayer();
- for (it = Layers.begin(); it != Layers.end(); ++it)
+ for (ScLayers::iterator it = Layers.begin(); it != Layers.end(); ++it)
{
setActiveLayer(it->ID);
for (uint ite = 0; ite < oldItems; ++ite)
{
PageItem *itemToCopy = Items->at(ite);
if ((itemToCopy->OwnPage == static_cast<int>(from->pageNr())) && (it->ID == itemToCopy->LayerID))
- m_Selection->addItem(itemToCopy, true);
+ tempSelection.addItem(itemToCopy, true);
}
- if (m_Selection->count() != 0)
+ if (tempSelection.count() != 0)
{
- std::ostringstream xmlString;
- SaxXML xmlStream(xmlString);
- Serializer::serializeObjects(*m_Selection, xmlStream);
- std::string xml(xmlString.str());
- itemBuffer.append( QByteArray(xml.c_str(), xml.size()) );
- m_Selection->clear();
+ ScriXmlDoc *ss = new ScriXmlDoc();
+ QString dataS = ss->WriteElem(this, &tempSelection);
+ itemBuffer.append(dataS);
+ delete ss;
}
else
- {
- itemBuffer.append(QByteArray());
- }
+ itemBuffer.append(QString());
+ tempSelection.clear();
}
setActiveLayer(currActiveLayer);
}
}
- m_Selection->delaySignalsOff();
+ tempSelection.delaySignalsOff();
for (int copyNumber=1; copyNumber<=copyCount; ++copyNumber)
@@ -6077,14 +6074,10 @@
{
if ((lcount < itemBuffer.count()) && !itemBuffer[lcount].isEmpty())
{
- QByteArray fragment = itemBuffer[lcount];
- Selection pastedObjects = Serializer(*this).deserializeObjects(fragment);
- for (int i=0; i < pastedObjects.count(); ++i)
- pastedObjects.itemAt(i)->LayerID = it->ID;
- // We do not need moveGroup undo actions
- UndoManager::instance()->setUndoEnabled(false);
- moveGroup(destination->xOffset() - from->xOffset(), destination->yOffset() - from->yOffset(), false, &pastedObjects);
- UndoManager::instance()->setUndoEnabled(true);
+ QString fragment = itemBuffer[lcount];
+ ScriXmlDoc *ss = new ScriXmlDoc();
+ ss->ReadElemToLayer(fragment, appPrefsData.fontPrefs.AvailFonts, this, destination->xOffset(), destination->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
+ delete ss;
}
lcount++;
}
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Thu Dec 23 13:13:38 2010
@@ -2152,7 +2152,7 @@
int ac = Doc->Items->count();
if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Doc->currentPage()->getUName(), 0, Um::Paste, "", Um::IPaste));
- if (ScMimeData::clipboardHasScribusFragment())
+/* if (ScMimeData::clipboardHasScribusFragment())
{
bool savedAlignGrid = Doc->useRaster;
bool savedAlignGuides = Doc->SnapGuides;
@@ -2167,10 +2167,10 @@
Doc->m_Selection->clear();
}
else
- {
+ { */
QString buffer = ScMimeData::clipboardScribusElem();
emit LoadElem(buffer, dragX, dragY, false, false, Doc, this);
- }
+// }
Doc->DraggedElem = 0;
Doc->DragElements.clear();
updateContents();
Modified: trunk/Scribus/scribus/serializer.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/serializer.cpp
==============================================================================
--- trunk/Scribus/scribus/serializer.cpp (original)
+++ trunk/Scribus/scribus/serializer.cpp Thu Dec 23 13:13:38 2010
@@ -177,6 +177,7 @@
}
+#if 0
void Serializer::serializeObjects(const Selection& selection, SaxHandler& outputhandler)
{
Xml_attr attr;
@@ -445,6 +446,7 @@
return result;
}
+#endif
bool Serializer::writeWithEncoding(const QString& filename, const QString& encoding,
const QString& txt)
@@ -482,7 +484,7 @@
}
return false;
}
-
+/*
void Serializer::updateGradientColors(const ColorList& colors)
{
VColorStop* grStop;
@@ -595,3 +597,4 @@
}
}
}
+*/
Modified: trunk/Scribus/scribus/serializer.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16159&path=/trunk/Scribus/scribus/serializer.h
==============================================================================
--- trunk/Scribus/scribus/serializer.h (original)
+++ trunk/Scribus/scribus/serializer.h Thu Dec 23 13:13:38 2010
@@ -58,19 +58,19 @@
Writes all objects in selection to handler as a fragment. Needed styles and colors
are included.
*/
- static void serializeObjects(const Selection& objects, SaxHandler& handler);
+// static void serializeObjects(const Selection& objects, SaxHandler& handler);
/**
Reads objects from the given QString which must represent a fragment, imports them
into the document and returns a (nonGUI) selection to it.
*/
- Selection deserializeObjects(const QByteArray & xml);
+// Selection deserializeObjects(const QByteArray & xml);
/**
Reads objects from the given QFile which must represent a fragment, imports them
into the document and returns a (nonGUI) selection to it.
*/
- Selection deserializeObjects(const QFile & xml);
+// Selection deserializeObjects(const QFile & xml);
- Selection cloneObjects(const Selection& objects);
+// Selection cloneObjects(const Selection& objects);
/** Legacy method to read plain text for a textframe */
static bool readWithEncoding(const QString& filename, const QString& encoding,
@@ -82,8 +82,8 @@
private:
ScribusDoc& m_Doc;
ColorList backUpColors;
- Selection importCollection();
- void updateGradientColors(const ColorList& colors);
+// Selection importCollection();
+// void updateGradientColors(const ColorList& colors);
};
#endif
More information about the scribus-commit
mailing list