Merge pull request #959 from manongjohn/fix_column_rename_on_frame_edit

Fix column renaming when editing frame
This commit is contained in:
manongjohn 2022-04-15 07:52:44 -04:00 committed by GitHub
commit 49fe6b08e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 10 deletions

View file

@ -659,7 +659,8 @@ void FullColorBrushTool::leftButtonUp(const TPointD &pos,
if (m_tileSet->getTileCount() > 0) { if (m_tileSet->getTileCount() > 0) {
delete m_tileSaver; delete m_tileSaver;
bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel(); bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel();
if (!isEditingLevel) TUndoManager::manager()->beginBlock(); bool renameColumn = m_isFrameCreated;
if (!isEditingLevel && renameColumn) TUndoManager::manager()->beginBlock();
TTool::Application *app = TTool::getApplication(); TTool::Application *app = TTool::getApplication();
TXshLevel *level = app->getCurrentLevel()->getLevel(); TXshLevel *level = app->getCurrentLevel()->getLevel();
TXshSimpleLevelP simLevel = level->getSimpleLevel(); TXshSimpleLevelP simLevel = level->getSimpleLevel();
@ -670,7 +671,7 @@ void FullColorBrushTool::leftButtonUp(const TPointD &pos,
m_strokeRect.getP00())); m_strokeRect.getP00()));
// Column name renamed to level name only if was originally empty // Column name renamed to level name only if was originally empty
if (!isEditingLevel) { if (!isEditingLevel && renameColumn) {
int col = app->getCurrentColumn()->getColumnIndex(); int col = app->getCurrentColumn()->getColumnIndex();
TXshColumn *column = app->getCurrentXsheet()->getXsheet()->getColumn(col); TXshColumn *column = app->getCurrentXsheet()->getXsheet()->getColumn(col);
int r0, r1; int r0, r1;

View file

@ -1260,12 +1260,13 @@ public:
if (!m_active) return; if (!m_active) return;
bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel(); bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel();
if (!isEditingLevel) TUndoManager::manager()->beginBlock(); bool renameColumn = m_isFrameCreated;
if (!isEditingLevel && renameColumn) TUndoManager::manager()->beginBlock();
if (m_primitive) m_primitive->leftButtonUp(p, e); if (m_primitive) m_primitive->leftButtonUp(p, e);
// Column name renamed to level name only if was originally empty // Column name renamed to level name only if was originally empty
if (!isEditingLevel) { if (!isEditingLevel && renameColumn) {
int col = m_application->getCurrentColumn()->getColumnIndex(); int col = m_application->getCurrentColumn()->getColumnIndex();
TXshColumn *column = TXshColumn *column =
m_application->getCurrentXsheet()->getXsheet()->getColumn(col); m_application->getCurrentXsheet()->getXsheet()->getColumn(col);

View file

@ -1861,7 +1861,8 @@ void ToonzRasterBrushTool::finishRasterBrush(const TPointD &pos,
TXshSimpleLevelP simLevel = level->getSimpleLevel(); TXshSimpleLevelP simLevel = level->getSimpleLevel();
bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel(); bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel();
if (!isEditingLevel) TUndoManager::manager()->beginBlock(); bool renameColumn = m_isFrameCreated;
if (!isEditingLevel && renameColumn) TUndoManager::manager()->beginBlock();
/*-- /*--
* Fidに対してUndoを記録する * Fidに対してUndoを記録する
@ -2087,7 +2088,7 @@ void ToonzRasterBrushTool::finishRasterBrush(const TPointD &pos,
} }
// Column name renamed to level name only if was originally empty // Column name renamed to level name only if was originally empty
if (!isEditingLevel) { if (!isEditingLevel && renameColumn) {
int col = app->getCurrentColumn()->getColumnIndex(); int col = app->getCurrentColumn()->getColumnIndex();
TXshColumn *column = app->getCurrentXsheet()->getXsheet()->getColumn(col); TXshColumn *column = app->getCurrentXsheet()->getXsheet()->getColumn(col);
int r0, r1; int r0, r1;

View file

@ -1148,7 +1148,8 @@ void ToonzVectorBrushTool::leftButtonUp(const TPointD &pos,
stroke->insertControlPoints(0.5); stroke->insertControlPoints(0.5);
bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel(); bool isEditingLevel = m_application->getCurrentFrame()->isEditingLevel();
if (!isEditingLevel) TUndoManager::manager()->beginBlock(); bool renameColumn = m_isFrameCreated;
if (!isEditingLevel && renameColumn) TUndoManager::manager()->beginBlock();
if (m_frameRange.getIndex()) { if (m_frameRange.getIndex()) {
if (m_firstFrameId == -1) { if (m_firstFrameId == -1) {
@ -1257,7 +1258,7 @@ void ToonzVectorBrushTool::leftButtonUp(const TPointD &pos,
} }
// Column name renamed to level name only if was originally empty // Column name renamed to level name only if was originally empty
if (!isEditingLevel) { if (!isEditingLevel && renameColumn) {
int col = getApplication()->getCurrentColumn()->getColumnIndex(); int col = getApplication()->getCurrentColumn()->getColumnIndex();
TXshColumn *column = TXshColumn *column =
getApplication()->getCurrentXsheet()->getXsheet()->getColumn(col); getApplication()->getCurrentXsheet()->getXsheet()->getColumn(col);

View file

@ -733,13 +733,14 @@ void TypeTool::stopEditing() {
invalidate(); invalidate();
if (m_undo) { if (m_undo) {
bool isEditingLevel = getApplication()->getCurrentFrame()->isEditingLevel(); bool isEditingLevel = getApplication()->getCurrentFrame()->isEditingLevel();
if (!isEditingLevel) TUndoManager::manager()->beginBlock(); bool renameColumn = m_isFrameCreated;
if (!isEditingLevel && renameColumn) TUndoManager::manager()->beginBlock();
TUndoManager::manager()->add(m_undo); TUndoManager::manager()->add(m_undo);
m_undo = 0; m_undo = 0;
// Column name renamed to level name only if was originally empty // Column name renamed to level name only if was originally empty
if (!isEditingLevel) { if (!isEditingLevel && renameColumn) {
int col = getApplication()->getCurrentColumn()->getColumnIndex(); int col = getApplication()->getCurrentColumn()->getColumnIndex();
TXshColumn *column = TXshColumn *column =
getApplication()->getCurrentXsheet()->getXsheet()->getColumn(col); getApplication()->getCurrentXsheet()->getXsheet()->getColumn(col);