Merge pull request #758 from manongjohn/stop_column_button_switching
Stop switching columns on column button press
This commit is contained in:
commit
fe48fb7d52
5 changed files with 87 additions and 67 deletions
|
@ -40,6 +40,8 @@
|
|||
#include "toonz/preferences.h"
|
||||
#include "toonz/tstageobjectid.h"
|
||||
|
||||
#include "../toonz/xsheetviewer.h"
|
||||
|
||||
// TnzBase includes
|
||||
#include "tfx.h"
|
||||
#include "tfxattributes.h"
|
||||
|
@ -1397,7 +1399,8 @@ public:
|
|||
TColumnSelection *selection = dynamic_cast<TColumnSelection *>(
|
||||
TApp::instance()->getCurrentSelection()->getSelection());
|
||||
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||
int cc = TApp::instance()->getCurrentColumn()->getColumnIndex();
|
||||
XsheetViewer *xviewer = TApp::instance()->getCurrentXsheetViewer();
|
||||
int cc = xviewer->getClickedColumn();
|
||||
bool sound_changed = false;
|
||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||
TTool::Viewer *viewer = tool ? tool->getViewer() : nullptr;
|
||||
|
|
|
@ -2194,9 +2194,6 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||
return;
|
||||
}
|
||||
// set the clicked column to current
|
||||
else
|
||||
m_viewer->setCurrentColumn(m_col);
|
||||
|
||||
TXshColumn *column = xsh->getColumn(m_col);
|
||||
bool isEmpty = !column || column->isEmpty();
|
||||
|
@ -2212,17 +2209,22 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
|
||||
// clicking on the camera column
|
||||
if (m_col < 0) {
|
||||
if (o->rect(PredefinedRect::CAMERA_LOCK_AREA).contains(mouseInCell)) {
|
||||
// lock button
|
||||
if (o->rect(PredefinedRect::CAMERA_LOCK_AREA).contains(mouseInCell) &&
|
||||
event->button() == Qt::LeftButton)
|
||||
if (event->button() == Qt::LeftButton)
|
||||
m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock;
|
||||
else
|
||||
return;
|
||||
} else if (o->rect(PredefinedRect::CAMERA_CONFIG_AREA)
|
||||
.contains(mouseInCell)) {
|
||||
// config button
|
||||
else if (o->rect(PredefinedRect::CAMERA_CONFIG_AREA)
|
||||
.contains(mouseInCell) &&
|
||||
event->button() == Qt::LeftButton)
|
||||
if (event->button() == Qt::LeftButton)
|
||||
m_doOnRelease = OpenSettings;
|
||||
else
|
||||
return;
|
||||
} else {
|
||||
// clicking another area means column selection
|
||||
else {
|
||||
m_viewer->setCurrentColumn(m_col);
|
||||
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
||||
event->button() == Qt::RightButton)
|
||||
return;
|
||||
|
@ -2239,15 +2241,15 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
&& (o->rect(PredefinedRect::LAYER_NUMBER).contains(mouseInCell) ||
|
||||
o->rect(PredefinedRect::LAYER_NAME).contains(mouseInCell)))) {
|
||||
setDragTool(XsheetGUI::DragTool::makeColumnMoveTool(m_viewer));
|
||||
}
|
||||
} else if (o->rect(PredefinedRect::LOCK_AREA).contains(mouseInCell)) {
|
||||
// lock button
|
||||
else if (o->rect(PredefinedRect::LOCK_AREA).contains(mouseInCell) &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
if (event->button() == Qt::LeftButton)
|
||||
m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock;
|
||||
}
|
||||
else
|
||||
return;
|
||||
} else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell)) {
|
||||
// preview button
|
||||
else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell) &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
if (column->getSoundTextColumn()) {
|
||||
// do nothing
|
||||
} else {
|
||||
|
@ -2256,11 +2258,12 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
if (column->getSoundColumn())
|
||||
TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged();
|
||||
}
|
||||
}
|
||||
} else
|
||||
return;
|
||||
} else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA)
|
||||
.contains(mouseInCell)) {
|
||||
// camstand button
|
||||
else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA)
|
||||
.contains(mouseInCell) &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
if (column->getPaletteColumn() || column->getSoundTextColumn()) {
|
||||
// do nothing
|
||||
} else {
|
||||
|
@ -2270,10 +2273,11 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
!column->getSoundColumn())
|
||||
startTransparencyPopupTimer(event);
|
||||
}
|
||||
}
|
||||
} else
|
||||
return;
|
||||
} else if (o->rect(PredefinedRect::CONFIG_AREA).contains(mouseInCell)) {
|
||||
// config button
|
||||
else if (o->rect(PredefinedRect::CONFIG_AREA).contains(mouseInCell) &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
TXshZeraryFxColumn *zColumn =
|
||||
dynamic_cast<TXshZeraryFxColumn *>(column);
|
||||
|
||||
|
@ -2282,9 +2286,10 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
// do nothing
|
||||
} else
|
||||
m_doOnRelease = OpenSettings;
|
||||
}
|
||||
} else
|
||||
return;
|
||||
} else if (column && column->getSoundColumn()) {
|
||||
// sound column
|
||||
else if (column && column->getSoundColumn()) {
|
||||
if (o->rect(PredefinedRect::SOUND_ICON).contains(mouseInCell)) {
|
||||
TXshSoundColumn *s = column->getSoundColumn();
|
||||
if (s) {
|
||||
|
@ -2314,9 +2319,9 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
setDragTool(XsheetGUI::DragTool::makeVolumeDragTool(m_viewer));
|
||||
else
|
||||
setDragTool(XsheetGUI::DragTool::makeColumnSelectionTool(m_viewer));
|
||||
}
|
||||
} else {
|
||||
// clicking another area means column selection
|
||||
else {
|
||||
m_viewer->setCurrentColumn(m_col);
|
||||
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
||||
event->button() == Qt::RightButton)
|
||||
return;
|
||||
|
@ -2378,6 +2383,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
TApp::instance()->getCurrentFx()->setFx(fx);
|
||||
}
|
||||
} else {
|
||||
m_viewer->setCurrentColumn(m_col);
|
||||
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
||||
event->button() == Qt::RightButton)
|
||||
return;
|
||||
|
@ -2388,6 +2394,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
|||
update();
|
||||
|
||||
} else if (event->button() == Qt::MidButton) {
|
||||
m_viewer->setCurrentColumn(m_col);
|
||||
m_pos = event->pos();
|
||||
m_isPanning = true;
|
||||
}
|
||||
|
@ -2678,7 +2685,6 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) {
|
|||
|
||||
bool isCamera = col < 0;
|
||||
|
||||
m_viewer->setCurrentColumn(col);
|
||||
TXsheet *xsh = m_viewer->getXsheet();
|
||||
QPoint topLeft = m_viewer->positionToXY(CellPosition(0, col));
|
||||
QPoint mouseInCell = event->pos() - topLeft;
|
||||
|
|
|
@ -358,6 +358,8 @@ public:
|
|||
|
||||
QPixmap getColumnIcon(int columnIndex);
|
||||
|
||||
int getClickedColumn() { return m_col; }
|
||||
|
||||
class Pixmaps {
|
||||
public:
|
||||
static const QPixmap &sound();
|
||||
|
|
|
@ -497,6 +497,14 @@ int XsheetViewer::getCurrentColumn() const {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int XsheetViewer::getClickedColumn() const {
|
||||
if (!m_columnArea) return -1;
|
||||
|
||||
return m_columnArea->getClickedColumn();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int XsheetViewer::getCurrentRow() const {
|
||||
return TApp::instance()->getCurrentFrame()->getFrame();
|
||||
}
|
||||
|
|
|
@ -675,6 +675,7 @@ public:
|
|||
|
||||
TXsheet *getXsheet() const;
|
||||
int getCurrentColumn() const;
|
||||
int getClickedColumn() const;
|
||||
int getCurrentRow() const;
|
||||
//! Restituisce la \b objectId corrispondente alla colonna \b col
|
||||
TStageObjectId getObjectId(int col) const;
|
||||
|
|
Loading…
Reference in a new issue