Fix crashes when pasting an outside image on a non-raster level (#227)
This commit is contained in:
parent
80fcee15eb
commit
8309e625a9
3 changed files with 17 additions and 4 deletions
|
@ -1217,7 +1217,7 @@ void RasterSelection::pasteSelection() {
|
|||
}
|
||||
}
|
||||
|
||||
if (clipImage.height() > 0) {
|
||||
if (clipImage.height() > 0 && m_currentImage->getType() == OVL_XSHLEVEL) {
|
||||
// An image was pasted from outside Tahoma
|
||||
|
||||
// Set up variables
|
||||
|
|
|
@ -1925,7 +1925,7 @@ void TCellSelection::pasteCells() {
|
|||
return;
|
||||
}
|
||||
// Convert non-plain raster data to strokes data
|
||||
if (vi) {
|
||||
if (vi && clipImage.isNull()) {
|
||||
if (!initUndo) {
|
||||
initUndo = true;
|
||||
TUndoManager::manager()->beginBlock();
|
||||
|
@ -1946,7 +1946,8 @@ void TCellSelection::pasteCells() {
|
|||
|
||||
// check the size of the incoming image
|
||||
bool tooBig = false;
|
||||
if (sl) {
|
||||
|
||||
if (sl && sl->getType() == OVL_XSHLEVEL) {
|
||||
// offer to make a new level or paste in place
|
||||
if (sl && (sl->getResolution().lx < clipImage.width() ||
|
||||
sl->getResolution().ly < clipImage.height())) {
|
||||
|
@ -1984,6 +1985,18 @@ void TCellSelection::pasteCells() {
|
|||
sl->getResolution().ly, Qt::KeepAspectRatio);
|
||||
}
|
||||
}
|
||||
} else if (sl) {
|
||||
// not on a raster level
|
||||
// find an empty column
|
||||
while (!xsh->isColumnEmpty(c0)) {
|
||||
c0 += 1;
|
||||
}
|
||||
TXshColumn *col =
|
||||
TApp::instance()->getCurrentXsheet()->getXsheet()->getColumn(c0);
|
||||
TApp::instance()->getCurrentColumn()->setColumnIndex(c0);
|
||||
TApp::instance()->getCurrentColumn()->setColumn(col);
|
||||
TApp::instance()->getCurrentFrame()->setFrame(r0);
|
||||
newLevel = true;
|
||||
}
|
||||
|
||||
// create variables to go into the Full Color Raster Selection data
|
||||
|
|
|
@ -1624,7 +1624,7 @@ void FilmstripCmd::paste(TXshSimpleLevel *sl, std::set<TFrameId> &frames) {
|
|||
TUndo *undo = 0;
|
||||
TPaletteP plt = sl->getPalette()->clone();
|
||||
QImage clipImage = clipboard->image();
|
||||
if (clipImage.height() > 0) {
|
||||
if (sl && sl->getType() == OVL_XSHLEVEL && !clipImage.isNull()) {
|
||||
// This stuff is only if we have a pasted image from outside Tahoma
|
||||
if (sl && (sl->getResolution().lx < clipImage.width() ||
|
||||
sl->getResolution().ly < clipImage.height())) {
|
||||
|
|
Loading…
Reference in a new issue