r15218 by jghali - #9181: Access violation occurs when pasting something into an image frame which is in "edit frame content" mode
scribus-commit
scribus-commit at lists.scribus.net
Fri Jun 18 00:20:39 CEST 2010
Revision: 15218
Author: jghali
Date: 2010-06-17T22:20:01.626748Z
Commit message: #9181: Access violation occurs when pasting something into an image frame which is in "edit frame content" mode
Changeset:
M /trunk/Scribus/scribus/scribus.cpp
Diffs:
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 15217)
+++ scribus/scribus.cpp (revision 15218)
@@ -4860,7 +4860,9 @@
return;
if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(doc->currentPage()->getUName(), 0, Um::Paste, "", Um::IPaste));
- if (doc->appMode == modeEdit && doc->m_Selection->itemAt(0))
+ PageItem* selItem = doc->m_Selection->itemAt(0);
+ bool isTextFrame = (dynamic_cast<PageItem_TextFrame*>(selItem) != NULL);
+ if (doc->appMode == modeEdit && isTextFrame)
{
PageItem_TextFrame *currItem = dynamic_cast<PageItem_TextFrame*>(doc->m_Selection->itemAt(0));
assert(currItem != NULL);
@@ -5230,8 +5232,15 @@
void ScribusMainWindow::ClipChange()
{
- bool hasScribusData = ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment();
- scrActions["editPaste"]->setEnabled(HaveDoc && (hasScribusData || doc->appMode == modeEdit));
+ bool textFrameEditMode = false;
+ bool hasScribusData = ScMimeData::clipboardHasScribusElem() || ScMimeData::clipboardHasScribusFragment();
+ if (HaveDoc && doc->m_Selection->count() != 0)
+ {
+ PageItem *currItem = NULL;
+ currItem = doc->m_Selection->itemAt(0);
+ textFrameEditMode = ((doc->appMode == modeEdit) && (currItem->asTextFrame()));
+ }
+ scrActions["editPaste"]->setEnabled(HaveDoc && (hasScribusData || textFrameEditMode));
}
void ScribusMainWindow::EnableTxEdit()
@@ -6246,10 +6255,8 @@
enableTextActions(&scrActions, true, currItem->currentCharStyle().font().scName());
if (ScMimeData::clipboardHasScribusData())
{
-// if (!hasXMLRootElem(Buffer2, "<SCRIBUSELEM"))
-// {
- scrActions["editPaste"]->setEnabled(true);
-// }
+ bool textFrameEditMode = ((currItem != NULL) && (currItem->asTextFrame()));
+ scrActions["editPaste"]->setEnabled( textFrameEditMode || (currItem == NULL) );
}
// view->slotDoCurs(true);
// scrMenuMgr->setMenuEnabled("Item", false);
More information about the scribus-commit
mailing list