Skip to content

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

C

Ready for testing

Jeremy Bullock45a41cc78ba7
diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp
index db06b41fe..c647ff0f8 100644
--- a/toonz/sources/toonz/filmstrip.cpp
+++ b/toonz/sources/toonz/filmstrip.cpp
@@ -723,7 +723,8 @@ void FilmstripFrames::paintEvent(QPaintEvent *evt) {
}
// navigator rect
- if (naviRect.isValid() && fid >= 0 && fid == getCurrentFrameId()) {
+ if (m_showNavigator && naviRect.isValid() && fid >= 0 &&
+ fid == getCurrentFrameId()) {
p.setPen(QPen(Qt::red, 1));
if (m_isVertical) {
p.drawRect(naviRect.translated(0, oneFrameHeight * i));
@@ -766,29 +767,43 @@ void FilmstripFrames::drawFrameIcon(QPainter &p, const QRect &r, int index,
p.drawPixmap(r.left(), r.top(), pm);
if (sl && sl->getType() == PLI_XSHLEVEL && flags & F_INBETWEEN_RANGE) {
- int x1 = r.right();
- int x0 = x1 - 12;
- int y0 = r.top();
- int y1 = r.bottom();
- p.fillRect(x0, y0, x1 - x0 + 1, y1 - y0 + 1, QColor(180, 180, 180, 255));
- p.setPen(Qt::black);
- p.drawLine(x0 - 1, y0, x0 - 1, y1);
-
- QPixmap inbetweenPixmap(
- svgToPixmap(":Resources/filmstrip_inbetween.svg"));
-
- if (r.height() - 6 < inbetweenPixmap.height()) {
- QSize rectSize(inbetweenPixmap.size());
- rectSize.setHeight(r.height() - 6);
- inbetweenPixmap = inbetweenPixmap.scaled(
- rectSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- }
+ if (m_isVertical) {
+ int x1 = r.right();
+ int x0 = x1 - 12;
+ int y0 = r.top();
+ int y1 = r.bottom();
+ p.fillRect(x0, y0, x1 - x0 + 1, y1 - y0 + 1,
+ QColor(180, 180, 180, 255));
+ p.setPen(Qt::black);
+ p.drawLine(x0 - 1, y0, x0 - 1, y1);
+
+ QPixmap inbetweenPixmap(
+ svgToPixmap(":Resources/filmstrip_inbetween.svg"));
+
+ if (r.height() - 6 < inbetweenPixmap.height()) {
+ QSize rectSize(inbetweenPixmap.size());
+ rectSize.setHeight(r.height() - 6);
+ inbetweenPixmap = inbetweenPixmap.scaled(
+ rectSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ }
- p.drawPixmap(
- x0 + 2,
- y1 - inbetweenPixmap.height() / inbetweenPixmap.devicePixelRatio() -
- 3,
- inbetweenPixmap);
+ p.drawPixmap(
+ x0 + 2,
+ y1 - inbetweenPixmap.height() / inbetweenPixmap.devicePixelRatio() -
+ 3,
+ inbetweenPixmap);
+ } else {
+ int x1 = r.right();
+ int x0 = r.left();
+ int y0 = r.bottom() - 15;
+ int y1 = r.bottom();
+ p.fillRect(x0, y0, x1 - x0 + 1, y1 - y0 + 1,
+ QColor(180, 180, 180, 255));
+ p.setPen(Qt::black);
+ p.drawLine(x0, y0, x1, y0);
+ p.drawText(r, tr("INBETWEEN"),
+ QTextOption(Qt::AlignBottom | Qt::AlignHCenter));
+ }
}
} else {
// non riesco (per qualche ragione) a visualizzare l'icona
@@ -866,9 +881,11 @@ void FilmstripFrames::mousePressEvent(QMouseEvent *event) {
(sl->getType() == TZP_XSHLEVEL || sl->getType() == OVL_XSHLEVEL) &&
m_viewer && m_viewer->isVisible() && actualIconClicked &&
event->button() == Qt::MiddleButton) {
- m_isNavigatorPanning = true;
- execNavigatorPan(event->pos());
- QApplication::setOverrideCursor(Qt::ClosedHandCursor);
+ if (m_showNavigator) {
+ m_isNavigatorPanning = true;
+ execNavigatorPan(event->pos());
+ QApplication::setOverrideCursor(Qt::ClosedHandCursor);
+ }
} else
m_isNavigatorPanning = false;
// end of navigator section
@@ -885,7 +902,8 @@ void FilmstripFrames::mousePressEvent(QMouseEvent *event) {
inbetweenSelected = event->pos().x() > width() - 20 - fs_rightMargin;
else
inbetweenSelected =
- event->pos().y() > height() - 20 - fs_iconMarginBottom;
+ event->pos().y() > height() - fs_iconMarginBottom - 20 &&
+ event->pos().y() < height() - fs_iconMarginBottom - fs_frameSpacing;
// with shift or control
if (event->modifiers() & Qt::ShiftModifier) {
@@ -1002,7 +1020,7 @@ void FilmstripFrames::mouseMoveEvent(QMouseEvent *e) {
if (!m_isVertical) index = x2index(e->pos().x());
if (e->buttons() & Qt::LeftButton || e->buttons() & Qt::MiddleButton) {
// navigator pan
- if (m_isNavigatorPanning) {
+ if (m_showNavigator && m_isNavigatorPanning) {
execNavigatorPan(e->pos());
e->accept();
return;
@@ -1087,11 +1105,17 @@ void FilmstripFrames::mouseMoveEvent(QMouseEvent *e) {
TFrameId fid = index2fid(index);
TXshSimpleLevel *sl = getLevel();
- if (sl && m_selection && sl->getType() == PLI_XSHLEVEL &&
+ if (m_isVertical && sl && m_selection && sl->getType() == PLI_XSHLEVEL &&
m_selection->isInInbetweenRange(fid) &&
e->pos().x() > width() - 20 - fs_rightMargin) {
setToolTip(tr("Auto Inbetween"));
}
+ if (!m_isVertical && sl && m_selection && sl->getType() == PLI_XSHLEVEL &&
+ m_selection->isInInbetweenRange(fid) &&
+ e->pos().y() > height() - 15 - fs_iconMarginBottom &&
+ e->pos().y() < height() - fs_iconMarginBottom - fs_frameSpacing) {
+ setToolTip(tr("Auto Inbetween"));
+ }
}
}
@@ -1247,16 +1271,39 @@ void FilmstripFrames::contextMenuEvent(QContextMenuEvent *event) {
menu->addAction(cm->getAction(MI_RevertToLastSaved));
menu->addSeparator();
- QAction *toggleOrientation = menu->addAction(tr("Toggle Orientation"));
-
+ QMenu *panelMenu = menu->addMenu(tr("Panel Settings"));
+ QAction *toggleOrientation = panelMenu->addAction(tr("Toggle Orientation"));
+ QAction *hideComboBox = panelMenu->addAction(tr("Show/Hide Drop Down Menu"));
+ QAction *hideNavigator =
+ panelMenu->addAction(tr("Show/Hide Level Navigator"));
+ hideComboBox->setCheckable(true);
+ hideComboBox->setChecked(m_showComboBox);
+ hideNavigator->setCheckable(true);
+ hideNavigator->setChecked(m_showNavigator);
connect(toggleOrientation, SIGNAL(triggered(bool)), this,
SLOT(orientationToggled(bool)));
+ connect(hideComboBox, SIGNAL(triggered(bool)), this,
+ SLOT(comboBoxToggled(bool)));
+ connect(hideNavigator, SIGNAL(triggered(bool)), this,
+ SLOT(navigatorToggled(bool)));
menu->exec(event->globalPos());
}
//-----------------------------------------------------------------------------
+void FilmstripFrames::comboBoxToggled(bool ignore) {
+ emit(comboBoxToggledSignal());
+}
+
+//-----------------------------------------------------------------------------
+
+void FilmstripFrames::navigatorToggled(bool ignore) {
+ emit(navigatorToggledSignal());
+}
+
+//-----------------------------------------------------------------------------
+
void FilmstripFrames::orientationToggled(bool ignore) {
m_isVertical = !m_isVertical;
emit(orientationToggledSignal(m_isVertical));
@@ -1291,6 +1338,18 @@ void FilmstripFrames::setOrientation(bool isVertical) {
//-----------------------------------------------------------------------------
+void FilmstripFrames::setNavigator(bool showNavigator) {
+ m_showNavigator = showNavigator;
+}
+
+//-----------------------------------------------------------------------------
+
+void FilmstripFrames::setComboBox(bool showComboBox) {
+ m_showComboBox = showComboBox;
+}
+
+//-----------------------------------------------------------------------------
+
void FilmstripFrames::onLevelChanged() {
if (m_isVertical)
updateContentHeight();
@@ -1421,7 +1480,6 @@ Filmstrip::Filmstrip(QWidget *parent, Qt::WFlags flags)
m_frameArea->setWidget(m_frames);
m_chooseLevelCombo->setMaxVisibleItems(50);
-
// layout
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->setMargin(0);
@@ -1443,6 +1501,10 @@ Filmstrip::Filmstrip(QWidget *parent, Qt::WFlags flags)
SLOT(onChooseLevelComboChanged(int)));
connect(m_frames, SIGNAL(orientationToggledSignal(bool)), this,
SLOT(orientationToggled(bool)));
+ connect(m_frames, SIGNAL(comboBoxToggledSignal()), this,
+ SLOT(comboBoxToggled()));
+ connect(m_frames, SIGNAL(navigatorToggledSignal()), this,
+ SLOT(navigatorToggled()));
}
//-----------------------------------------------------------------------------
@@ -1767,6 +1829,24 @@ void Filmstrip::orientationToggled(bool isVertical) {
//-----------------------------------------------------------------------------
+void Filmstrip::comboBoxToggled() {
+ if (m_chooseLevelCombo->isHidden())
+ m_chooseLevelCombo->show();
+ else
+ m_chooseLevelCombo->hide();
+ m_showComboBox = !m_chooseLevelCombo->isHidden();
+ m_frames->setComboBox(m_showComboBox);
+}
+
+//-----------------------------------------------------------------------------
+
+void Filmstrip::navigatorToggled() {
+ m_showNavigator = !m_showNavigator;
+ m_frames->setNavigator(m_showNavigator);
+}
+
+//-----------------------------------------------------------------------------
+
void Filmstrip::setOrientation(bool isVertical) {
m_isVertical = isVertical;
if (isVertical) {
@@ -1786,12 +1866,33 @@ void Filmstrip::save(QSettings &settings) const {
UINT orientation = 0;
orientation = m_isVertical ? 1 : 0;
settings.setValue("vertical", orientation);
+
+ UINT showCombo = 0;
+ showCombo = m_chooseLevelCombo->isHidden() ? 0 : 1;
+ settings.setValue("showCombo", showCombo);
+
+ UINT navigator = 0;
+ navigator = m_showNavigator ? 1 : 0;
+ settings.setValue("navigator", navigator);
}
void Filmstrip::load(QSettings &settings) {
UINT orientation = settings.value("vertical", 1).toUInt();
m_isVertical = orientation == 1;
setOrientation(m_isVertical);
+
+ UINT navigator = settings.value("navigator", 1).toUInt();
+ m_showNavigator = navigator == 1;
+ m_frames->setNavigator(m_showNavigator);
+
+ UINT showCombo = settings.value("showCombo", 1).toUInt();
+ m_showComboBox = showCombo == 1;
+ if (showCombo == 1) {
+ m_chooseLevelCombo->show();
+ } else {
+ m_chooseLevelCombo->hide();
+ }
+ m_frames->setComboBox(m_showComboBox);
}
//=============================================================================
diff --git a/toonz/sources/toonz/filmstrip.h b/toonz/sources/toonz/filmstrip.h
index ba7aecd44..c9e3b79c5 100644
--- a/toonz/sources/toonz/filmstrip.h
+++ b/toonz/sources/toonz/filmstrip.h
@@ -49,7 +49,9 @@ public:
#endif
~FilmstripFrames();
- bool m_isVertical = true;
+ bool m_isVertical = true;
+ bool m_showNavigator = true;
+ bool m_showComboBox = true;
void setBGColor(const QColor &color) { m_bgColor = color; }
QColor getBGColor() const { return m_bgColor; }
@@ -119,9 +121,13 @@ public:
int getOneFrameHeight();
int getOneFrameWidth();
void setOrientation(bool isVertical);
+ void setNavigator(bool showNavigator);
+ void setComboBox(bool showComboBox);
signals:
void orientationToggledSignal(bool);
+ void comboBoxToggledSignal();
+ void navigatorToggledSignal();
protected:
void showEvent(QShowEvent *) override;
@@ -162,6 +168,8 @@ protected slots:
void onFrameSwitched();
void getViewer();
void orientationToggled(bool);
+ void comboBoxToggled(bool);
+ void navigatorToggled(bool);
private:
// QSS Properties
@@ -223,7 +231,9 @@ class Filmstrip final : public QWidget, public SaveLoadQSettings {
std::vector<TXshSimpleLevel *> m_levels;
std::map<TXshSimpleLevel *, TFrameId> m_workingFrames;
- bool m_isVertical = true;
+ bool m_isVertical = true;
+ bool m_showNavigator = true;
+ bool m_showComboBox = true;
public:
#if QT_VERSION >= 0x050500
@@ -261,6 +271,8 @@ public slots:
void onFrameSwitched();
void orientationToggled(bool);
+ void comboBoxToggled();
+ void navigatorToggled();
private:
void updateWindowTitle();
diff --git a/toonz/sources/toonz/frameheadgadget.cpp b/toonz/sources/toonz/frameheadgadget.cpp
index c3dedd04b..9c920f5fe 100644
--- a/toonz/sources/toonz/frameheadgadget.cpp
+++ b/toonz/sources/toonz/frameheadgadget.cpp
@@ -297,6 +297,8 @@ FilmstripFrameHeadGadget::FilmstripFrameHeadGadget(FilmstripFrames *filmstrip)
: m_filmstrip(filmstrip)
, m_dy(m_filmstrip->getIconSize().height() + fs_frameSpacing +
fs_iconMarginTop + fs_iconMarginBottom)
+ , m_dx(m_filmstrip->getIconSize().width() + fs_frameSpacing +
+ fs_leftMargin + fs_rightMargin + fs_iconMarginLR)
, m_highlightedghostFrame(-1) {}
int FilmstripFrameHeadGadget::getY() const { return 50; }
@@ -305,6 +307,12 @@ int FilmstripFrameHeadGadget::index2y(int index) const { return index * m_dy; }
int FilmstripFrameHeadGadget::y2index(int y) const { return y / m_dy; }
+int FilmstripFrameHeadGadget::getX() const { return 50; }
+
+int FilmstripFrameHeadGadget::index2x(int index) const { return index * m_dx; }
+
+int FilmstripFrameHeadGadget::x2index(int x) const { return x / m_dx; }
+
void FilmstripFrameHeadGadget::setCurrentFrame(int index) const {
TXshSimpleLevel *level = m_filmstrip->getLevel();
if (!level) return;
@@ -339,6 +347,7 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
int i;
// OnionSkinの円の左上座標のy値
int onionDotYPos = m_dy / 2 - 5;
+ int onionDotXPos = m_dx / 2 - 5;
p.setPen(Qt::red);
//--- OnionSkinが有効なら実線、無効なら点線
@@ -356,8 +365,12 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
//上向きのハンドル:1フレーム目のときは描画しない
if (currentRow > 0) {
int y0 = index2y(currentRow) - 15;
+ int x0 = index2x(currentRow) - 15;
p.setBrush(QBrush(backColor));
- p.drawChord(handleRect.translated(0, y0), 0, angle180);
+ if (m_filmstrip->m_isVertical)
+ p.drawChord(handleRect.translated(0, y0), 0, angle180);
+ else
+ p.drawChord(handleRect.translated(x0, 0), 16 * 90, angle180);
}
//下向きのハンドル:最終フレームの時は描画しない
@@ -366,8 +379,13 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
int frameCount = (int)fids.size();
if (currentRow < frameCount - 1) {
int y1 = index2y(currentRow + 1) - 15;
+ int x1 = index2x(currentRow + 1) - 15;
p.setBrush(QBrush(frontColor));
- p.drawChord(handleRect.translated(0, y1), angle180, angle180);
+
+ if (m_filmstrip->m_isVertical)
+ p.drawChord(handleRect.translated(0, y1), angle180, angle180);
+ else
+ p.drawChord(handleRect.translated(x1, 0), 16 * 90, -angle180);
}
//--- 動く Onion Skinの描画 その1
@@ -384,15 +402,29 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
// min/maxが更新されていたら、線を描く
if (minMos < 0) //上方向に伸ばす線
{
- int y0 = index2y(currentRow + minMos) + onionDotYPos + 10; // 10は●の直径
- int y1 = index2y(currentRow) - 15;
- p.drawLine(15, y0, 15, y1);
+ if (m_filmstrip->m_isVertical) {
+ int y0 =
+ index2y(currentRow + minMos) + onionDotYPos + 10; // 10は●の直径
+ int y1 = index2y(currentRow) - 15;
+ p.drawLine(15, y0, 15, y1);
+ } else {
+ int x0 =
+ index2x(currentRow + minMos) + onionDotXPos + 10; // 10は●の直径
+ int x1 = index2x(currentRow) - 15;
+ p.drawLine(x0, 15, x1, 15);
+ }
}
if (maxMos > 0) //下方向に伸ばす線
{
- int y0 = index2y(currentRow + 1) + 15;
- int y1 = index2y(currentRow + maxMos) + onionDotYPos;
- p.drawLine(15, y0, 15, y1);
+ if (m_filmstrip->m_isVertical) {
+ int y0 = index2y(currentRow + 1) + 15;
+ int y1 = index2y(currentRow + maxMos) + onionDotYPos;
+ p.drawLine(15, y0, 15, y1);
+ } else {
+ int x0 = index2x(currentRow + 1) + 15;
+ int x1 = index2x(currentRow + maxMos) + onionDotXPos;
+ p.drawLine(x0, 15, x1, 15);
+ }
}
}
@@ -401,11 +433,15 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
int fos = osMask.getFos(i);
// if(fos == currentRow) continue;
int y = index2y(fos) + onionDotYPos;
+ int x = index2x(fos) + onionDotXPos;
p.setPen(Qt::red);
// OnionSkinがDisableなら中空にする
p.setBrush(osMask.isEnabled() ? QBrush(QColor(0, 255, 255, 128))
: Qt::NoBrush);
- p.drawEllipse(0, y, 10, 10);
+ if (m_filmstrip->m_isVertical)
+ p.drawEllipse(0, y, 10, 10);
+ else
+ p.drawEllipse(x, 0, 10, 10);
}
//---
@@ -420,10 +456,14 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
if (currentRow + mos == m_highlightedMosFrame) continue;
int y = index2y(currentRow + mos) + onionDotYPos;
+ int x = index2x(currentRow + mos) + onionDotXPos;
p.setBrush(mos < 0 ? backColor : frontColor);
- p.drawEllipse(10, y, 10, 10);
+ if (m_filmstrip->m_isVertical)
+ p.drawEllipse(10, y, 10, 10);
+ else
+ p.drawEllipse(x, 10, 10, 10);
}
// Fix Onion Skin ハイライトの描画
@@ -432,14 +472,20 @@ void FilmstripFrameHeadGadget::drawOnionSkinSelection(QPainter &p,
if (m_highlightedFosFrame >= 0 && m_highlightedFosFrame != currentRow) {
p.setPen(QColor(255, 128, 0));
p.setBrush(QBrush(QColor(255, 255, 0, 200)));
- p.drawEllipse(0, index2y(m_highlightedFosFrame) + onionDotYPos, 10, 10);
+ if (m_filmstrip->m_isVertical)
+ p.drawEllipse(0, index2y(m_highlightedFosFrame) + onionDotYPos, 10, 10);
+ else
+ p.drawEllipse(index2x(m_highlightedFosFrame) + onionDotXPos, 0, 10, 10);
}
//通常のOnion Skin ハイライトの描画
if (m_highlightedMosFrame >= 0 && m_highlightedMosFrame != currentRow) {
p.setPen(QColor(255, 128, 0));
p.setBrush(QBrush(QColor(255, 255, 0, 200)));
- p.drawEllipse(10, index2y(m_highlightedMosFrame) + onionDotYPos, 10, 10);
+ if (m_filmstrip->m_isVertical)
+ p.drawEllipse(10, index2y(m_highlightedMosFrame) + onionDotYPos, 10, 10);
+ else
+ p.drawEllipse(index2x(m_highlightedMosFrame) + onionDotXPos, 10, 10, 10);
}
}
@@ -463,23 +509,43 @@ void FilmstripFrameHeadGadget::drawShiftTraceMarker(QPainter &p) {
const int shiftTraceDotSize = 12;
const int shiftTraceDotXOffset = 3;
+ const int shiftTraceDotYOffset = 3;
int dotYPos = (m_dy - shiftTraceDotSize) / 2;
+ int dotXPos = (m_dx - shiftTraceDotSize) / 2;
if (currentRow > 0 && prevOffset < 0) // previous ghost
{
- p.setPen(backColor);
- int y0 = index2y(currentRow + prevOffset) + dotYPos + shiftTraceDotSize;
- int y1 = index2y(currentRow);
- p.drawLine(shiftTraceDotXOffset + shiftTraceDotSize / 2, y0,
- shiftTraceDotXOffset + shiftTraceDotSize / 2, y1);
+ if (m_filmstrip->m_isVertical) {
+ p.setPen(backColor);
+ int y0 = index2y(currentRow + prevOffset) + dotYPos + shiftTraceDotSize;
+ int y1 = index2y(currentRow);
+ p.drawLine(shiftTraceDotXOffset + shiftTraceDotSize / 2, y0,
+ shiftTraceDotXOffset + shiftTraceDotSize / 2, y1);
+ } else {
+ p.setPen(backColor);
+ int x0 = index2x(currentRow + prevOffset) + dotXPos + shiftTraceDotSize;
+ int x1 = index2x(currentRow);
+ p.drawLine(x0, shiftTraceDotYOffset + shiftTraceDotSize / 2, x1,
+ shiftTraceDotYOffset + shiftTraceDotSize / 2);
+ }
}
if (forwardOffset > 0) // forward ghost
{
- p.setPen(frontColor);
- int y0 = index2y(currentRow + 1);
- int y1 = index2y(currentRow + forwardOffset) + dotYPos + shiftTraceDotSize;
- p.drawLine(shiftTraceDotXOffset + shiftTraceDotSize / 2, y0,
- shiftTraceDotXOffset + shiftTraceDotSize / 2, y1);
+ if (m_filmstrip->m_isVertical) {
+ p.setPen(frontColor);
+ int y0 = index2y(currentRow + 1);
+ int y1 =
+ index2y(currentRow + forwardOffset) + dotYPos + shiftTraceDotSize;
+ p.drawLine(shiftTraceDotXOffset + shiftTraceDotSize / 2, y0,
+ shiftTraceDotXOffset + shiftTraceDotSize / 2, y1);
+ } else {
+ p.setPen(frontColor);
+ int x0 = index2x(currentRow + 1);
+ int x1 =
+ index2x(currentRow + forwardOffset) + dotXPos + shiftTraceDotSize;
+ p.drawLine(x0, shiftTraceDotYOffset + shiftTraceDotSize / 2, x1,
+ shiftTraceDotYOffset + shiftTraceDotSize / 2);
+ }
}
// draw dots
std::vector<int> offsVec = {prevOffset, 0, forwardOffset};
@@ -493,9 +559,17 @@ void FilmstripFrameHeadGadget::drawShiftTraceMarker(QPainter &p) {
if (i != 1 && offsVec[i] == 0) continue;
p.setPen(colorsVec[i]);
p.setBrush(Qt::gray);
- int topPos = index2y(currentRow + offsVec[i]) + dotYPos;
- QRect dotRect(shiftTraceDotXOffset, topPos, shiftTraceDotSize,
- shiftTraceDotSize);
+ int topPos;
+ QRect dotRect;
+ if (m_filmstrip->m_isVertical) {
+ topPos = index2y(currentRow + offsVec[i]) + dotYPos;
+ dotRect = QRect(shiftTraceDotXOffset, topPos, shiftTraceDotSize,
+ shiftTraceDotSize);
+ } else {
+ topPos = index2x(currentRow + offsVec[i]) + dotXPos;
+ dotRect = QRect(topPos, shiftTraceDotYOffset, shiftTraceDotSize,
+ shiftTraceDotSize);
+ }
p.drawRect(dotRect);
// draw shortcut numbers
@@ -508,9 +582,17 @@ void FilmstripFrameHeadGadget::drawShiftTraceMarker(QPainter &p) {
if (m_highlightedghostFrame >= 0) {
p.setPen(QColor(255, 255, 0));
p.setBrush(QColor(255, 255, 0, 180));
- int topPos = index2y(m_highlightedghostFrame) + dotYPos;
- QRect dotRect(shiftTraceDotXOffset, topPos, shiftTraceDotSize,
- shiftTraceDotSize);
+ int topPos;
+ QRect dotRect;
+ if (m_filmstrip->m_isVertical) {
+ topPos = index2y(m_highlightedghostFrame) + dotYPos;
+ dotRect = QRect(shiftTraceDotXOffset, topPos, shiftTraceDotSize,
+ shiftTraceDotSize);
+ } else {
+ topPos = index2x(m_highlightedghostFrame) + dotXPos;
+ dotRect = QRect(topPos, shiftTraceDotYOffset, shiftTraceDotSize,
+ shiftTraceDotSize);
+ }
p.drawRect(dotRect);
}
}
@@ -538,14 +620,22 @@ bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) {
//それぞれのパーツの位置Rectの指定。各フレームの右上座標からのオフセットも含む。
// OnionSkinの円の左上座標のy値
int onionDotYPos = m_dy / 2 - 5;
+ int onionDotXPos = m_dx / 2 - 5;
// OnionSkinの●のRect
QRect onionDotRect(10, onionDotYPos, 10, 10);
+ if (!m_filmstrip->m_isVertical)
+ onionDotRect = QRect(onionDotXPos, 10, 10, 10);
// FixedOnionSkinの●のRect
QRect fixedOnionDotRect(0, onionDotYPos, 10, 10);
+ if (!m_filmstrip->m_isVertical)
+ fixedOnionDotRect = QRect(onionDotXPos, 0, 10, 10);
//上方向のOnionSkinタブのRect
QRect backOnionTabRect(0, m_dy - 15, 30, 15);
+ if (!m_filmstrip->m_isVertical)
+ backOnionTabRect = QRect(m_dx - 15, 0, 15, 30);
//下方向のOnionSkinタブのRect
QRect frontOnionTabRect(0, 0, 30, 15);
+ if (!m_filmstrip->m_isVertical) frontOnionTabRect = QRect(0, 0, 15, 30);
//-----
//----- ハイライト表示、actionのリセット
@@ -563,13 +653,16 @@ bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) {
//----- 以下、クリック位置に応じてアクションを変えていく
//クリックされたフレームを取得
- QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
- int frame = y2index(mouseEvent->pos().y());
- m_buttonPressCellIndex = frame;
- int currentFrame = getCurrentFrame();
+ QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
+ int frame = y2index(mouseEvent->pos().y());
+ if (!m_filmstrip->m_isVertical) frame = x2index(mouseEvent->pos().x());
+ m_buttonPressCellIndex = frame;
+ int currentFrame = getCurrentFrame();
//各フレーム左上からの位置
QPoint clickedPos = mouseEvent->pos() + QPoint(0, -index2y(frame));
+ if (!m_filmstrip->m_isVertical)
+ clickedPos = mouseEvent->pos() + QPoint(-index2x(frame), 0);
//カレントフレームの場合、無視
if (frame == currentFrame) return false;
@@ -608,15 +701,21 @@ bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) {
else if (e->type() == QEvent::MouseButtonDblClick) {
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
if (mouseEvent->buttons() & Qt::LeftButton) {
- int frame = y2index(mouseEvent->pos().y());
+ int frame = y2index(mouseEvent->pos().y());
+ if (!m_filmstrip->m_isVertical) frame = x2index(mouseEvent->pos().x());
//各フレーム左上からの位置
QPoint clickedPos = mouseEvent->pos() + QPoint(0, -index2y(frame));
+ if (!m_filmstrip->m_isVertical)
+ clickedPos = mouseEvent->pos() + QPoint(-index2x(frame), 0);
//カレントフレーム
int currentFrame = getCurrentFrame();
//上方向のOnionSkinタブのRect
QRect backOnionTabRect(0, m_dy - 15, 30, 15);
+ if (!m_filmstrip->m_isVertical)
+ backOnionTabRect = QRect(m_dx - 15, 0, 15, 30);
//下方向のOnionSkinタブのRect
QRect frontOnionTabRect(0, 0, 30, 15);
+ if (!m_filmstrip->m_isVertical) frontOnionTabRect = QRect(0, 0, 15, 30);
if ((currentFrame - 1 == frame &&
backOnionTabRect.contains(clickedPos)) ||
(currentFrame + 1 == frame &&
@@ -629,10 +728,13 @@ bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) {
}
//----
else if (e->type() == QEvent::MouseMove) {
- QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
- int frame = y2index(mouseEvent->pos().y());
+ QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
+ int frame = y2index(mouseEvent->pos().y());
+ if (!m_filmstrip->m_isVertical) frame = x2index(mouseEvent->pos().x());
//各フレーム左上からの位置
QPoint clickedPos = mouseEvent->pos() + QPoint(0, -index2y(frame));
+ if (!m_filmstrip->m_isVertical)
+ clickedPos = mouseEvent->pos() + QPoint(-index2x(frame), 0);
//カレントフレーム
int currentFrame = getCurrentFrame();
//マウスボタンが押されていない場合
@@ -641,15 +743,22 @@ bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) {
//それぞれのパーツの位置Rectの指定。各フレームの右上座標からのオフセットも含む。
// OnionSkinの円の左上座標のy値
int onionDotYPos = m_dy / 2 - 5;
- // OnionSkinの●のRect
+ int onionDotXPos = m_dx / 2 - 5;
+
QRect onionDotRect(10, onionDotYPos, 10, 10);
+ if (!m_filmstrip->m_isVertical)
+ onionDotRect = QRect(onionDotXPos, 10, 10, 10);
// FixedOnionSkinの●のRect
QRect fixedOnionDotRect(0, onionDotYPos, 10, 10);
+ if (!m_filmstrip->m_isVertical)
+ fixedOnionDotRect = QRect(onionDotXPos, 0, 10, 10);
//上方向のOnionSkinタブのRect
QRect backOnionTabRect(0, m_dy - 15, 30, 15);
+ if (!m_filmstrip->m_isVertical)
+ backOnionTabRect = QRect(m_dx - 15, 0, 15, 30);
//下方向のOnionSkinタブのRect
QRect frontOnionTabRect(0, 0, 30, 15);
- //-----
+ if (!m_filmstrip->m_isVertical) frontOnionTabRect = QRect(0, 0, 15, 30);
//----- Fixed Onion Skin の ハイライト
int highlightedFrame;
@@ -737,9 +846,15 @@ bool FilmstripFrameHeadGadget::shiftTraceEventFilter(QObject *obj, QEvent *e) {
const int shiftTraceDotSize = 12;
const int shiftTraceDotXOffset = 3;
+ const int shiftTraceDotYOffset = 3;
int dotYPos = (m_dy - shiftTraceDotSize) / 2;
+ int dotXPos = (m_dx - shiftTraceDotSize) / 2;
QRect dotRect(shiftTraceDotXOffset, dotYPos, shiftTraceDotSize,
shiftTraceDotSize);
+ if (!m_filmstrip->m_isVertical) {
+ dotRect = QRect(dotXPos, shiftTraceDotYOffset, shiftTraceDotSize,
+ shiftTraceDotSize);
+ }
// reset highlight
if (m_highlightedghostFrame >= 0) {
@@ -747,14 +862,22 @@ bool FilmstripFrameHeadGadget::shiftTraceEventFilter(QObject *obj, QEvent *e) {
viewer->update();
}
- QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
- int frame = y2index(mouseEvent->pos().y());
+ QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e);
+ int frame = y2index(mouseEvent->pos().y());
+ if (!m_filmstrip->m_isVertical) frame = x2index(mouseEvent->pos().x());
// position from top-left of the frame
- QPoint mousePos = mouseEvent->pos() + QPoint(0, -index2y(frame));
+ QPoint mousePos = mouseEvent->pos() + QPoint(0, -index2y(frame));
+ if (!m_filmstrip->m_isVertical)
+ mousePos = mouseEvent->pos() + QPoint(-index2x(frame), 0);
int currentFrame = getCurrentFrame();
- if (mousePos.x() < dotRect.left() || mousePos.x() > dotRect.right())
- return false;
+ if (m_filmstrip->m_isVertical) {
+ if (mousePos.x() < dotRect.left() || mousePos.x() > dotRect.right())
+ return false;
+ } else {
+ if (mousePos.y() < dotRect.top() || mousePos.y() > dotRect.bottom())
+ return false;
+ }
if (e->type() == QEvent::MouseButtonPress) {
if (frame == currentFrame) {
diff --git a/toonz/sources/toonz/frameheadgadget.h b/toonz/sources/toonz/frameheadgadget.h
index 9e4f8ae29..a1c31c365 100644
--- a/toonz/sources/toonz/frameheadgadget.h
+++ b/toonz/sources/toonz/frameheadgadget.h
@@ -72,7 +72,7 @@ public:
class FilmstripFrameHeadGadget final : public FrameHeadGadget {
Q_OBJECT
FilmstripFrames *m_filmstrip;
- int m_dy;
+ int m_dy, m_dx;
int m_highlightedghostFrame;
public:
@@ -82,6 +82,10 @@ public:
int index2y(int index) const override;
int y2index(int y) const override;
+ int getX() const;
+ int index2x(int index) const;
+ int x2index(int y) const;
+
void drawOnionSkinSelection(QPainter &p, const QColor &lightColor,
const QColor &darkColor) override;