r14296 by jghali - #8575, grouping object on a different layer makes some / all other objects invisible : - when grouping objects, create layer on same layer as items, was possibly not the case before - check that all objects belong to a common layer before allowing user to group them
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 15 03:45:57 CET 2009
Revision: 14296
Author: jghali
Date: 2009-11-14T18:45:44.287960Z
Commit message: #8575, grouping object on a different layer makes some / all other objects invisible :
- when grouping objects, create layer on same layer as items, was possibly not the case before
- check that all objects belong to a common layer before allowing user to group them
Changeset:
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/selection.h
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/selection.cpp
Diffs:
Index: scribus/selection.h
===================================================================
--- scribus/selection.h (revision 14295)
+++ scribus/selection.h (revision 14296)
@@ -152,6 +152,12 @@
//!\brief Test to see if all items in the selection are the same typedef
bool itemsAreSameType() const;
+ /**
+ * \brief get the layer ID of items in the selection
+ * @return the layer ID or -1 if items do not belong to the same layer
+ */
+ int objectsLayer(void) const;
+
bool signalsDelayed(void);
void delaySignalsOn(void);
void delaySignalsOff(void);
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14295)
+++ scribus/scribusdoc.cpp (revision 14296)
@@ -10317,6 +10317,9 @@
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
if (itemSelection->count() < 1)
return;
+ int objectsLayer = itemSelection->objectsLayer();
+ if (objectsLayer == -1)
+ return;
PageItem *currItem;
PageItem* bb;
double x, y, w, h;
@@ -10414,12 +10417,13 @@
PageItem *high = Items->at(highestItem);
undoManager->setUndoEnabled(false);
int z = itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, itemToolPrefs.shapeFillColor, itemToolPrefs.shapeLineColor, true);
- PageItem *neu = Items->takeAt(z);
- Items->insert(lowestItem, neu);
- neu->setItemName( tr("Group%1").arg(GroupCounter));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
+ PageItem *groupItem = Items->takeAt(z);
+ Items->insert(lowestItem, groupItem);
+ groupItem->setItemName( tr("Group%1").arg(GroupCounter));
+ groupItem->AutoName = false;
+ groupItem->isGroupControl = true;
+ groupItem->groupsLastItem = high;
+ groupItem->LayerID = objectsLayer;
undoManager->setUndoEnabled(true);
QMap<int, uint> ObjOrder;
@@ -10437,7 +10441,7 @@
}
renumberItemsInListOrder();
- itemSelection->prependItem(neu);
+ itemSelection->prependItem(groupItem);
selectedItemCount=itemSelection->count();
SimpleState *ss = new SimpleState(Um::Group, tooltip);
ss->set("GROUP", "group");
Index: scribus/selection.cpp
===================================================================
--- scribus/selection.cpp (revision 14295)
+++ scribus/selection.cpp (revision 14296)
@@ -510,6 +510,22 @@
return true;
}
+int Selection::objectsLayer(void) const
+{
+ if (m_SelList.isEmpty())
+ return -1;
+ int layerID = m_SelList.at(0)->LayerID;
+ for (int i = 1; i < m_SelList.count(); ++i)
+ {
+ if (m_SelList.at(i)->LayerID != layerID)
+ {
+ layerID = -1;
+ break;
+ }
+ }
+ return layerID;
+}
+
bool Selection::signalsDelayed(void)
{
return (m_isGUISelection && (m_delaySignals > 0));
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14295)
+++ scribus/scribus.cpp (revision 14296)
@@ -3257,7 +3257,11 @@
else
isGroup = false;
}
- scrActions["itemGroup"]->setEnabled(!isGroup);
+ // It is possible to select objects on different layer using
+ // document outline palette. We need to check selected objects
+ // are on a common layer before allowing user to group them
+ bool objectsOnSameLayer = (doc->m_Selection->objectsLayer() != -1);
+ scrActions["itemGroup"]->setEnabled(!isGroup && objectsOnSameLayer);
scrActions["itemCombinePolygons"]->setEnabled(hPoly);
if (docSelectionCount == 2)
{
More information about the scribus-commit
mailing list