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/preferences.h"
|
||||||
#include "toonz/tstageobjectid.h"
|
#include "toonz/tstageobjectid.h"
|
||||||
|
|
||||||
|
#include "../toonz/xsheetviewer.h"
|
||||||
|
|
||||||
// TnzBase includes
|
// TnzBase includes
|
||||||
#include "tfx.h"
|
#include "tfx.h"
|
||||||
#include "tfxattributes.h"
|
#include "tfxattributes.h"
|
||||||
|
@ -1396,10 +1398,11 @@ public:
|
||||||
void execute() override {
|
void execute() override {
|
||||||
TColumnSelection *selection = dynamic_cast<TColumnSelection *>(
|
TColumnSelection *selection = dynamic_cast<TColumnSelection *>(
|
||||||
TApp::instance()->getCurrentSelection()->getSelection());
|
TApp::instance()->getCurrentSelection()->getSelection());
|
||||||
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
||||||
int cc = TApp::instance()->getCurrentColumn()->getColumnIndex();
|
XsheetViewer *xviewer = TApp::instance()->getCurrentXsheetViewer();
|
||||||
bool sound_changed = false;
|
int cc = xviewer->getClickedColumn();
|
||||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
bool sound_changed = false;
|
||||||
|
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||||
TTool::Viewer *viewer = tool ? tool->getViewer() : nullptr;
|
TTool::Viewer *viewer = tool ? tool->getViewer() : nullptr;
|
||||||
bool viewer_changed = false;
|
bool viewer_changed = false;
|
||||||
|
|
||||||
|
|
|
@ -2194,9 +2194,6 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
||||||
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// set the clicked column to current
|
|
||||||
else
|
|
||||||
m_viewer->setCurrentColumn(m_col);
|
|
||||||
|
|
||||||
TXshColumn *column = xsh->getColumn(m_col);
|
TXshColumn *column = xsh->getColumn(m_col);
|
||||||
bool isEmpty = !column || column->isEmpty();
|
bool isEmpty = !column || column->isEmpty();
|
||||||
|
@ -2212,17 +2209,22 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
||||||
|
|
||||||
// clicking on the camera column
|
// clicking on the camera column
|
||||||
if (m_col < 0) {
|
if (m_col < 0) {
|
||||||
// lock button
|
if (o->rect(PredefinedRect::CAMERA_LOCK_AREA).contains(mouseInCell)) {
|
||||||
if (o->rect(PredefinedRect::CAMERA_LOCK_AREA).contains(mouseInCell) &&
|
// lock button
|
||||||
event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock;
|
m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock;
|
||||||
// config button
|
else
|
||||||
else if (o->rect(PredefinedRect::CAMERA_CONFIG_AREA)
|
return;
|
||||||
.contains(mouseInCell) &&
|
} else if (o->rect(PredefinedRect::CAMERA_CONFIG_AREA)
|
||||||
event->button() == Qt::LeftButton)
|
.contains(mouseInCell)) {
|
||||||
m_doOnRelease = OpenSettings;
|
// config button
|
||||||
// clicking another area means column selection
|
if (event->button() == Qt::LeftButton)
|
||||||
else {
|
m_doOnRelease = OpenSettings;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// clicking another area means column selection
|
||||||
|
m_viewer->setCurrentColumn(m_col);
|
||||||
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
||||||
event->button() == Qt::RightButton)
|
event->button() == Qt::RightButton)
|
||||||
return;
|
return;
|
||||||
|
@ -2239,52 +2241,55 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
||||||
&& (o->rect(PredefinedRect::LAYER_NUMBER).contains(mouseInCell) ||
|
&& (o->rect(PredefinedRect::LAYER_NUMBER).contains(mouseInCell) ||
|
||||||
o->rect(PredefinedRect::LAYER_NAME).contains(mouseInCell)))) {
|
o->rect(PredefinedRect::LAYER_NAME).contains(mouseInCell)))) {
|
||||||
setDragTool(XsheetGUI::DragTool::makeColumnMoveTool(m_viewer));
|
setDragTool(XsheetGUI::DragTool::makeColumnMoveTool(m_viewer));
|
||||||
}
|
} else if (o->rect(PredefinedRect::LOCK_AREA).contains(mouseInCell)) {
|
||||||
// lock button
|
// lock button
|
||||||
else if (o->rect(PredefinedRect::LOCK_AREA).contains(mouseInCell) &&
|
if (event->button() == Qt::LeftButton)
|
||||||
event->button() == Qt::LeftButton) {
|
m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock;
|
||||||
m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock;
|
else
|
||||||
}
|
return;
|
||||||
// preview button
|
} else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell)) {
|
||||||
else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell) &&
|
// preview button
|
||||||
event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
if (column->getSoundTextColumn()) {
|
if (column->getSoundTextColumn()) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
m_doOnRelease =
|
m_doOnRelease =
|
||||||
isCtrlPressed ? ToggleAllPreviewVisible : TogglePreviewVisible;
|
isCtrlPressed ? ToggleAllPreviewVisible : TogglePreviewVisible;
|
||||||
if (column->getSoundColumn())
|
if (column->getSoundColumn())
|
||||||
TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged();
|
TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// camstand button
|
|
||||||
else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA)
|
|
||||||
.contains(mouseInCell) &&
|
|
||||||
event->button() == Qt::LeftButton) {
|
|
||||||
if (column->getPaletteColumn() || column->getSoundTextColumn()) {
|
|
||||||
// do nothing
|
|
||||||
} else {
|
|
||||||
m_doOnRelease =
|
|
||||||
isCtrlPressed ? ToggleAllTransparency : ToggleTransparency;
|
|
||||||
if (!o->flag(PredefinedFlag::CONFIG_AREA_VISIBLE) &&
|
|
||||||
!column->getSoundColumn())
|
|
||||||
startTransparencyPopupTimer(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// config button
|
|
||||||
else if (o->rect(PredefinedRect::CONFIG_AREA).contains(mouseInCell) &&
|
|
||||||
event->button() == Qt::LeftButton) {
|
|
||||||
TXshZeraryFxColumn *zColumn =
|
|
||||||
dynamic_cast<TXshZeraryFxColumn *>(column);
|
|
||||||
|
|
||||||
if (column && (zColumn || column->getPaletteColumn() ||
|
|
||||||
column->getSoundTextColumn())) {
|
|
||||||
// do nothing
|
|
||||||
} else
|
} else
|
||||||
m_doOnRelease = OpenSettings;
|
return;
|
||||||
}
|
} else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA)
|
||||||
// sound column
|
.contains(mouseInCell)) {
|
||||||
else if (column && column->getSoundColumn()) {
|
// camstand button
|
||||||
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
if (column->getPaletteColumn() || column->getSoundTextColumn()) {
|
||||||
|
// do nothing
|
||||||
|
} else {
|
||||||
|
m_doOnRelease =
|
||||||
|
isCtrlPressed ? ToggleAllTransparency : ToggleTransparency;
|
||||||
|
if (!o->flag(PredefinedFlag::CONFIG_AREA_VISIBLE) &&
|
||||||
|
!column->getSoundColumn())
|
||||||
|
startTransparencyPopupTimer(event);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
} else if (o->rect(PredefinedRect::CONFIG_AREA).contains(mouseInCell)) {
|
||||||
|
// config button
|
||||||
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
TXshZeraryFxColumn *zColumn =
|
||||||
|
dynamic_cast<TXshZeraryFxColumn *>(column);
|
||||||
|
|
||||||
|
if (column && (zColumn || column->getPaletteColumn() ||
|
||||||
|
column->getSoundTextColumn())) {
|
||||||
|
// do nothing
|
||||||
|
} else
|
||||||
|
m_doOnRelease = OpenSettings;
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
} else if (column && column->getSoundColumn()) {
|
||||||
|
// sound column
|
||||||
if (o->rect(PredefinedRect::SOUND_ICON).contains(mouseInCell)) {
|
if (o->rect(PredefinedRect::SOUND_ICON).contains(mouseInCell)) {
|
||||||
TXshSoundColumn *s = column->getSoundColumn();
|
TXshSoundColumn *s = column->getSoundColumn();
|
||||||
if (s) {
|
if (s) {
|
||||||
|
@ -2314,9 +2319,9 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
||||||
setDragTool(XsheetGUI::DragTool::makeVolumeDragTool(m_viewer));
|
setDragTool(XsheetGUI::DragTool::makeVolumeDragTool(m_viewer));
|
||||||
else
|
else
|
||||||
setDragTool(XsheetGUI::DragTool::makeColumnSelectionTool(m_viewer));
|
setDragTool(XsheetGUI::DragTool::makeColumnSelectionTool(m_viewer));
|
||||||
}
|
} else {
|
||||||
// clicking another area means column selection
|
// clicking another area means column selection
|
||||||
else {
|
m_viewer->setCurrentColumn(m_col);
|
||||||
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
||||||
event->button() == Qt::RightButton)
|
event->button() == Qt::RightButton)
|
||||||
return;
|
return;
|
||||||
|
@ -2378,6 +2383,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
||||||
TApp::instance()->getCurrentFx()->setFx(fx);
|
TApp::instance()->getCurrentFx()->setFx(fx);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
m_viewer->setCurrentColumn(m_col);
|
||||||
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
if (m_viewer->getColumnSelection()->isColumnSelected(m_col) &&
|
||||||
event->button() == Qt::RightButton)
|
event->button() == Qt::RightButton)
|
||||||
return;
|
return;
|
||||||
|
@ -2388,6 +2394,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
|
||||||
update();
|
update();
|
||||||
|
|
||||||
} else if (event->button() == Qt::MidButton) {
|
} else if (event->button() == Qt::MidButton) {
|
||||||
|
m_viewer->setCurrentColumn(m_col);
|
||||||
m_pos = event->pos();
|
m_pos = event->pos();
|
||||||
m_isPanning = true;
|
m_isPanning = true;
|
||||||
}
|
}
|
||||||
|
@ -2678,7 +2685,6 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) {
|
||||||
|
|
||||||
bool isCamera = col < 0;
|
bool isCamera = col < 0;
|
||||||
|
|
||||||
m_viewer->setCurrentColumn(col);
|
|
||||||
TXsheet *xsh = m_viewer->getXsheet();
|
TXsheet *xsh = m_viewer->getXsheet();
|
||||||
QPoint topLeft = m_viewer->positionToXY(CellPosition(0, col));
|
QPoint topLeft = m_viewer->positionToXY(CellPosition(0, col));
|
||||||
QPoint mouseInCell = event->pos() - topLeft;
|
QPoint mouseInCell = event->pos() - topLeft;
|
||||||
|
|
|
@ -358,6 +358,8 @@ public:
|
||||||
|
|
||||||
QPixmap getColumnIcon(int columnIndex);
|
QPixmap getColumnIcon(int columnIndex);
|
||||||
|
|
||||||
|
int getClickedColumn() { return m_col; }
|
||||||
|
|
||||||
class Pixmaps {
|
class Pixmaps {
|
||||||
public:
|
public:
|
||||||
static const QPixmap &sound();
|
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 {
|
int XsheetViewer::getCurrentRow() const {
|
||||||
return TApp::instance()->getCurrentFrame()->getFrame();
|
return TApp::instance()->getCurrentFrame()->getFrame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -675,6 +675,7 @@ public:
|
||||||
|
|
||||||
TXsheet *getXsheet() const;
|
TXsheet *getXsheet() const;
|
||||||
int getCurrentColumn() const;
|
int getCurrentColumn() const;
|
||||||
|
int getClickedColumn() const;
|
||||||
int getCurrentRow() const;
|
int getCurrentRow() const;
|
||||||
//! Restituisce la \b objectId corrispondente alla colonna \b col
|
//! Restituisce la \b objectId corrispondente alla colonna \b col
|
||||||
TStageObjectId getObjectId(int col) const;
|
TStageObjectId getObjectId(int col) const;
|
||||||
|
|
Loading…
Reference in a new issue