Add Create Blank Drawing command
This commit is contained in:
parent
d98db10fae
commit
0ec114857b
11 changed files with 258 additions and 79 deletions
|
@ -212,6 +212,7 @@
|
||||||
</menu>
|
</menu>
|
||||||
<separator/>
|
<separator/>
|
||||||
<command>MI_Autorenumber</command>
|
<command>MI_Autorenumber</command>
|
||||||
|
<command>MI_CreateBlankDrawing</command>
|
||||||
<command>MI_Duplicate</command>
|
<command>MI_Duplicate</command>
|
||||||
<command>MI_MergeFrames</command>
|
<command>MI_MergeFrames</command>
|
||||||
<command>MI_CloneLevel</command>
|
<command>MI_CloneLevel</command>
|
||||||
|
|
|
@ -110,6 +110,7 @@ MI_ConvertToToonzRaster=
|
||||||
MI_ConvertToVectors=
|
MI_ConvertToVectors=
|
||||||
MI_ConvertVectorToVector=
|
MI_ConvertVectorToVector=
|
||||||
MI_Copy=Ctrl+C
|
MI_Copy=Ctrl+C
|
||||||
|
MI_CreateBlankDrawing=Alt+D
|
||||||
MI_CursorOutline=
|
MI_CursorOutline=
|
||||||
MI_Cut=Ctrl+X
|
MI_Cut=Ctrl+X
|
||||||
MI_DeactivateAllColumns=
|
MI_DeactivateAllColumns=
|
||||||
|
|
|
@ -110,6 +110,7 @@ MI_ConvertToToonzRaster=
|
||||||
MI_ConvertToVectors=
|
MI_ConvertToVectors=
|
||||||
MI_ConvertVectorToVector=
|
MI_ConvertVectorToVector=
|
||||||
MI_Copy=Ctrl+C
|
MI_Copy=Ctrl+C
|
||||||
|
MI_CreateBlankDrawing=F7
|
||||||
MI_CursorOutline=
|
MI_CursorOutline=
|
||||||
MI_Cut=Ctrl+X
|
MI_Cut=Ctrl+X
|
||||||
MI_DeactivateAllColumns=
|
MI_DeactivateAllColumns=
|
||||||
|
|
|
@ -110,6 +110,7 @@ MI_ConvertToToonzRaster=
|
||||||
MI_ConvertToVectors=
|
MI_ConvertToVectors=
|
||||||
MI_ConvertVectorToVector=
|
MI_ConvertVectorToVector=
|
||||||
MI_Copy=Ctrl+C
|
MI_Copy=Ctrl+C
|
||||||
|
MI_CreateBlankDrawing=Alt+Shift+R
|
||||||
MI_CursorOutline=
|
MI_CursorOutline=
|
||||||
MI_Cut=Ctrl+X
|
MI_Cut=Ctrl+X
|
||||||
MI_DeactivateAllColumns=
|
MI_DeactivateAllColumns=
|
||||||
|
|
|
@ -110,6 +110,7 @@ MI_ConvertToToonzRaster=
|
||||||
MI_ConvertToVectors=
|
MI_ConvertToVectors=
|
||||||
MI_ConvertVectorToVector=
|
MI_ConvertVectorToVector=
|
||||||
MI_Copy=Ctrl+C
|
MI_Copy=Ctrl+C
|
||||||
|
MI_CreateBlankDrawing=
|
||||||
MI_CursorOutline=
|
MI_CursorOutline=
|
||||||
MI_Cut=Ctrl+X
|
MI_Cut=Ctrl+X
|
||||||
MI_DeactivateAllColumns=
|
MI_DeactivateAllColumns=
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
// TnzTools includes
|
// TnzTools includes
|
||||||
#include "tools/toolutils.h"
|
#include "tools/toolutils.h"
|
||||||
#include "tools/toolhandle.h"
|
#include "tools/toolhandle.h"
|
||||||
|
#include "tools/toolcommandids.h"
|
||||||
|
|
||||||
// TnzQt includes
|
// TnzQt includes
|
||||||
#include "toonzqt/strokesdata.h"
|
#include "toonzqt/strokesdata.h"
|
||||||
|
@ -1217,6 +1218,42 @@ public:
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class CreateBlankDrawingUndo final : public ToolUtils::TToolUndo {
|
||||||
|
int row;
|
||||||
|
int col;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CreateBlankDrawingUndo(TXshSimpleLevel *level, const TFrameId &frameId,
|
||||||
|
bool levelCreated, const TPaletteP &oldPalette)
|
||||||
|
: TToolUndo(level, frameId, true, levelCreated, oldPalette) {}
|
||||||
|
|
||||||
|
~CreateBlankDrawingUndo() {}
|
||||||
|
|
||||||
|
void undo() const override {
|
||||||
|
removeLevelAndFrameIfNeeded();
|
||||||
|
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||||
|
notifyImageChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void redo() const override {
|
||||||
|
insertLevelAndFrameIfNeeded();
|
||||||
|
|
||||||
|
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||||
|
notifyImageChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSize() const override { return sizeof(*this); }
|
||||||
|
|
||||||
|
QString getHistoryString() override {
|
||||||
|
return QObject::tr("Create Blank Drawing");
|
||||||
|
}
|
||||||
|
|
||||||
|
int getHistoryType() override { return HistoryType::Xsheet; }
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class FillEmptyCellUndo final : public TUndo {
|
class FillEmptyCellUndo final : public TUndo {
|
||||||
TCellSelection *m_selection;
|
TCellSelection *m_selection;
|
||||||
TXshCell m_cell;
|
TXshCell m_cell;
|
||||||
|
@ -1397,6 +1434,8 @@ void TCellSelection::enableCommands() {
|
||||||
&TCellSelection::reframeWithEmptyInbetweens);
|
&TCellSelection::reframeWithEmptyInbetweens);
|
||||||
|
|
||||||
enableCommand(this, MI_PasteNumbers, &TCellSelection::overwritePasteNumbers);
|
enableCommand(this, MI_PasteNumbers, &TCellSelection::overwritePasteNumbers);
|
||||||
|
enableCommand(this, MI_CreateBlankDrawing,
|
||||||
|
&TCellSelection::createBlankDrawings);
|
||||||
enableCommand(this, MI_Duplicate, &TCellSelection::duplicateFrame);
|
enableCommand(this, MI_Duplicate, &TCellSelection::duplicateFrame);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1439,6 +1478,7 @@ bool TCellSelection::isEnabledCommand(
|
||||||
MI_PasteNumbers,
|
MI_PasteNumbers,
|
||||||
MI_ConvertToToonzRaster,
|
MI_ConvertToToonzRaster,
|
||||||
MI_ConvertVectorToVector,
|
MI_ConvertVectorToVector,
|
||||||
|
MI_CreateBlankDrawing,
|
||||||
MI_FillEmptyCell};
|
MI_FillEmptyCell};
|
||||||
return commands.contains(commandId);
|
return commands.contains(commandId);
|
||||||
}
|
}
|
||||||
|
@ -1919,6 +1959,110 @@ void TCellSelection::pasteKeyframesInto() {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void TCellSelection::createBlankDrawing(int row, int col, bool multiple) {
|
||||||
|
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||||
|
|
||||||
|
if (col < 0) {
|
||||||
|
if (!multiple)
|
||||||
|
DVGui::warning(
|
||||||
|
QObject::tr("Unable to create a blank drawing on the camera column"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TXshColumn *column = xsh->getColumn(col);
|
||||||
|
if (column && column->isLocked()) {
|
||||||
|
if (!multiple) DVGui::warning(QObject::tr("The current column is locked"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TApp::instance()->getCurrentColumn()->setColumnIndex(col);
|
||||||
|
TApp::instance()->getCurrentFrame()->setCurrentFrame(row + 1);
|
||||||
|
|
||||||
|
TXshLevel *level = TApp::instance()->getCurrentLevel()->getLevel();
|
||||||
|
if (!level && Preferences::instance()->isAutoCreateEnabled() &&
|
||||||
|
Preferences::instance()->isAnimationSheetEnabled()) {
|
||||||
|
int r0, r1;
|
||||||
|
xsh->getCellRange(col, r0, r1);
|
||||||
|
for (int r = std::min(r1, row); r > r0; r--) {
|
||||||
|
TXshCell cell = xsh->getCell(r, col);
|
||||||
|
if (cell.isEmpty()) continue;
|
||||||
|
level = cell.m_level.getPointer();
|
||||||
|
if (!level) continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (level) {
|
||||||
|
int levelType = level->getType();
|
||||||
|
if (levelType == ZERARYFX_XSHLEVEL || levelType == PLT_XSHLEVEL ||
|
||||||
|
levelType == SND_XSHLEVEL || levelType == SND_TXT_XSHLEVEL ||
|
||||||
|
levelType == MESH_XSHLEVEL) {
|
||||||
|
if (!multiple)
|
||||||
|
DVGui::warning(
|
||||||
|
QObject::tr("Cannot create a blank drawing on the current column"));
|
||||||
|
return;
|
||||||
|
} else if (level->getSimpleLevel() &&
|
||||||
|
level->getSimpleLevel()->isReadOnly()) {
|
||||||
|
if (!multiple)
|
||||||
|
DVGui::warning(QObject::tr("The current level is not editable"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolHandle *toolHandle = TApp::instance()->getCurrentTool();
|
||||||
|
|
||||||
|
// If autocreate disabled, let's turn it on temporarily
|
||||||
|
bool isAutoCreateEnabled = Preferences::instance()->isAutoCreateEnabled();
|
||||||
|
if (!isAutoCreateEnabled) Preferences::instance()->setAutocreationType(1);
|
||||||
|
|
||||||
|
TImage *img = toolHandle->getTool()->touchImage();
|
||||||
|
|
||||||
|
TXshCell cell = xsh->getCell(row, col);
|
||||||
|
TXshSimpleLevel *sl = cell.getSimpleLevel();
|
||||||
|
|
||||||
|
if (!img || !sl) {
|
||||||
|
if (!isAutoCreateEnabled) Preferences::instance()->setAutocreationType(0);
|
||||||
|
if (!multiple)
|
||||||
|
DVGui::warning(QObject::tr(
|
||||||
|
"Unable to create a blank drawing on the current column"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TPalette *palette = sl->getPalette();
|
||||||
|
TFrameId frame = cell.getFrameId();
|
||||||
|
|
||||||
|
CreateBlankDrawingUndo *undo = new CreateBlankDrawingUndo(
|
||||||
|
sl, frame, toolHandle->getTool()->m_isLevelCreated, palette);
|
||||||
|
TUndoManager::manager()->add(undo);
|
||||||
|
|
||||||
|
// Reset back to what these were
|
||||||
|
if (!isAutoCreateEnabled) Preferences::instance()->setAutocreationType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void TCellSelection::createBlankDrawings() {
|
||||||
|
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
|
||||||
|
int row = TApp::instance()->getCurrentFrame()->getFrameIndex();
|
||||||
|
|
||||||
|
int r0, c0, r1, c1;
|
||||||
|
getSelectedCells(r0, c0, r1, c1);
|
||||||
|
|
||||||
|
bool multiple = (r1 - r0 > 1) || (c1 - c0 > 1);
|
||||||
|
|
||||||
|
TUndoManager::manager()->beginBlock();
|
||||||
|
for (int c = c0; c <= c1; c++) {
|
||||||
|
for (int r = r0; r <= r1; r++) {
|
||||||
|
createBlankDrawing(r, c, multiple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TUndoManager::manager()->endBlock();
|
||||||
|
|
||||||
|
TApp::instance()->getCurrentColumn()->setColumnIndex(col);
|
||||||
|
TApp::instance()->getCurrentFrame()->setCurrentFrame(row + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void TCellSelection::duplicateFrame() {
|
void TCellSelection::duplicateFrame() {
|
||||||
if (!Preferences::instance()->isSyncLevelRenumberWithXsheetEnabled()) {
|
if (!Preferences::instance()->isSyncLevelRenumberWithXsheetEnabled()) {
|
||||||
DVGui::warning(
|
DVGui::warning(
|
||||||
|
|
|
@ -117,6 +117,8 @@ public:
|
||||||
|
|
||||||
static bool isEnabledCommand(std::string commandId);
|
static bool isEnabledCommand(std::string commandId);
|
||||||
|
|
||||||
|
void createBlankDrawing(int row, int col, bool inRange);
|
||||||
|
void createBlankDrawings();
|
||||||
void fillEmptyCell();
|
void fillEmptyCell();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1802,6 +1802,8 @@ void MainWindow::defineActions() {
|
||||||
QAction *timeStretchAction =
|
QAction *timeStretchAction =
|
||||||
createMenuCellsAction(MI_TimeStretch, tr("&Time Stretch..."), "");
|
createMenuCellsAction(MI_TimeStretch, tr("&Time Stretch..."), "");
|
||||||
timeStretchAction->setIcon(QIcon(":Resources/timestretch.svg"));
|
timeStretchAction->setIcon(QIcon(":Resources/timestretch.svg"));
|
||||||
|
createMenuCellsAction(MI_CreateBlankDrawing, tr("&Create Blank Drawing"),
|
||||||
|
"Alt+D");
|
||||||
createMenuCellsAction(MI_Duplicate, tr("&Duplicate Drawing "), "D");
|
createMenuCellsAction(MI_Duplicate, tr("&Duplicate Drawing "), "D");
|
||||||
createMenuCellsAction(MI_Autorenumber, tr("&Autorenumber"), "");
|
createMenuCellsAction(MI_Autorenumber, tr("&Autorenumber"), "");
|
||||||
createMenuCellsAction(MI_CloneLevel, tr("&Clone"), "");
|
createMenuCellsAction(MI_CloneLevel, tr("&Clone"), "");
|
||||||
|
|
|
@ -1315,6 +1315,7 @@ QMenuBar *StackedMenuBar::createFullMenuBar() {
|
||||||
}
|
}
|
||||||
cellsMenu->addSeparator();
|
cellsMenu->addSeparator();
|
||||||
addMenuItem(cellsMenu, MI_Autorenumber);
|
addMenuItem(cellsMenu, MI_Autorenumber);
|
||||||
|
addMenuItem(cellsMenu, MI_CreateBlankDrawing);
|
||||||
addMenuItem(cellsMenu, MI_Duplicate);
|
addMenuItem(cellsMenu, MI_Duplicate);
|
||||||
addMenuItem(cellsMenu, MI_MergeFrames);
|
addMenuItem(cellsMenu, MI_MergeFrames);
|
||||||
addMenuItem(cellsMenu, MI_CloneLevel);
|
addMenuItem(cellsMenu, MI_CloneLevel);
|
||||||
|
|
|
@ -147,6 +147,7 @@
|
||||||
|
|
||||||
#define MI_PasteNew "MI_PasteNew"
|
#define MI_PasteNew "MI_PasteNew"
|
||||||
#define MI_Autorenumber "MI_Autorenumber"
|
#define MI_Autorenumber "MI_Autorenumber"
|
||||||
|
#define MI_CreateBlankDrawing "MI_CreateBlankDrawing"
|
||||||
#define MI_FillEmptyCell "MI_FillEmptyCell"
|
#define MI_FillEmptyCell "MI_FillEmptyCell"
|
||||||
|
|
||||||
#define MI_MergeFrames "MI_MergeFrames"
|
#define MI_MergeFrames "MI_MergeFrames"
|
||||||
|
|
|
@ -318,36 +318,46 @@ bool isGlobalKeyFrameWithSameTypeDiffFromLinear(TStageObject *stageObject,
|
||||||
TDoubleKeyframe::Type type =
|
TDoubleKeyframe::Type type =
|
||||||
stageObject->getParam(TStageObject::T_Angle)->getKeyframeAt(frame).m_type;
|
stageObject->getParam(TStageObject::T_Angle)->getKeyframeAt(frame).m_type;
|
||||||
if (type == TDoubleKeyframe::Linear) return false;
|
if (type == TDoubleKeyframe::Linear) return false;
|
||||||
if (type != stageObject->getParam(TStageObject::T_X)
|
if (type !=
|
||||||
->getKeyframeAt(frame)
|
stageObject->getParam(TStageObject::T_X)
|
||||||
.m_type ||
|
->getKeyframeAt(frame)
|
||||||
type != stageObject->getParam(TStageObject::T_Y)
|
.m_type ||
|
||||||
->getKeyframeAt(frame)
|
type !=
|
||||||
.m_type ||
|
stageObject->getParam(TStageObject::T_Y)
|
||||||
type != stageObject->getParam(TStageObject::T_Z)
|
->getKeyframeAt(frame)
|
||||||
->getKeyframeAt(frame)
|
.m_type ||
|
||||||
.m_type ||
|
type !=
|
||||||
type != stageObject->getParam(TStageObject::T_SO)
|
stageObject->getParam(TStageObject::T_Z)
|
||||||
->getKeyframeAt(frame)
|
->getKeyframeAt(frame)
|
||||||
.m_type ||
|
.m_type ||
|
||||||
type != stageObject->getParam(TStageObject::T_ScaleX)
|
type !=
|
||||||
->getKeyframeAt(frame)
|
stageObject->getParam(TStageObject::T_SO)
|
||||||
.m_type ||
|
->getKeyframeAt(frame)
|
||||||
type != stageObject->getParam(TStageObject::T_ScaleY)
|
.m_type ||
|
||||||
->getKeyframeAt(frame)
|
type !=
|
||||||
.m_type ||
|
stageObject->getParam(TStageObject::T_ScaleX)
|
||||||
type != stageObject->getParam(TStageObject::T_Scale)
|
->getKeyframeAt(frame)
|
||||||
->getKeyframeAt(frame)
|
.m_type ||
|
||||||
.m_type ||
|
type !=
|
||||||
type != stageObject->getParam(TStageObject::T_Path)
|
stageObject->getParam(TStageObject::T_ScaleY)
|
||||||
->getKeyframeAt(frame)
|
->getKeyframeAt(frame)
|
||||||
.m_type ||
|
.m_type ||
|
||||||
type != stageObject->getParam(TStageObject::T_ShearX)
|
type !=
|
||||||
->getKeyframeAt(frame)
|
stageObject->getParam(TStageObject::T_Scale)
|
||||||
.m_type ||
|
->getKeyframeAt(frame)
|
||||||
type != stageObject->getParam(TStageObject::T_ShearY)
|
.m_type ||
|
||||||
->getKeyframeAt(frame)
|
type !=
|
||||||
.m_type)
|
stageObject->getParam(TStageObject::T_Path)
|
||||||
|
->getKeyframeAt(frame)
|
||||||
|
.m_type ||
|
||||||
|
type !=
|
||||||
|
stageObject->getParam(TStageObject::T_ShearX)
|
||||||
|
->getKeyframeAt(frame)
|
||||||
|
.m_type ||
|
||||||
|
type !=
|
||||||
|
stageObject->getParam(TStageObject::T_ShearY)
|
||||||
|
->getKeyframeAt(frame)
|
||||||
|
.m_type)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -370,36 +380,46 @@ bool isGlobalKeyFrameWithSamePrevTypeDiffFromLinear(TStageObject *stageObject,
|
||||||
->getKeyframeAt(frame)
|
->getKeyframeAt(frame)
|
||||||
.m_prevType;
|
.m_prevType;
|
||||||
if (type == TDoubleKeyframe::Linear) return false;
|
if (type == TDoubleKeyframe::Linear) return false;
|
||||||
if (type != stageObject->getParam(TStageObject::T_X)
|
if (type !=
|
||||||
->getKeyframeAt(frame)
|
stageObject->getParam(TStageObject::T_X)
|
||||||
.m_prevType ||
|
->getKeyframeAt(frame)
|
||||||
type != stageObject->getParam(TStageObject::T_Y)
|
.m_prevType ||
|
||||||
->getKeyframeAt(frame)
|
type !=
|
||||||
.m_prevType ||
|
stageObject->getParam(TStageObject::T_Y)
|
||||||
type != stageObject->getParam(TStageObject::T_Z)
|
->getKeyframeAt(frame)
|
||||||
->getKeyframeAt(frame)
|
.m_prevType ||
|
||||||
.m_prevType ||
|
type !=
|
||||||
type != stageObject->getParam(TStageObject::T_SO)
|
stageObject->getParam(TStageObject::T_Z)
|
||||||
->getKeyframeAt(frame)
|
->getKeyframeAt(frame)
|
||||||
.m_prevType ||
|
.m_prevType ||
|
||||||
type != stageObject->getParam(TStageObject::T_ScaleX)
|
type !=
|
||||||
->getKeyframeAt(frame)
|
stageObject->getParam(TStageObject::T_SO)
|
||||||
.m_prevType ||
|
->getKeyframeAt(frame)
|
||||||
type != stageObject->getParam(TStageObject::T_ScaleY)
|
.m_prevType ||
|
||||||
->getKeyframeAt(frame)
|
type !=
|
||||||
.m_prevType ||
|
stageObject->getParam(TStageObject::T_ScaleX)
|
||||||
type != stageObject->getParam(TStageObject::T_Scale)
|
->getKeyframeAt(frame)
|
||||||
->getKeyframeAt(frame)
|
.m_prevType ||
|
||||||
.m_prevType ||
|
type !=
|
||||||
type != stageObject->getParam(TStageObject::T_Path)
|
stageObject->getParam(TStageObject::T_ScaleY)
|
||||||
->getKeyframeAt(frame)
|
->getKeyframeAt(frame)
|
||||||
.m_prevType ||
|
.m_prevType ||
|
||||||
type != stageObject->getParam(TStageObject::T_ShearX)
|
type !=
|
||||||
->getKeyframeAt(frame)
|
stageObject->getParam(TStageObject::T_Scale)
|
||||||
.m_prevType ||
|
->getKeyframeAt(frame)
|
||||||
type != stageObject->getParam(TStageObject::T_ShearY)
|
.m_prevType ||
|
||||||
->getKeyframeAt(frame)
|
type !=
|
||||||
.m_prevType)
|
stageObject->getParam(TStageObject::T_Path)
|
||||||
|
->getKeyframeAt(frame)
|
||||||
|
.m_prevType ||
|
||||||
|
type !=
|
||||||
|
stageObject->getParam(TStageObject::T_ShearX)
|
||||||
|
->getKeyframeAt(frame)
|
||||||
|
.m_prevType ||
|
||||||
|
type !=
|
||||||
|
stageObject->getParam(TStageObject::T_ShearY)
|
||||||
|
->getKeyframeAt(frame)
|
||||||
|
.m_prevType)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -758,7 +778,7 @@ void RenameCellField::renameCell() {
|
||||||
fid = TFrameId(fidRe.cap(1).toInt(),
|
fid = TFrameId(fidRe.cap(1).toInt(),
|
||||||
fidRe.cap(2) == "" ? 0 : fidRe.cap(2).toLatin1()[0]);
|
fidRe.cap(2) == "" ? 0 : fidRe.cap(2).toLatin1()[0]);
|
||||||
#else
|
#else
|
||||||
fid = TFrameId(fidRe.cap(1).toInt(),
|
fid = TFrameId(fidRe.cap(1).toInt(),
|
||||||
fidRe.cap(2) == "" ? 0 : fidRe.cap(2).toAscii()[0]);
|
fidRe.cap(2) == "" ? 0 : fidRe.cap(2).toAscii()[0]);
|
||||||
#endif
|
#endif
|
||||||
FilmstripCmd::renumberDrawing(sl, cell.m_frameId, fid);
|
FilmstripCmd::renumberDrawing(sl, cell.m_frameId, fid);
|
||||||
|
@ -1805,10 +1825,10 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
|
||||||
nameRect.adjust(0, 0, -frameAdj, 0);
|
nameRect.adjust(0, 0, -frameAdj, 0);
|
||||||
|
|
||||||
// draw text in red if the file does not exist
|
// draw text in red if the file does not exist
|
||||||
bool isRed = false;
|
bool isRed = false;
|
||||||
TXshSimpleLevel *sl = cell.getSimpleLevel();
|
TXshSimpleLevel *sl = cell.getSimpleLevel();
|
||||||
if (sl && !sl->isFid(cell.m_frameId)) isRed = true;
|
if (sl && !sl->isFid(cell.m_frameId)) isRed = true;
|
||||||
TXshChildLevel *cl = cell.getChildLevel();
|
TXshChildLevel *cl = cell.getChildLevel();
|
||||||
if (cl && cell.getFrameId().getNumber() - 1 >= cl->getFrameCount())
|
if (cl && cell.getFrameId().getNumber() - 1 >= cl->getFrameCount())
|
||||||
isRed = true;
|
isRed = true;
|
||||||
QColor penColor =
|
QColor penColor =
|
||||||
|
@ -1908,9 +1928,8 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
|
||||||
bool isSelected = cellSelection->isCellSelected(row, col) ||
|
bool isSelected = cellSelection->isCellSelected(row, col) ||
|
||||||
columnSelection->isColumnSelected(col);
|
columnSelection->isColumnSelected(col);
|
||||||
|
|
||||||
if (row > 0)
|
if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame
|
||||||
prevCell = xsh->getCell(row - 1, col); // cell in previous frame
|
// nothing to draw
|
||||||
// nothing to draw
|
|
||||||
|
|
||||||
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
|
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
|
||||||
|
|
||||||
|
@ -2016,7 +2035,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fontName = "Arial";
|
fontName = "Arial";
|
||||||
#else
|
#else
|
||||||
fontName = "Helvetica";
|
fontName = "Helvetica";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
static QFont font(fontName, -1, QFont::Normal);
|
static QFont font(fontName, -1, QFont::Normal);
|
||||||
|
@ -2048,7 +2067,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
|
||||||
#if QT_VERSION >= 0x050500
|
#if QT_VERSION >= 0x050500
|
||||||
QString elidaName = elideText(text, metric, nameRect.width(), "~");
|
QString elidaName = elideText(text, metric, nameRect.width(), "~");
|
||||||
#else
|
#else
|
||||||
QString elidaName = elideText(text, font, nameRect.width(), "~");
|
QString elidaName = elideText(text, font, nameRect.width(), "~");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!sameLevel || prevCell.m_frameId != cell.m_frameId)
|
if (!sameLevel || prevCell.m_frameId != cell.m_frameId)
|
||||||
|
@ -2069,7 +2088,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
|
||||||
bool isSelected = cellSelection->isCellSelected(row, col);
|
bool isSelected = cellSelection->isCellSelected(row, col);
|
||||||
|
|
||||||
if (row > 0) prevCell = xsh->getCell(row - 1, col);
|
if (row > 0) prevCell = xsh->getCell(row - 1, col);
|
||||||
TXshCell nextCell = xsh->getCell(row + 1, col);
|
TXshCell nextCell = xsh->getCell(row + 1, col);
|
||||||
|
|
||||||
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
|
bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();
|
||||||
|
|
||||||
|
@ -2080,8 +2099,8 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
|
||||||
bool isAfterMarkers =
|
bool isAfterMarkers =
|
||||||
distance > 0 && ((row - offset) % distance) == 0 && row != 0;
|
distance > 0 && ((row - offset) % distance) == 0 && row != 0;
|
||||||
|
|
||||||
bool isRed = false;
|
bool isRed = false;
|
||||||
TXshPaletteLevel *pl = cell.getPaletteLevel();
|
TXshPaletteLevel *pl = cell.getPaletteLevel();
|
||||||
if (pl && !pl->getPalette()) isRed = true;
|
if (pl && !pl->getPalette()) isRed = true;
|
||||||
|
|
||||||
QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
|
QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
|
||||||
|
@ -2213,7 +2232,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fontName = "Arial";
|
fontName = "Arial";
|
||||||
#else
|
#else
|
||||||
fontName = "Helvetica";
|
fontName = "Helvetica";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
static QFont font(fontName, -1, QFont::Normal);
|
static QFont font(fontName, -1, QFont::Normal);
|
||||||
|
@ -2772,9 +2791,10 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
|
||||||
setDragTool(XsheetGUI::DragTool::makeLevelMoverTool(m_viewer));
|
setDragTool(XsheetGUI::DragTool::makeLevelMoverTool(m_viewer));
|
||||||
} else {
|
} else {
|
||||||
m_viewer->getKeyframeSelection()->selectNone();
|
m_viewer->getKeyframeSelection()->selectNone();
|
||||||
if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)
|
if (isSoundColumn &&
|
||||||
.adjusted(0, 0, -frameAdj, 0)
|
o->rect(PredefinedRect::PREVIEW_TRACK)
|
||||||
.contains(mouseInCell))
|
.adjusted(0, 0, -frameAdj, 0)
|
||||||
|
.contains(mouseInCell))
|
||||||
setDragTool(XsheetGUI::DragTool::makeSoundScrubTool(
|
setDragTool(XsheetGUI::DragTool::makeSoundScrubTool(
|
||||||
m_viewer, column->getSoundColumn()));
|
m_viewer, column->getSoundColumn()));
|
||||||
else if (isSoundColumn &&
|
else if (isSoundColumn &&
|
||||||
|
@ -2909,9 +2929,10 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {
|
||||||
: QString::fromStdWString(levelName) + QString(" ") +
|
: QString::fromStdWString(levelName) + QString(" ") +
|
||||||
QString::fromStdString(frameNumber));
|
QString::fromStdString(frameNumber));
|
||||||
}
|
}
|
||||||
} else if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)
|
} else if (isSoundColumn &&
|
||||||
.adjusted(0, 0, -frameAdj, 0)
|
o->rect(PredefinedRect::PREVIEW_TRACK)
|
||||||
.contains(mouseInCell))
|
.adjusted(0, 0, -frameAdj, 0)
|
||||||
|
.contains(mouseInCell))
|
||||||
m_tooltip = tr("Click and drag to play");
|
m_tooltip = tr("Click and drag to play");
|
||||||
else if (m_levelExtenderRect.contains(pos))
|
else if (m_levelExtenderRect.contains(pos))
|
||||||
m_tooltip = tr("Click and drag to repeat selected cells");
|
m_tooltip = tr("Click and drag to repeat selected cells");
|
||||||
|
@ -3292,6 +3313,7 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
||||||
|
|
||||||
menu.addAction(cmdManager->getAction(MI_Clear));
|
menu.addAction(cmdManager->getAction(MI_Clear));
|
||||||
menu.addAction(cmdManager->getAction(MI_Insert));
|
menu.addAction(cmdManager->getAction(MI_Insert));
|
||||||
|
menu.addAction(cmdManager->getAction(MI_CreateBlankDrawing));
|
||||||
menu.addAction(cmdManager->getAction(MI_Duplicate));
|
menu.addAction(cmdManager->getAction(MI_Duplicate));
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
|
@ -3330,6 +3352,8 @@ void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell) {
|
||||||
TApp::instance()->getCurrentLevel()->getLevel()->getChildLevel()))
|
TApp::instance()->getCurrentLevel()->getLevel()->getChildLevel()))
|
||||||
menu.addAction(cmdManager->getAction(MI_LipSyncPopup));
|
menu.addAction(cmdManager->getAction(MI_LipSyncPopup));
|
||||||
} else {
|
} else {
|
||||||
|
menu.addAction(cmdManager->getAction(MI_CreateBlankDrawing));
|
||||||
|
menu.addSeparator();
|
||||||
menu.addAction(cmdManager->getAction(MI_FillEmptyCell));
|
menu.addAction(cmdManager->getAction(MI_FillEmptyCell));
|
||||||
if (cameraCellsSelected) {
|
if (cameraCellsSelected) {
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
Loading…
Reference in a new issue