Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Add alwaysDragFrameCell preference

Abel You5d3dd1420262
diff --git a/toonz/sources/.clang-format b/toonz/sources/.clang-format
index 700421a18..85c47f76b 100644
--- a/toonz/sources/.clang-format
+++ b/toonz/sources/.clang-format
@@ -1,5 +1,5 @@
BasedOnStyle: Google
-Standard: C++17
+Standard: c++17
UseTab: Never
AccessModifierOffset: -2
AlignAfterOpenBracket: true
diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h
index 23a787cc2..2a5d0c72c 100644
--- a/toonz/sources/include/toonz/preferences.h
+++ b/toonz/sources/include/toonz/preferences.h
@@ -369,6 +369,7 @@ public:
bool isXsheetAutopanEnabled() const {
return getBoolValue(xsheetAutopanEnabled);
} //!< Returns whether xsheet pans during playback.
+ int isAlwaysDragFrameCell() const { return getBoolValue(alwaysDragFrameCell); }
int getDragCellsBehaviour() const { return getIntValue(DragCellsBehaviour); }
int getDeleteCommandBehaviour() const {
return getIntValue(deleteCommandBehavior);
diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h
index 279a53b44..4e2693db9 100644
--- a/toonz/sources/include/toonz/preferencesitemids.h
+++ b/toonz/sources/include/toonz/preferencesitemids.h
@@ -123,6 +123,7 @@ enum PreferencesItemId {
xsheetLayoutPreference,
xsheetStep,
xsheetAutopanEnabled,
+ alwaysDragFrameCell,
DragCellsBehaviour,
deleteCommandBehavior,
pasteCellsBehavior,
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index c1d75c7f2..b12771513 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -1324,6 +1324,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
{xsheetLayoutPreference, tr("Column Header Layout*:")},
{xsheetStep, tr("Next/Previous Step Frames:")},
{xsheetAutopanEnabled, tr("Xsheet Autopan during Playback")},
+ {alwaysDragFrameCell, tr("Always Drag Frame Cell")},
{DragCellsBehaviour, tr("Cell-dragging Behaviour:")},
{deleteCommandBehavior, tr("Delete Command Behaviour:")},
{pasteCellsBehavior, tr("Paste Cells Behaviour:")},
@@ -2077,6 +2078,7 @@ QWidget* PreferencesPopup::createXsheetPage() {
insertUI(linkColumnNameWithLevel, lay);
insertUI(xsheetStep, lay);
insertUI(xsheetAutopanEnabled, lay);
+ insertUI(alwaysDragFrameCell, lay);
insertUI(DragCellsBehaviour, lay, getComboItemList(DragCellsBehaviour));
insertUI(deleteCommandBehavior, lay, getComboItemList(deleteCommandBehavior));
insertUI(pasteCellsBehavior, lay, getComboItemList(pasteCellsBehavior));
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index cc31782b2..906ef6868 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -3368,32 +3368,34 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
m_viewer->getKeyframeSelection()->selectNone();
setDragTool(
XsheetGUI::DragTool::makeLevelExtenderTool(m_viewer, false, true));
- } else if ((!xsh->getCell(row, col).isEmpty()) &&
- o->rect(PredefinedRect::DRAG_AREA)
- .adjusted(0, 0, -frameAdj.x(), -frameAdj.y())
- .contains(mouseInCell)) {
+ } else if ((!xsh->getCell(row, col).isEmpty()) &&(
+ (Preferences::instance()->isAlwaysDragFrameCell() &&
+ xsh->getCell(row,col)!=xsh->getCell(row-1,col)) ||
+ o->rect(PredefinedRect::DRAG_AREA).adjusted(0, 0, -frameAdj.x(), -frameAdj.y()).contains(mouseInCell))) {
TXshColumn *column = xsh->getColumn(col);
// If draged cell out of the CellSelection , drag the level
// if (column && !m_viewer->getCellSelection()->isCellSelected(row, col)) {
// IF draged cell is not Frame cell, drag the level
if (column && !m_viewer->getCellSelection()->isCellSelected(row, col)) {
- if(xsh->getCell(cellPosition) == xsh->getCell(row-1, col)) {
- int r0, r1;
- column->getLevelRange(row, r0, r1);
- if (event->modifiers() & Qt::ControlModifier) {
- m_viewer->getCellKeyframeSelection()->makeCurrent();
- m_viewer->getCellKeyframeSelection()->selectCellsKeyframes(r0, col,
- r1, col);
- } else {
- m_viewer->getKeyframeSelection()->selectNone();
- m_viewer->getCellSelection()->makeCurrent();
- m_viewer->getCellSelection()->selectCells(r0, col, r1, col);
+ if(xsh->getCell(cellPosition) == xsh->getCell(row - 1, col)) {
+ int r0, r1;
+ column->getLevelRange(row, r0, r1);
+ if (event->modifiers() & Qt::ControlModifier) {
+ m_viewer->getCellKeyframeSelection()->makeCurrent();
+ m_viewer->getCellKeyframeSelection()->selectCellsKeyframes(r0, col,
+ r1, col);
+ } else {
+ m_viewer->getKeyframeSelection()->selectNone();
+ m_viewer->getCellSelection()->makeCurrent();
+ m_viewer->getCellSelection()->selectCells(r0, col, r1, col);
+ }
+ TApp::instance()->getCurrentSelection()->notifySelectionChanged();
+ } else { // switch to that FrameCell
+ m_viewer->setCurrentRow(row);
+ m_viewer->setCurrentColumn(col);
+ m_viewer->getCellSelection()->selectCell(row, col);
}
- TApp::instance()->getCurrentSelection()->notifySelectionChanged();
- }
- else// switch to that FrameCell
- m_viewer->getCellSelection()->selectCell(row,col);
}
TSelection *selection =
TApp::instance()->getCurrentSelection()->getSelection();
diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp
index 02172f6a2..bba18f6a4 100644
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@ -562,6 +562,8 @@ void Preferences::definePreferenceItems() {
define(xsheetStep, "xsheetStep", QMetaType::Int, 10, 0,
std::numeric_limits<int>::max());
define(xsheetAutopanEnabled, "xsheetAutopanEnabled", QMetaType::Bool, true);
+ define(alwaysDragFrameCell, "alwaysDragFrameCell", QMetaType::Bool,
+ true);
define(DragCellsBehaviour, "DragCellsBehaviour", QMetaType::Int,
1); // Cells and Column Data
define(deleteCommandBehavior, "deleteCommandBehavior", QMetaType::Int,