Skip to content

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

C

clang format all

shun_iwasawa0cae242b7258
diff --git a/toonz/sources/common/tcore/tstring.cpp b/toonz/sources/common/tcore/tstring.cpp
index a993f8d80..743db4b21 100644
--- a/toonz/sources/common/tcore/tstring.cpp
+++ b/toonz/sources/common/tcore/tstring.cpp
@@ -58,7 +58,7 @@ std::string to_string(std::wstring ws) {
#endif
}
-std::string to_string(const TFilePath &fp) {
+std::string to_string(const TFilePath& fp) {
return ::to_string(fp.getWideString());
}
@@ -80,7 +80,7 @@ std::string to_string(double value, int prec) {
return out.str();
}
-std::string to_string(void *p) {
+std::string to_string(void* p) {
std::ostringstream out;
out << p;
return out.str();
@@ -125,7 +125,7 @@ bool isDouble(std::wstring s) { return isDouble(::to_string(s)); }
std::string toUpper(std::string a) {
#ifdef _WIN32
- size_t size = a.size();
+ size_t size = a.size();
const char* cstr = a.c_str();
std::vector<char> buf(cstr, cstr + size + 1);
return _strupr(&buf[0]);
@@ -138,7 +138,7 @@ std::string toUpper(std::string a) {
std::string toLower(std::string a) {
#ifdef _WIN32
- size_t size = a.size();
+ size_t size = a.size();
const char* cstr = a.c_str();
std::vector<char> buf(cstr, cstr + size + 1);
return _strlwr(&buf[0]);
@@ -151,7 +151,7 @@ std::string toLower(std::string a) {
std::wstring toUpper(std::wstring a) {
#ifdef _WIN32
- size_t size = a.size();
+ size_t size = a.size();
const wchar_t* cstr = a.c_str();
std::vector<wchar_t> buf(cstr, cstr + size + 1);
return _wcsupr(&buf[0]);
@@ -164,7 +164,7 @@ std::wstring toUpper(std::wstring a) {
std::wstring toLower(std::wstring a) {
#ifdef _WIN32
- size_t size = a.size();
+ size_t size = a.size();
const wchar_t* cstr = a.c_str();
std::vector<wchar_t> buf(cstr, cstr + size + 1);
return _wcslwr(&buf[0]);
diff --git a/toonz/sources/common/trop/trop_borders.cpp b/toonz/sources/common/trop/trop_borders.cpp
index ac39021a9..44a03e3ff 100644
--- a/toonz/sources/common/trop/trop_borders.cpp
+++ b/toonz/sources/common/trop/trop_borders.cpp
@@ -58,18 +58,18 @@ namespace borders {
// Standard type instantiations
-template void DVAPI readMeshes<TPixel32>(
- const TRasterPT<TPixel32> &raster, ImageMeshesReaderT<TPixel32> &reader);
-template void DVAPI readMeshes<TPixel64>(
- const TRasterPT<TPixel64> &raster, ImageMeshesReaderT<TPixel64> &reader);
+template void DVAPI readMeshes<TPixel32>(const TRasterPT<TPixel32> &raster,
+ ImageMeshesReaderT<TPixel32> &reader);
+template void DVAPI readMeshes<TPixel64>(const TRasterPT<TPixel64> &raster,
+ ImageMeshesReaderT<TPixel64> &reader);
template void DVAPI readMeshes<TPixelGR8>(
const TRasterPT<TPixelGR8> &raster, ImageMeshesReaderT<TPixelGR8> &reader);
-template void DVAPI readMeshes<TPixelGR16>(
- const TRasterPT<TPixelGR16> &raster,
- ImageMeshesReaderT<TPixelGR16> &reader);
-template void DVAPI readMeshes<TPixelCM32>(
- const TRasterPT<TPixelCM32> &raster,
- ImageMeshesReaderT<TPixelCM32> &reader);
+template void DVAPI
+readMeshes<TPixelGR16>(const TRasterPT<TPixelGR16> &raster,
+ ImageMeshesReaderT<TPixelGR16> &reader);
+template void DVAPI
+readMeshes<TPixelCM32>(const TRasterPT<TPixelCM32> &raster,
+ ImageMeshesReaderT<TPixelCM32> &reader);
//--------------------------------------------------------------------------------
@@ -323,6 +323,5 @@ void readMeshes(const TRasterPT<Pix> &raster, ImageMeshesReaderT<Pix> &reader) {
raster, reader.pixelSelector(), reader);
raster->unlock();
}
-
}
} // namespace TRop::borders
diff --git a/toonz/sources/common/tsound/tsound_nt.cpp b/toonz/sources/common/tsound/tsound_nt.cpp
index 94a18e366..2ff35fa3d 100644
--- a/toonz/sources/common/tsound/tsound_nt.cpp
+++ b/toonz/sources/common/tsound/tsound_nt.cpp
@@ -139,7 +139,7 @@ private:
//==============================================================================
static WAVEHDR *prepareWaveHeader(HWAVEOUT wout, const TSoundTrackP &subTrack,
- ULONG &count) {
+ ULONG &count) {
WAVEHDR *whdr = new WAVEHDR;
memset(whdr, 0, sizeof(WAVEHDR));
whdr->dwBufferLength = subTrack->getSampleSize() * subTrack->getSampleCount();
diff --git a/toonz/sources/common/tvrender/qtofflinegl.cpp b/toonz/sources/common/tvrender/qtofflinegl.cpp
index bc434e5ca..b11b351aa 100644
--- a/toonz/sources/common/tvrender/qtofflinegl.cpp
+++ b/toonz/sources/common/tvrender/qtofflinegl.cpp
@@ -6,7 +6,7 @@
//-----------------------------------------------------------------------------
-#if 0 // was _WIN32, this function not used
+#if 0 // was _WIN32, this function not used
static void swapRedBlueChannels(
void *buffer,
diff --git a/toonz/sources/common/twain/ttwain_win.c b/toonz/sources/common/twain/ttwain_win.c
index ec59606b7..62774397b 100644
--- a/toonz/sources/common/twain/ttwain_win.c
+++ b/toonz/sources/common/twain/ttwain_win.c
@@ -13,9 +13,9 @@ int TTWAIN_EnableWindow(void *hwnd, int flag) {
return TTWAIN_EnableWindowPD(hwnd, flag);
}
-//static void TTWAIN_EmptyMessageQueue(void) { TTWAIN_EmptyMessageQueuePD(); }
+// static void TTWAIN_EmptyMessageQueue(void) { TTWAIN_EmptyMessageQueuePD(); }
-//static void TTWAIN_ModalEventLoop(void) { TTWAIN_ModalEventLoopPD(); }
+// static void TTWAIN_ModalEventLoop(void) { TTWAIN_ModalEventLoopPD(); }
#ifdef __cplusplus
}
diff --git a/toonz/sources/image/avi/tiio_avi.cpp b/toonz/sources/image/avi/tiio_avi.cpp
index a43f423f8..04bcd670b 100644
--- a/toonz/sources/image/avi/tiio_avi.cpp
+++ b/toonz/sources/image/avi/tiio_avi.cpp
@@ -1061,9 +1061,11 @@ LRESULT safe_ICClose(HIC hic) {
}
#ifdef _MSC_VER
- typedef std::unique_ptr<std::remove_pointer_t<HIC>, decltype(&safe_ICClose)> hic_t;
+typedef std::unique_ptr<std::remove_pointer_t<HIC>, decltype(&safe_ICClose)>
+ hic_t;
#else
- typedef std::unique_ptr<std::remove_pointer<HIC>::type, decltype(&safe_ICClose)> hic_t;
+typedef std::unique_ptr<std::remove_pointer<HIC>::type, decltype(&safe_ICClose)>
+ hic_t;
#endif
hic_t safe_ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) {
diff --git a/toonz/sources/include/ext/plasticskeleton.h b/toonz/sources/include/ext/plasticskeleton.h
index 2e95de88a..e622e5dff 100644
--- a/toonz/sources/include/ext/plasticskeleton.h
+++ b/toonz/sources/include/ext/plasticskeleton.h
@@ -8,8 +8,8 @@
// TnzCore includes
#include "tsmartpointer.h"
#include "tpersist.h"
-#include "tmeshimage.h" // add imported template
- // instance tcg::Vertex<TPointD> (for Windows dll)
+#include "tmeshimage.h" // add imported template
+ // instance tcg::Vertex<TPointD> (for Windows dll)
// TnzExt includes
#include "plastichandle.h"
diff --git a/toonz/sources/include/orientation.h b/toonz/sources/include/orientation.h
index 56f6f04dc..d40c94991 100644
--- a/toonz/sources/include/orientation.h
+++ b/toonz/sources/include/orientation.h
@@ -76,12 +76,12 @@ enum class PredefinedRect {
FRAME_LABEL, //! area for writing frame number
FRAME_HEADER,
LAYER_HEADER,
- FOLDED_LAYER_HEADER, //! size of layer header when it is folded
- PLAY_RANGE, //! area for play range marker within frame header
- ONION, //! onion handle placement
- ONION_DOT, //! moveable dot placement
- ONION_DOT_FIXED, //! fixed dot placement
- ONION_AREA, //! area where mouse events will alter onion
+ FOLDED_LAYER_HEADER, //! size of layer header when it is folded
+ PLAY_RANGE, //! area for play range marker within frame header
+ ONION, //! onion handle placement
+ ONION_DOT, //! moveable dot placement
+ ONION_DOT_FIXED, //! fixed dot placement
+ ONION_AREA, //! area where mouse events will alter onion
ONION_FIXED_DOT_AREA,
ONION_DOT_AREA,
PINNED_CENTER_KEY, //! displays a small blue number
@@ -91,22 +91,22 @@ enum class PredefinedRect {
PREVIEW_LAYER_AREA, //! clickable area larger than preview icon, containing
//! it
PREVIEW_LAYER,
- LOCK_AREA, //! clickable area larger than lock icon, containing it
- LOCK, //! the lock icon itself
- DRAG_LAYER, //! draggable area in layer header
- LAYER_NAME, //! where to display column name. clicking will rename
+ LOCK_AREA, //! clickable area larger than lock icon, containing it
+ LOCK, //! the lock icon itself
+ DRAG_LAYER, //! draggable area in layer header
+ LAYER_NAME, //! where to display column name. clicking will rename
LAYER_NUMBER, //! where to display column number.
SOUND_ICON,
- VOLUME_TRACK, //! area where track is displayed
- VOLUME_AREA, //! active area for volume control
- LOOP_ICON, //! area for repeat animation icon
- LAYER_HEADER_PANEL, //! panel displaying headers for the layer rows in
- //! timeline mode
- THUMBNAIL_AREA, //! area for header thumbnails and other icons
- THUMBNAIL, //! the actual thumbnail, if there is one
- PEGBAR_NAME, //! where to display pegbar name
- PARENT_HANDLE_NAME, //! where to display parent handle number
- FILTER_COLOR //! where to show layer's filter color
+ VOLUME_TRACK, //! area where track is displayed
+ VOLUME_AREA, //! active area for volume control
+ LOOP_ICON, //! area for repeat animation icon
+ LAYER_HEADER_PANEL, //! panel displaying headers for the layer rows in
+ //! timeline mode
+ THUMBNAIL_AREA, //! area for header thumbnails and other icons
+ THUMBNAIL, //! the actual thumbnail, if there is one
+ PEGBAR_NAME, //! where to display pegbar name
+ PARENT_HANDLE_NAME, //! where to display parent handle number
+ FILTER_COLOR //! where to show layer's filter color
};
enum class PredefinedLine {
LOCKED, //! dotted vertical line when cell is locked
@@ -206,7 +206,7 @@ public:
return _ranges.at(which);
}
- virtual int cellWidth() const = 0;
+ virtual int cellWidth() const = 0;
virtual int cellHeight() const = 0;
protected:
diff --git a/toonz/sources/include/toonzqt/gutil.h b/toonz/sources/include/toonzqt/gutil.h
index 16d984d0b..c31733394 100644
--- a/toonz/sources/include/toonzqt/gutil.h
+++ b/toonz/sources/include/toonzqt/gutil.h
@@ -120,12 +120,8 @@ bool DVAPI acceptResourceOrFolderDrop(const QList<QUrl> &urls);
inline QPointF toQPointF(const TPointD &p) { return QPointF(p.x, p.y); }
inline QPointF toQPointF(const TPoint &p) { return QPointF(p.x, p.y); }
inline QPoint toQPoint(const TPoint &p) { return QPoint(p.x, p.y); }
-inline TPointD toTPointD(const QPointF &p) {
- return TPointD(p.x(), p.y());
-}
-inline TPointD toTPointD(const QPoint &p) {
- return TPointD(p.x(), p.y());
-}
+inline TPointD toTPointD(const QPointF &p) { return TPointD(p.x(), p.y()); }
+inline TPointD toTPointD(const QPoint &p) { return TPointD(p.x(), p.y()); }
inline TPoint toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); }
inline QRect toQRect(const TRect &r) {
diff --git a/toonz/sources/toonz/layerheaderpanel.cpp b/toonz/sources/toonz/layerheaderpanel.cpp
index f1f6f54fc..63cc931d8 100644
--- a/toonz/sources/toonz/layerheaderpanel.cpp
+++ b/toonz/sources/toonz/layerheaderpanel.cpp
@@ -64,7 +64,7 @@ void LayerHeaderPanel::paintEvent(QPaintEvent *event) {
QColor background = m_viewer->getBGColor();
QColor slightlyLighter = {mix(background, Qt::white, 0.95)};
- QRect rect = QRect(QPoint(0, 0), size());
+ QRect rect = QRect(QPoint(0, 0), size());
p.fillRect(rect.adjusted(0, 0, -3, 0), slightlyLighter);
drawIcon(p, PredefinedRect::EYE, XsheetGUI::PreviewVisibleColor,
@@ -77,14 +77,14 @@ void LayerHeaderPanel::paintEvent(QPaintEvent *event) {
QRect numberRect = o->rect(PredefinedRect::LAYER_NUMBER);
int leftadj = 2;
- if (Preferences::instance()->isShowColumnNumbersEnabled())
- {
- p.drawText(numberRect, Qt::AlignCenter | Qt::TextSingleLine, "#");
+ if (Preferences::instance()->isShowColumnNumbersEnabled()) {
+ p.drawText(numberRect, Qt::AlignCenter | Qt::TextSingleLine, "#");
- leftadj += 20;
+ leftadj += 20;
}
- QRect nameRect = o->rect(PredefinedRect::LAYER_NAME).adjusted(leftadj, 0, -1, 0);
+ QRect nameRect =
+ o->rect(PredefinedRect::LAYER_NAME).adjusted(leftadj, 0, -1, 0);
p.drawText(nameRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,
QObject::tr("Layer name"));
@@ -94,17 +94,16 @@ void LayerHeaderPanel::paintEvent(QPaintEvent *event) {
void LayerHeaderPanel::drawIcon(QPainter &p, PredefinedRect rect,
optional<QColor> fill,
const QPixmap &pixmap) const {
- QRect iconRect = Orientations::leftToRight()->rect(rect).adjusted(-2, 0,-2, 0);
-
- if (rect == PredefinedRect::LOCK)
- {
- p.setPen(Qt::gray);
- p.setBrush(QColor(255, 255, 255, 128));
- p.drawRect(iconRect);
- iconRect.adjust(1, 1, -1, -1);
- }
- else
- if (fill) p.fillRect(iconRect, *fill);
+ QRect iconRect =
+ Orientations::leftToRight()->rect(rect).adjusted(-2, 0, -2, 0);
+
+ if (rect == PredefinedRect::LOCK) {
+ p.setPen(Qt::gray);
+ p.setBrush(QColor(255, 255, 255, 128));
+ p.drawRect(iconRect);
+ iconRect.adjust(1, 1, -1, -1);
+ } else if (fill)
+ p.fillRect(iconRect, *fill);
p.drawPixmap(iconRect, pixmap);
}
@@ -115,10 +114,9 @@ void LayerHeaderPanel::drawLines(QPainter &p, const QRect &numberRect,
QLine line = {leftSide(shorter(numberRect)).translated(-2, 0)};
p.drawLine(line);
- if (Preferences::instance()->isShowColumnNumbersEnabled())
- {
- line = rightSide(shorter(numberRect)).translated(-2, 0);
- p.drawLine(line);
+ if (Preferences::instance()->isShowColumnNumbersEnabled()) {
+ line = rightSide(shorter(numberRect)).translated(-2, 0);
+ p.drawLine(line);
}
line = rightSide(shorter(nameRect));
@@ -136,105 +134,100 @@ void LayerHeaderPanel::showOrHide(const Orientation *o) {
//-----------------------------------------------------------------------------
void LayerHeaderPanel::mousePressEvent(QMouseEvent *event) {
- const Orientation *o = Orientations::leftToRight();
-
- m_doOnRelease = 0;
-
- if (event->button() == Qt::LeftButton) {
- // get mouse position
- QPoint pos = event->pos();
-
- // preview button
- if (o->rect(PredefinedRect::EYE_AREA).contains(pos)) {
- m_doOnRelease = ToggleAllPreviewVisible;
- }
- // camstand button
- else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(pos)) {
- m_doOnRelease = ToggleAllTransparency;
- }
- // lock button
- else if (o->rect(PredefinedRect::LOCK_AREA).contains(pos)) {
- m_doOnRelease = ToggleAllLock;
- }
- }
-
- update();
+ const Orientation *o = Orientations::leftToRight();
+
+ m_doOnRelease = 0;
+
+ if (event->button() == Qt::LeftButton) {
+ // get mouse position
+ QPoint pos = event->pos();
+
+ // preview button
+ if (o->rect(PredefinedRect::EYE_AREA).contains(pos)) {
+ m_doOnRelease = ToggleAllPreviewVisible;
+ }
+ // camstand button
+ else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(pos)) {
+ m_doOnRelease = ToggleAllTransparency;
+ }
+ // lock button
+ else if (o->rect(PredefinedRect::LOCK_AREA).contains(pos)) {
+ m_doOnRelease = ToggleAllLock;
+ }
+ }
+
+ update();
}
void LayerHeaderPanel::mouseMoveEvent(QMouseEvent *event) {
- const Orientation *o = Orientations::leftToRight();
-
- QPoint pos = event->pos();
-
- // preview button
- if (o->rect(PredefinedRect::EYE_AREA).contains(pos)) {
- m_tooltip = tr("Preview Visbility Toggle All");
- }
- // camstand button
- else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(pos)) {
- m_tooltip = tr("Camera Stand Visibility Toggle All");
- }
- // lock button
- else if (o->rect(PredefinedRect::LOCK).contains(pos)) {
- m_tooltip = tr("Lock Toggle All");
- }
- else {
- m_tooltip = tr("");
- }
-
- m_pos = pos;
-
- update();
+ const Orientation *o = Orientations::leftToRight();
+
+ QPoint pos = event->pos();
+
+ // preview button
+ if (o->rect(PredefinedRect::EYE_AREA).contains(pos)) {
+ m_tooltip = tr("Preview Visbility Toggle All");
+ }
+ // camstand button
+ else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(pos)) {
+ m_tooltip = tr("Camera Stand Visibility Toggle All");
+ }
+ // lock button
+ else if (o->rect(PredefinedRect::LOCK).contains(pos)) {
+ m_tooltip = tr("Lock Toggle All");
+ } else {
+ m_tooltip = tr("");
+ }
+
+ m_pos = pos;
+
+ update();
}
//-----------------------------------------------------------------------------
bool LayerHeaderPanel::event(QEvent *event) {
- if (event->type() == QEvent::ToolTip) {
- if (!m_tooltip.isEmpty())
- QToolTip::showText(mapToGlobal(m_pos), m_tooltip);
- else
- QToolTip::hideText();
- }
- return QWidget::event(event);
+ if (event->type() == QEvent::ToolTip) {
+ if (!m_tooltip.isEmpty())
+ QToolTip::showText(mapToGlobal(m_pos), m_tooltip);
+ else
+ QToolTip::hideText();
+ }
+ return QWidget::event(event);
}
//-----------------------------------------------------------------------------
void LayerHeaderPanel::mouseReleaseEvent(QMouseEvent *event) {
- TApp *app = TApp::instance();
- TXsheet *xsh = m_viewer->getXsheet();
- int col, totcols = xsh->getColumnCount();
- bool sound_changed = false;
-
- if (m_doOnRelease != 0 && totcols > 0)
- {
- for (col = 0; col < totcols; col++)
- {
- if (!xsh->isColumnEmpty(col)) {
- TXshColumn *column = xsh->getColumn(col);
-
- if (m_doOnRelease == ToggleAllPreviewVisible) {
- column->setPreviewVisible(!column->isPreviewVisible());
- }
- else if (m_doOnRelease == ToggleAllTransparency) {
- column->setCamstandVisible(!column->isCamstandVisible());
- if (column->getSoundColumn()) sound_changed = true;
- }
- else if (m_doOnRelease == ToggleAllLock) {
- column->lock(!column->isLocked());
- }
- }
- }
-
- if (sound_changed) {
- app->getCurrentXsheet()->notifyXsheetSoundChanged();
- }
-
- app->getCurrentScene()->notifySceneChanged();
- app->getCurrentXsheet()->notifyXsheetChanged();
- }
- m_viewer->updateColumnArea();
- update();
- m_doOnRelease = 0;
+ TApp *app = TApp::instance();
+ TXsheet *xsh = m_viewer->getXsheet();
+ int col, totcols = xsh->getColumnCount();
+ bool sound_changed = false;
+
+ if (m_doOnRelease != 0 && totcols > 0) {
+ for (col = 0; col < totcols; col++) {
+ if (!xsh->isColumnEmpty(col)) {
+ TXshColumn *column = xsh->getColumn(col);
+
+ if (m_doOnRelease == ToggleAllPreviewVisible) {
+ column->setPreviewVisible(!column->isPreviewVisible());
+ } else if (m_doOnRelease == ToggleAllTransparency) {
+ column->setCamstandVisible(!column->isCamstandVisible());
+ if (column->getSoundColumn()) sound_changed = true;
+ } else if (m_doOnRelease == ToggleAllLock) {
+ column->lock(!column->isLocked());
+ }
+ }
+ }
+
+ if (sound_changed) {
+ app->getCurrentXsheet()->notifyXsheetSoundChanged();
+ }
+
+ app->getCurrentScene()->notifySceneChanged();
+ app->getCurrentXsheet()->notifyXsheetChanged();
+ }
+ m_viewer->updateColumnArea();
+ update();
+ m_doOnRelease = 0;
}
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 39ec78f46..8e3195faf 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -1003,7 +1003,7 @@ void PreferencesPopup::onExpandFunctionHeaderClicked(bool checked) {
}
void PreferencesPopup::onShowColumnNumbersChanged(int index) {
- m_pref->enableShowColumnNumbers(index == Qt::Checked);
+ m_pref->enableShowColumnNumbers(index == Qt::Checked);
}
//-----------------------------------------------------------------------------
@@ -1228,7 +1228,8 @@ PreferencesPopup::PreferencesPopup()
tr("Expand Function Editor Header to Match XSheet Toolbar Height "
"(Requires Restart)"),
this);
- CheckBox *showColumnNumbersCB = new CheckBox(tr("Show Column Numbers in Column Headers"), this);
+ CheckBox *showColumnNumbersCB =
+ new CheckBox(tr("Show Column Numbers in Column Headers"), this);
//--- Animation ------------------------------
categoryList->addItem(tr("Animation"));
@@ -1961,8 +1962,8 @@ PreferencesPopup::PreferencesPopup()
m_showXSheetToolbar->setLayout(xSheetToolbarLay);
xsheetFrameLay->addWidget(m_showXSheetToolbar, 7, 0, 3, 3);
- xsheetFrameLay->addWidget(showColumnNumbersCB, 10, 0, 1, 2);
- }
+ xsheetFrameLay->addWidget(showColumnNumbersCB, 10, 0, 1, 2);
+ }
xsheetFrameLay->setColumnStretch(0, 0);
xsheetFrameLay->setColumnStretch(1, 0);
xsheetFrameLay->setColumnStretch(2, 1);
@@ -2312,8 +2313,8 @@ PreferencesPopup::PreferencesPopup()
ret = ret && connect(m_expandFunctionHeader, SIGNAL(clicked(bool)),
SLOT(onExpandFunctionHeaderClicked(bool)));
- ret = ret && connect(showColumnNumbersCB, SIGNAL(stateChanged(int)),
- this, SLOT(onShowColumnNumbersChanged(int)));
+ ret = ret && connect(showColumnNumbersCB, SIGNAL(stateChanged(int)), this,
+ SLOT(onShowColumnNumbersChanged(int)));
//--- Animation ----------------------
ret = ret && connect(m_keyframeType, SIGNAL(currentIndexChanged(int)),
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index 3ce32de11..c64c40cb2 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -549,8 +549,8 @@ void RenameCellField::showInRowCol(int row, int col, bool multiColumnSelected) {
TXshCell cell = xsh->getCell(row, col);
QPoint xy = m_viewer->positionToXY(CellPosition(row, col)) - QPoint(1, 2);
if (!cell.isEmpty()) {
- setFixedSize(o->cellWidth(), o->cellHeight() + 2);
- move(xy + QPoint(1, 1));
+ setFixedSize(o->cellWidth(), o->cellHeight() + 2);
+ move(xy + QPoint(1, 1));
TFrameId fid = cell.getFrameId();
std::wstring levelName = cell.m_level->getName();
@@ -580,8 +580,8 @@ void RenameCellField::showInRowCol(int row, int col, bool multiColumnSelected) {
}
// clear the field if the empty cell is clicked
else {
- setFixedSize(o->cellWidth(), o->cellHeight() + 2);
- move(xy + QPoint(1, 1));
+ setFixedSize(o->cellWidth(), o->cellHeight() + 2);
+ move(xy + QPoint(1, 1));
setText("");
}
@@ -770,31 +770,32 @@ void RenameCellField::keyPressEvent(QKeyEvent *event) {
case Qt::Key_Down:
case Qt::Key_Left:
case Qt::Key_Right:
- offset = m_viewer->orientation()->arrowShift(key);
- break;
+ offset = m_viewer->orientation()->arrowShift(key);
+ break;
default:
- QLineEdit::keyPressEvent(event);
- return;
- break;
+ QLineEdit::keyPressEvent(event);
+ return;
+ break;
}
if (isCtrlPressed &&
Preferences::instance()->isUseArrowKeyToShiftCellSelectionEnabled()) {
if (r0 == r1 && offset.frame() == -1) return;
if (c0 == c1 && offset.layer() == -1) return;
- cellSelection->selectCells(r0, c0, r1 + offset.frame(), c1 + offset.layer());
+ cellSelection->selectCells(r0, c0, r1 + offset.frame(),
+ c1 + offset.layer());
} else {
- CellPosition offset(offset * stride);
- int movedR0 = std::max(0, r0 + offset.frame());
- int movedC0 = std::max(0, c0 + offset.layer());
- int diffFrame = movedR0 - r0;
- int diffLayer = movedC0 - c0;
+ CellPosition offset(offset * stride);
+ int movedR0 = std::max(0, r0 + offset.frame());
+ int movedC0 = std::max(0, c0 + offset.layer());
+ int diffFrame = movedR0 - r0;
+ int diffLayer = movedC0 - c0;
// It needs to be discussed - I made not to rename cell with arrow key.
// 19/Jan/2017 shun-iwasawa
// renameCell();
- cellSelection->selectCells(r0 + diffFrame, c0 + diffLayer, r1 + diffFrame,
- c1 + diffLayer);
- showInRowCol(m_row + offset.frame(), m_col + offset.layer(), c1 - c0 > 0);
+ cellSelection->selectCells(r0 + diffFrame, c0 + diffLayer, r1 + diffFrame,
+ c1 + diffLayer);
+ showInRowCol(m_row + offset.frame(), m_col + offset.layer(), c1 - c0 > 0);
}
m_viewer->updateCells();
TApp::instance()->getCurrentSelection()->notifySelectionChanged();
@@ -942,20 +943,20 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) {
QLine verticalLine =
m_viewer->orientation()->verticalLine(layerAxis, frameSide);
p.drawLine(verticalLine);
- }
+ }
// for each frame
for (row = r0; row <= r1; row++) {
// draw horizontal lines
// hide top-most marker line
- QColor color = ((row - offset) % distance == 0 && row != 0)
- ? m_viewer->getMarkerLineColor()
- : m_viewer->getLightLineColor();
+ QColor color = ((row - offset) % distance == 0 && row != 0)
+ ? m_viewer->getMarkerLineColor()
+ : m_viewer->getLightLineColor();
p.setPen(color);
int frameAxis = m_viewer->rowToFrameAxis(row);
QLine horizontalLine =
- m_viewer->orientation()->horizontalLine(frameAxis, layerAxisRange);
+ m_viewer->orientation()->horizontalLine(frameAxis, layerAxisRange);
p.drawLine(horizontalLine);
if (!isColumn) continue;
@@ -1096,17 +1097,16 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col) {
const Orientation *o = m_viewer->orientation();
TXshSoundColumn *soundColumn =
m_viewer->getXsheet()->getColumn(col)->getSoundColumn();
- QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
- int x = xy.x();
- int y = xy.y();
- if (row == 0)
- {
- if (o->isVerticalTimeline())
- xy.setY(xy.y() + 1);
- else
- xy.setX(xy.x() + 1);
+ QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
+ int x = xy.x();
+ int y = xy.y();
+ if (row == 0) {
+ if (o->isVerticalTimeline())
+ xy.setY(xy.y() + 1);
+ else
+ xy.setX(xy.x() + 1);
}
- QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));
+ QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));
QRect rect = cellRect.adjusted(1, 1, 0, 0);
int maxNumFrame = soundColumn->getMaxFrame() + 1;
int startFrame = soundColumn->getFirstRow();
@@ -1182,7 +1182,7 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col) {
if (scrub && i % 2) {
p.setPen(m_viewer->getSoundColumnHlColor());
- QLine stroke = o->horizontalLine(i, previewBounds.adjusted(-1,-1));
+ QLine stroke = o->horizontalLine(i, previewBounds.adjusted(-1, -1));
p.drawLine(stroke);
} else if (i != begin || !isFirstRow) {
// preview tool on the right side
@@ -1282,15 +1282,14 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
TXshCell nextCell;
nextCell = xsh->getCell(row + 1, col); // cell in next frame
- QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
- int x = xy.x();
- int y = xy.y();
- if (row == 0)
- {
- if (o->isVerticalTimeline())
- xy.setY(xy.y() + 1);
- else
- xy.setX(xy.x() + 1);
+ QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
+ int x = xy.x();
+ int y = xy.y();
+ if (row == 0) {
+ if (o->isVerticalTimeline())
+ xy.setY(xy.y() + 1);
+ else
+ xy.setX(xy.x() + 1);
}
QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));
QRect rect = cellRect.adjusted(1, 1, 0, 0);
@@ -1332,14 +1331,14 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
if (yetToCleanupCell) // ORIENTATION: what's this?
{
- if (o->isVerticalTimeline())
- p.fillRect(
- rect.adjusted(rect.width() / 2, 0, 0, 0),
- (isSelected) ? SelectedFullcolorColumnColor : FullcolorColumnColor);
- else
- p.fillRect(
- rect.adjusted(0, rect.height() / 2, 0, 0),
- (isSelected) ? SelectedFullcolorColumnColor : FullcolorColumnColor);
+ if (o->isVerticalTimeline())
+ p.fillRect(
+ rect.adjusted(rect.width() / 2, 0, 0, 0),
+ (isSelected) ? SelectedFullcolorColumnColor : FullcolorColumnColor);
+ else
+ p.fillRect(
+ rect.adjusted(0, rect.height() / 2, 0, 0),
+ (isSelected) ? SelectedFullcolorColumnColor : FullcolorColumnColor);
}
bool isLastRow = nextCell.isEmpty() ||
@@ -1353,7 +1352,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
int distance, offset;
TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers(
distance, offset);
- bool isAfterMarkers = (row - offset) % distance == 0 && distance != 0 && row != 0;
+ bool isAfterMarkers =
+ (row - offset) % distance == 0 && distance != 0 && row != 0;
// draw marker interval
if (isAfterMarkers) {
@@ -1367,8 +1367,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
int r0, r1;
if (pegbar && pegbar->getKeyframeRange(r0, r1))
- nameRect =
- o->rect(PredefinedRect::CELL_NAME_WITH_KEYFRAME).translated(QPoint(x, y));
+ nameRect = o->rect(PredefinedRect::CELL_NAME_WITH_KEYFRAME)
+ .translated(QPoint(x, y));
}
// draw text in red if the file does not exist
@@ -1399,7 +1399,7 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
PredefinedLine which =
Preferences::instance()->isLevelNameOnEachMarkerEnabled()
? PredefinedLine::CONTINUE_LEVEL_WITH_NAME
- : PredefinedLine::CONTINUE_LEVEL;
+ : PredefinedLine::CONTINUE_LEVEL;
QLine continueLine = o->line(which).translated(xy);
p.drawLine(continueLine);
@@ -1419,7 +1419,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
if (fid.getNumber() > 0) frameNumber = std::to_string(fid.getNumber());
// add letter
if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter());
- p.drawText(nameRect, Qt::AlignRight | Qt::AlignBottom, QString::fromStdString(frameNumber));
+ p.drawText(nameRect, Qt::AlignRight | Qt::AlignBottom,
+ QString::fromStdString(frameNumber));
}
}
@@ -1443,37 +1444,36 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
const Orientation *o = m_viewer->orientation();
- TXsheet *xsh = m_viewer->getXsheet();
- TXshCell cell = xsh->getCell(row, col);
+ TXsheet *xsh = m_viewer->getXsheet();
+ TXshCell cell = xsh->getCell(row, col);
TXshCell prevCell;
- TCellSelection *cellSelection = m_viewer->getCellSelection();
+ TCellSelection *cellSelection = m_viewer->getCellSelection();
TColumnSelection *columnSelection = m_viewer->getColumnSelection();
- bool isSelected = cellSelection->isCellSelected(row, col) ||
- columnSelection->isColumnSelected(col);
+ bool isSelected = cellSelection->isCellSelected(row, col) ||
+ columnSelection->isColumnSelected(col);
- if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame
- // nothing to draw
+ if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame
+ // nothing to draw
if (cell.isEmpty() && prevCell.isEmpty()) return;
TXshCell nextCell;
nextCell = xsh->getCell(row + 1, col);
- QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
- int x = xy.x();
- int y = xy.y();
- if (row == 0)
- {
- if (o->isVerticalTimeline())
- xy.setY(xy.y() + 1);
- else
- xy.setX(xy.x() + 1);
+ QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
+ int x = xy.x();
+ int y = xy.y();
+ if (row == 0) {
+ if (o->isVerticalTimeline())
+ xy.setY(xy.y() + 1);
+ else
+ xy.setX(xy.x() + 1);
}
QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));
- QRect rect = cellRect.adjusted(1, 1, 0, 0);
- if (cell.isEmpty()) { // diagonal cross meaning end of level
- QColor levelEndColor = m_viewer->getTextColor();
- levelEndColor.setAlphaF(0.3);
- p.setPen(levelEndColor);
+ QRect rect = cellRect.adjusted(1, 1, 0, 0);
+ if (cell.isEmpty()) { // diagonal cross meaning end of level
+ QColor levelEndColor = m_viewer->getTextColor();
+ levelEndColor.setAlphaF(0.3);
+ p.setPen(levelEndColor);
p.drawLine(rect.topLeft(), rect.bottomRight());
p.drawLine(rect.topRight(), rect.bottomLeft());
return;
@@ -1482,7 +1482,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
int levelType;
QColor cellColor, sideColor;
m_viewer->getCellTypeAndColors(levelType, cellColor, sideColor, cell,
- isSelected);
+ isSelected);
// paint cell
p.fillRect(rect, QBrush(cellColor));
@@ -1490,7 +1490,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
drawDragHandle(p, xy, sideColor);
bool isLastRow = nextCell.isEmpty() ||
- cell.m_level.getPointer() != nextCell.m_level.getPointer();
+ cell.m_level.getPointer() != nextCell.m_level.getPointer();
drawEndOfDragHandle(p, isLastRow, xy, cellColor);
drawLockedDottedLine(p, xsh->getColumn(col)->isLocked(), xy, cellColor);
@@ -1498,13 +1498,14 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
int distance, offset;
TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers(
- distance, offset);
- bool isAfterMarkers = (row - offset) % distance == 0 && distance != 0 && row != 0;
+ distance, offset);
+ bool isAfterMarkers =
+ (row - offset) % distance == 0 && distance != 0 && row != 0;
// draw marker interval
if (isAfterMarkers) {
- p.setPen(m_viewer->getMarkerLineColor());
- p.drawLine(o->line(PredefinedLine::SEE_MARKER_THROUGH).translated(xy));
+ p.setPen(m_viewer->getMarkerLineColor());
+ p.drawLine(o->line(PredefinedLine::SEE_MARKER_THROUGH).translated(xy));
}
p.setPen(Qt::black);
@@ -1523,16 +1524,17 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
// if the same level & same fId with the previous cell,
// draw continue line
if (sameLevel && prevCell.m_frameId == cell.m_frameId) {
- // not on line marker
- PredefinedLine which =
- Preferences::instance()->isLevelNameOnEachMarkerEnabled()
- ? PredefinedLine::CONTINUE_LEVEL_WITH_NAME
- : PredefinedLine::CONTINUE_LEVEL;
- QLine continueLine = o->line(which).translated(xy);
- p.drawLine(continueLine);
+ // not on line marker
+ PredefinedLine which =
+ Preferences::instance()->isLevelNameOnEachMarkerEnabled()
+ ? PredefinedLine::CONTINUE_LEVEL_WITH_NAME
+ : PredefinedLine::CONTINUE_LEVEL;
+ QLine continueLine = o->line(which).translated(xy);
+ p.drawLine(continueLine);
}
- QString text = cell.getSoundTextLevel()->getFrameText(cell.m_frameId.getNumber() - 1);
+ QString text =
+ cell.getSoundTextLevel()->getFrameText(cell.m_frameId.getNumber() - 1);
#if QT_VERSION >= 0x050500
QFontMetrics metric(font);
@@ -1542,7 +1544,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
#endif
if (!sameLevel || prevCell.m_frameId != cell.m_frameId)
- p.drawText(nameRect, Qt::AlignLeft | Qt::AlignBottom, elidaName);
+ p.drawText(nameRect, Qt::AlignLeft | Qt::AlignBottom, elidaName);
}
//-----------------------------------------------------------------------------
@@ -1562,15 +1564,14 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
TXshCell nextCell = xsh->getCell(row + 1, col);
if (cell.isEmpty() && prevCell.isEmpty()) return;
- QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
- int x = xy.x();
- int y = xy.y();
- if (row == 0)
- {
- if (o->isVerticalTimeline())
- xy.setY(xy.y() + 1);
- else
- xy.setX(xy.x() + 1);
+ QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
+ int x = xy.x();
+ int y = xy.y();
+ if (row == 0) {
+ if (o->isVerticalTimeline())
+ xy.setY(xy.y() + 1);
+ else
+ xy.setX(xy.x() + 1);
}
QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));
QRect rect = cellRect.adjusted(1, 1, 0, 0);
@@ -1631,15 +1632,16 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
if (fid.getNumber() > 0) frameNumber = std::to_string(fid.getNumber());
if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter());
- QRect nameRect = o->rect(PredefinedRect::CELL_NAME).translated(QPoint(x, y));
+ QRect nameRect =
+ o->rect(PredefinedRect::CELL_NAME).translated(QPoint(x, y));
- if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled()) {
- TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
- int r0, r1;
- if (pegbar && pegbar->getKeyframeRange(r0, r1))
- nameRect =
- o->rect(PredefinedRect::CELL_NAME_WITH_KEYFRAME).translated(QPoint(x, y));
- }
+ if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled()) {
+ TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
+ int r0, r1;
+ if (pegbar && pegbar->getKeyframeRange(r0, r1))
+ nameRect = o->rect(PredefinedRect::CELL_NAME_WITH_KEYFRAME)
+ .translated(QPoint(x, y));
+ }
bool isRed = false;
TXshPaletteLevel *pl = cell.getPaletteLevel();
@@ -1661,21 +1663,20 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
// e' diverso dal precedente
QString numberStr;
if (!sameLevel || prevCell.m_frameId != cell.m_frameId) {
- // convert the last one digit of the frame number to alphabet
- // Ex. 12 -> 1B 21 -> 2A 30 -> 3
- if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) {
- numberStr = m_viewer->getFrameNumberWithLetters(fid.getNumber());
- p.drawText(nameRect, Qt::AlignRight | Qt::AlignBottom, numberStr);
- }
- else {
- std::string frameNumber("");
- // set number
- if (fid.getNumber() > 0) frameNumber = std::to_string(fid.getNumber());
- // add letter
- if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter());
- numberStr = QString::fromStdString(frameNumber);
- p.drawText(nameRect, Qt::AlignRight | Qt::AlignBottom, numberStr);
- }
+ // convert the last one digit of the frame number to alphabet
+ // Ex. 12 -> 1B 21 -> 2A 30 -> 3
+ if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) {
+ numberStr = m_viewer->getFrameNumberWithLetters(fid.getNumber());
+ p.drawText(nameRect, Qt::AlignRight | Qt::AlignBottom, numberStr);
+ } else {
+ std::string frameNumber("");
+ // set number
+ if (fid.getNumber() > 0) frameNumber = std::to_string(fid.getNumber());
+ // add letter
+ if (fid.getLetter() != 0) frameNumber.append(1, fid.getLetter());
+ numberStr = QString::fromStdString(frameNumber);
+ p.drawText(nameRect, Qt::AlignRight | Qt::AlignBottom, numberStr);
+ }
}
QString text = QString::fromStdWString(levelName);
@@ -2039,8 +2040,8 @@ void CellArea::mousePressEvent(QMouseEvent *event) {
row <= k1 + 1;
bool isKeyFrameArea =
isKeyframeFrame &&
- o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell)
- && row < k1 + 1;
+ o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell) &&
+ row < k1 + 1;
bool accept = false;
if (isKeyFrameArea) { // They are in the keyframe selection
@@ -2185,13 +2186,13 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {
TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
int k0, k1;
- bool isKeyframeFrame =
- Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled() &&
- pegbar && pegbar->getKeyframeRange(k0, k1) && k0 <= row && row <= k1 + 1;
+ bool isKeyframeFrame =
+ Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled() &&
+ pegbar && pegbar->getKeyframeRange(k0, k1) && k0 <= row && row <= k1 + 1;
bool isKeyFrameArea =
- isKeyframeFrame &&
- o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell)
- && row < k1 + 1;
+ isKeyframeFrame &&
+ o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell) &&
+ row < k1 + 1;
if (isKeyFrameArea) {
if (pegbar->isKeyframe(row)) // key frame
@@ -2214,7 +2215,8 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {
o->rect(PredefinedRect::LOOP_ICON)
.contains(mouseInCell)) // cycle toggle of key frames
m_tooltip = tr("Set the cycle of previous keyframes");
- else if ((!xsh->getCell(row, col).isEmpty()) && o->rect(PredefinedRect::DRAG_AREA).contains(mouseInCell))
+ else if ((!xsh->getCell(row, col).isEmpty()) &&
+ o->rect(PredefinedRect::DRAG_AREA).contains(mouseInCell))
m_tooltip = tr("Click and drag to move the selection");
else if (isZeraryColumn)
m_tooltip = QString::fromStdWString(column->getZeraryFxColumn()
@@ -2245,16 +2247,17 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {
: QString::fromStdWString(levelName) + QString(" ") +
QString::fromStdString(frameNumber));
}
- } else if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK).contains(mouseInCell))
+ } else if (isSoundColumn &&
+ o->rect(PredefinedRect::PREVIEW_TRACK).contains(mouseInCell))
m_tooltip = tr("Click and drag to play");
else if (m_levelExtenderRect.contains(pos))
m_tooltip = tr("Click and drag to repeat selected cells");
else if (isSoundColumn && rectContainsPos(m_soundLevelModifyRects, pos)) {
- if (o->isVerticalTimeline())
- setCursor(Qt::SplitVCursor);
- else
- setCursor(Qt::SplitHCursor);
- m_tooltip = tr("");
+ if (o->isVerticalTimeline())
+ setCursor(Qt::SplitVCursor);
+ else
+ setCursor(Qt::SplitHCursor);
+ m_tooltip = tr("");
} else
m_tooltip = tr("");
}
@@ -2301,17 +2304,17 @@ void CellArea::mouseDoubleClickEvent(QMouseEvent *event) {
oh->setObjectId(m_viewer->getObjectId(col));
if (Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled()) {
- QPoint cellTopLeft = m_viewer->positionToXY(CellPosition(row, col));
- QPoint mouseInCell = event->pos() - cellTopLeft;
- TXsheet *xsh = m_viewer->getXsheet();
- TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
- int k0, k1;
- bool isKeyframeFrame =
- pegbar && pegbar->getKeyframeRange(k0, k1) && k0 <= row && row <= k1 + 1;
- bool isKeyFrameArea =
- isKeyframeFrame &&
- o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell)
- && row < k1 + 1;
+ QPoint cellTopLeft = m_viewer->positionToXY(CellPosition(row, col));
+ QPoint mouseInCell = event->pos() - cellTopLeft;
+ TXsheet *xsh = m_viewer->getXsheet();
+ TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col));
+ int k0, k1;
+ bool isKeyframeFrame = pegbar && pegbar->getKeyframeRange(k0, k1) &&
+ k0 <= row && row <= k1 + 1;
+ bool isKeyFrameArea =
+ isKeyframeFrame &&
+ o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell) &&
+ row < k1 + 1;
// If you are in the keyframe area, open a function editor
if (isKeyFrameArea) {
@@ -2372,16 +2375,15 @@ void CellArea::contextMenuEvent(QContextMenuEvent *event) {
QPoint cellTopLeft = m_viewer->positionToXY(CellPosition(row, col));
QPoint mouseInCell = event->pos() - cellTopLeft;
- bool isKeyframeFrame =
- Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled() &&
- pegbar && pegbar->getKeyframeRange(k0, k1) &&
- k0 <= row && row <= k1 + 1;
+ bool isKeyframeFrame =
+ Preferences::instance()->isShowKeyframesOnXsheetCellAreaEnabled() &&
+ pegbar && pegbar->getKeyframeRange(k0, k1) && k0 <= row && row <= k1 + 1;
bool isKeyFrameArea =
- isKeyframeFrame &&
- o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell)
- && row < k1 + 1;
+ isKeyframeFrame &&
+ o->rect(PredefinedRect::KEYFRAME_AREA).contains(mouseInCell) &&
+ row < k1 + 1;
- if (isKeyFrameArea) {
+ if (isKeyFrameArea) {
TStageObjectId objectId;
if (col < 0)
objectId = TStageObjectId::CameraId(0);
diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp
index dc30cf43b..30f064d99 100644
--- a/toonz/sources/toonz/xshcolumnviewer.cpp
+++ b/toonz/sources/toonz/xshcolumnviewer.cpp
@@ -521,8 +521,8 @@ void RenameColumnField::focusOutEvent(QFocusEvent *e) {
//-----------------------------------------------------------------------------
void ColumnArea::onControlPressed(bool pressed) {
- isCtrlPressed = pressed;
- update();
+ isCtrlPressed = pressed;
+ update();
}
const bool ColumnArea::isControlPressed() { return isCtrlPressed; }
@@ -671,7 +671,9 @@ void ColumnArea::DrawHeader::drawBaseFill(const QColor &columnColor,
void ColumnArea::DrawHeader::drawEye() const {
if (col < 0 || isEmpty) return;
- if (!column->isPreviewVisible() || column->getPaletteColumn() || column->getSoundTextColumn()) return;
+ if (!column->isPreviewVisible() || column->getPaletteColumn() ||
+ column->getSoundTextColumn())
+ return;
QRect prevViewRect = o->rect(PredefinedRect::EYE_AREA).translated(orig);
QRect eyeRect = o->rect(PredefinedRect::EYE).translated(orig);
@@ -683,10 +685,12 @@ void ColumnArea::DrawHeader::drawEye() const {
void ColumnArea::DrawHeader::drawPreviewToggle(int opacity) const {
if (col < 0 || isEmpty) return;
// camstand visible toggle
- if (!column->isCamstandVisible() || column->getPaletteColumn() || column->getSoundTextColumn()) return;
+ if (!column->isCamstandVisible() || column->getPaletteColumn() ||
+ column->getSoundTextColumn())
+ return;
QRect tableViewRect =
- o->rect(PredefinedRect::PREVIEW_LAYER_AREA).translated(orig);
+ o->rect(PredefinedRect::PREVIEW_LAYER_AREA).translated(orig);
QRect tableViewImgRect =
o->rect(PredefinedRect::PREVIEW_LAYER).translated(orig);
@@ -699,7 +703,7 @@ void ColumnArea::DrawHeader::drawPreviewToggle(int opacity) const {
void ColumnArea::DrawHeader::drawLock() const {
if (col < 0 || isEmpty) return;
- QRect lockModeRect = o->rect(PredefinedRect::LOCK_AREA).translated(orig);
+ QRect lockModeRect = o->rect(PredefinedRect::LOCK_AREA).translated(orig);
QRect lockModeImgRect = o->rect(PredefinedRect::LOCK).translated(orig);
// lock button
@@ -713,13 +717,15 @@ void ColumnArea::DrawHeader::drawLock() const {
void ColumnArea::DrawHeader::drawColumnNumber() const {
if (o->isVerticalTimeline()) return;
- if (col < 0 || isEmpty || !Preferences::instance()->isShowColumnNumbersEnabled()) return;
+ if (col < 0 || isEmpty ||
+ !Preferences::instance()->isShowColumnNumbersEnabled())
+ return;
if (!isEmpty)
- p.setPen((isCurrent) ? Qt::red : Qt::black);
+ p.setPen((isCurrent) ? Qt::red : Qt::black);
else
- p.setPen((isCurrent) ? m_viewer->getSelectedColumnTextColor()
- : m_viewer->getTextColor());
+ p.setPen((isCurrent) ? m_viewer->getSelectedColumnTextColor()
+ : m_viewer->getTextColor());
QRect pos = o->rect(PredefinedRect::LAYER_NUMBER).translated(orig);
if (pos.isEmpty()) return;
@@ -735,162 +741,170 @@ void ColumnArea::DrawHeader::drawColumnName() const {
std::string name(columnObject->getName());
if (col < 0) name = std::string("Camera");
- //ZeraryFx columns store name elsewhere
+ // ZeraryFx columns store name elsewhere
TXshZeraryFxColumn *zColumn = dynamic_cast<TXshZeraryFxColumn *>(column);
if (zColumn)
- name = ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName());
+ name = ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName());
QRect columnName = o->rect(PredefinedRect::LAYER_NAME).translated(orig);
int rightadj = -2;
- int leftadj = 3;
+ int leftadj = 3;
+
+ if (!isEmpty) {
+ if (Preferences::instance()->isShowColumnNumbersEnabled()) {
+ if (o->isVerticalTimeline())
+ rightadj = -20;
+ else
+ leftadj = 24;
+ }
- if (!isEmpty)
- {
- if (Preferences::instance()->isShowColumnNumbersEnabled())
- {
- if (o->isVerticalTimeline())
- rightadj = -20;
- else
- leftadj = 24;
- }
-
- if (!o->isVerticalTimeline())
- {
- if (column->getSoundColumn())
- rightadj -= 97;
- else if (column->getFilterColorId())
- rightadj -= 15;
- }
-
- p.setPen((isCurrent) ? Qt::red : Qt::black);
- }
- else
+ if (!o->isVerticalTimeline()) {
+ if (column->getSoundColumn())
+ rightadj -= 97;
+ else if (column->getFilterColorId())
+ rightadj -= 15;
+ }
+
+ p.setPen((isCurrent) ? Qt::red : Qt::black);
+ } else
p.setPen((isCurrent) ? m_viewer->getSelectedColumnTextColor()
: m_viewer->getTextColor());
- if(o->isVerticalTimeline())
- p.drawText(columnName.adjusted(leftadj, 0, rightadj, 0), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,
- QString(name.c_str()));
+ if (o->isVerticalTimeline())
+ p.drawText(columnName.adjusted(leftadj, 0, rightadj, 0),
+ Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,
+ QString(name.c_str()));
else
- p.drawText(columnName.adjusted(leftadj, 0, rightadj, 0), Qt::AlignLeft | Qt::AlignBottom | Qt::TextSingleLine,
- QString(name.c_str()));
-
+ p.drawText(columnName.adjusted(leftadj, 0, rightadj, 0),
+ Qt::AlignLeft | Qt::AlignBottom | Qt::TextSingleLine,
+ QString(name.c_str()));
}
void ColumnArea::DrawHeader::drawThumbnail(QPixmap &iconPixmap) const {
- if (col < 0 || isEmpty) return;
-
- QRect thumbnailRect = o->rect(PredefinedRect::THUMBNAIL_AREA).translated(orig);
-
- // sound thumbnail
- if (column->getSoundColumn())
- {
- TXshSoundColumn *sc = xsh->getColumn(col) ? xsh->getColumn(col)->getSoundColumn() : 0;
-
- drawSoundIcon(sc->isPlaying());
- drawVolumeControl(sc->getVolume());
- return;
- }
-
- if (!o->isVerticalTimeline()) return;
-
- QRect thumbnailImageRect = o->rect(PredefinedRect::THUMBNAIL).translated(orig);
-
- // pallete thumbnail
- if (column->getPaletteColumn())
- {
- p.drawPixmap(thumbnailImageRect, iconPixmap);
- return;
- }
-
- // soundtext thumbnail
- if (column->getSoundTextColumn())
- {
- p.drawPixmap(thumbnailImageRect, iconPixmap);
- return;
- }
-
- // All other thumbnails
- p.setPen(m_viewer->getTextColor());
-
- // for zerary fx, display fxId here instead of thumbnail
- TXshZeraryFxColumn *zColumn = dynamic_cast<TXshZeraryFxColumn *>(column);
- if (zColumn) {
- QFont lastfont = p.font();
- QFont font("Verdana", 8);
- p.setFont(font);
-
- TFx *fx = zColumn->getZeraryColumnFx()->getZeraryFx();
- QString fxName = QString::fromStdWString(fx->getFxId());
- p.drawText(thumbnailImageRect, Qt::TextWrapAnywhere | Qt::TextWordWrap, fxName);
- p.setFont(lastfont);
- }
- else {
- TXshLevelColumn *levelColumn = column->getLevelColumn();
-
- if (levelColumn &&
- Preferences::instance()->getColumnIconLoadingPolicy() ==
- Preferences::LoadOnDemand &&
- !levelColumn->isIconVisible()) {
- // display nothing
- }
- else {
- if (!iconPixmap.isNull()) {
- p.drawPixmap(thumbnailImageRect, iconPixmap);
- }
- // notify that the column icon is already shown
- if (levelColumn) levelColumn->setIconVisible(true);
- }
- }
+ if (col < 0 || isEmpty) return;
+
+ QRect thumbnailRect =
+ o->rect(PredefinedRect::THUMBNAIL_AREA).translated(orig);
+
+ // sound thumbnail
+ if (column->getSoundColumn()) {
+ TXshSoundColumn *sc =
+ xsh->getColumn(col) ? xsh->getColumn(col)->getSoundColumn() : 0;
+
+ drawSoundIcon(sc->isPlaying());
+ drawVolumeControl(sc->getVolume());
+ return;
+ }
+
+ if (!o->isVerticalTimeline()) return;
+
+ QRect thumbnailImageRect =
+ o->rect(PredefinedRect::THUMBNAIL).translated(orig);
+
+ // pallete thumbnail
+ if (column->getPaletteColumn()) {
+ p.drawPixmap(thumbnailImageRect, iconPixmap);
+ return;
+ }
+
+ // soundtext thumbnail
+ if (column->getSoundTextColumn()) {
+ p.drawPixmap(thumbnailImageRect, iconPixmap);
+ return;
+ }
+
+ // All other thumbnails
+ p.setPen(m_viewer->getTextColor());
+
+ // for zerary fx, display fxId here instead of thumbnail
+ TXshZeraryFxColumn *zColumn = dynamic_cast<TXshZeraryFxColumn *>(column);
+ if (zColumn) {
+ QFont lastfont = p.font();
+ QFont font("Verdana", 8);
+ p.setFont(font);
+
+ TFx *fx = zColumn->getZeraryColumnFx()->getZeraryFx();
+ QString fxName = QString::fromStdWString(fx->getFxId());
+ p.drawText(thumbnailImageRect, Qt::TextWrapAnywhere | Qt::TextWordWrap,
+ fxName);
+ p.setFont(lastfont);
+ } else {
+ TXshLevelColumn *levelColumn = column->getLevelColumn();
+
+ if (levelColumn &&
+ Preferences::instance()->getColumnIconLoadingPolicy() ==
+ Preferences::LoadOnDemand &&
+ !levelColumn->isIconVisible()) {
+ // display nothing
+ } else {
+ if (!iconPixmap.isNull()) {
+ p.drawPixmap(thumbnailImageRect, iconPixmap);
+ }
+ // notify that the column icon is already shown
+ if (levelColumn) levelColumn->setIconVisible(true);
+ }
+ }
}
void ColumnArea::DrawHeader::drawPegbarName() const {
- if (col < 0 || isEmpty || !o->isVerticalTimeline()) return;
+ if (col < 0 || isEmpty || !o->isVerticalTimeline()) return;
- TStageObjectId columnId = m_viewer->getObjectId(col);
- TStageObjectId parentId = xsh->getStageObjectParent(columnId);
+ TStageObjectId columnId = m_viewer->getObjectId(col);
+ TStageObjectId parentId = xsh->getStageObjectParent(columnId);
- // pegbar name
- QRect pegbarnamerect = o->rect(PredefinedRect::PEGBAR_NAME).translated(orig);
+ // pegbar name
+ QRect pegbarnamerect = o->rect(PredefinedRect::PEGBAR_NAME).translated(orig);
- if (column->getSoundColumn() || column->getSoundTextColumn() || column->getPaletteColumn()) return;
+ if (column->getSoundColumn() || column->getSoundTextColumn() ||
+ column->getPaletteColumn())
+ return;
- p.setPen(m_viewer->getTextColor());
+ p.setPen(m_viewer->getTextColor());
- p.drawText(pegbarnamerect.adjusted(3, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,
- QString(parentId.toString().c_str()));
+ p.drawText(pegbarnamerect.adjusted(3, 0, 0, 0),
+ Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,
+ QString(parentId.toString().c_str()));
}
void ColumnArea::DrawHeader::drawParentHandleName() const {
- if (col < 0 || isEmpty || !o->isVerticalTimeline()
- || column->getSoundColumn() || column->getSoundTextColumn() || column->getPaletteColumn()) return;
+ if (col < 0 || isEmpty || !o->isVerticalTimeline() ||
+ column->getSoundColumn() || column->getSoundTextColumn() ||
+ column->getPaletteColumn())
+ return;
- QRect parenthandleRect = o->rect(PredefinedRect::PARENT_HANDLE_NAME).translated(orig);
+ QRect parenthandleRect =
+ o->rect(PredefinedRect::PARENT_HANDLE_NAME).translated(orig);
- TStageObjectId columnId = m_viewer->getObjectId(col);
- TStageObjectId parentId = xsh->getStageObjectParent(columnId);
+ TStageObjectId columnId = m_viewer->getObjectId(col);
+ TStageObjectId parentId = xsh->getStageObjectParent(columnId);
- p.setPen(m_viewer->getTextColor());
+ p.setPen(m_viewer->getTextColor());
- std::string handle = xsh->getStageObject(columnId)->getParentHandle();
- if (handle[0] == 'H' && handle.length() > 1) handle = handle.substr(1);
- if (parentId != TStageObjectId::TableId)
- p.drawText(parenthandleRect, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine, QString::fromStdString(handle));
+ std::string handle = xsh->getStageObject(columnId)->getParentHandle();
+ if (handle[0] == 'H' && handle.length() > 1) handle = handle.substr(1);
+ if (parentId != TStageObjectId::TableId)
+ p.drawText(parenthandleRect,
+ Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine,
+ QString::fromStdString(handle));
}
void ColumnArea::DrawHeader::drawFilterColor() const {
- if (col < 0 || isEmpty || !column->getFilterColorId()
- || column->getSoundColumn() || column->getSoundTextColumn() || column->getPaletteColumn()) return;
+ if (col < 0 || isEmpty || !column->getFilterColorId() ||
+ column->getSoundColumn() || column->getSoundTextColumn() ||
+ column->getPaletteColumn())
+ return;
- QRect filterColorRect = o->rect(PredefinedRect::FILTER_COLOR).translated(orig);
- p.drawPixmap(filterColorRect, getColorChipIcon(column->getFilterColorId()).pixmap(12, 12));
+ QRect filterColorRect =
+ o->rect(PredefinedRect::FILTER_COLOR).translated(orig);
+ p.drawPixmap(filterColorRect,
+ getColorChipIcon(column->getFilterColorId()).pixmap(12, 12));
}
void ColumnArea::DrawHeader::drawSoundIcon(bool isPlaying) const {
- QRect rect = m_viewer->orientation()
- ->rect(PredefinedRect::SOUND_ICON)
- .translated(orig);
+ QRect rect = m_viewer->orientation()
+ ->rect(PredefinedRect::SOUND_ICON)
+ .translated(orig);
p.drawPixmap(rect, isPlaying ? Pixmaps::soundPlaying() : Pixmaps::sound());
}
@@ -902,28 +916,27 @@ void ColumnArea::DrawHeader::drawVolumeControl(double volume) const {
int layerAxis = o->layerAxis(divisionsTopLeft);
int frameAxis = o->frameAxis(divisionsTopLeft);
if (o->isVerticalTimeline()) {
- for (int i = 0; i <= 20; i++, frameAxis += 3)
- if ((i % 10) == 0)
- p.drawLine(
- o->horizontalLine(frameAxis, NumberRange(layerAxis - 3, layerAxis)));
- else if (i & 1)
- p.drawLine(
- o->horizontalLine(frameAxis, NumberRange(layerAxis, layerAxis)));
- else
- p.drawLine(
- o->horizontalLine(frameAxis, NumberRange(layerAxis - 2, layerAxis)));
- }
- else {
- for (int i = 0; i <= 20; i++, frameAxis += 3)
- if ((i % 10) == 0)
- p.drawLine(
- o->horizontalLine(frameAxis, NumberRange(layerAxis, layerAxis + 3)));
- else if (i & 1)
- p.drawLine(
- o->horizontalLine(frameAxis, NumberRange(layerAxis, layerAxis)));
- else
- p.drawLine(
- o->horizontalLine(frameAxis, NumberRange(layerAxis, layerAxis + 2)));
+ for (int i = 0; i <= 20; i++, frameAxis += 3)
+ if ((i % 10) == 0)
+ p.drawLine(o->horizontalLine(frameAxis,
+ NumberRange(layerAxis - 3, layerAxis)));
+ else if (i & 1)
+ p.drawLine(
+ o->horizontalLine(frameAxis, NumberRange(layerAxis, layerAxis)));
+ else
+ p.drawLine(o->horizontalLine(frameAxis,
+ NumberRange(layerAxis - 2, layerAxis)));
+ } else {
+ for (int i = 0; i <= 20; i++, frameAxis += 3)
+ if ((i % 10) == 0)
+ p.drawLine(o->horizontalLine(frameAxis,
+ NumberRange(layerAxis, layerAxis + 3)));
+ else if (i & 1)
+ p.drawLine(
+ o->horizontalLine(frameAxis, NumberRange(layerAxis, layerAxis)));
+ else
+ p.drawLine(o->horizontalLine(frameAxis,
+ NumberRange(layerAxis, layerAxis + 2)));
}
// slider track
@@ -1010,85 +1023,90 @@ void ColumnArea::setDragTool(DragTool *dragTool) {
//-----------------------------------------------------------------------------
void ColumnArea::drawFoldedColumnHead(QPainter &p, int col) {
- const Orientation *o = m_viewer->orientation();
-
- QPoint orig = m_viewer->positionToXY(CellPosition(0, col));
- QRect rect = o->rect(PredefinedRect::FOLDED_LAYER_HEADER).translated(orig);
-
- int x0, y0, x, y;
-
- if (o->isVerticalTimeline())
- {
- x0 = rect.topLeft().x() + 1;
- y0 = 0;
-
- p.setPen(m_viewer->getDarkLineColor());
- p.fillRect(x0 , y0 + 1, rect.width(), 18, QBrush(m_viewer->getDarkBGColor()));
- p.fillRect(x0 , y0 + 17, 2, rect.height() - 34, QBrush(m_viewer->getLightLightBGColor()));
- p.fillRect(x0 + 3, y0 + 20, 2, rect.height() - 36, QBrush(m_viewer->getLightLightBGColor()));
- p.fillRect(x0 + 6, y0 + 17, 2, rect.height() - 34, QBrush(m_viewer->getLightLightBGColor()));
-
- p.setPen(Qt::black);
- p.drawLine(x0 - 1, y0 + 17, x0 - 1, rect.height());
- p.setPen(m_viewer->getDarkLineColor());
- p.drawLine(x0 + 2, y0 + 17, x0 + 2, rect.height());
- p.drawLine(x0 + 5, y0 + 17, x0 + 5, rect.height());
- p.drawLine(x0 , y0 + 17, x0 + 1, 17);
- p.drawLine(x0 + 3, y0 + 20, x0 + 4, 20);
- p.drawLine(x0 + 6, y0 + 17, x0 + 7, 17);
-
- // triangolini
- p.setPen(Qt::black);
- x = x0;
- y = 12;
- p.drawPoint(QPointF(x, y));
- x++;
- p.drawLine(x, y - 1, x, y + 1);
- x++;
- p.drawLine(x, y - 2, x, y + 2);
- x += 3;
- p.drawLine(x, y - 2, x, y + 2);
- x++;
- p.drawLine(x, y - 1, x, y + 1);
- x++;
- p.drawPoint(x, y);
- }
- else
- {
- x0 = 0;
- y0 = rect.topLeft().y() + 1;
-
- p.setPen(m_viewer->getDarkLineColor());
- p.fillRect( x0 + 1, y0, 18, rect.height(), QBrush(m_viewer->getDarkBGColor()));
- p.fillRect(x0 + 17, y0, rect.width() - 34, 2, QBrush(m_viewer->getLightLightBGColor()));
- p.fillRect(x0 + 20, y0 + 3, rect.width() - 36, 2, QBrush(m_viewer->getLightLightBGColor()));
- p.fillRect(x0 + 17, y0 + 6, rect.width() - 34, 2, QBrush(m_viewer->getLightLightBGColor()));
-
- p.setPen(Qt::black);
- p.drawLine(x0 + 17, y0 - 1, rect.width(), y0 - 1);
- p.setPen(m_viewer->getDarkLineColor());
- p.drawLine(x0 + 17, y0 + 2, rect.width(), y0 + 2);
- p.drawLine(x0 + 17, y0 + 5, rect.width(), y0 + 5);
- p.drawLine(x0 + 17, y0, 17, y0 + 1);
- p.drawLine(x0 + 20, y0 + 3, 20, y0 + 4);
- p.drawLine(x0 + 17, y0 + 6, 17, y0 + 7);
-
- // triangolini
- p.setPen(Qt::black);
- x = 12;
- y = y0;
- p.drawPoint(QPointF(x, y));
- y++;
- p.drawLine(x - 1, y, x + 1, y);
- y++;
- p.drawLine(x - 2, y, x + 2, y);
- y += 3;
- p.drawLine(x - 2, y, x + 2, y);
- y++;
- p.drawLine(x - 1, y, x + 1, y);
- y++;
- p.drawPoint(x, y);
- }
+ const Orientation *o = m_viewer->orientation();
+
+ QPoint orig = m_viewer->positionToXY(CellPosition(0, col));
+ QRect rect = o->rect(PredefinedRect::FOLDED_LAYER_HEADER).translated(orig);
+
+ int x0, y0, x, y;
+
+ if (o->isVerticalTimeline()) {
+ x0 = rect.topLeft().x() + 1;
+ y0 = 0;
+
+ p.setPen(m_viewer->getDarkLineColor());
+ p.fillRect(x0, y0 + 1, rect.width(), 18,
+ QBrush(m_viewer->getDarkBGColor()));
+ p.fillRect(x0, y0 + 17, 2, rect.height() - 34,
+ QBrush(m_viewer->getLightLightBGColor()));
+ p.fillRect(x0 + 3, y0 + 20, 2, rect.height() - 36,
+ QBrush(m_viewer->getLightLightBGColor()));
+ p.fillRect(x0 + 6, y0 + 17, 2, rect.height() - 34,
+ QBrush(m_viewer->getLightLightBGColor()));
+
+ p.setPen(Qt::black);
+ p.drawLine(x0 - 1, y0 + 17, x0 - 1, rect.height());
+ p.setPen(m_viewer->getDarkLineColor());
+ p.drawLine(x0 + 2, y0 + 17, x0 + 2, rect.height());
+ p.drawLine(x0 + 5, y0 + 17, x0 + 5, rect.height());
+ p.drawLine(x0, y0 + 17, x0 + 1, 17);
+ p.drawLine(x0 + 3, y0 + 20, x0 + 4, 20);
+ p.drawLine(x0 + 6, y0 + 17, x0 + 7, 17);
+
+ // triangolini
+ p.setPen(Qt::black);
+ x = x0;
+ y = 12;
+ p.drawPoint(QPointF(x, y));
+ x++;
+ p.drawLine(x, y - 1, x, y + 1);
+ x++;
+ p.drawLine(x, y - 2, x, y + 2);
+ x += 3;
+ p.drawLine(x, y - 2, x, y + 2);
+ x++;
+ p.drawLine(x, y - 1, x, y + 1);
+ x++;
+ p.drawPoint(x, y);
+ } else {
+ x0 = 0;
+ y0 = rect.topLeft().y() + 1;
+
+ p.setPen(m_viewer->getDarkLineColor());
+ p.fillRect(x0 + 1, y0, 18, rect.height(),
+ QBrush(m_viewer->getDarkBGColor()));
+ p.fillRect(x0 + 17, y0, rect.width() - 34, 2,
+ QBrush(m_viewer->getLightLightBGColor()));
+ p.fillRect(x0 + 20, y0 + 3, rect.width() - 36, 2,
+ QBrush(m_viewer->getLightLightBGColor()));
+ p.fillRect(x0 + 17, y0 + 6, rect.width() - 34, 2,
+ QBrush(m_viewer->getLightLightBGColor()));
+
+ p.setPen(Qt::black);
+ p.drawLine(x0 + 17, y0 - 1, rect.width(), y0 - 1);
+ p.setPen(m_viewer->getDarkLineColor());
+ p.drawLine(x0 + 17, y0 + 2, rect.width(), y0 + 2);
+ p.drawLine(x0 + 17, y0 + 5, rect.width(), y0 + 5);
+ p.drawLine(x0 + 17, y0, 17, y0 + 1);
+ p.drawLine(x0 + 20, y0 + 3, 20, y0 + 4);
+ p.drawLine(x0 + 17, y0 + 6, 17, y0 + 7);
+
+ // triangolini
+ p.setPen(Qt::black);
+ x = 12;
+ y = y0;
+ p.drawPoint(QPointF(x, y));
+ y++;
+ p.drawLine(x - 1, y, x + 1, y);
+ y++;
+ p.drawLine(x - 2, y, x + 2, y);
+ y += 3;
+ p.drawLine(x - 2, y, x + 2, y);
+ y++;
+ p.drawLine(x - 1, y, x + 1, y);
+ y++;
+ p.drawPoint(x, y);
+ }
}
void ColumnArea::drawLevelColumnHead(QPainter &p, int col) {
@@ -1160,7 +1178,7 @@ void ColumnArea::drawLevelColumnHead(QPainter &p, int col) {
void ColumnArea::drawSoundColumnHead(QPainter &p, int col) { // AREA
TColumnSelection *selection = m_viewer->getColumnSelection();
- const Orientation *o = m_viewer->orientation();
+ const Orientation *o = m_viewer->orientation();
int x = m_viewer->columnToLayerAxis(col);
@@ -1209,7 +1227,7 @@ void ColumnArea::drawSoundColumnHead(QPainter &p, int col) { // AREA
void ColumnArea::drawPaletteColumnHead(QPainter &p, int col) { // AREA
TColumnSelection *selection = m_viewer->getColumnSelection();
- const Orientation *o = m_viewer->orientation();
+ const Orientation *o = m_viewer->orientation();
QPoint orig = m_viewer->positionToXY(CellPosition(0, max(col, 0)));
@@ -1255,7 +1273,7 @@ void ColumnArea::drawPaletteColumnHead(QPainter &p, int col) { // AREA
void ColumnArea::drawSoundTextColumnHead(QPainter &p, int col) { // AREA
TColumnSelection *selection = m_viewer->getColumnSelection();
- const Orientation *o = m_viewer->orientation();
+ const Orientation *o = m_viewer->orientation();
int x = m_viewer->columnToLayerAxis(col);
@@ -1358,7 +1376,7 @@ void ColumnArea::paintEvent(QPaintEvent *event) { // AREA
for (col = c0; col <= c1; col++) {
// draw column fan (collapsed columns)
if (!columnFan->isActive(col)) {
- drawFoldedColumnHead(p, col);
+ drawFoldedColumnHead(p, col);
} else if (col >= 0) {
TXshColumn *column = m_viewer->getXsheet()->getColumn(col);
@@ -1385,12 +1403,11 @@ void ColumnArea::paintEvent(QPaintEvent *event) { // AREA
p.setPen(grey150);
p.setBrush(Qt::NoBrush);
if (m_viewer->orientation()->isVerticalTimeline())
- p.drawRect(toBeUpdated.adjusted(0, 0, -1, -3));
+ p.drawRect(toBeUpdated.adjusted(0, 0, -1, -3));
else
- p.drawRect(toBeUpdated.adjusted(0, 0, -3, -1));
+ p.drawRect(toBeUpdated.adjusted(0, 0, -3, -1));
if (getDragTool()) getDragTool()->drawColumnsArea(p);
-
}
//-----------------------------------------------------------------------------
@@ -1640,30 +1657,29 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) {
// preview button
else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell) &&
event->button() == Qt::LeftButton) {
- if (column->getPaletteColumn() || column->getSoundTextColumn()) {
- // do nothing
- }
- else {
- m_doOnRelease = isCtrlPressed ? ToggleAllPreviewVisible : TogglePreviewVisible;
- if (column->getSoundColumn())
- TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged();
- }
- }
+ if (column->getPaletteColumn() || column->getSoundTextColumn()) {
+ // do nothing
+ } else {
+ m_doOnRelease =
+ isCtrlPressed ? ToggleAllPreviewVisible : TogglePreviewVisible;
+ if (column->getSoundColumn())
+ 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 (column->getSoundColumn()) {
- // do nothing
- }
- else
- startTransparencyPopupTimer(event);
- }
+ if (column->getPaletteColumn() || column->getSoundTextColumn()) {
+ // do nothing
+ } else {
+ m_doOnRelease =
+ isCtrlPressed ? ToggleAllTransparency : ToggleTransparency;
+ if (column->getSoundColumn()) {
+ // do nothing
+ } else
+ startTransparencyPopupTimer(event);
+ }
}
// sound column
else if (column && column->getSoundColumn()) {
@@ -1735,10 +1751,10 @@ void ColumnArea::mouseMoveEvent(QMouseEvent *event) {
if (m_isPanning) { // Pan tasto centrale
QPoint delta = m_pos - pos;
- if(o->isVerticalTimeline())
- delta.setY(0);
- else
- delta.setX(0);
+ if (o->isVerticalTimeline())
+ delta.setY(0);
+ else
+ delta.setX(0);
m_viewer->scroll(delta);
return;
}
@@ -1760,10 +1776,10 @@ void ColumnArea::mouseMoveEvent(QMouseEvent *event) {
if ((event->buttons() & Qt::LeftButton) != 0 &&
!visibleRegion().contains(pos)) {
QRect bounds = visibleRegion().boundingRect();
- if (o->isVerticalTimeline())
- m_viewer->setAutoPanSpeed(bounds, QPoint(pos.x(), bounds.top()));
- else
- m_viewer->setAutoPanSpeed(bounds, QPoint(bounds.left(), pos.y()));
+ if (o->isVerticalTimeline())
+ m_viewer->setAutoPanSpeed(bounds, QPoint(pos.x(), bounds.top()));
+ else
+ m_viewer->setAutoPanSpeed(bounds, QPoint(bounds.left(), pos.y()));
} else
m_viewer->stopAutoPan();
@@ -1787,7 +1803,8 @@ void ColumnArea::mouseMoveEvent(QMouseEvent *event) {
m_tooltip = tr("Lock Toggle");
} else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell)) {
m_tooltip = tr("Preview Visibility Toggle");
- } else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(mouseInCell)) {
+ } else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA)
+ .contains(mouseInCell)) {
m_tooltip = tr("Camera Stand Visibility Toggle");
} else {
if (column && column->getSoundColumn()) {
@@ -1796,9 +1813,8 @@ void ColumnArea::mouseMoveEvent(QMouseEvent *event) {
m_tooltip = tr("Click to play the soundtrack back");
else if (o->rect(PredefinedRect::VOLUME_AREA).contains(mouseInCell))
m_tooltip = tr("Set the volume of the soundtrack");
- }
- else if (Preferences::instance()->getColumnIconLoadingPolicy() ==
- Preferences::LoadOnDemand)
+ } else if (Preferences::instance()->getColumnIconLoadingPolicy() ==
+ Preferences::LoadOnDemand)
m_tooltip = tr("Alt + Click to Toggle Thumbnail");
else
m_tooltip = tr("");
@@ -1821,7 +1837,7 @@ bool ColumnArea::event(QEvent *event) {
//-----------------------------------------------------------------------------
void ColumnArea::mouseReleaseEvent(QMouseEvent *event) {
- TApp *app = TApp::instance();
+ TApp *app = TApp::instance();
TXsheet *xsh = m_viewer->getXsheet();
int col, totcols = xsh->getColumnCount();
if (m_doOnRelease != 0 && m_col != -1) {
@@ -1830,43 +1846,40 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) {
(!m_columnTransparencyPopup || m_columnTransparencyPopup->isHidden())) {
column->setCamstandVisible(!column->isCamstandVisible());
app->getCurrentXsheet()->notifyXsheetSoundChanged();
- }
- else if (m_doOnRelease == TogglePreviewVisible)
+ } else if (m_doOnRelease == TogglePreviewVisible)
column->setPreviewVisible(!column->isPreviewVisible());
else if (m_doOnRelease == ToggleLock)
column->lock(!column->isLocked());
- else if (m_doOnRelease == ToggleAllPreviewVisible) {
- for (col = 0; col < totcols; col++) {
- TXshColumn *column = xsh->getColumn(col);
- if (!xsh->isColumnEmpty(col) && !column->getPaletteColumn() && !column->getSoundTextColumn()) {
- column->setPreviewVisible(!column->isPreviewVisible());
- }
- }
- }
- else if (m_doOnRelease == ToggleAllTransparency) {
- bool sound_changed = false;
- for (col = 0; col < totcols; col++) {
- TXshColumn *column = xsh->getColumn(col);
- if (!xsh->isColumnEmpty(col) && !column->getPaletteColumn() && !column->getSoundTextColumn()) {
- column->setCamstandVisible(!column->isCamstandVisible());
- if (column->getSoundColumn()) sound_changed = true;
- }
- }
-
- if (sound_changed) {
- app->getCurrentXsheet()->notifyXsheetSoundChanged();
- }
- }
- else if (m_doOnRelease == ToggleAllLock) {
- for (col = 0; col < totcols; col++)
- {
- TXshColumn *column = xsh->getColumn(col);
- if (!xsh->isColumnEmpty(col)) {
- column->lock(!column->isLocked());
- }
- }
- }
- else
+ else if (m_doOnRelease == ToggleAllPreviewVisible) {
+ for (col = 0; col < totcols; col++) {
+ TXshColumn *column = xsh->getColumn(col);
+ if (!xsh->isColumnEmpty(col) && !column->getPaletteColumn() &&
+ !column->getSoundTextColumn()) {
+ column->setPreviewVisible(!column->isPreviewVisible());
+ }
+ }
+ } else if (m_doOnRelease == ToggleAllTransparency) {
+ bool sound_changed = false;
+ for (col = 0; col < totcols; col++) {
+ TXshColumn *column = xsh->getColumn(col);
+ if (!xsh->isColumnEmpty(col) && !column->getPaletteColumn() &&
+ !column->getSoundTextColumn()) {
+ column->setCamstandVisible(!column->isCamstandVisible());
+ if (column->getSoundColumn()) sound_changed = true;
+ }
+ }
+
+ if (sound_changed) {
+ app->getCurrentXsheet()->notifyXsheetSoundChanged();
+ }
+ } else if (m_doOnRelease == ToggleAllLock) {
+ for (col = 0; col < totcols; col++) {
+ TXshColumn *column = xsh->getColumn(col);
+ if (!xsh->isColumnEmpty(col)) {
+ column->lock(!column->isLocked());
+ }
+ }
+ } else
assert(false);
app->getCurrentScene()->notifySceneChanged();
diff --git a/toonz/sources/toonz/xshcolumnviewer.h b/toonz/sources/toonz/xshcolumnviewer.h
index 10b222373..5240116b5 100644
--- a/toonz/sources/toonz/xshcolumnviewer.h
+++ b/toonz/sources/toonz/xshcolumnviewer.h
@@ -182,7 +182,14 @@ protected slots:
class ColumnArea final : public QWidget {
Q_OBJECT
- enum { ToggleTransparency = 1, ToggleAllTransparency, TogglePreviewVisible, ToggleAllPreviewVisible, ToggleLock, ToggleAllLock };
+ enum {
+ ToggleTransparency = 1,
+ ToggleAllTransparency,
+ TogglePreviewVisible,
+ ToggleAllPreviewVisible,
+ ToggleLock,
+ ToggleAllLock
+ };
ColumnTransparencyPopup *m_columnTransparencyPopup;
QTimer *m_transparencyPopupTimer;
@@ -244,10 +251,10 @@ class ColumnArea final : public QWidget {
void drawLock() const;
void drawColumnNumber() const;
void drawColumnName() const;
- void drawThumbnail(QPixmap &iconPixmap) const;
- void drawPegbarName() const;
- void drawParentHandleName() const;
- void drawFilterColor() const;
+ void drawThumbnail(QPixmap &iconPixmap) const;
+ void drawPegbarName() const;
+ void drawParentHandleName() const;
+ void drawFilterColor() const;
void drawSoundIcon(bool isPlaying) const;
void drawVolumeControl(double volume) const;
diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp
index 12faedca5..b34eeb948 100644
--- a/toonz/sources/toonz/xsheetviewer.cpp
+++ b/toonz/sources/toonz/xsheetviewer.cpp
@@ -157,7 +157,7 @@ XsheetViewer::XsheetViewer(QWidget *parent, Qt::WFlags flags)
, m_qtModifiers(0)
, m_frameDisplayStyle(to_enum(FrameDisplayStyleInXsheetRowArea))
, m_orientation(nullptr) {
-
+
setFocusPolicy(Qt::StrongFocus);
setFrameStyle(QFrame::StyledPanel);
@@ -167,17 +167,19 @@ XsheetViewer::XsheetViewer(QWidget *parent, Qt::WFlags flags)
m_cellKeyframeSelection->setXsheetHandle(
TApp::instance()->getCurrentXsheet());
-
+
m_toolbarScrollArea = new XsheetScrollArea(this);
- m_toolbarScrollArea->setFixedSize(m_orientation->cellWidth() * 12, XsheetGUI::TOOLBAR_HEIGHT);
+ m_toolbarScrollArea->setFixedSize(m_orientation->cellWidth() * 12,
+ XsheetGUI::TOOLBAR_HEIGHT);
m_toolbarScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_toolbarScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_toolbar = new XsheetGUI::Toolbar(this);
- m_toolbar->setFixedSize(m_orientation->cellWidth() * 12, XsheetGUI::TOOLBAR_HEIGHT);
+ m_toolbar->setFixedSize(m_orientation->cellWidth() * 12,
+ XsheetGUI::TOOLBAR_HEIGHT);
m_toolbarScrollArea->setWidget(m_toolbar);
QRect noteArea(0, 0, 75, 120);
- m_noteArea = new XsheetGUI::NoteArea(this);
+ m_noteArea = new XsheetGUI::NoteArea(this);
m_noteScrollArea = new XsheetScrollArea(this);
m_noteScrollArea->setObjectName("xsheetArea");
m_noteScrollArea->setWidget(m_noteArea);
@@ -310,30 +312,31 @@ void XsheetViewer::positionSections() {
NumberRange bodyFrame(headerFrame.to(), allFrame.to());
if (Preferences::instance()->isShowXSheetToolbarEnabled()) {
- m_toolbar->showToolbar(true);
-
- int w = geometry().size().width();
- m_toolbarScrollArea->setGeometry(0, 0, w, XsheetGUI::TOOLBAR_HEIGHT);
-
- if (o->isVerticalTimeline()) {
- headerFrame = headerFrame.adjusted(XsheetGUI::TOOLBAR_HEIGHT, XsheetGUI::TOOLBAR_HEIGHT);
- bodyFrame = bodyFrame.adjusted(XsheetGUI::TOOLBAR_HEIGHT, 0);
- }
- else {
- headerLayer = headerLayer.adjusted(XsheetGUI::TOOLBAR_HEIGHT, XsheetGUI::TOOLBAR_HEIGHT);
- bodyLayer = bodyLayer.adjusted(XsheetGUI::TOOLBAR_HEIGHT, 0);
- }
- }
- else {
- m_toolbar->showToolbar(false);
+ m_toolbar->showToolbar(true);
+
+ int w = geometry().size().width();
+ m_toolbarScrollArea->setGeometry(0, 0, w, XsheetGUI::TOOLBAR_HEIGHT);
+
+ if (o->isVerticalTimeline()) {
+ headerFrame = headerFrame.adjusted(XsheetGUI::TOOLBAR_HEIGHT,
+ XsheetGUI::TOOLBAR_HEIGHT);
+ bodyFrame = bodyFrame.adjusted(XsheetGUI::TOOLBAR_HEIGHT, 0);
+ } else {
+ headerLayer = headerLayer.adjusted(XsheetGUI::TOOLBAR_HEIGHT,
+ XsheetGUI::TOOLBAR_HEIGHT);
+ bodyLayer = bodyLayer.adjusted(XsheetGUI::TOOLBAR_HEIGHT, 0);
+ }
+ } else {
+ m_toolbar->showToolbar(false);
}
m_noteScrollArea->setGeometry(o->frameLayerRect(headerFrame, headerLayer));
m_cellScrollArea->setGeometry(o->frameLayerRect(bodyFrame, bodyLayer));
- m_columnScrollArea->setGeometry(o->frameLayerRect(
- headerFrame.adjusted(-1,-1), bodyLayer.adjusted(0, -XsheetGUI::SCROLLBAR_WIDTH)));
+ m_columnScrollArea->setGeometry(
+ o->frameLayerRect(headerFrame.adjusted(-1, -1),
+ bodyLayer.adjusted(0, -XsheetGUI::SCROLLBAR_WIDTH)));
m_rowScrollArea->setGeometry(o->frameLayerRect(
- bodyFrame.adjusted(0, -XsheetGUI::SCROLLBAR_WIDTH), headerLayer));
+ bodyFrame.adjusted(0, -XsheetGUI::SCROLLBAR_WIDTH), headerLayer));
}
void XsheetViewer::disconnectScrollBars() {
@@ -462,7 +465,7 @@ frameHandle->setFrame(row);*/
void XsheetViewer::scroll(QPoint delta) {
int x = delta.x();
int y = delta.y();
-
+
int valueH = m_cellScrollArea->horizontalScrollBar()->value() + x;
int valueV = m_cellScrollArea->verticalScrollBar()->value() + y;
int maxValueH = m_cellScrollArea->horizontalScrollBar()->maximum();
@@ -492,7 +495,7 @@ void XsheetViewer::scroll(QPoint delta) {
//-----------------------------------------------------------------------------
void XsheetViewer::onPrepareToScrollOffset(const QPoint &offset) {
- refreshContentSize(offset.x(), offset.y());
+ refreshContentSize(offset.x(), offset.y());
}
//-----------------------------------------------------------------------------
@@ -866,7 +869,7 @@ void XsheetViewer::paintEvent(QPaintEvent*)
void XsheetViewer::resizeEvent(QResizeEvent *event) {
positionSections();
-
+
//(New Layout Manager) introduced automatic refresh
refreshContentSize(
0,
@@ -887,17 +890,14 @@ void XsheetViewer::wheelEvent(QWheelEvent *event) {
->getMarkers(markerDistance, markerOffset);
if (event->angleDelta().x() == 0) { // vertical scroll
- if (!orientation()->isVerticalTimeline())
- markerDistance = 1;
+ if (!orientation()->isVerticalTimeline()) markerDistance = 1;
int scrollPixels = (event->angleDelta().y() > 0 ? 1 : -1) *
markerDistance * orientation()->cellHeight();
scroll(QPoint(0, -scrollPixels));
} else { // horizontal scroll
- if (orientation()->isVerticalTimeline())
- markerDistance = 1;
- int scrollPixels =
- (event->angleDelta().x() > 0 ? 1 : -1) *
- markerDistance * orientation()->cellWidth();
+ if (orientation()->isVerticalTimeline()) markerDistance = 1;
+ int scrollPixels = (event->angleDelta().x() > 0 ? 1 : -1) *
+ markerDistance * orientation()->cellWidth();
scroll(QPoint(-scrollPixels, 0));
}
break;
@@ -991,8 +991,8 @@ void XsheetViewer::keyPressEvent(QKeyEvent *event) {
case Qt::Key_Control:
// display the upper-directional smart tab only when the ctrl key is pressed
m_cellArea->onControlPressed(true);
- m_columnArea->onControlPressed(true);
- break;
+ m_columnArea->onControlPressed(true);
+ break;
default: {
QRect visibleRect = m_cellArea->visibleRegion().boundingRect();
@@ -1013,7 +1013,8 @@ void XsheetViewer::keyPressEvent(QKeyEvent *event) {
locals.scrollTo(0, visibleRect);
break;
case Qt::Key_End:
- locals.scrollTo((frameCount + 1) * orientation()->cellHeight(), visibleRect);
+ locals.scrollTo((frameCount + 1) * orientation()->cellHeight(),
+ visibleRect);
break;
}
break;
@@ -1025,14 +1026,14 @@ void XsheetViewer::keyPressEvent(QKeyEvent *event) {
// display the upper-directional smart tab only when the ctrl key is pressed
void XsheetViewer::keyReleaseEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Control) {
- m_cellArea->onControlPressed(false);
- m_columnArea->onControlPressed(false);
+ m_cellArea->onControlPressed(false);
+ m_columnArea->onControlPressed(false);
}
}
void XsheetViewer::enterEvent(QEvent *) {
- m_cellArea->onControlPressed(false);
- m_columnArea->onControlPressed(false);
+ m_cellArea->onControlPressed(false);
+ m_columnArea->onControlPressed(false);
}
//-----------------------------------------------------------------------------
@@ -1041,7 +1042,8 @@ void XsheetViewer::enterEvent(QEvent *) {
void XsheetViewer::scrollTo(int row, int col) {
QRect visibleRect = m_cellArea->visibleRegion().boundingRect();
QPoint topLeft = positionToXY(CellPosition(row, col));
- QRect cellRect(topLeft, QSize(orientation()->cellWidth(), orientation()->cellHeight()));
+ QRect cellRect(
+ topLeft, QSize(orientation()->cellWidth(), orientation()->cellHeight()));
int deltaX = 0;
int deltaY = 0;
@@ -1081,10 +1083,10 @@ void XsheetViewer::onXsheetChanged() {
//-----------------------------------------------------------------------------
void XsheetViewer::onPreferenceChanged(const QString &prefName) {
- if (prefName == "XSheetToolbar") {
- positionSections();
- refreshContentSize(0, 0);
- }
+ if (prefName == "XSheetToolbar") {
+ positionSections();
+ refreshContentSize(0, 0);
+ }
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/xshnoteviewer.cpp b/toonz/sources/toonz/xshnoteviewer.cpp
index 3d40d369b..454bff007 100644
--- a/toonz/sources/toonz/xshnoteviewer.cpp
+++ b/toonz/sources/toonz/xshnoteviewer.cpp
@@ -550,7 +550,7 @@ void NoteArea::removeLayout() {
void NoteArea::createLayout() {
const Orientation *o = m_viewer->orientation();
- QRect rect = o->rect(PredefinedRect::NOTE_AREA);
+ QRect rect = o->rect(PredefinedRect::NOTE_AREA);
setFixedSize(rect.size());
diff --git a/toonz/sources/toonz/xshrowviewer.cpp b/toonz/sources/toonz/xshrowviewer.cpp
index f4194e043..fe323d928 100644
--- a/toonz/sources/toonz/xshrowviewer.cpp
+++ b/toonz/sources/toonz/xshrowviewer.cpp
@@ -282,9 +282,8 @@ void RowArea::drawOnionSkinSelection(QPainter &p) {
bool inksOnly;
Preferences::instance()->getOnionData(frontPixel, backPixel, inksOnly);
QColor frontColor((int)frontPixel.r, (int)frontPixel.g, (int)frontPixel.b,
- 128);
- QColor backColor((int)backPixel.r, (int)backPixel.g, (int)backPixel.b,
- 128);
+ 128);
+ QColor backColor((int)backPixel.r, (int)backPixel.g, (int)backPixel.b, 128);
// If the onion skin is disabled, draw dash line instead.
if (osMask.isEnabled())
@@ -322,10 +321,12 @@ void RowArea::drawOnionSkinSelection(QPainter &p) {
int toFrameAxis = m_viewer->rowToFrameAxis(currentRow) + onionCenter_frame;
QLine verticalLine = m_viewer->orientation()->verticalLine(
layerAxis, NumberRange(fromFrameAxis, toFrameAxis));
- if (m_viewer->orientation()->isVerticalTimeline())
- p.drawLine(verticalLine.x1() + 1, verticalLine.y1() + 4, verticalLine.x2() + 1, verticalLine.y2() - 10);
- else
- p.drawLine(verticalLine.x1() + 4, verticalLine.y1() + 1, verticalLine.x2() - 10, verticalLine.y2() + 1);
+ if (m_viewer->orientation()->isVerticalTimeline())
+ p.drawLine(verticalLine.x1() + 1, verticalLine.y1() + 4,
+ verticalLine.x2() + 1, verticalLine.y2() - 10);
+ else
+ p.drawLine(verticalLine.x1() + 4, verticalLine.y1() + 1,
+ verticalLine.x2() - 10, verticalLine.y2() + 1);
}
if (maxMos > 0) // forward frames
{
@@ -336,10 +337,12 @@ void RowArea::drawOnionSkinSelection(QPainter &p) {
m_viewer->rowToFrameAxis(currentRow + maxMos) + onionCenter_frame;
QLine verticalLine = m_viewer->orientation()->verticalLine(
layerAxis, NumberRange(fromFrameAxis, toFrameAxis));
- if (m_viewer->orientation()->isVerticalTimeline())
- p.drawLine(verticalLine.x1() + 1, verticalLine.y1() + 10, verticalLine.x2() + 1, verticalLine.y2() - 4);
- else
- p.drawLine(verticalLine.x1() + 10, verticalLine.y1() + 1, verticalLine.x2() - 4, verticalLine.y2() + 1);
+ if (m_viewer->orientation()->isVerticalTimeline())
+ p.drawLine(verticalLine.x1() + 1, verticalLine.y1() + 10,
+ verticalLine.x2() + 1, verticalLine.y2() - 4);
+ else
+ p.drawLine(verticalLine.x1() + 10, verticalLine.y1() + 1,
+ verticalLine.x2() - 4, verticalLine.y2() + 1);
}
// Draw onion skin main handle
@@ -613,11 +616,11 @@ void RowArea::mouseMoveEvent(QMouseEvent *event) {
// pan by middle-drag
if (m_isPanning) {
QPoint delta = m_pos - pos;
- if (o->isVerticalTimeline())
- delta.setX(0);
- else
- delta.setY(0);
- m_viewer->scroll(delta);
+ if (o->isVerticalTimeline())
+ delta.setX(0);
+ else
+ delta.setY(0);
+ m_viewer->scroll(delta);
return;
}
@@ -627,10 +630,10 @@ void RowArea::mouseMoveEvent(QMouseEvent *event) {
if ((event->buttons() & Qt::LeftButton) != 0 &&
!visibleRegion().contains(pos)) {
QRect bounds = visibleRegion().boundingRect();
- if(o->isVerticalTimeline())
- m_viewer->setAutoPanSpeed(bounds, QPoint(bounds.left(), pos.y()));
- else
- m_viewer->setAutoPanSpeed(bounds, QPoint(pos.x(), bounds.top()));
+ if (o->isVerticalTimeline())
+ m_viewer->setAutoPanSpeed(bounds, QPoint(bounds.left(), pos.y()));
+ else
+ m_viewer->setAutoPanSpeed(bounds, QPoint(pos.x(), bounds.top()));
} else
m_viewer->stopAutoPan();
diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp
index 6fcbb6494..3c9171908 100644
--- a/toonz/sources/toonzlib/orientation.cpp
+++ b/toonz/sources/toonzlib/orientation.cpp
@@ -18,17 +18,17 @@ const int PINNED_SIZE = 10;
}
class TopToBottomOrientation : public Orientation {
- const int CELL_WIDTH = 74;
- const int CELL_HEIGHT = 20;
- const int CELL_DRAG_WIDTH = 7;
- const int EXTENDER_WIDTH = 18;
- const int EXTENDER_HEIGHT = 8;
- const int SOUND_PREVIEW_WIDTH = 7;
- const int LAYER_HEADER_HEIGHT = CELL_HEIGHT * 3 + 60;
+ const int CELL_WIDTH = 74;
+ const int CELL_HEIGHT = 20;
+ const int CELL_DRAG_WIDTH = 7;
+ const int EXTENDER_WIDTH = 18;
+ const int EXTENDER_HEIGHT = 8;
+ const int SOUND_PREVIEW_WIDTH = 7;
+ const int LAYER_HEADER_HEIGHT = CELL_HEIGHT * 3 + 60;
const int FOLDED_LAYER_HEADER_HEIGHT = LAYER_HEADER_HEIGHT;
- const int FOLDED_LAYER_HEADER_WIDTH = 8;
- const int FRAME_HEADER_WIDTH = CELL_WIDTH;
- const int PLAY_RANGE_X = FRAME_HEADER_WIDTH / 2 - PLAY_MARKER_SIZE;
+ const int FOLDED_LAYER_HEADER_WIDTH = 8;
+ const int FRAME_HEADER_WIDTH = CELL_WIDTH;
+ const int PLAY_RANGE_X = FRAME_HEADER_WIDTH / 2 - PLAY_MARKER_SIZE;
const int ONION_X = 0, ONION_Y = 0;
const int ICON_WIDTH = CELL_HEIGHT;
@@ -87,7 +87,7 @@ class LeftToRightOrientation : public Orientation {
const int LAYER_HEADER_WIDTH =
ICONS_WIDTH + LAYER_NUMBER_WIDTH + LAYER_NAME_WIDTH;
const int FOLDED_LAYER_HEADER_HEIGHT = 8;
- const int FOLDED_LAYER_HEADER_WIDTH = LAYER_HEADER_WIDTH;
+ const int FOLDED_LAYER_HEADER_WIDTH = LAYER_HEADER_WIDTH;
public:
LeftToRightOrientation();
@@ -245,53 +245,92 @@ TopToBottomOrientation::TopToBottomOrientation() {
// Cell viewer
QRect cellRect(0, 0, CELL_WIDTH, CELL_HEIGHT);
addRect(PredefinedRect::CELL, cellRect);
- addRect(PredefinedRect::DRAG_HANDLE_CORNER, QRect(0, 0, CELL_DRAG_WIDTH, CELL_HEIGHT));
- QRect keyRect(CELL_WIDTH - KEY_ICON_WIDTH, (CELL_HEIGHT - KEY_ICON_HEIGHT) / 2, KEY_ICON_WIDTH, KEY_ICON_HEIGHT);
+ addRect(PredefinedRect::DRAG_HANDLE_CORNER,
+ QRect(0, 0, CELL_DRAG_WIDTH, CELL_HEIGHT));
+ QRect keyRect(CELL_WIDTH - KEY_ICON_WIDTH,
+ (CELL_HEIGHT - KEY_ICON_HEIGHT) / 2, KEY_ICON_WIDTH,
+ KEY_ICON_HEIGHT);
addRect(PredefinedRect::KEY_ICON, keyRect);
QRect nameRect = cellRect.adjusted(8, 0, -6, 0);
addRect(PredefinedRect::CELL_NAME, nameRect);
- addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME, nameRect.adjusted(0, 0, -KEY_ICON_WIDTH, 0));
- addRect(PredefinedRect::END_EXTENDER, QRect(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0, EXTENDER_WIDTH, EXTENDER_HEIGHT));
- addRect(PredefinedRect::BEGIN_EXTENDER, QRect(-EXTENDER_WIDTH - KEY_ICON_WIDTH, -EXTENDER_HEIGHT, EXTENDER_WIDTH, EXTENDER_HEIGHT));
- addRect(PredefinedRect::KEYFRAME_AREA, QRect(CELL_WIDTH - KEY_ICON_WIDTH, 0, KEY_ICON_WIDTH, CELL_HEIGHT));
+ addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME,
+ nameRect.adjusted(0, 0, -KEY_ICON_WIDTH, 0));
+ addRect(PredefinedRect::END_EXTENDER,
+ QRect(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0, EXTENDER_WIDTH,
+ EXTENDER_HEIGHT));
+ addRect(PredefinedRect::BEGIN_EXTENDER,
+ QRect(-EXTENDER_WIDTH - KEY_ICON_WIDTH, -EXTENDER_HEIGHT,
+ EXTENDER_WIDTH, EXTENDER_HEIGHT));
+ addRect(PredefinedRect::KEYFRAME_AREA,
+ QRect(CELL_WIDTH - KEY_ICON_WIDTH, 0, KEY_ICON_WIDTH, CELL_HEIGHT));
addRect(PredefinedRect::DRAG_AREA, QRect(0, 0, CELL_DRAG_WIDTH, CELL_HEIGHT));
- QRect soundRect(CELL_DRAG_WIDTH, 0, CELL_WIDTH - CELL_DRAG_WIDTH - SOUND_PREVIEW_WIDTH, CELL_HEIGHT);
+ QRect soundRect(CELL_DRAG_WIDTH, 0,
+ CELL_WIDTH - CELL_DRAG_WIDTH - SOUND_PREVIEW_WIDTH,
+ CELL_HEIGHT);
addRect(PredefinedRect::SOUND_TRACK, soundRect);
- addRect(PredefinedRect::PREVIEW_TRACK, QRect(CELL_WIDTH - SOUND_PREVIEW_WIDTH + 1, 0, SOUND_PREVIEW_WIDTH, CELL_HEIGHT));
- addRect(PredefinedRect::BEGIN_SOUND_EDIT, QRect(CELL_DRAG_WIDTH, 0, CELL_WIDTH - CELL_DRAG_WIDTH, 2));
- addRect(PredefinedRect::END_SOUND_EDIT, QRect(CELL_DRAG_WIDTH, CELL_HEIGHT - 2, CELL_WIDTH - CELL_DRAG_WIDTH, 2));
+ addRect(PredefinedRect::PREVIEW_TRACK,
+ QRect(CELL_WIDTH - SOUND_PREVIEW_WIDTH + 1, 0, SOUND_PREVIEW_WIDTH,
+ CELL_HEIGHT));
+ addRect(PredefinedRect::BEGIN_SOUND_EDIT,
+ QRect(CELL_DRAG_WIDTH, 0, CELL_WIDTH - CELL_DRAG_WIDTH, 2));
+ addRect(
+ PredefinedRect::END_SOUND_EDIT,
+ QRect(CELL_DRAG_WIDTH, CELL_HEIGHT - 2, CELL_WIDTH - CELL_DRAG_WIDTH, 2));
addRect(PredefinedRect::LOOP_ICON, QRect(keyRect.left(), 0, 10, 11));
// Note viewer
- addRect(PredefinedRect::NOTE_AREA, QRect(QPoint(0, 0), QSize(FRAME_HEADER_WIDTH, LAYER_HEADER_HEIGHT - 1)));
- addRect(PredefinedRect::NOTE_ICON, QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
+ addRect(
+ PredefinedRect::NOTE_AREA,
+ QRect(QPoint(0, 0), QSize(FRAME_HEADER_WIDTH, LAYER_HEADER_HEIGHT - 1)));
+ addRect(PredefinedRect::NOTE_ICON,
+ QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
addRect(PredefinedRect::LAYER_HEADER_PANEL, QRect(0, 0, -1, -1)); // hide
// Row viewer
- addRect(PredefinedRect::FRAME_LABEL, QRect(CELL_WIDTH / 2, 1, CELL_WIDTH / 2, CELL_HEIGHT - 2));
- addRect(PredefinedRect::FRAME_HEADER, QRect(0, 0, FRAME_HEADER_WIDTH - 1, CELL_HEIGHT));
- addRect(PredefinedRect::PLAY_RANGE, QRect(PLAY_RANGE_X, 0, PLAY_MARKER_SIZE, CELL_HEIGHT));
- addRect(PredefinedRect::ONION, QRect(ONION_X + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2, ONION_Y, ONION_SIZE, ONION_SIZE));
+ addRect(PredefinedRect::FRAME_LABEL,
+ QRect(CELL_WIDTH / 2, 1, CELL_WIDTH / 2, CELL_HEIGHT - 2));
+ addRect(PredefinedRect::FRAME_HEADER,
+ QRect(0, 0, FRAME_HEADER_WIDTH - 1, CELL_HEIGHT));
+ addRect(PredefinedRect::PLAY_RANGE,
+ QRect(PLAY_RANGE_X, 0, PLAY_MARKER_SIZE, CELL_HEIGHT));
+ addRect(PredefinedRect::ONION,
+ QRect(ONION_X + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2, ONION_Y,
+ ONION_SIZE, ONION_SIZE));
int adjustOnion = (ONION_SIZE - ONION_DOT_SIZE) / 2;
- addRect(PredefinedRect::ONION_DOT, QRect(ONION_X + ONION_DOT_SIZE, ONION_Y + adjustOnion, ONION_DOT_SIZE, ONION_DOT_SIZE));
- addRect(PredefinedRect::ONION_DOT_FIXED, QRect(ONION_X, ONION_Y + adjustOnion, ONION_DOT_SIZE, ONION_DOT_SIZE));
- addRect(PredefinedRect::ONION_AREA, QRect(ONION_X, ONION_Y, PLAY_RANGE_X, CELL_HEIGHT));
- addRect(PredefinedRect::ONION_FIXED_DOT_AREA, QRect(ONION_X, ONION_Y, ONION_DOT_SIZE, CELL_HEIGHT));
- addRect(PredefinedRect::ONION_DOT_AREA, QRect(ONION_X + ONION_DOT_SIZE, ONION_Y, ONION_DOT_SIZE, CELL_HEIGHT));
- addRect(PredefinedRect::PINNED_CENTER_KEY, QRect((FRAME_HEADER_WIDTH - PINNED_SIZE) / 2, (CELL_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE));
+ addRect(PredefinedRect::ONION_DOT,
+ QRect(ONION_X + ONION_DOT_SIZE, ONION_Y + adjustOnion, ONION_DOT_SIZE,
+ ONION_DOT_SIZE));
+ addRect(
+ PredefinedRect::ONION_DOT_FIXED,
+ QRect(ONION_X, ONION_Y + adjustOnion, ONION_DOT_SIZE, ONION_DOT_SIZE));
+ addRect(PredefinedRect::ONION_AREA,
+ QRect(ONION_X, ONION_Y, PLAY_RANGE_X, CELL_HEIGHT));
+ addRect(PredefinedRect::ONION_FIXED_DOT_AREA,
+ QRect(ONION_X, ONION_Y, ONION_DOT_SIZE, CELL_HEIGHT));
+ addRect(
+ PredefinedRect::ONION_DOT_AREA,
+ QRect(ONION_X + ONION_DOT_SIZE, ONION_Y, ONION_DOT_SIZE, CELL_HEIGHT));
+ addRect(PredefinedRect::PINNED_CENTER_KEY,
+ QRect((FRAME_HEADER_WIDTH - PINNED_SIZE) / 2,
+ (CELL_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE));
// Column viewer
- static int INDENT = 9;
- static int HDRROW1 = 6; // Name/eye
- static int HDRROW2 = HDRROW1 + CELL_HEIGHT; // lock, preview
- static int HDRROW3 = HDRROW2 + CELL_HEIGHT + 1; // thumbnail
- static int HDRROW4 = HDRROW3 + 48; // pegbar, parenthandle
-
- addRect(PredefinedRect::LAYER_HEADER, QRect(0, 1, CELL_WIDTH, LAYER_HEADER_HEIGHT - 3));
- addRect(PredefinedRect::DRAG_LAYER, QRect(0, 0, CELL_DRAG_WIDTH, LAYER_HEADER_HEIGHT - 3));
- addRect(PredefinedRect::FOLDED_LAYER_HEADER, QRect(0, 1, FOLDED_LAYER_HEADER_WIDTH, FOLDED_LAYER_HEADER_HEIGHT - 3));
-
- addRect(PredefinedRect::RENAME_COLUMN, QRect(0, 6, CELL_WIDTH, CELL_HEIGHT - 3));
+ static int INDENT = 9;
+ static int HDRROW1 = 6; // Name/eye
+ static int HDRROW2 = HDRROW1 + CELL_HEIGHT; // lock, preview
+ static int HDRROW3 = HDRROW2 + CELL_HEIGHT + 1; // thumbnail
+ static int HDRROW4 = HDRROW3 + 48; // pegbar, parenthandle
+
+ addRect(PredefinedRect::LAYER_HEADER,
+ QRect(0, 1, CELL_WIDTH, LAYER_HEADER_HEIGHT - 3));
+ addRect(PredefinedRect::DRAG_LAYER,
+ QRect(0, 0, CELL_DRAG_WIDTH, LAYER_HEADER_HEIGHT - 3));
+ addRect(
+ PredefinedRect::FOLDED_LAYER_HEADER,
+ QRect(0, 1, FOLDED_LAYER_HEADER_WIDTH, FOLDED_LAYER_HEADER_HEIGHT - 3));
+
+ addRect(PredefinedRect::RENAME_COLUMN,
+ QRect(0, 6, CELL_WIDTH, CELL_HEIGHT - 3));
QRect layername(INDENT, HDRROW1, CELL_WIDTH - 11, CELL_HEIGHT - 3);
addRect(PredefinedRect::LAYER_NAME, layername);
@@ -316,26 +355,37 @@ TopToBottomOrientation::TopToBottomOrientation() {
addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea);
QRect thumbnail(INDENT, HDRROW3, CELL_WIDTH - 11, 42);
addRect(PredefinedRect::THUMBNAIL, thumbnail);
- addRect(PredefinedRect::FILTER_COLOR, QRect(thumbnailArea.right() - 14, thumbnailArea.top() + 3, 12, 12));
- addRect(PredefinedRect::SOUND_ICON, QRect(thumbnailArea.right() - 40, 3 * CELL_HEIGHT + 4, 40, 30));
+ addRect(PredefinedRect::FILTER_COLOR,
+ QRect(thumbnailArea.right() - 14, thumbnailArea.top() + 3, 12, 12));
+ addRect(PredefinedRect::SOUND_ICON,
+ QRect(thumbnailArea.right() - 40, 3 * CELL_HEIGHT + 4, 40, 30));
int trackLen = 60;
- QRect volumeArea(thumbnailArea.left(), thumbnailArea.top() + 1, 29 - CELL_DRAG_WIDTH, trackLen + 7);
+ QRect volumeArea(thumbnailArea.left(), thumbnailArea.top() + 1,
+ 29 - CELL_DRAG_WIDTH, trackLen + 7);
addRect(PredefinedRect::VOLUME_AREA, volumeArea);
QPoint soundTopLeft(volumeArea.left() + 12, volumeArea.top() + 4);
- addRect(PredefinedRect::VOLUME_TRACK, QRect(soundTopLeft, QSize(3, trackLen)));
+ addRect(PredefinedRect::VOLUME_TRACK,
+ QRect(soundTopLeft, QSize(3, trackLen)));
QRect pegbarname(INDENT, HDRROW4, CELL_WIDTH - 11, CELL_HEIGHT - 3);
addRect(PredefinedRect::PEGBAR_NAME, pegbarname);
- addRect(PredefinedRect::PARENT_HANDLE_NAME, QRect(INDENT + pegbarname.width() - 20, HDRROW4, 20, CELL_HEIGHT - 3));
+ addRect(
+ PredefinedRect::PARENT_HANDLE_NAME,
+ QRect(INDENT + pegbarname.width() - 20, HDRROW4, 20, CELL_HEIGHT - 3));
//
// Lines
//
- addLine(PredefinedLine::LOCKED, verticalLine((CELL_DRAG_WIDTH + 1) / 2, NumberRange(0, CELL_HEIGHT)));
- addLine(PredefinedLine::SEE_MARKER_THROUGH, horizontalLine(0, NumberRange(0, CELL_DRAG_WIDTH)));
- addLine(PredefinedLine::CONTINUE_LEVEL, verticalLine(CELL_WIDTH / 2, NumberRange(0, CELL_HEIGHT)));
- addLine(PredefinedLine::CONTINUE_LEVEL_WITH_NAME, verticalLine(CELL_WIDTH - 11, NumberRange(0, CELL_HEIGHT)));
- addLine(PredefinedLine::EXTENDER_LINE, horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
+ addLine(PredefinedLine::LOCKED,
+ verticalLine((CELL_DRAG_WIDTH + 1) / 2, NumberRange(0, CELL_HEIGHT)));
+ addLine(PredefinedLine::SEE_MARKER_THROUGH,
+ horizontalLine(0, NumberRange(0, CELL_DRAG_WIDTH)));
+ addLine(PredefinedLine::CONTINUE_LEVEL,
+ verticalLine(CELL_WIDTH / 2, NumberRange(0, CELL_HEIGHT)));
+ addLine(PredefinedLine::CONTINUE_LEVEL_WITH_NAME,
+ verticalLine(CELL_WIDTH - 11, NumberRange(0, CELL_HEIGHT)));
+ addLine(PredefinedLine::EXTENDER_LINE,
+ horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
//
// Dimensions
@@ -343,10 +393,12 @@ TopToBottomOrientation::TopToBottomOrientation() {
addDimension(PredefinedDimension::LAYER, CELL_WIDTH);
addDimension(PredefinedDimension::FRAME, CELL_HEIGHT);
addDimension(PredefinedDimension::INDEX, 0);
- addDimension(PredefinedDimension::SOUND_AMPLITUDE, int(sqrt(CELL_HEIGHT * soundRect.width()) / 2));
+ addDimension(PredefinedDimension::SOUND_AMPLITUDE,
+ int(sqrt(CELL_HEIGHT * soundRect.width()) / 2));
addDimension(PredefinedDimension::FRAME_LABEL_ALIGN, Qt::AlignCenter);
addDimension(PredefinedDimension::ONION_TURN, 0);
- addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION, QBoxLayout::Direction::TopToBottom);
+ addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION,
+ QBoxLayout::Direction::TopToBottom);
addDimension(PredefinedDimension::CENTER_ALIGN, Qt::AlignHCenter);
//
@@ -409,7 +461,8 @@ TopToBottomOrientation::TopToBottomOrientation() {
//
addPoint(PredefinedPoint::KEY_HIDDEN, QPoint(KEY_ICON_WIDTH, 0));
addPoint(PredefinedPoint::EXTENDER_XY_RADIUS, QPoint(30, 75));
- addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT, soundTopLeft - QPoint(5, 0));
+ addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT,
+ soundTopLeft - QPoint(5, 0));
//
// Ranges
@@ -491,76 +544,127 @@ LeftToRightOrientation::LeftToRightOrientation() {
// Cell viewer
QRect cellRect(0, 0, CELL_WIDTH, CELL_HEIGHT);
addRect(PredefinedRect::CELL, cellRect);
- addRect(PredefinedRect::DRAG_HANDLE_CORNER, QRect(0, 0, CELL_WIDTH, CELL_DRAG_HEIGHT));
- QRect keyRect((CELL_WIDTH - KEY_ICON_WIDTH) / 2, CELL_HEIGHT - KEY_ICON_HEIGHT, KEY_ICON_WIDTH, KEY_ICON_HEIGHT);
+ addRect(PredefinedRect::DRAG_HANDLE_CORNER,
+ QRect(0, 0, CELL_WIDTH, CELL_DRAG_HEIGHT));
+ QRect keyRect((CELL_WIDTH - KEY_ICON_WIDTH) / 2,
+ CELL_HEIGHT - KEY_ICON_HEIGHT, KEY_ICON_WIDTH, KEY_ICON_HEIGHT);
addRect(PredefinedRect::KEY_ICON, keyRect);
QRect nameRect = cellRect.adjusted(4, 4, -6, 0);
addRect(PredefinedRect::CELL_NAME, nameRect);
addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME, nameRect);
- addRect(PredefinedRect::END_EXTENDER, QRect(0, -EXTENDER_HEIGHT - 10, EXTENDER_WIDTH, EXTENDER_HEIGHT));
- addRect(PredefinedRect::BEGIN_EXTENDER, QRect(-EXTENDER_WIDTH, -EXTENDER_HEIGHT - 10, EXTENDER_WIDTH, EXTENDER_HEIGHT));
+ addRect(PredefinedRect::END_EXTENDER,
+ QRect(0, -EXTENDER_HEIGHT - 10, EXTENDER_WIDTH, EXTENDER_HEIGHT));
+ addRect(PredefinedRect::BEGIN_EXTENDER,
+ QRect(-EXTENDER_WIDTH, -EXTENDER_HEIGHT - 10, EXTENDER_WIDTH,
+ EXTENDER_HEIGHT));
addRect(PredefinedRect::KEYFRAME_AREA, keyRect);
addRect(PredefinedRect::DRAG_AREA, QRect(0, 0, CELL_WIDTH, CELL_DRAG_HEIGHT));
- QRect soundRect(0, CELL_DRAG_HEIGHT, CELL_WIDTH, CELL_HEIGHT - CELL_DRAG_HEIGHT - SOUND_PREVIEW_HEIGHT);
+ QRect soundRect(0, CELL_DRAG_HEIGHT, CELL_WIDTH,
+ CELL_HEIGHT - CELL_DRAG_HEIGHT - SOUND_PREVIEW_HEIGHT);
addRect(PredefinedRect::SOUND_TRACK, soundRect);
- addRect(PredefinedRect::PREVIEW_TRACK, QRect(0, CELL_HEIGHT - SOUND_PREVIEW_HEIGHT + 1, CELL_WIDTH, SOUND_PREVIEW_HEIGHT));
- addRect(PredefinedRect::BEGIN_SOUND_EDIT, QRect(0, CELL_DRAG_HEIGHT, 2, CELL_HEIGHT - CELL_DRAG_HEIGHT));
- addRect(PredefinedRect::END_SOUND_EDIT, QRect(CELL_WIDTH - 2, CELL_DRAG_HEIGHT, 2, CELL_HEIGHT - CELL_DRAG_HEIGHT));
+ addRect(PredefinedRect::PREVIEW_TRACK,
+ QRect(0, CELL_HEIGHT - SOUND_PREVIEW_HEIGHT + 1, CELL_WIDTH,
+ SOUND_PREVIEW_HEIGHT));
+ addRect(PredefinedRect::BEGIN_SOUND_EDIT,
+ QRect(0, CELL_DRAG_HEIGHT, 2, CELL_HEIGHT - CELL_DRAG_HEIGHT));
+ addRect(PredefinedRect::END_SOUND_EDIT,
+ QRect(CELL_WIDTH - 2, CELL_DRAG_HEIGHT, 2,
+ CELL_HEIGHT - CELL_DRAG_HEIGHT));
addRect(PredefinedRect::LOOP_ICON, QRect(0, keyRect.top(), 10, 11));
// Notes viewer
- addRect(PredefinedRect::NOTE_AREA, QRect(QPoint(0, 0), QSize(LAYER_HEADER_WIDTH - 1, FRAME_HEADER_HEIGHT)));
- addRect(PredefinedRect::NOTE_ICON, QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
- addRect(PredefinedRect::LAYER_HEADER_PANEL, QRect(0, FRAME_HEADER_HEIGHT - CELL_HEIGHT, LAYER_HEADER_WIDTH, CELL_HEIGHT));
+ addRect(
+ PredefinedRect::NOTE_AREA,
+ QRect(QPoint(0, 0), QSize(LAYER_HEADER_WIDTH - 1, FRAME_HEADER_HEIGHT)));
+ addRect(PredefinedRect::NOTE_ICON,
+ QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
+ addRect(PredefinedRect::LAYER_HEADER_PANEL,
+ QRect(0, FRAME_HEADER_HEIGHT - CELL_HEIGHT, LAYER_HEADER_WIDTH,
+ CELL_HEIGHT));
// Row viewer
- addRect(PredefinedRect::FRAME_LABEL, QRect(CELL_WIDTH / 4, 1, CELL_WIDTH / 2, FRAME_HEADER_HEIGHT - 2));
- addRect(PredefinedRect::FRAME_HEADER, QRect(0, 0, CELL_WIDTH, FRAME_HEADER_HEIGHT - 1));
- addRect(PredefinedRect::PLAY_RANGE, QRect(0, PLAY_RANGE_Y, CELL_WIDTH, PLAY_MARKER_SIZE));
- addRect(PredefinedRect::ONION, QRect(ONION_X, ONION_Y + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2, ONION_SIZE, ONION_SIZE));
+ addRect(PredefinedRect::FRAME_LABEL,
+ QRect(CELL_WIDTH / 4, 1, CELL_WIDTH / 2, FRAME_HEADER_HEIGHT - 2));
+ addRect(PredefinedRect::FRAME_HEADER,
+ QRect(0, 0, CELL_WIDTH, FRAME_HEADER_HEIGHT - 1));
+ addRect(PredefinedRect::PLAY_RANGE,
+ QRect(0, PLAY_RANGE_Y, CELL_WIDTH, PLAY_MARKER_SIZE));
+ addRect(PredefinedRect::ONION,
+ QRect(ONION_X, ONION_Y + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2,
+ ONION_SIZE, ONION_SIZE));
int adjustOnion = (ONION_SIZE - ONION_DOT_SIZE) / 2;
- addRect(PredefinedRect::ONION_DOT, QRect(ONION_X + adjustOnion, ONION_Y + ONION_DOT_SIZE, ONION_DOT_SIZE, ONION_DOT_SIZE));
- addRect(PredefinedRect::ONION_DOT_FIXED, QRect(ONION_X + adjustOnion, ONION_Y, ONION_DOT_SIZE, ONION_DOT_SIZE));
- addRect(PredefinedRect::ONION_AREA, QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_SIZE));
- addRect(PredefinedRect::ONION_FIXED_DOT_AREA, QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_DOT_SIZE));
- addRect(PredefinedRect::ONION_DOT_AREA, QRect(ONION_X, ONION_Y + ONION_DOT_SIZE, CELL_WIDTH, ONION_DOT_SIZE));
- addRect(PredefinedRect::PINNED_CENTER_KEY, QRect((CELL_WIDTH - PINNED_SIZE) / 2, (FRAME_HEADER_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE));
+ addRect(PredefinedRect::ONION_DOT,
+ QRect(ONION_X + adjustOnion, ONION_Y + ONION_DOT_SIZE, ONION_DOT_SIZE,
+ ONION_DOT_SIZE));
+ addRect(
+ PredefinedRect::ONION_DOT_FIXED,
+ QRect(ONION_X + adjustOnion, ONION_Y, ONION_DOT_SIZE, ONION_DOT_SIZE));
+ addRect(PredefinedRect::ONION_AREA,
+ QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_SIZE));
+ addRect(PredefinedRect::ONION_FIXED_DOT_AREA,
+ QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_DOT_SIZE));
+ addRect(PredefinedRect::ONION_DOT_AREA,
+ QRect(ONION_X, ONION_Y + ONION_DOT_SIZE, CELL_WIDTH, ONION_DOT_SIZE));
+ addRect(
+ PredefinedRect::PINNED_CENTER_KEY,
+ QRect((CELL_WIDTH - PINNED_SIZE) / 2,
+ (FRAME_HEADER_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE));
// Column viewer
- addRect(PredefinedRect::LAYER_HEADER, QRect(1, 0, LAYER_HEADER_WIDTH - 3, CELL_HEIGHT));
- addRect(PredefinedRect::FOLDED_LAYER_HEADER, QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 3, FOLDED_LAYER_HEADER_HEIGHT));
- QRect columnName(ICONS_WIDTH + 1, 0, LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 3, CELL_HEIGHT);
+ addRect(PredefinedRect::LAYER_HEADER,
+ QRect(1, 0, LAYER_HEADER_WIDTH - 3, CELL_HEIGHT));
+ addRect(
+ PredefinedRect::FOLDED_LAYER_HEADER,
+ QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 3, FOLDED_LAYER_HEADER_HEIGHT));
+ QRect columnName(ICONS_WIDTH + 1, 0,
+ LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 3, CELL_HEIGHT);
addRect(PredefinedRect::RENAME_COLUMN, columnName);
QRect eye(1, 0, ICON_WIDTH, CELL_HEIGHT);
addRect(PredefinedRect::EYE_AREA, eye);
addRect(PredefinedRect::EYE, eye.adjusted(1, 1, 0, 0));
addRect(PredefinedRect::PREVIEW_LAYER_AREA, eye.translated(ICON_OFFSET, 0));
- addRect(PredefinedRect::PREVIEW_LAYER, eye.translated(ICON_OFFSET + 1, 0).adjusted(-1, 1, -1, 0));
+ addRect(PredefinedRect::PREVIEW_LAYER,
+ eye.translated(ICON_OFFSET + 1, 0).adjusted(-1, 1, -1, 0));
addRect(PredefinedRect::LOCK_AREA, eye.translated(2 * ICON_OFFSET, 0));
- addRect(PredefinedRect::LOCK, eye.translated(2 * ICON_OFFSET + 1, 0).adjusted(-1, 1, -1, 0));
- addRect(PredefinedRect::DRAG_LAYER, QRect(ICONS_WIDTH + 1, 0, LAYER_HEADER_WIDTH - ICONS_WIDTH - 3, CELL_DRAG_HEIGHT));
+ addRect(PredefinedRect::LOCK,
+ eye.translated(2 * ICON_OFFSET + 1, 0).adjusted(-1, 1, -1, 0));
+ addRect(PredefinedRect::DRAG_LAYER,
+ QRect(ICONS_WIDTH + 1, 0, LAYER_HEADER_WIDTH - ICONS_WIDTH - 3,
+ CELL_DRAG_HEIGHT));
addRect(PredefinedRect::LAYER_NAME, columnName);
- addRect(PredefinedRect::LAYER_NUMBER, QRect(ICONS_WIDTH + 1, 0, LAYER_NUMBER_WIDTH, CELL_HEIGHT));
- addRect(PredefinedRect::THUMBNAIL_AREA, QRect(0, 0, -1, -1)); // hide
- addRect(PredefinedRect::FILTER_COLOR, QRect(LAYER_HEADER_WIDTH - 17, 6, 12, 12));
- addRect(PredefinedRect::PEGBAR_NAME, QRect(0, 0, -1, -1)); // hide
- addRect(PredefinedRect::PARENT_HANDLE_NAME, QRect(0, 0, -1, -1)); // hide
+ addRect(PredefinedRect::LAYER_NUMBER,
+ QRect(ICONS_WIDTH + 1, 0, LAYER_NUMBER_WIDTH, CELL_HEIGHT));
+ addRect(PredefinedRect::THUMBNAIL_AREA, QRect(0, 0, -1, -1)); // hide
+ addRect(PredefinedRect::FILTER_COLOR,
+ QRect(LAYER_HEADER_WIDTH - 17, 6, 12, 12));
+ addRect(PredefinedRect::PEGBAR_NAME, QRect(0, 0, -1, -1)); // hide
+ addRect(PredefinedRect::PARENT_HANDLE_NAME, QRect(0, 0, -1, -1)); // hide
int trackLen = 60;
- QRect volumeArea(QRect(columnName.topRight(), QSize(trackLen + 8, columnName.height())).adjusted(-97, 0, -97, 0));
+ QRect volumeArea(
+ QRect(columnName.topRight(), QSize(trackLen + 8, columnName.height()))
+ .adjusted(-97, 0, -97, 0));
addRect(PredefinedRect::VOLUME_AREA, volumeArea);
QPoint soundTopLeft(volumeArea.left() + 4, volumeArea.top() + 12);
- addRect(PredefinedRect::VOLUME_TRACK, QRect(soundTopLeft, QSize(trackLen, 3)));
- addRect(PredefinedRect::SOUND_ICON, QRect(columnName.topRight(), QSize(27, columnName.height())).adjusted(-28, 0, -28, 0));
+ addRect(PredefinedRect::VOLUME_TRACK,
+ QRect(soundTopLeft, QSize(trackLen, 3)));
+ addRect(PredefinedRect::SOUND_ICON,
+ QRect(columnName.topRight(), QSize(27, columnName.height()))
+ .adjusted(-28, 0, -28, 0));
//
// Lines
//
- addLine(PredefinedLine::LOCKED, verticalLine(CELL_DRAG_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
- addLine(PredefinedLine::SEE_MARKER_THROUGH, horizontalLine(0, NumberRange(0, CELL_DRAG_HEIGHT)));
- addLine(PredefinedLine::CONTINUE_LEVEL, verticalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
- addLine(PredefinedLine::CONTINUE_LEVEL_WITH_NAME, verticalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
- addLine(PredefinedLine::EXTENDER_LINE, horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
+ addLine(PredefinedLine::LOCKED,
+ verticalLine(CELL_DRAG_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
+ addLine(PredefinedLine::SEE_MARKER_THROUGH,
+ horizontalLine(0, NumberRange(0, CELL_DRAG_HEIGHT)));
+ addLine(PredefinedLine::CONTINUE_LEVEL,
+ verticalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
+ addLine(PredefinedLine::CONTINUE_LEVEL_WITH_NAME,
+ verticalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
+ addLine(PredefinedLine::EXTENDER_LINE,
+ horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
//
// Dimensions
@@ -569,9 +673,11 @@ LeftToRightOrientation::LeftToRightOrientation() {
addDimension(PredefinedDimension::FRAME, CELL_WIDTH);
addDimension(PredefinedDimension::INDEX, 1);
addDimension(PredefinedDimension::SOUND_AMPLITUDE, soundRect.height() / 2);
- addDimension(PredefinedDimension::FRAME_LABEL_ALIGN, Qt::AlignHCenter | Qt::AlignBottom | Qt::TextWordWrap);
+ addDimension(PredefinedDimension::FRAME_LABEL_ALIGN,
+ Qt::AlignHCenter | Qt::AlignBottom | Qt::TextWordWrap);
addDimension(PredefinedDimension::ONION_TURN, 90);
- addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION, QBoxLayout::Direction::LeftToRight);
+ addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION,
+ QBoxLayout::Direction::LeftToRight);
addDimension(PredefinedDimension::CENTER_ALIGN, Qt::AlignVCenter);
//
@@ -634,7 +740,8 @@ LeftToRightOrientation::LeftToRightOrientation() {
//
addPoint(PredefinedPoint::KEY_HIDDEN, QPoint(0, 10));
addPoint(PredefinedPoint::EXTENDER_XY_RADIUS, QPoint(75, 30));
- addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT, soundTopLeft + QPoint(0, 3));
+ addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT,
+ soundTopLeft + QPoint(0, 3));
//
// Ranges
diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp
index 8f9f9e81e..94cff5a80 100644
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@ -310,8 +310,8 @@ Preferences::Preferences()
, m_useNumpadForSwitchingStyles(true)
, m_showXSheetToolbar(false)
, m_expandFunctionHeader(false)
- , m_showColumnNumbers(false)
- , m_useArrowKeyToShiftCellSelection(false)
+ , m_showColumnNumbers(false)
+ , m_useArrowKeyToShiftCellSelection(false)
, m_inputCellsWithoutDoubleClickingEnabled(false)
, m_importPolicy(0)
, m_watchFileSystem(true) {
@@ -1392,8 +1392,8 @@ void Preferences::enableExpandFunctionHeader(bool on) {
}
void Preferences::enableShowColumnNumbers(bool on) {
- m_showColumnNumbers = on;
- m_settings->setValue("showColumnNumbers", on ? "1" : "0");
+ m_showColumnNumbers = on;
+ m_settings->setValue("showColumnNumbers", on ? "1" : "0");
}
//-----------------------------------------------------------------
diff --git a/toonz/sources/toonzqt/spreadsheetviewer.cpp b/toonz/sources/toonzqt/spreadsheetviewer.cpp
index 8d6136df5..127477276 100644
--- a/toonz/sources/toonzqt/spreadsheetviewer.cpp
+++ b/toonz/sources/toonzqt/spreadsheetviewer.cpp
@@ -27,7 +27,7 @@ FrameScroller::FrameScroller()
, m_scrollArea(nullptr)
, m_lastX(0)
, m_lastY(0)
- ,m_syncing(false){}
+ , m_syncing(false) {}
FrameScroller::~FrameScroller() {}
@@ -76,19 +76,18 @@ static QList<FrameScroller *> frameScrollers;
void FrameScroller::handleScroll(const QPoint &offset) const {
CellPositionRatio ratio = orientation()->xyToPositionRatio(offset);
- if( (m_orientation->isVerticalTimeline() && offset.x())
- || (!m_orientation->isVerticalTimeline() && offset.y())) // only synchronize changes by frames axis
+ if ((m_orientation->isVerticalTimeline() && offset.x()) ||
+ (!m_orientation->isVerticalTimeline() &&
+ offset.y())) // only synchronize changes by frames axis
return;
for (int i = 0; i < frameScrollers.size(); i++)
- if (frameScrollers[i] != this)
- {
- if (!frameScrollers[i]->isSyncing())
- {
- frameScrollers[i]->onScroll(ratio);
- break;
- }
- }
+ if (frameScrollers[i] != this) {
+ if (!frameScrollers[i]->isSyncing()) {
+ frameScrollers[i]->onScroll(ratio);
+ break;
+ }
+ }
}
void adjustScrollbar(QScrollBar *scrollBar, int add);
@@ -96,11 +95,9 @@ void adjustScrollbar(QScrollBar *scrollBar, int add);
void FrameScroller::onScroll(const CellPositionRatio &ratio) {
QPoint offset = orientation()->positionRatioToXY(ratio);
if (offset.x())
- adjustScrollbar(m_scrollArea->horizontalScrollBar(),
- offset.x());
+ adjustScrollbar(m_scrollArea->horizontalScrollBar(), offset.x());
if (offset.y())
- adjustScrollbar(m_scrollArea->verticalScrollBar(),
- offset.y());
+ adjustScrollbar(m_scrollArea->verticalScrollBar(), offset.y());
emit prepareToScrollOffset(offset);
}
@@ -120,7 +117,7 @@ void FrameScroller::prepareToScrollOthers(const QPoint &offset) {
CellPositionRatio ratio = orientation()->xyToPositionRatio(offset);
for (int i = 0; i < frameScrollers.size(); i++)
if (frameScrollers[i] != this)
- frameScrollers[i]->prepareToScrollRatio(ratio);
+ frameScrollers[i]->prepareToScrollRatio(ratio);
}
void FrameScroller::prepareToScrollRatio(const CellPositionRatio &ratio) {
QPoint offset = orientation()->positionRatioToXY(ratio);
@@ -610,7 +607,7 @@ void SpreadsheetViewer::scroll(QPoint delta) {
}
void SpreadsheetViewer::onPrepareToScrollOffset(const QPoint &offset) {
- refreshContentSize(offset.x(), offset.y());
+ refreshContentSize(offset.x(), offset.y());
}
void SpreadsheetViewer::setAutoPanSpeed(const QPoint &speed) {