Disable Canvas Size for uneditable files

This commit is contained in:
manongjohn 2021-08-22 02:10:07 -04:00
parent a2903da89f
commit 6be4bead4d
2 changed files with 14 additions and 2 deletions

View file

@ -82,8 +82,14 @@ bool containsOnlyOneRasterLevel(int r0, int c0, int r1, int c1) {
if (xsh->getCell(r, c).m_level.getPointer() != xl.getPointer())
return false;
}
return xl && (xl->getType() == TZP_XSHLEVEL ||
xl->getType() == OVL_XSHLEVEL || xl->getType() == TZI_XSHLEVEL);
if (!xl) return false;
if (xl->getType() == OVL_XSHLEVEL &&
(xl->getPath().getType() == "psd" || xl->getPath().getType() == "gif" ||
xl->getPath().getType() == "mp4" || xl->getPath().getType() == "webm" ||
xl->getPath().getType() == "mov"))
return false;
return (xl->getType() == TZP_XSHLEVEL || xl->getType() == OVL_XSHLEVEL ||
xl->getType() == TZI_XSHLEVEL);
}
//-----------------------------------------------------------------------------

View file

@ -586,6 +586,12 @@ void TApp::onXshLevelSwitched(TXshLevel *) {
bool isRasterLevel = (simpleLevel->getType() == TZP_XSHLEVEL ||
simpleLevel->getType() == OVL_XSHLEVEL ||
simpleLevel->getType() == TZI_XSHLEVEL);
if (isRasterLevel && (simpleLevel->getPath().getType() == "psd" ||
simpleLevel->getPath().getType() == "gif" ||
simpleLevel->getPath().getType() == "mp4" ||
simpleLevel->getPath().getType() == "webm" ||
simpleLevel->getPath().getType() == "mov"))
isRasterLevel = false;
CommandManager::instance()->enable(MI_CanvasSize, isRasterLevel);
return;