r16740 by fschmid - Made the Outline Palette useable when editing Symbols/Patterns.

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 31 10:30:09 UTC 2011


Author: fschmid
Date: Sun Jul 31 10:30:08 2011
New Revision: 16740

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16740
Log:
Made the Outline Palette useable when editing Symbols/Patterns.

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/ui/outlinepalette.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16740&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Jul 31 10:30:08 2011
@@ -7423,8 +7423,11 @@
 		view->requestMode(submodeEndNodeEdit);
 	activateWindow();
 	view->Deselect(true);
-	if ((ite->OwnPage != -1) && (ite->OwnPage != static_cast<int>(doc->currentPage()->pageNr())))
-		view->GotoPage(ite->OwnPage);
+	if (!doc->symbolEditMode())
+	{
+		if ((ite->OwnPage != -1) && (ite->OwnPage != static_cast<int>(doc->currentPage()->pageNr())))
+			view->GotoPage(ite->OwnPage);
+	}
 	doc->m_Selection->delaySignalsOn();
 	view->SelectItem(ite, true, single);
 	doc->m_Selection->delaySignalsOff();
@@ -8528,6 +8531,8 @@
 		symbolPalette->editingStart(patternsDependingOnThis);
 		propertiesPalette->Cpal->hideEditedPatterns(patternsDependingOnThis);
 		propertiesPalette->Tpal->hideEditedPatterns(patternsDependingOnThis);
+		if (outlinePalette->isVisible())
+			outlinePalette->BuildTree(false);
 		updateActiveWindowCaption( tr("Editing Symbol: %1").arg(temp));
 	}
 }
@@ -8581,6 +8586,8 @@
 	propertiesPalette->updateColorList();
 	symbolPalette->editingFinished();
 	layerPalette->setEnabled(true);
+	if (outlinePalette->isVisible())
+		outlinePalette->BuildTree(false);
 	updateActiveWindowCaption(doc->DocName);
 }
 

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16740&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Jul 31 10:30:08 2011
@@ -5403,6 +5403,8 @@
 		}
 		QRectF sR = m_Selection->getGroupRect();
 		moveGroup(-sR.x() + addedPage->xOffset(), -sR.y() + addedPage->yOffset());
+		if (Items->at(0)->isGroup())
+			Items->at(0)->asGroupFrame()->adjustXYPosition();
 		m_Selection->clear();
 		m_Selection->delaySignalsOff();
 		m_ScMW->changeLayer(0);
@@ -5418,6 +5420,7 @@
 			{
 				itemAdd(PageItem::Group, PageItem::Rectangle, addedPage->xOffset(), addedPage->yOffset(), 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
 				PageItem *groupItem = Items->takeLast();
+				groupItem->setLayer(0);
 				Items->insert(0, groupItem);
 				double minx =  std::numeric_limits<double>::max();
 				double miny =  std::numeric_limits<double>::max();
@@ -5434,6 +5437,8 @@
 					maxx = qMax(maxx, x2);
 					maxy = qMax(maxy, y2);
 				}
+				Items->clear();
+				Items->append(groupItem);
 				for (int em = 0; em < groupItem->groupItemList.count(); ++em)
 				{
 					PageItem* currItem = groupItem->groupItemList.at(em);
@@ -5446,6 +5451,8 @@
 				groupItem->setWidthHeight(maxx - minx, maxy - miny, true);
 				groupItem->groupWidth = maxx - minx;
 				groupItem->groupHeight = maxy - miny;
+				groupItem->gWidth = maxx - minx;
+				groupItem->gHeight = maxy - miny;
 				groupItem->SetRectFrame();
 				groupItem->ClipEdited = true;
 				groupItem->FrameType = 3;
@@ -5453,6 +5460,7 @@
 				groupItem->AutoName = false;
 				groupItem->setFillTransparency(0);
 				groupItem->setLineTransparency(0);
+				groupItem->asGroupFrame()->adjustXYPosition();
 				GroupCounter++;
 				renumberItemsInListOrder();
 			}
@@ -12278,6 +12286,7 @@
 		int d = Items->indexOf(currItem);
 		groupItem->groupItemList.append(Items->takeAt(d));
 	}
+	groupItem->asGroupFrame()->adjustXYPosition();
 	renumberItemsInListOrder();
 	itemSelection->clear();
 	itemSelection->addItem(groupItem);
@@ -12333,6 +12342,7 @@
 		currItem->gHeight = maxy - miny;
 	}
 	renumberItemsInListOrder();
+	groupItem->asGroupFrame()->adjustXYPosition();
 	GroupCounter++;
 	itemList.clear();
 	itemList.append(groupItem);
@@ -12373,6 +12383,7 @@
 	}
 	renumberItemsInListOrder();
 	GroupCounter++;
