r15217 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:21 CEST 2010
Revision: 15217
Author: jghali
Date: 2010-06-17T22:19:23.467223Z
Commit message: #9181: Access violation occurs when pasting something into an image frame which is in "edit frame content" mode
Changeset:
M /branches/Version135/Scribus/scribus/scribus.cpp
Diffs:
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 15216)
+++ scribus/scribus.cpp (revision 15217)
@@ -5074,7 +5074,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);
@@ -5425,8 +5427,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()
@@ -6414,10 +6423,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