r16916 by fschmid - First part of fixing Bug 10179 "change level by moving the items in the outline palette"
scribus-commit
scribus-commit at lists.scribus.net
Wed Oct 19 20:29:54 UTC 2011
Author: fschmid
Date: Wed Oct 19 20:29:54 2011
New Revision: 16916
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16916
Log:
First part of fixing Bug 10179 "change level by moving the items in the outline palette"
Modified:
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/ui/outlinepalette.cpp
trunk/Scribus/scribus/ui/outlinepalette.h
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16916&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Oct 19 20:29:54 2011
@@ -99,6 +99,7 @@
#include "gtgettext.h"
#include "hyphenator.h"
#include "langmgr.h"
+#include "pageitem_group.h"
#include "pageitem_imageframe.h"
#include "pageitem_latexframe.h"
#include "pageitem_table.h"
@@ -2139,7 +2140,7 @@
{
PageItem *currItem = doc->Items->at(i);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -2728,7 +2729,7 @@
scrActions["toolsCopyProperties"]->setEnabled(false);
//CB 061005 moved to cpalette choosegrad
//propertiesPalette->Cpal->gradientQCombo->setCurrentItem(0);
- outlinePalette->slotShowSelect(doc->currentPageNumber(), -1);
+ outlinePalette->slotShowSelect(doc->currentPageNumber(), NULL);
propertiesPalette->setGradientEditMode(false);
break;
case PageItem::ImageFrame: //Image Frame
@@ -3155,7 +3156,7 @@
if (SelectedType != -1)
{
//propertiesPalette->setCurrentItem(currItem);
- outlinePalette->slotShowSelect(currItem->OwnPage, currItem->ItemNr);
+ outlinePalette->slotShowSelect(currItem->OwnPage, currItem);
actionManager->connectNewSelectionActions(view, doc);
// propertiesPalette->handleSelectionChanged();
}
@@ -5850,7 +5851,7 @@
{
PageItem *currItem = doc->Items->at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16916&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Oct 19 20:29:54 2011
@@ -538,7 +538,7 @@
{
PageItem *currItem = DocItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -558,7 +558,7 @@
{
PageItem *currItem = MasterItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -578,7 +578,7 @@
{
PageItem *currItem = FrameItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -602,7 +602,7 @@
{
PageItem *currItem = pa.items.at(o);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -672,7 +672,7 @@
PageItem* embedded = items.at(em);
ret.append(embedded);
if (embedded->isGroup())
- ret += embedded->getItemList();
+ ret += embedded->asGroupFrame()->getItemList();
}
return ret;
}
@@ -2917,7 +2917,7 @@
{
PageItem* currItem = MasterItems.at(i);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -2933,7 +2933,7 @@
{
PageItem* currItem = DocItems.at(i);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3169,7 +3169,7 @@
{
PageItem* currItem = MasterItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3194,7 +3194,7 @@
{
PageItem* currItem = DocItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3219,7 +3219,7 @@
{
PageItem* currItem = FrameItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3246,7 +3246,7 @@
{
PageItem* currItem = it.value().items.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3397,7 +3397,7 @@
{
PageItem* currItem = MasterItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3419,7 +3419,7 @@
{
PageItem* currItem = DocItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3439,7 +3439,7 @@
{
PageItem* currItem = FrameItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3461,7 +3461,7 @@
{
PageItem* currItem = it.value().items.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3544,7 +3544,7 @@
break;
}
if (it->isGroup())
- allItems = it->getItemList();
+ allItems = it->asGroupFrame()->getItemList();
else
allItems.append(it);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3620,7 +3620,7 @@
break;
}
if (it->isGroup())
- allItems = it->getItemList();
+ allItems = it->asGroupFrame()->getItemList();
else
allItems.append(it);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3639,7 +3639,7 @@
{
it = pa.items.at(o);
if (it->isGroup())
- allItems = it->getItemList();
+ allItems = it->asGroupFrame()->getItemList();
else
allItems.append(it);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -3850,7 +3850,7 @@
else if(lc == 2)
it = FrameItems.at(d);
if (it->isGroup())
- allItems = it->getItemList();
+ allItems = it->asGroupFrame()->getItemList();
else
allItems.append(it);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -5028,7 +5028,7 @@
{
if (!currItem->isGroup())
return;
- QList<PageItem*> Objects = currItem->getItemList();
+ QList<PageItem*> Objects = currItem->asGroupFrame()->getItemList();
int Off_Page = -1;
int On_Page = 999999;
uint objectCount = Objects.count();
@@ -5046,6 +5046,7 @@
{
Objects.at(a)->OwnPage = final;
}
+ currItem->OwnPage = OnPage(currItem);
}
void ScribusDoc::fixItemPageOwner()
@@ -6151,7 +6152,7 @@
{
PageItem *ite = DocItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -6175,7 +6176,7 @@
{
PageItem *ite = MasterItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -6199,7 +6200,7 @@
{
PageItem *ite = FrameItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -6227,7 +6228,7 @@
{
PageItem *ite = pa.items.at(o);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -6273,7 +6274,7 @@
{
it = items->at(i);
if (it->isGroup())
- allItems = it->getItemList();
+ allItems = it->asGroupFrame()->getItemList();
else
allItems.append(it);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8167,7 +8168,7 @@
{
PageItem *currItem = DocItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8189,7 +8190,7 @@
{
PageItem *currItem = MasterItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8211,7 +8212,7 @@
{
PageItem *currItem = FrameItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8237,7 +8238,7 @@
{
PageItem *currItem = pa.items.at(o);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8273,7 +8274,7 @@
{
PageItem *currItem = DocItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8306,7 +8307,7 @@
{
PageItem *currItem = MasterItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8339,7 +8340,7 @@
{
PageItem *currItem = FrameItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8376,7 +8377,7 @@
{
PageItem *currItem = pa.items.at(o);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8427,7 +8428,7 @@
{
PageItem *currItem = DocItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8442,7 +8443,7 @@
{
PageItem *currItem = MasterItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8457,7 +8458,7 @@
{
PageItem *currItem = FrameItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8476,7 +8477,7 @@
{
PageItem *currItem = pa.items.at(o);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8493,7 +8494,7 @@
{
PageItem *currItem = DocItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8524,7 +8525,7 @@
{
PageItem *currItem = MasterItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8555,7 +8556,7 @@
{
PageItem *currItem = FrameItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8589,7 +8590,7 @@
{
PageItem *currItem = pa.items.at(o);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8633,7 +8634,7 @@
{
PageItem *currItem = DocItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8652,7 +8653,7 @@
{
PageItem *currItem = MasterItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8671,7 +8672,7 @@
{
PageItem *currItem = FrameItems.at(a);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -8694,7 +8695,7 @@
{
PageItem *currItem = pa.items.at(o);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -9401,7 +9402,7 @@
{
PageItem *currItem = DocItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -9423,7 +9424,7 @@
{
PageItem *currItem = MasterItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -9445,7 +9446,7 @@
{
PageItem *currItem = FrameItems.at(c);
if (currItem->isGroup())
- allItems = currItem->getItemList();
+ allItems = currItem->asGroupFrame()->getItemList();
else
allItems.append(currItem);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -11513,7 +11514,7 @@
{
PageItem *ite = DocItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -11527,7 +11528,7 @@
{
PageItem *ite = MasterItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -11547,7 +11548,7 @@
{
PageItem *ite = DocItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -11564,7 +11565,7 @@
{
PageItem *ite = MasterItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -11586,7 +11587,7 @@
{
PageItem *ite = DocItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -11601,7 +11602,7 @@
{
PageItem *ite = MasterItems.at(c);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
@@ -13085,7 +13086,7 @@
ss->set("GROUP", "group");
ss->set("itemcount", selectedItemCount + 1);
ss->set(QString("item%1").arg(0), groupItem->uniqueNr);
- for (uint a = 0; a < groupItem->groupItemList.count(); ++a)
+ for (int a = 0; a < groupItem->groupItemList.count(); ++a)
{
currItem = groupItem->groupItemList.at(a);
ss->set(QString("item%1").arg(a + 1), currItem->uniqueNr);
@@ -14047,7 +14048,7 @@
{
PageItem* ite = DocItems.at(i);
if (ite->isGroup())
- allItems = ite->getItemList();
+ allItems = ite->asGroupFrame()->getItemList();
else
allItems.append(ite);
for (int ii = 0; ii < allItems.count(); ii++)
Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16916&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Wed Oct 19 20:29:54 2011
@@ -21,6 +21,7 @@
#include <QWidgetAction>
#include <QSignalMapper>
#include <QShortcut>
+#include <QDebug>
#include "actionmanager.h"
#include "canvasmode.h"
@@ -60,6 +61,7 @@
OutlineWidget::OutlineWidget(QWidget* parent) : QTreeWidget(parent)
{
+ setDragDropMode(QAbstractItemView::InternalMove);
}
void OutlineWidget::selectItems(QList<QTreeWidgetItem*> items)
@@ -74,6 +76,147 @@
}
}
selectionModel()->select(itemSelection, QItemSelectionModel::Select);
+}
+
+void OutlineWidget::dropEvent(QDropEvent *e)
+{
+ bool haveLayers = false;
+ QModelIndex id;
+ QTreeWidgetItem* it = NULL;
+ QList<QModelIndex> idxs = selectedIndexes();
+ if (!idxs.isEmpty())
+ id = idxs.at(0);
+ if (id.isValid())
+ it = itemFromIndex(id);
+ QTreeWidgetItem *oldParent = it->parent();
+ QTreeWidgetItem *oldPageParent = NULL;
+ OutlineTreeItem *itemP = (OutlineTreeItem*)oldParent;
+ if (itemP->type == 5) // old Parent is a Layer
+ {
+ oldPageParent = it->parent()->parent();
+ haveLayers = true;
+ }
+ else
+ oldPageParent = it->parent();
+ QTreeWidget::dropEvent(e);
+ if (it != NULL)
+ {
+ OutlineTreeItem *item = (OutlineTreeItem*)it;
+ if (item != NULL)
+ {
+ OutlineTreeItem *itemPl = (OutlineTreeItem*)it->parent();
+ OutlineTreeItem *itemPar = (OutlineTreeItem*)oldPageParent;
+ OutlineTreeItem *itemPg;
+ if (itemPl->type == 5)
+ {
+ itemPg = (OutlineTreeItem*)it->parent()->parent();
+ }
+ else
+ {
+ itemPg = (OutlineTreeItem*)it->parent();
+ if (haveLayers)
+ {
+ itemPl = (OutlineTreeItem*)itemBelow(itemPg);
+ itemPg->removeChild(it);
+ itemPl->addChild(it);
+ }
+ }
+ if (itemPl->childCount() > 1)
+ {
+ if (itemAbove(it) != NULL) // do we have a pageitem above us
+ {
+ OutlineTreeItem *itemAb = (OutlineTreeItem*)itemAbove(it);
+ if ((itemAb->type == 1) || (itemAb->type == 3) || (itemAb->type == 4))
+ {
+ item->DocObject->Items->takeAt(item->DocObject->Items->indexOf(item->PageItemObject));
+ int d = item->DocObject->Items->indexOf(itemAb->PageItemObject);
+ item->DocObject->Items->insert(d, item->PageItemObject);
+ if (itemPl->type == 5)
+ item->PageItemObject->setLayer(itemPl->LayerID);
+ double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset();
+ double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset();
+ item->PageItemObject->setXYPos(xx, yy);
+ item->DocObject->setModified(true);
+ item->PageItemObject->setRedrawBounding();
+ item->DocObject->scMW()->showLayer();
+ item->DocObject->scMW()->closeActiveWindowMasterPageEditor();
+ if (item->PageItemObject->isGroup())
+ {
+ item->DocObject->GroupOnPage(item->PageItemObject);
+ item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, false);
+ }
+ else
+ {
+ item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject);
+ item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true);
+ }
+ item->DocObject->renumberItemsInListOrder();
+ QList<QTreeWidgetItem*> selList;
+ selList.append(it);
+ selectItems(selList);
+ }
+ else if (itemBelow(it) != NULL)
+ {
+ OutlineTreeItem *itemBe = (OutlineTreeItem*)itemBelow(it);
+ if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4))
+ {
+ item->DocObject->Items->takeAt(item->DocObject->Items->indexOf(item->PageItemObject));
+ int d = item->DocObject->Items->indexOf(itemBe->PageItemObject);
+ item->DocObject->Items->insert(d+1, item->PageItemObject);
+ if (itemPl->type == 5)
+ item->PageItemObject->setLayer(itemPl->LayerID);
+ double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset();
+ double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset();
+ item->PageItemObject->setXYPos(xx, yy);
+ item->PageItemObject->setRedrawBounding();
+ item->DocObject->setModified(true);
+ item->DocObject->scMW()->showLayer();
+ item->DocObject->scMW()->closeActiveWindowMasterPageEditor();
+ if (item->PageItemObject->isGroup())
+ {
+ item->DocObject->GroupOnPage(item->PageItemObject);
+ item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, false);
+ }
+ else
+ {
+ item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject);
+ item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true);
+ }
+ item->DocObject->renumberItemsInListOrder();
+ QList<QTreeWidgetItem*> selList;
+ selList.append(it);
+ selectItems(selList);
+ }
+ }
+ }
+ }
+ else
+ {
+ if (itemPl->type == 5)
+ item->PageItemObject->setLayer(itemPl->LayerID);
+ double xx = item->PageItemObject->xPos() - itemPar->PageObject->xOffset() + itemPg->PageObject->xOffset();
+ double yy = item->PageItemObject->yPos() - itemPar->PageObject->yOffset() + itemPg->PageObject->yOffset();
+ item->PageItemObject->setXYPos(xx, yy);
+ item->PageItemObject->setRedrawBounding();
+ item->DocObject->setModified(true);
+ item->DocObject->scMW()->showLayer();
+ item->DocObject->scMW()->closeActiveWindowMasterPageEditor();
+ if (item->PageItemObject->isGroup())
+ {
+ item->DocObject->GroupOnPage(item->PageItemObject);
+ item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, false);
+ }
+ else
+ {
+ item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject);
+ item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true);
+ }
+ QList<QTreeWidgetItem*> selList;
+ selList.append(it);
+ selectItems(selList);
+ }
+ }
+ }
}
bool OutlineWidget::viewportEvent(QEvent *event)
@@ -106,14 +249,21 @@
}
else if ((item->type == 1) || (item->type == 3) || (item->type == 4))
{
- PageItem *pgItem = item->PageItemObject;
+ PageItem *pgItem = item->PageItemObject;
+ QPainter p;
+ QImage pm = QImage(80, 80, QImage::Format_ARGB32_Premultiplied);
+ QBrush b(QColor(205,205,205), loadIcon("testfill.png"));
+ p.begin(&pm);
+ p.fillRect(QRectF(0, 0, 80, 80), b);
QImage thumb = pgItem->DrawObj_toImage(80);
+ p.drawImage((80 - thumb.width()) / 2, (80 - thumb.height()) / 2, thumb);
+ p.end();
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
- thumb.save(&buffer, "PNG");
+ pm.save(&buffer, "PNG");
QByteArray ba = buffer.buffer().toBase64();
buffer.close();
- tipText = "<p align=}\"center\"><img src=\"data:image/png;base64," + QString(ba) + "\"></p><p>";
+ tipText = "<p align=\"center\"><img src=\"data:image/png;base64," + QString(ba) + "\"></p><p>";
switch (pgItem->itemType())
{
case PageItem::ImageFrame:
@@ -464,13 +614,13 @@
connect(reportDisplay, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotDoRename(QTreeWidgetItem*, int)));
}
-QTreeWidgetItem* OutlinePalette::getListItem(int SNr, int Nr)
+QTreeWidgetItem* OutlinePalette::getListItem(int SNr, PageItem *Nr)
{
OutlineTreeItem *item = 0;
QTreeWidgetItem *retVal = 0;
if (currDoc->masterPageMode())
{
- if (Nr == -1)
+ if (Nr == NULL)
{
QTreeWidgetItemIterator it( reportDisplay );
while ( (*it) )
@@ -490,7 +640,7 @@
while ( (*it) )
{
item = (OutlineTreeItem*)(*it);
- if ((item->type == 1) && (static_cast<int>(item->PageItemObject->ItemNr) == Nr))
+ if ((item->type == 1) && (item->PageItemObject == Nr))
{
retVal = (*it);
break;
@@ -501,7 +651,7 @@
}
else
{
- if (Nr == -1)
+ if (Nr == NULL)
{
QTreeWidgetItemIterator it( reportDisplay );
while ( (*it) )
@@ -521,7 +671,7 @@
while ( (*it) )
{
item = (OutlineTreeItem*)(*it);
- if (((item->type == 3) || (item->type == 4)) && (static_cast<int>(item->PageItemObject->ItemNr) == Nr))
+ if (((item->type == 3) || (item->type == 4)) && (item->PageItemObject == Nr))
{
retVal = (*it);
break;
@@ -533,7 +683,7 @@
return retVal;
}
-void OutlinePalette::slotShowSelect(uint SNr, int Nr)
+void OutlinePalette::slotShowSelect(uint SNr, PageItem *Nr)
{
if (!m_MainWindow || m_MainWindow->scriptIsRunning())
return;
@@ -552,7 +702,7 @@
for (uint a = 0; a < docSelectionCount; a++)
{
PageItem *item = currDoc->m_Selection->itemAt(a);
- QTreeWidgetItem *retVal = getListItem(item->OwnPage, item->ItemNr);
+ QTreeWidgetItem *retVal = getListItem(item->OwnPage, item);
if (retVal != 0)
itemSelection.append(retVal);
}
@@ -807,6 +957,7 @@
rootObject = item;
item->setText( 0, currDoc->DocName.section( '/', -1 ) );
item->type = -2;
+ item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
OutlineTreeItem * pagep = 0;
freeObjects = 0;
PageItem* pgItem;
@@ -816,6 +967,7 @@
OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
page->PageObject = currDoc->Pages->at(0);
page->type = 2;
+ page->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
pagep = page;
for (int b = 0; b < currDoc->Items->count(); ++b)
{
@@ -824,19 +976,23 @@
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
+ object->PageObject = currDoc->DocPages.at(0);
+ object->DocObject = currDoc;
object->type = 3;
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
- object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
}
else
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
+ object->PageObject = currDoc->DocPages.at(0);
+ object->DocObject = currDoc;
object->type = 3;
object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
- object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
parseSubGroup(object, &pgItem->groupItemList, 3, currDoc->Pages->at(0));
}
}
@@ -849,6 +1005,7 @@
OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
page->PageObject = currDoc->MasterPages.at(a);
page->type = 0;
+ page->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
QString pageNam = currDoc->MasterPages.at(a)->pageName();
pagep = page;
for (int b = 0; b < currDoc->MasterItems.count(); ++b)
@@ -860,6 +1017,8 @@
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
+ object->PageObject = currDoc->MasterPages.at(a);
+ object->DocObject = currDoc;
object->type = 1;
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
@@ -869,6 +1028,8 @@
{
OutlineTreeItem * object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
+ object->PageObject = currDoc->MasterPages.at(a);
+ object->DocObject = currDoc;
object->type = 1;
object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
@@ -885,6 +1046,7 @@
OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
page->PageObject = currDoc->DocPages.at(a);
page->type = 2;
+ page->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
pagep = page;
int layerCount = currDoc->layerCount();
if (layerCount > 1)
@@ -907,6 +1069,7 @@
ObjLayer->type = 5;
ObjLayer->LayerID = layer.ID;
ObjLayer->DocObject = currDoc;
+ ObjLayer->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
ObjLayer->setText(0, tr("Layer: \"") + layer.Name + "\"");
for (int it = 0; it < pgItems.count(); ++it)
{
@@ -922,7 +1085,7 @@
object->type = 3;
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
- object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
}
else
{
@@ -933,7 +1096,7 @@
object->type = 3;
object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
- object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
parseSubGroup(object, &pgItem->groupItemList, 3, currDoc->DocPages.at(a));
}
}
@@ -957,7 +1120,7 @@
object->type = 3;
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
- object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
}
else
{
@@ -968,7 +1131,7 @@
object->type = 3;
object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
- object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
parseSubGroup(object, &pgItem->groupItemList, 3, currDoc->DocPages.at(a));
}
}
@@ -982,6 +1145,7 @@
pagep = page;
freeObjects = page;
page->type = -3;
+ page->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
int layerCount = currDoc->layerCount();
if (layerCount > 1)
{
@@ -1001,6 +1165,7 @@
ObjLayer->type = 5;
ObjLayer->LayerID = layer.ID;
ObjLayer->DocObject = currDoc;
+ ObjLayer->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
ObjLayer->setText(0, tr("Layer: \"") + layer.Name + "\"");
for (int it = 0; it < pgItems.count(); ++it)
{
@@ -1013,7 +1178,7 @@
object->PageItemObject = pgItem;
object->PageObject = NULL;
object->DocObject = currDoc;
- object->type = 3;
+ object->type = 4;
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
@@ -1024,7 +1189,7 @@
object->PageItemObject = pgItem;
object->PageObject = NULL;
object->DocObject = currDoc;
- object->type = 3;
+ object->type = 4;
object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
@@ -1071,9 +1236,10 @@
}
if (storeVals)
reopenTree();
+ reportDisplay->invisibleRootItem()->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
setUpdatesEnabled(true);
if (currDoc->m_Selection->count() > 0)
- slotShowSelect(0, -1);
+ slotShowSelect(0, NULL);
filterTree();
repaint();
connect(reportDisplay, SIGNAL(itemSelectionChanged()), this, SLOT(slotMultiSelect()));
Modified: trunk/Scribus/scribus/ui/outlinepalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16916&path=/trunk/Scribus/scribus/ui/outlinepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.h (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.h Wed Oct 19 20:29:54 2011
@@ -46,6 +46,7 @@
void selectItems(QList<QTreeWidgetItem*> items);
protected:
+ void dropEvent(QDropEvent *e);
bool viewportEvent(QEvent *event);
};
@@ -63,7 +64,7 @@
void setDoc(ScribusDoc *);
void unsetDoc();
void reopenTree();
- QTreeWidgetItem* getListItem(int SNr, int Nr);
+ QTreeWidgetItem* getListItem(int SNr, PageItem *Nr);
void setItemIcon(QTreeWidgetItem *item, PageItem *pgItem);
void parseSubGroup(OutlineTreeItem* object, QList<PageItem*> *subGroupList, int itemType, ScPage *a);
void buildReopenVals();
@@ -72,7 +73,7 @@
void BuildTree(bool storeVals = true);
void filterTree(const QString& keyword);
void languageChange();
- void slotShowSelect(uint SNr, int Nr);
+ void slotShowSelect(uint SNr, PageItem *Nr);
void setPaletteShown(bool);
void slotRightClick(QPoint point);
void setActiveLayer(int layerID);
More information about the scribus-commit
mailing list