Merge pull request #763 from manongjohn/fix_canvas_size_availability

Fix Canvas Size availability
This commit is contained in:
manongjohn 2021-08-27 16:15:33 -04:00 committed by GitHub
commit 2d3f05e838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 17 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);
}
//-----------------------------------------------------------------------------
@ -1585,7 +1591,6 @@ void TCellSelection::selectCell(int row, int col) {
void TCellSelection::selectNone() {
m_range = Range();
CommandManager::instance()->enable(MI_CanvasSize, false);
}
//-----------------------------------------------------------------------------

View file

@ -855,8 +855,15 @@ void FilmstripFrames::mousePressEvent(QMouseEvent *event) {
TXshSimpleLevel *sl = getLevel();
CommandManager::instance()->enable(MI_CanvasSize, false);
if (!sl) return;
bool isRasterLevel =
(sl->getType() == TZP_XSHLEVEL || sl->getType() == OVL_XSHLEVEL ||
sl->getType() == TZI_XSHLEVEL);
CommandManager::instance()->enable(MI_CanvasSize, isRasterLevel);
// If accessed after 1st frame on a Single Frame level
// Block movement so we can't create new images
if (index > 0) {

View file

@ -146,11 +146,6 @@ void TFilmstripSelection::select(const TFrameId &fid, bool selected) {
if (tool) tool->setSelectedFrames(m_selectedFrames);
TXshSimpleLevel *sl = app->getCurrentLevel()->getSimpleLevel();
bool rasterLevel = sl->getType() == TZP_XSHLEVEL ||
sl->getType() == OVL_XSHLEVEL ||
sl->getType() == TZI_XSHLEVEL;
CommandManager::instance()->enable(MI_CanvasSize, rasterLevel);
}
//-----------------------------------------------------------------------------
@ -165,7 +160,6 @@ void TFilmstripSelection::selectNone() {
m_selectedFrames.clear();
updateInbetweenRange();
TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel();
CommandManager::instance()->enable(MI_CanvasSize, false);
}
//-----------------------------------------------------------------------------
@ -180,10 +174,6 @@ void TFilmstripSelection::selectAll() {
updateInbetweenRange();
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
tool->setSelectedFrames(m_selectedFrames);
bool rasterLevel = sl->getType() == TZP_XSHLEVEL ||
sl->getType() == OVL_XSHLEVEL ||
sl->getType() == TZI_XSHLEVEL;
CommandManager::instance()->enable(MI_CanvasSize, rasterLevel);
notifyView();
}
@ -204,9 +194,6 @@ void TFilmstripSelection::invertSelection() {
updateInbetweenRange();
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
tool->setSelectedFrames(m_selectedFrames);
if (sl->getType() == TZP_XSHLEVEL || sl->getType() == OVL_XSHLEVEL ||
sl->getType() == TZI_XSHLEVEL)
CommandManager::instance()->enable(MI_CanvasSize, true);
notifyView();
}

View file

@ -11,6 +11,7 @@
#include "cellselection.h"
#include "sceneviewer.h"
#include "statusbar.h"
#include "menubarcommandids.h"
// TnzTools includes
#include "tools/tool.h"
@ -566,6 +567,7 @@ void TApp::onColumnIndexSwitched() {
void TApp::onXshLevelSwitched(TXshLevel *) {
TXshLevel *level = m_currentLevel->getLevel();
CommandManager::instance()->enable(MI_CanvasSize, false);
if (level) {
TXshSimpleLevel *simpleLevel = level->getSimpleLevel();
@ -581,6 +583,17 @@ void TApp::onXshLevelSwitched(TXshLevel *) {
currentPalette->isCleanupPalette())
m_paletteController->editCleanupPalette();
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;
}

View file

@ -3498,6 +3498,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
if (selectionContainRasterImage(m_viewer->getCellSelection(),
m_viewer->getXsheet())) {
menu.addAction(cmdManager->getAction(MI_CanvasSize));
QMenu *editImageMenu = new QMenu(tr("Edit Image"), this);
{
editImageMenu->addAction(cmdManager->getAction(MI_AdjustLevels));
@ -3505,7 +3506,6 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
editImageMenu->addAction(
cmdManager->getAction(MI_BrightnessAndContrast));
editImageMenu->addAction(cmdManager->getAction(MI_Antialias));
editImageMenu->addAction(cmdManager->getAction(MI_CanvasSize));
}
menu.addMenu(editImageMenu);