Fix Canvas Size availability

This commit is contained in:
manongjohn 2021-08-22 02:03:27 -04:00
parent 7f444c8c96
commit a2903da89f
4 changed files with 14 additions and 14 deletions

View file

@ -1585,7 +1585,6 @@ void TCellSelection::selectCell(int row, int col) {
void TCellSelection::selectNone() { void TCellSelection::selectNone() {
m_range = Range(); m_range = Range();
CommandManager::instance()->enable(MI_CanvasSize, false);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

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

View file

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

View file

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