+	groupItem->asGroupFrame()->adjustXYPosition();
 	itemList.clear();
 	itemList.append(groupItem);
 }
@@ -12444,7 +12455,7 @@
 		miny = qMin(miny, y1);
 		maxx = qMax(maxx, x2);
 		maxy = qMax(maxy, y2);
-		}
+	}
 	double gx = minx;
 	double gy = miny;
 	double gw = maxx - minx;
@@ -12467,6 +12478,7 @@
 		groupItem->groupItemList.append(Items->takeAt(d));
 	}
 	renumberItemsInListOrder();
+	groupItem->asGroupFrame()->adjustXYPosition();
 	itemSelection->clear();
 	itemSelection->addItem(groupItem);
 	selectedItemCount = itemSelection->count();

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16740&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sun Jul 31 10:30:08 2011
@@ -832,6 +832,9 @@
 	/*** Is the document in symbol edit mode? */
 	bool symbolEditMode() const { return m_symbolEditMode; }
 	
+	/*** get the name of the symbol currently in editing */
+	QString getEditedSymbol() const { return currentEditedSymbol; }
+
 	/**
 	 * @brief Add a section to the document sections list
 	 * Set number to -1 to add in the default section if the map is empty

Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16740&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Sun Jul 31 10:30:08 2011
@@ -637,9 +637,12 @@
 				emit selectElementByItem(pgItem, true);
 			break;
 		case 2:
-			pg = item->PageObject->pageNr();
-			m_MainWindow->closeActiveWindowMasterPageEditor();
-			emit selectPage(pg);
+			if (!currDoc->symbolEditMode())
+			{
+				pg = item->PageObject->pageNr();
+				m_MainWindow->closeActiveWindowMasterPageEditor();
+				emit selectPage(pg);
+			}
 			break;
 		case 3:
 		case 4:
@@ -678,117 +681,151 @@
 	freeObjects = 0;
 	PageItem* pgItem;
 	QString tmp;
-	for (int a = 0; a < static_cast<int>(currDoc->MasterPages.count()); ++a)
+	if (currDoc->symbolEditMode())
 	{
 		OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
-		page->PageObject = currDoc->MasterPages.at(a);
-		page->type = 0;
-		QString pageNam = currDoc->MasterPages.at(a)->pageName();
-		pagep = page;
-		for (int b = 0; b < currDoc->MasterItems.count(); ++b)
-		{
-			pgItem = currDoc->MasterItems.at(b);
-			if (((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam)))
-			{
-				if (!pgItem->isGroup())
-				{
-					OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
-					object->PageItemObject = pgItem;
-					object->type = 1;
-					object->setText(0, pgItem->itemName());
-					setItemIcon(object, pgItem);
-					object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-				}
-				else
-				{
-					OutlineTreeItem * object = new OutlineTreeItem( page, 0 );
-					object->PageItemObject = pgItem;
-					object->type = 1;
-					object->setText(0, pgItem->itemName());
-					object->setIcon( 0, groupIcon );
-					object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-					parseSubGroup(object, &pgItem->groupItemList, 1);
-				}
-			}
-		}
-		page->setText(0, currDoc->MasterPages.at(a)->pageName());
-	}
-	for (int a = 0; a < static_cast<int>(currDoc->DocPages.count()); ++a)
-	{
-		OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
-		page->PageObject = currDoc->DocPages.at(a);
+		page->PageObject = currDoc->Pages->at(0);
 		page->type = 2;
 		pagep = page;
+		for (int b = 0; b < currDoc->Items->count(); ++b)
+		{
+			pgItem = currDoc->Items->at(b);
+			if (!pgItem->isGroup())
+			{
+				OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+				object->PageItemObject = pgItem;
+				object->type = 3;
+				object->setText(0, pgItem->itemName());
+				setItemIcon(object, pgItem);
+				object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+			}
+			else
+			{
+				OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+				object->PageItemObject = pgItem;
+				object->type = 3;
+				object->setText(0, pgItem->itemName());
+				object->setIcon( 0, groupIcon );
+				object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+				parseSubGroup(object, &pgItem->groupItemList, 3);
+			}
+		}
+		page->setText(0, currDoc->getEditedSymbol());
+	}
+	else
+	{
+		for (int a = 0; a < static_cast<int>(currDoc->MasterPages.count()); ++a)
+		{
+			OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
+			page->PageObject = currDoc->MasterPages.at(a);
+			page->type = 0;
+			QString pageNam = currDoc->MasterPages.at(a)->pageName();
+			pagep = page;
+			for (int b = 0; b < currDoc->MasterItems.count(); ++b)
+			{
+				pgItem = currDoc->MasterItems.at(b);
+				if (((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam)))
+				{
+					if (!pgItem->isGroup())
+					{
+						OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+						object->PageItemObject = pgItem;
+						object->type = 1;
+						object->setText(0, pgItem->itemName());
+						setItemIcon(object, pgItem);
+						object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+					}
+					else
+					{
+						OutlineTreeItem * object = new OutlineTreeItem( page, 0 );
+						object->PageItemObject = pgItem;
+						object->type = 1;
+						object->setText(0, pgItem->itemName());
+						object->setIcon( 0, groupIcon );
+						object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+						parseSubGroup(object, &pgItem->groupItemList, 1);
+					}
+				}
+			}
+			page->setText(0, currDoc->MasterPages.at(a)->pageName());
+		}
+		for (int a = 0; a < static_cast<int>(currDoc->DocPages.count()); ++a)
+		{
+			OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
+			page->PageObject = currDoc->DocPages.at(a);
+			page->type = 2;
+			pagep = page;
+			for (int b = 0; b < currDoc->DocItems.count(); ++b)
+			{
+				pgItem = currDoc->DocItems.at(b);
+				if (pgItem->OwnPage == a)
+				{
+					if (!pgItem->isGroup())
+					{
+						OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+						object->PageItemObject = pgItem;
+						object->type = 3;
+						object->setText(0, pgItem->itemName());
+						setItemIcon(object, pgItem);
+						object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+					}
+					else
+					{
+						OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+						object->PageItemObject = pgItem;
+						object->type = 3;
+						object->setText(0, pgItem->itemName());
+						object->setIcon( 0, groupIcon );
+						object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+						parseSubGroup(object, &pgItem->groupItemList, 3);
+					}
+				}
+			}
+			page->setText(0, tr("Page ")+tmp.setNum(a+1));
+		}
+		bool hasfreeItems = false;
 		for (int b = 0; b < currDoc->DocItems.count(); ++b)
 		{
-			pgItem = currDoc->DocItems.at(b);
-			if (pgItem->OwnPage == a)
-			{
-				if (!pgItem->isGroup())
+			if (currDoc->DocItems.at(b)->OwnPage == -1)
+			{
+				hasfreeItems = true;
+				break;
+			}
+		}
+		if (hasfreeItems)
+		{
+			OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
+			pagep = page;
+			freeObjects = page;
+			page->type = -3;
+			for (int b = 0; b < currDoc->DocItems.count(); ++b)
+			{
+				pgItem = currDoc->DocItems.at(b);
+				if (pgItem->OwnPage == -1)
 				{
-					OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
-					object->PageItemObject = pgItem;
-					object->type = 3;
-					object->setText(0, pgItem->itemName());
-					setItemIcon(object, pgItem);
-					object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-				}
-				else
-				{
-					OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
-					object->PageItemObject = pgItem;
-					object->type = 3;
-					object->setText(0, pgItem->itemName());
-					object->setIcon( 0, groupIcon );
-					object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-					parseSubGroup(object, &pgItem->groupItemList, 3);
-				}
-			}
-		}
-		page->setText(0, tr("Page ")+tmp.setNum(a+1));
-	}
-	bool hasfreeItems = false;
-	for (int b = 0; b < currDoc->DocItems.count(); ++b)
-	{
-		if (currDoc->DocItems.at(b)->OwnPage == -1)
-		{
-			hasfreeItems = true;
-			break;
-		}
-	}
-	if (hasfreeItems)
-	{
-		OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
-		pagep = page;
-		freeObjects = page;
-		page->type = -3;
-		for (int b = 0; b < currDoc->DocItems.count(); ++b)
-		{
-			pgItem = currDoc->DocItems.at(b);
-			if (pgItem->OwnPage == -1)
-			{
-				if (!pgItem->isGroup())
-				{
-					OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
-					object->PageItemObject = pgItem;
-					object->type = 4;
-					object->setText(0, pgItem->itemName());
-					setItemIcon(object, pgItem);
-					object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-				}
-				else
-				{
-					OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
-					object->PageItemObject = pgItem;
-					object->type = 4;
-					object->setText(0, pgItem->itemName());
-					object->setIcon( 0, groupIcon );
-					object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-					parseSubGroup(object, &pgItem->groupItemList, 4);
-				}
-			}
-		}
-		page->setText(0, tr("Free Objects"));
+					if (!pgItem->isGroup())
+					{
+						OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+						object->PageItemObject = pgItem;
+						object->type = 4;
+						object->setText(0, pgItem->itemName());
+						setItemIcon(object, pgItem);
+						object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+					}
+					else
+					{
+						OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
+						object->PageItemObject = pgItem;
+						object->type = 4;
+						object->setText(0, pgItem->itemName());
+						object->setIcon( 0, groupIcon );
+						object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+						parseSubGroup(object, &pgItem->groupItemList, 4);
+					}
+				}
+			}
+			page->setText(0, tr("Free Objects"));
+		}
 	}
 	if (storeVals)
 		reopenTree();




More information about the scribus-commit mailing list