r18363 by fschmid - Fixed crashes when editing inline frames
scribus-commit
scribus-commit at lists.scribus.net
Wed Jul 10 20:13:23 UTC 2013
Author: fschmid
Date: Wed Jul 10 20:13:23 2013
New Revision: 18363
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18363
Log:
Fixed crashes when editing inline frames
Modified:
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/ui/inlinepalette.cpp
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Wed Jul 10 20:13:23 2013
@@ -1871,6 +1871,7 @@
if (tagName == "FRAMEOBJECT")
{
doc->addToInlineFrames(doc->Items->takeAt(doc->Items->indexOf(newItem)));
+ newItem->LayerID = doc->firstLayerID();
}
info.item = newItem;
@@ -3304,6 +3305,7 @@
if (tagName == "FRAMEOBJECT")
{
FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
+ newItem->LayerID = m_Doc->firstLayerID();
}
}
}
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Wed Jul 10 20:13:23 2013
@@ -938,6 +938,7 @@
if (pg.tagName()=="FRAMEOBJECT")
{
FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
+ Neu->LayerID = m_Doc->firstLayerID();
}
if (Neu->isTableItem)
{
@@ -2327,6 +2328,7 @@
if (pg.tagName()=="FRAMEOBJECT")
{
FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
+ Neu->LayerID = m_Doc->firstLayerID();
}
}
counter++;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&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 Wed Jul 10 20:13:23 2013
@@ -3589,7 +3589,8 @@
if (newItem->inlineCharID == -1)
FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
else
- doc->FrameItems.insert(newItem->inlineCharID, doc->Items->takeAt(doc->Items->indexOf(newItem)));
+ doc->FrameItems.insert(newItem->inlineCharID, doc->Items->takeAt(doc->Items->indexOf(newItem)));
+ newItem->LayerID = doc->firstLayerID();
}
info.item = newItem;
@@ -5885,6 +5886,7 @@
FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
else
m_Doc->FrameItems.insert(newItem->inlineCharID, m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
+ newItem->LayerID = m_Doc->firstLayerID();
}
if (groupStack.count() > 0)
{
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Jul 10 20:13:23 2013
@@ -4099,7 +4099,6 @@
newActWin(ActWinOld->getSubWin());
return false;
}
- inlinePalette->setDoc(doc);
symbolPalette->setDoc(doc);
outlinePalette->setDoc(doc);
fileLoader->informReplacementFonts();
@@ -4301,6 +4300,7 @@
/*qDebug("Time elapsed: %d ms", t.elapsed());*/
doc->RePos = false;
doc->setModified(false);
+ inlinePalette->setDoc(doc);
updateRecent(FName);
mainWindowStatusLabel->setText( tr("Ready"));
ret = true;
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Jul 10 20:13:23 2013
@@ -3644,6 +3644,12 @@
}
}
+int ScribusDoc::firstLayerID()
+{
+ QStringList newNames;
+ orderedLayerList(&newNames);
+ return layerIDFromName(newNames.first());
+}
bool ScribusDoc::renumberLayer(const int layerID, const int newLayerID)
{
@@ -6584,11 +6590,12 @@
if (mode)
{
m_storedLayerID = activeLayer();
- m_storedLayerLock = layerLocked(0);
- m_storedLayerVis = layerVisible(0);
- setActiveLayer(0);
- setLayerVisible(0, true);
- setLayerLocked(0, false);
+ int layerID = firstLayerID();
+ m_storedLayerLock = layerLocked(layerID);
+ m_storedLayerVis = layerVisible(layerID);
+ setActiveLayer(layerID);
+ setLayerVisible(layerID, true);
+ setLayerLocked(layerID, false);
ScPattern pa = docPatterns[symbolName];
currentEditedSymbol = symbolName;
ScPage* addedPage = new ScPage(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, pa.width, pa.height);
@@ -6612,13 +6619,14 @@
for (int as = 0; as < Items->count(); ++as)
{
m_Selection->addItem(Items->at(as));
+ Items->at(as)->setLayer(layerID);
}
moveGroup(addedPage->xOffset(), addedPage->yOffset());
if (Items->at(0)->isGroup())
Items->at(0)->asGroupFrame()->adjustXYPosition();
m_Selection->clear();
m_Selection->delaySignalsOff();
- m_ScMW->changeLayer(0);
+ m_ScMW->changeLayer(layerID);
changed();
}
else
@@ -6637,7 +6645,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);
+ groupItem->setLayer(firstLayerID());
Items->insert(0, groupItem);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
@@ -6722,8 +6730,8 @@
}
delete addedPage;
setActiveLayer(m_storedLayerID);
- setLayerVisible(0, m_storedLayerVis);
- setLayerLocked(0, m_storedLayerLock);
+ setLayerVisible(m_storedLayerID, m_storedLayerVis);
+ setLayerLocked(m_storedLayerID, m_storedLayerLock);
m_ScMW->changeLayer(m_storedLayerID);
}
}
@@ -6736,11 +6744,12 @@
if (mode)
{
m_storedLayerID = activeLayer();
- m_storedLayerLock = layerLocked(0);
- m_storedLayerVis = layerVisible(0);
- setActiveLayer(0);
- setLayerVisible(0, true);
- setLayerLocked(0, false);
+ int layerID = firstLayerID();
+ m_storedLayerLock = layerLocked(layerID);
+ m_storedLayerVis = layerVisible(layerID);
+ setActiveLayer(layerID);
+ setLayerVisible(layerID, true);
+ setLayerLocked(layerID, false);
PageItem *pa = FrameItems[id];
pa->isEmbedded = false;
currentEditedIFrame = id;
@@ -6767,13 +6776,14 @@
for (int as = 0; as < Items->count(); ++as)
{
m_Selection->addItem(Items->at(as));
+ Items->at(as)->setLayer(layerID);
}
moveGroup(addedPage->xOffset(), addedPage->yOffset());
if (Items->at(0)->isGroup())
Items->at(0)->asGroupFrame()->adjustXYPosition();
m_Selection->clear();
m_Selection->delaySignalsOff();
- m_ScMW->changeLayer(0);
+ m_ScMW->changeLayer(layerID);
changed();
}
else
@@ -6792,7 +6802,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);
+ groupItem->setLayer(firstLayerID());
Items->insert(0, groupItem);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
@@ -6869,8 +6879,8 @@
delete addedPage;
EditFrameItems.clear();
setActiveLayer(m_storedLayerID);
- setLayerVisible(0, m_storedLayerVis);
- setLayerLocked(0, m_storedLayerLock);
+ setLayerVisible(m_storedLayerID, m_storedLayerVis);
+ setLayerLocked(m_storedLayerID, m_storedLayerLock);
m_ScMW->changeLayer(m_storedLayerID);
}
}
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Wed Jul 10 20:13:23 2013
@@ -520,6 +520,8 @@
* @param list QStringList to insert the layer names into
*/
void orderedLayerList(QStringList* list);
+
+ int firstLayerID();
//Items
bool deleteTaggedItems();
Modified: trunk/Scribus/scribus/ui/inlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18363&path=/trunk/Scribus/scribus/ui/inlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/inlinepalette.cpp Wed Jul 10 20:13:23 2013
@@ -31,6 +31,7 @@
#include "scribusdoc.h"
#include "scribus.h"
#include "selection.h"
+#include "util_icon.h"
InlineView::InlineView(QWidget* parent) : QListWidget(parent)
{
@@ -258,6 +259,9 @@
pm2.fill(palette().color(QPalette::Base));
QPainter p;
p.begin(&pm2);
+ QBrush b(QColor(205,205,205), loadIcon("testfill.png"));
+ p.setBrush(b);
+ p.drawRect(0, 0, 50, 50);
p.drawPixmap(25 - pm.width() / 2, 25 - pm.height() / 2, pm);
p.end();
QListWidgetItem *item = new QListWidgetItem(pm2, currItem->itemName(), InlineViewWidget);
More information about the scribus-commit
mailing list