Author: jghali
Date: Thu Aug 10 00:03:56 2017
New Revision: 22132

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22132
Log:
#14940: Ungrouping items on a new master page move the objects to Normal rather 
than keeping on the same page

Modified:
    trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp

Modified: trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22132&path=/trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp        (original)
+++ trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp        Thu Aug 10 
00:03:56 2017
@@ -278,8 +278,9 @@
                                
destination->initialMargins.setRight(from->initialMargins.right());
                        }
                }
-               //#8321 : incorrect selection of master page on new mp 
creation/duplictation
+               //#8321 : incorrect selection of master page on new mp 
creation/duplication
                //m_doc->setCurrentPage(destination);
+               updateMasterPageList(MasterPageName);
                selectMasterPage(MasterPageName);
                uint oldItems = m_doc->Items->count();
                uint end2 = m_doc->MasterItems.count();
@@ -314,11 +315,24 @@
                        PageItem *newItem = m_doc->MasterItems.at(a);
                        newItem->OnMasterPage = MasterPageName;
                        newItem->OwnPage = m_doc->MasterNames[MasterPageName];
+                       if (!newItem->isGroup())
+                               continue;
+
+                       int masterPageIndex = 
m_doc->MasterNames[MasterPageName];
+                       PageItem_Group* group = newItem->asGroupFrame();
+                       QList<PageItem*> groupList = group->groupItemList;
+                       while (!groupList.isEmpty())
+                       {
+                               newItem = groupList.takeFirst();
+                               newItem->OnMasterPage = MasterPageName;
+                               newItem->OwnPage = masterPageIndex;
+                               if (newItem->isGroup())
+                                       groupList = 
newItem->asGroupFrame()->groupItemList + groupList;
+                       }
                }
                from->guides.copy(&destination->guides);
                m_doc->GroupCounter = GrMax + 1;
                m_view->Deselect(true);
-               updateMasterPageList(MasterPageName);
                m_doc->setLoading(false);
                m_view->reformPages();
                m_view->DrawNew();


_______________________________________________
scribus-commit mailing list
scribus-commit@lists.scribus.net
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to