diff --git a/toonz/sources/include/orientation.h b/toonz/sources/include/orientation.h index 58584cd..df129d6 100644 --- a/toonz/sources/include/orientation.h +++ b/toonz/sources/include/orientation.h @@ -23,8 +23,8 @@ #include #include -using std::vector; using std::map; +using std::vector; // Defines timeline direction: top to bottom; left to right. // old (vertical timeline) = new (universal) = old (kept) @@ -59,8 +59,10 @@ class QPainterPath; //! of a cell) enum class PredefinedRect { CELL, //! size of a cell + CAMERA_CELL, //! size of a cell of the camera column DRAG_HANDLE_CORNER, //! area for dragging a cell KEY_ICON, //! position of key icon + CAMERA_KEY_ICON, //! position of key icon in the camera column CELL_NAME, //! cell name box CELL_NAME_WITH_KEYFRAME, //! cell name box when keyframe is displayed END_EXTENDER, //! bottom / right extender @@ -77,11 +79,12 @@ enum class PredefinedRect { 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 + CAMERA_LAYER_HEADER, + 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,26 +94,34 @@ 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 - LAYER_NUMBER, //! where to display column number. + LOCK_AREA, //! clickable area larger than lock icon, containing it + LOCK, //! the lock icon itself + CAMERA_LOCK_AREA, //! lock area for the camera column + CAMERA_LOCK, //! the lock icon for camera column + DRAG_LAYER, //! draggable area in layer header + LAYER_NAME, //! where to display column name. clicking will rename + CAMERA_LAYER_NAME, //! where to display the camera column name + 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 + CAMERA_LOOP_ICON, //! area for repeat icon in the camera column 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 + CAMERA_ICON_AREA, //! area for the camera column icon + CAMERA_ICON, //! the actual camera column icon 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 CONFIG_AREA, //! clickable area larger than the config icon, containing it CONFIG, //! the config icon itself - FRAME_MARKER_AREA, //! Cell's frame indicator - FRAME_INDICATOR, //! Row # indicator + CAMERA_CONFIG_AREA, //! config area for the camera column + CAMERA_CONFIG, //! the config icon for camera column + FRAME_MARKER_AREA, //! Cell's frame indicator + FRAME_INDICATOR, //! Row # indicator ZOOM_SLIDER_AREA, ZOOM_SLIDER, ZOOM_IN_AREA, @@ -142,6 +153,7 @@ enum class PredefinedDimension { ONION_TURN, //! onion handle turn in degrees QBOXLAYOUT_DIRECTION, //! direction of QBoxLayout CENTER_ALIGN, //! horizontal / vertical align + CAMERA_LAYER //! width of a camera column / height of camera row }; enum class PredefinedPath { DRAG_HANDLE_CORNER, //! triangle corner at drag sidebar @@ -177,6 +189,7 @@ enum class PredefinedFlag { PREVIEW_LAYER_AREA_BORDER, PREVIEW_LAYER_AREA_VISIBLE, CONFIG_AREA_BORDER, + CAMERA_CONFIG_AREA_BORDER, CONFIG_AREA_VISIBLE, PEGBAR_NAME_BORDER, PEGBAR_NAME_VISIBLE, @@ -184,6 +197,7 @@ enum class PredefinedFlag { PARENT_HANDLE_NAME_VISIBILE, THUMBNAIL_AREA_BORDER, THUMBNAIL_AREA_VISIBLE, + CAMERA_ICON_VISIBLE, VOLUME_AREA_VERTICAL }; @@ -200,14 +214,14 @@ protected: public: virtual CellPosition xyToPosition(const QPoint &xy, - const ColumnFan *fan) const = 0; + const ColumnFan *fan) const = 0; virtual QPoint positionToXY(const CellPosition &position, const ColumnFan *fan) const = 0; virtual CellPositionRatio xyToPositionRatio(const QPoint &xy) const = 0; virtual QPoint positionRatioToXY(const CellPositionRatio &ratio) const = 0; virtual int colToLayerAxis(int layer, const ColumnFan *fan) const = 0; - virtual int rowToFrameAxis(int frame) const = 0; + virtual int rowToFrameAxis(int frame) const = 0; virtual QPoint frameLayerToXY(int frameAxis, int layerAxis) const = 0; QRect frameLayerRect(const NumberRange &frameAxis, diff --git a/toonz/sources/include/toonz/columnfan.h b/toonz/sources/include/toonz/columnfan.h index a892725..446eec9 100644 --- a/toonz/sources/include/toonz/columnfan.h +++ b/toonz/sources/include/toonz/columnfan.h @@ -43,6 +43,7 @@ class DVAPI ColumnFan { int m_firstFreePos; int m_unfolded, m_folded; bool m_cameraActive; + int m_cameraColumnDim; /*! Called by activate() and deactivate() to update columns coordinates. */ @@ -55,7 +56,7 @@ Constructs a ColumnFan with default value. ColumnFan(); //! Adjust column sizes when switching orientation - void setDimension(int unfolded); + void setDimensions(int unfolded, int cameraColumn); /*! Set column \b col not folded. diff --git a/toonz/sources/toonz/Resources/camera_small.svg b/toonz/sources/toonz/Resources/camera_small.svg new file mode 100644 index 0000000..157e996 --- /dev/null +++ b/toonz/sources/toonz/Resources/camera_small.svg @@ -0,0 +1,55 @@ + +image/svg+xml + + + + \ No newline at end of file diff --git a/toonz/sources/toonz/toonz.qrc b/toonz/sources/toonz/toonz.qrc index 24811d4..3d013f2 100644 --- a/toonz/sources/toonz/toonz.qrc +++ b/toonz/sources/toonz/toonz.qrc @@ -27,6 +27,7 @@ Resources/brush_rollover.svg Resources/camera.png Resources/camera.svg + Resources/camera_small.svg Resources/camera_selected.png Resources/camerastand_toggle.png Resources/canvas.svg diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index 7f1c23a..17a320d 100644 --- a/toonz/sources/toonz/xshcellviewer.cpp +++ b/toonz/sources/toonz/xshcellviewer.cpp @@ -1302,6 +1302,10 @@ void CellArea::drawExtenderHandles(QPainter &p) { int selRow0, selCol0, selRow1, selCol1; cellSelection->getSelectedCells(selRow0, selCol0, selRow1, selCol1); + + // do nothing if only the camera column is selected + if (selCol1 < 0) return; + QRect selected; selected = m_viewer->rangeToXYRect(CellRange( CellPosition(selRow0, selCol0), CellPosition(selRow1 + 1, selCol1 + 1))); @@ -1665,8 +1669,10 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { TXshCell nextCell; nextCell = xsh->getCell(row + 1, col); // cell in next frame - int frameAdj = m_viewer->getFrameZoomAdjustment(); - QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y)); + int frameAdj = m_viewer->getFrameZoomAdjustment(); + QRect cellRect = + o->rect((col < 0) ? PredefinedRect::CAMERA_CELL : PredefinedRect::CELL) + .translated(QPoint(x, y)); cellRect.adjust(0, 0, -frameAdj, 0); QRect rect = cellRect.adjusted( 1, 1, @@ -2286,9 +2292,14 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) { row0 = std::max(row0, r0); row1 = std::min(row1, r1); + QRect tmpKeyRect = (col >= 0) + ? keyRect + : o->rect(PredefinedRect::CAMERA_KEY_ICON) + .adjusted(-frameAdj / 2, 0, -frameAdj / 2, 0); + /*- first, draw key segments -*/ p.setPen(m_viewer->getTextColor()); - int line_layerAxis = layerAxis + o->layerSide(keyRect).middle(); + int line_layerAxis = layerAxis + o->layerSide(tmpKeyRect).middle(); for (row = row0; row <= row1; row++) { int segmentRow0, segmentRow1; double ease0, ease1; @@ -2303,14 +2314,16 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) { handleRow1)) { QPoint topLeft = m_viewer->positionToXY(CellPosition(handleRow0, col)); - m_viewer->drawPredefinedPath(p, PredefinedPath::BEGIN_EASE_TRIANGLE, - topLeft + QPoint(-frameAdj / 2, 0), - keyFrameColor, outline); + m_viewer->drawPredefinedPath( + p, PredefinedPath::BEGIN_EASE_TRIANGLE, + tmpKeyRect.translated(topLeft).center(), keyFrameColor, + outline); topLeft = m_viewer->positionToXY(CellPosition(handleRow1, col)); - m_viewer->drawPredefinedPath(p, PredefinedPath::END_EASE_TRIANGLE, - topLeft + QPoint(-frameAdj / 2, 0), - keyFrameColor, outline); + m_viewer->drawPredefinedPath( + p, PredefinedPath::END_EASE_TRIANGLE, + tmpKeyRect.translated(topLeft).center(), keyFrameColor, + outline); } } // skip to next segment @@ -2327,7 +2340,7 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) { p.setPen(m_viewer->getTextColor()); if (pegbar->isKeyframe(row)) { QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); - QPoint target = keyRect.translated(xy).topLeft(); + QPoint target = tmpKeyRect.translated(xy).topLeft(); if (!o->isVerticalTimeline() && m_viewer->getFrameZoomFactor() <= 50) { QColor color = Qt::white; int x = xy.x(); @@ -2401,7 +2414,8 @@ void CellArea::drawKeyframeLine(QPainter &p, int col, const NumberRange &rows) const { int frameAdj = m_viewer->getFrameZoomAdjustment(); const QRect &keyRect = m_viewer->orientation() - ->rect(PredefinedRect::KEY_ICON) + ->rect((col < 0) ? PredefinedRect::CAMERA_KEY_ICON + : PredefinedRect::KEY_ICON) .adjusted(-frameAdj / 2, 0, -frameAdj / 2, 0); QPoint begin = keyRect.center() + m_viewer->positionToXY(CellPosition(rows.from(), col)); @@ -2511,10 +2525,11 @@ void CellArea::paintEvent(QPaintEvent *event) { int row = m_viewer->getCurrentRow(); int col = m_viewer->getCurrentColumn(); QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); - QRect rect = m_viewer->orientation() - ->rect(PredefinedRect::CELL) - .translated(xy) - .adjusted(0, 0, -1 - frameAdj, 0); + QRect rect = + m_viewer->orientation() + ->rect((col < 0) ? PredefinedRect::CAMERA_CELL : PredefinedRect::CELL) + .translated(xy) + .adjusted(0, 0, -1 - frameAdj, 0); p.setPen(Qt::black); p.setBrush(Qt::NoBrush); for (int i = 0; i < 2; i++) // thick border within cell @@ -2569,8 +2584,8 @@ bool CellArea::isKeyFrameArea(int col, int row, QPoint mouseInCell) { int frameAdj = m_viewer->getFrameZoomAdjustment(); if (o->isVerticalTimeline()) - return o->rect(PredefinedRect::KEYFRAME_AREA) - .adjusted(-frameAdj / 2, 0, -frameAdj / 2, 0) + return o->rect((col < 0) ? PredefinedRect::CAMERA_CELL + : PredefinedRect::KEYFRAME_AREA) .contains(mouseInCell) && row < k1 + 1; @@ -2700,7 +2715,8 @@ void CellArea::mousePressEvent(QMouseEvent *event) { } } } else if (isKeyframeFrame && row == k1 + 1 && - o->rect(PredefinedRect::LOOP_ICON) + o->rect((col < 0) ? PredefinedRect::CAMERA_LOOP_ICON + : PredefinedRect::LOOP_ICON) .contains(mouseInCell)) { // cycle toggle CycleUndo *undo = new CycleUndo(pegbar, this); undo->redo(); @@ -2852,7 +2868,8 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) { } } } else if (isKeyframeFrame && row == k1 + 1 && - o->rect(PredefinedRect::LOOP_ICON) + o->rect((col < 0) ? PredefinedRect::CAMERA_LOOP_ICON + : 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()) && @@ -3439,6 +3456,11 @@ void CellArea::createKeyLineMenu(QMenu &menu, int row, int col) { if (rType != TDoubleKeyframe::Constant) menu.addAction(cmdManager->getAction(MI_UseConstantInterpolation)); + if (col < 0) { + menu.addSeparator(); + menu.addAction(cmdManager->getAction(MI_SetKeyframes)); + } + #ifdef LINETEST menu.addSeparator(); int paramStep = getParamStep(pegbar, r0); diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index b605dce..7d2fdcf 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -117,7 +117,7 @@ const QIcon getColorChipIcon(TPixel32 color) { } bool isCtrlPressed = false; -} +} // namespace //----------------------------------------------------------------------------- @@ -370,9 +370,9 @@ void ChangeObjectParent::onTextChanged(const QString &text) { hide(); return; } - bool isPegbar = false; + bool isPegbar = false; if (text.startsWith("Peg")) isPegbar = true; - QString number = text; + QString number = text; number.remove(0, 4); int index = number.toInt() - 1; if (index < 0) { @@ -445,7 +445,7 @@ void ChangeObjectHandle::onTextChanged(const QString &text) { assert(m_objectHandle); TStageObjectId currentObjectId = m_objectHandle->getObjectId(); QString handle = text; - if (text.toInt() != 0) handle = QString("H") + handle; + if (text.toInt() != 0) handle = QString("H") + handle; if (handle.isEmpty()) return; std::vector ids; ids.push_back(currentObjectId); @@ -613,7 +613,7 @@ void ColumnArea::DrawHeader::levelColors(QColor &columnColor, } enum { Normal, Reference, Control } usage = Reference; if (column) { - if (column->isControl()) usage = Control; + if (column->isControl()) usage = Control; if (column->isRendered() || column->getMeshColumn()) usage = Normal; } @@ -631,7 +631,7 @@ void ColumnArea::DrawHeader::paletteColors(QColor &columnColor, QColor &dragColor) const { enum { Normal, Reference, Control } usage = Reference; if (column) { // Check if column is a mask - if (column->isControl()) usage = Control; + if (column->isControl()) usage = Control; if (column->isRendered()) usage = Normal; } @@ -649,7 +649,9 @@ void ColumnArea::DrawHeader::drawBaseFill(const QColor &columnColor, // check if the column is reference bool isEditingSpline = app->getCurrentObject()->isSpline(); - QRect rect = o->rect(PredefinedRect::LAYER_HEADER).translated(orig); + QRect rect = o->rect((col < 0) ? PredefinedRect::CAMERA_LAYER_HEADER + : PredefinedRect::LAYER_HEADER) + .translated(orig); int x0 = rect.left(); int x1 = rect.right(); @@ -699,6 +701,8 @@ void ColumnArea::DrawHeader::drawBaseFill(const QColor &columnColor, void ColumnArea::DrawHeader::drawEye() const { if (isEmpty || !o->flag(PredefinedFlag::EYE_AREA_VISIBLE)) return; + if (col < 0 && o->isVerticalTimeline()) + return; // no preview eye in the camera column QColor bgColor; QImage icon; int buttonType = !column->isPreviewVisible() ? PREVIEW_OFF_XSHBUTTON @@ -729,6 +733,8 @@ void ColumnArea::DrawHeader::drawEye() const { void ColumnArea::DrawHeader::drawPreviewToggle(int opacity) const { if (isEmpty || !o->flag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE)) return; + if (col < 0 && o->isVerticalTimeline()) + return; // no camstand toggle in the camera column // camstand visible toggle QColor bgColor; QImage icon; @@ -770,8 +776,12 @@ void ColumnArea::DrawHeader::drawLock() const { int buttonType = !column->isLocked() ? LOCK_OFF_XSHBUTTON : LOCK_ON_XSHBUTTON; m_viewer->getButton(buttonType, bgColor, icon, !o->isVerticalTimeline()); - QRect lockModeRect = o->rect(PredefinedRect::LOCK_AREA).translated(orig); - QRect lockModeImgRect = o->rect(PredefinedRect::LOCK).translated(orig); + QRect lockModeRect = o->rect((col < 0) ? PredefinedRect::CAMERA_LOCK_AREA + : PredefinedRect::LOCK_AREA) + .translated(orig); + QRect lockModeImgRect = + o->rect((col < 0) ? PredefinedRect::CAMERA_LOCK : PredefinedRect::LOCK) + .translated(orig); if (o->isVerticalTimeline() && m_viewer->getXsheetLayout() == QString("Classic") && @@ -799,13 +809,19 @@ void ColumnArea::DrawHeader::drawConfig() const { int buttonType = CONFIG_XSHBUTTON; m_viewer->getButton(buttonType, bgColor, icon, !o->isVerticalTimeline()); - QRect configRect = o->rect(PredefinedRect::CONFIG_AREA).translated(orig); - QRect configImgRect = o->rect(PredefinedRect::CONFIG).translated(orig); + QRect configRect = o->rect((col < 0) ? PredefinedRect::CAMERA_CONFIG_AREA + : PredefinedRect::CONFIG_AREA) + .translated(orig); + QRect configImgRect = o->rect((col < 0) ? PredefinedRect::CAMERA_CONFIG + : PredefinedRect::CONFIG) + .translated(orig); // config button p.setPen(m_viewer->getVerticalLineColor()); p.fillRect(configRect, bgColor); - if (o->flag(PredefinedFlag::CONFIG_AREA_BORDER)) p.drawRect(configRect); + if (o->flag((col < 0) ? PredefinedFlag::CAMERA_CONFIG_AREA_BORDER + : PredefinedFlag::CONFIG_AREA_BORDER)) + p.drawRect(configRect); TXshZeraryFxColumn *zColumn = dynamic_cast(column); @@ -849,7 +865,9 @@ void ColumnArea::DrawHeader::drawColumnName() const { if (zColumn) name = ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName()); - QRect columnName = o->rect(PredefinedRect::LAYER_NAME).translated(orig); + QRect columnName = o->rect((col < 0) ? PredefinedRect::CAMERA_LAYER_NAME + : PredefinedRect::LAYER_NAME) + .translated(orig); bool nameBacklit = false; int rightadj = -2; @@ -861,7 +879,7 @@ void ColumnArea::DrawHeader::drawColumnName() const { m_viewer->getXsheetLayout() != QString("Classic")) // Legacy - No background { - if (columnName.contains(area->m_pos)) { + if (columnName.contains(area->m_pos) && col >= 0) { p.fillRect(columnName, m_viewer->getXsheetDragBarHighlightColor()); // Qt::yellow); nameBacklit = true; @@ -876,7 +894,7 @@ void ColumnArea::DrawHeader::drawColumnName() const { rightadj = -20; if (column->isPreviewVisible() && !column->getSoundTextColumn() && - !column->getPaletteColumn()) + !column->getPaletteColumn() && col >= 0) nameBacklit = true; } else if (Preferences::instance()->isShowColumnNumbersEnabled()) { if (o->isVerticalTimeline()) @@ -891,6 +909,19 @@ void ColumnArea::DrawHeader::drawColumnName() const { p.setPen((isCurrent) ? m_viewer->getSelectedColumnTextColor() : m_viewer->getTextColor()); + if (o->isVerticalTimeline() && col < 0) { + QString cameraName = QString::fromStdString(name); + p.save(); + p.translate(columnName.topRight()); + p.rotate(90); + p.drawText(columnName.translated(-columnName.topLeft()) + .transposed() + .adjusted(5, 0, 0, 0), + Qt::AlignLeft | valign, cameraName); + p.restore(); + return; + } + p.drawText(columnName.adjusted(leftadj, 0, rightadj, 0), Qt::AlignLeft | valign | Qt::TextSingleLine, QString(name.c_str())); @@ -899,8 +930,9 @@ void ColumnArea::DrawHeader::drawColumnName() const { void ColumnArea::DrawHeader::drawThumbnail(QPixmap &iconPixmap) const { if (isEmpty) return; - QRect thumbnailRect = - o->rect(PredefinedRect::THUMBNAIL_AREA).translated(orig); + QRect thumbnailRect = o->rect((col < 0) ? PredefinedRect::CAMERA_ICON_AREA + : PredefinedRect::THUMBNAIL_AREA) + .translated(orig); p.setPen(m_viewer->getVerticalLineColor()); if (o->flag(PredefinedFlag::THUMBNAIL_AREA_BORDER)) p.drawRect(thumbnailRect); @@ -917,10 +949,12 @@ void ColumnArea::DrawHeader::drawThumbnail(QPixmap &iconPixmap) const { return; } - if (!o->flag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE)) return; - - QRect thumbnailImageRect = - o->rect(PredefinedRect::THUMBNAIL).translated(orig); + if (!o->flag((col < 0) ? PredefinedFlag::CAMERA_ICON_VISIBLE + : PredefinedFlag::THUMBNAIL_AREA_VISIBLE)) + return; + QRect thumbnailImageRect = o->rect((col < 0) ? PredefinedRect::CAMERA_ICON + : PredefinedRect::THUMBNAIL) + .translated(orig); // pallete thumbnail if (column->getPaletteColumn()) { @@ -956,7 +990,8 @@ void ColumnArea::DrawHeader::drawThumbnail(QPixmap &iconPixmap) const { if (Preferences::instance()->getColumnIconLoadingPolicy() == Preferences::LoadOnDemand && ((levelColumn && !levelColumn->isIconVisible()) || - (meshColumn && !meshColumn->isIconVisible()))) { + (meshColumn && !meshColumn->isIconVisible())) && + col >= 0) { // display nothing } else { if (!iconPixmap.isNull()) { @@ -973,6 +1008,8 @@ void ColumnArea::DrawHeader::drawThumbnail(QPixmap &iconPixmap) const { void ColumnArea::DrawHeader::drawPegbarName() const { if (isEmpty || !o->flag(PredefinedFlag::PEGBAR_NAME_VISIBLE)) return; + // the camera column may have parent pegbar, but it is not displayed for now + if (col < 0) return; TStageObjectId columnId = m_viewer->getObjectId(col); TStageObjectId parentId = xsh->getStageObjectParent(columnId); @@ -982,7 +1019,7 @@ void ColumnArea::DrawHeader::drawPegbarName() const { p.setPen(m_viewer->getVerticalLineColor()); if (o->flag(PredefinedFlag::PEGBAR_NAME_BORDER)) p.drawRect(pegbarnamerect); - if (col < 0 || column->getSoundColumn() || column->getSoundTextColumn() || + if (column->getSoundColumn() || column->getSoundTextColumn() || column->getPaletteColumn()) return; @@ -1273,7 +1310,7 @@ void ColumnArea::drawLevelColumnHead(QPainter &p, int col) { #ifdef _WIN32 fontName = "Arial"; #else - fontName = "Helvetica"; + fontName = "Helvetica"; #endif } static QFont font(fontName, -1, QFont::Normal); @@ -1348,7 +1385,7 @@ void ColumnArea::drawSoundColumnHead(QPainter &p, int col) { // AREA #ifdef _WIN32 fontName = "Arial"; #else - fontName = "Helvetica"; + fontName = "Helvetica"; #endif } static QFont font(fontName, -1, QFont::Normal); @@ -1402,7 +1439,7 @@ void ColumnArea::drawPaletteColumnHead(QPainter &p, int col) { // AREA #ifdef _WIN32 fontName = "Arial"; #else - fontName = "Helvetica"; + fontName = "Helvetica"; #endif } static QFont font(fontName, -1, QFont::Normal); @@ -1454,7 +1491,7 @@ void ColumnArea::drawSoundTextColumnHead(QPainter &p, int col) { // AREA #ifdef _WIN32 fontName = "Arial"; #else - fontName = "Helvetica"; + fontName = "Helvetica"; #endif } static QFont font(fontName, -1, QFont::Normal); @@ -1502,9 +1539,13 @@ QPixmap ColumnArea::getColumnIcon(int columnIndex) { const Orientation *o = m_viewer->orientation(); if (columnIndex == -1) { // Indice colonna = -1 -> CAMERA - TApp *app = TApp::instance(); - static QPixmap camera = svgToPixmap(":Resources/camera.svg"); - return camera; + if (o->isVerticalTimeline()) { + static QPixmap camera = svgToPixmap(":Resources/camera_small.svg"); + return camera; + } else { + static QPixmap camera = svgToPixmap(":Resources/camera.svg"); + return camera; + } } TXsheet *xsh = m_viewer->getXsheet(); if (!xsh) return QPixmap(); @@ -1579,7 +1620,7 @@ void ColumnArea::paintEvent(QPaintEvent *event) { // AREA drawSoundTextColumnHead(p, col); break; default: - drawLevelColumnHead(p, col); + drawLevelColumnHead(p, col); // camera column is also painted here break; } } @@ -1655,11 +1696,11 @@ m_value->setFont(font);*/ bool ret = connect(m_slider, SIGNAL(sliderReleased()), this, SLOT(onSliderReleased())); - ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this, + ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderChange(int))); - ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this, + ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int))); - ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this, + ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this, SLOT(onValueChanged(const QString &))); ret = ret && connect(m_filterColorCombo, SIGNAL(activated(int)), this, @@ -1772,11 +1813,11 @@ SoundColumnPopup::SoundColumnPopup(QWidget *parent) bool ret = connect(m_slider, SIGNAL(sliderReleased()), this, SLOT(onSliderReleased())); - ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this, + ret = ret && connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderChange(int))); - ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this, + ret = ret && connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int))); - ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this, + ret = ret && connect(m_value, SIGNAL(textChanged(const QString &)), this, SLOT(onValueChanged(const QString &))); assert(ret); } @@ -1967,7 +2008,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { m_viewer->setCurrentColumn(m_col); TXshColumn *column = xsh->getColumn(m_col); - bool isEmpty = m_col < 0 ? false : (!column || column->isEmpty()); + bool isEmpty = !column || column->isEmpty(); TApp::instance()->getCurrentObject()->setIsSpline(false); // get mouse position @@ -1978,7 +2019,29 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { // QPoint mouseInCell(x, y); int x = mouseInCell.x(), y = mouseInCell.y(); - if (!isEmpty) { + // clicking on the camera column + if (m_col < 0) { + // lock button + if (o->rect(PredefinedRect::CAMERA_LOCK_AREA).contains(mouseInCell) && + event->button() == Qt::LeftButton) + m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock; + // config button + else if (o->rect(PredefinedRect::CAMERA_CONFIG_AREA) + .contains(mouseInCell) && + event->button() == Qt::LeftButton) + m_doOnRelease = OpenSettings; + // clicking another area means column selection + else { + if (m_viewer->getColumnSelection()->isColumnSelected(m_col) && + event->button() == Qt::RightButton) + return; + setDragTool(XsheetGUI::DragTool::makeColumnSelectionTool(m_viewer)); + } + // synchronize the current column and the current fx + if (column) TApp::instance()->getCurrentFx()->setFx(column->getFx()); + } + // clicking on the normal columns + else if (!isEmpty) { // grabbing the left side of the column enables column move if (o->rect(PredefinedRect::DRAG_LAYER).contains(mouseInCell) || (!o->flag(PredefinedFlag::DRAG_LAYER_VISIBLE) // If dragbar hidden, @@ -1986,8 +2049,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { // becomes dragbar && (o->rect(PredefinedRect::LAYER_NUMBER).contains(mouseInCell) || o->rect(PredefinedRect::LAYER_NAME).contains(mouseInCell)))) { - if (m_col >= 0) - setDragTool(XsheetGUI::DragTool::makeColumnMoveTool(m_viewer)); + setDragTool(XsheetGUI::DragTool::makeColumnMoveTool(m_viewer)); } // lock button else if (o->rect(PredefinedRect::LOCK_AREA).contains(mouseInCell) && @@ -1997,7 +2059,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { // preview button else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell) && event->button() == Qt::LeftButton) { - if (m_col < 0 || column->getSoundTextColumn()) { + if (column->getSoundTextColumn()) { // do nothing } else { m_doOnRelease = @@ -2010,8 +2072,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA) .contains(mouseInCell) && event->button() == Qt::LeftButton) { - if (m_col < 0 || column->getPaletteColumn() || - column->getSoundTextColumn()) { + if (column->getPaletteColumn() || column->getSoundTextColumn()) { // do nothing } else { m_doOnRelease = @@ -2120,8 +2181,8 @@ void ColumnArea::mouseMoveEvent(QMouseEvent *event) { return; } - int col = m_viewer->xyToPosition(pos).layer(); - if (col < -1) col = 0; + int col = m_viewer->xyToPosition(pos).layer(); + if (col < -1) col = 0; TXsheet *xsh = m_viewer->getXsheet(); TXshColumn *column = xsh->getColumn(col); QPoint mouseInCell = pos - m_viewer->positionToXY(CellPosition(0, col)); @@ -2233,11 +2294,12 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) { else if (m_doOnRelease == ToggleLock) column->lock(!column->isLocked()); else if (m_doOnRelease == OpenSettings) { - // Align popup to be below to CONFIG button - QRect configRect = - m_viewer->orientation()->rect(PredefinedRect::CONFIG_AREA); QPoint pos = event->pos(); int col = m_viewer->xyToPosition(pos).layer(); + // Align popup to be below to CONFIG button + QRect configRect = m_viewer->orientation()->rect( + (col < 0) ? PredefinedRect::CAMERA_CONFIG_AREA + : PredefinedRect::CONFIG_AREA); CellPosition cellPosition(0, col); QPoint topLeft = m_viewer->positionToXY(cellPosition); QPoint mouseInCell = pos - topLeft; @@ -2331,12 +2393,15 @@ void ColumnArea::mouseDoubleClickEvent(QMouseEvent *event) { if (col == -1) return; #endif - if (!o->rect(PredefinedRect::LAYER_NAME).contains(mouseInCell)) return; + QRect nameRect = o->rect((col < 0) ? PredefinedRect::CAMERA_LAYER_NAME + : PredefinedRect::LAYER_NAME); + if (!nameRect.contains(mouseInCell)) return; TXsheet *xsh = m_viewer->getXsheet(); if (col >= 0 && xsh->isColumnEmpty(col)) return; - QRect renameRect = o->rect(PredefinedRect::RENAME_COLUMN).translated(topLeft); + QRect renameRect = + o->rect(PredefinedRect::RENAME_COLUMN).translated(nameRect.topLeft()); m_renameColumnField->show(renameRect, col); } diff --git a/toonz/sources/toonzlib/columnfan.cpp b/toonz/sources/toonzlib/columnfan.cpp index fd03b10..cefb1aa 100644 --- a/toonz/sources/toonzlib/columnfan.cpp +++ b/toonz/sources/toonzlib/columnfan.cpp @@ -13,12 +13,17 @@ // ColumnFan ColumnFan::ColumnFan() - : m_firstFreePos(0), m_unfolded(74), m_folded(9), m_cameraActive(true) {} + : m_firstFreePos(0) + , m_unfolded(74) + , m_folded(9) + , m_cameraActive(true) + , m_cameraColumnDim(22) {} //----------------------------------------------------------------------------- -void ColumnFan::setDimension(int unfolded) { - m_unfolded = unfolded; +void ColumnFan::setDimensions(int unfolded, int cameraColumn) { + m_unfolded = unfolded; + m_cameraColumnDim = cameraColumn; // folded always 9 update(); } @@ -56,7 +61,7 @@ int ColumnFan::layerAxisToCol(int coord) const { if (Preferences::instance()->isXsheetCameraColumnVisible()) { int firstCol = m_cameraActive - ? m_unfolded + ? m_cameraColumnDim : ((m_columns.size() > 0 && !m_columns[0].m_active) ? 0 : m_folded); if (coord < firstCol) return -1; coord -= firstCol; @@ -76,11 +81,11 @@ int ColumnFan::colToLayerAxis(int col) const { int m = m_columns.size(); int firstCol = 0; if (Preferences::instance()->isXsheetCameraColumnVisible()) { - if (col < -1) return -m_unfolded; + if (col < -1) return -m_cameraColumnDim; if (col < 0) return 0; firstCol = m_cameraActive - ? m_unfolded + ? m_cameraColumnDim : ((m_columns.size() > 0 && !m_columns[0].m_active) ? 0 : m_folded); } if (col >= 0 && col < m) diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp index d42fae0..34b1248 100644 --- a/toonz/sources/toonzlib/orientation.cpp +++ b/toonz/sources/toonzlib/orientation.cpp @@ -20,8 +20,17 @@ const int PINNED_SIZE = 10; const int FRAME_MARKER_SIZE = 4; const int FOLDED_CELL_SIZE = 9; const int SHIFTTRACE_DOT_SIZE = 12; + +QRect iconRect(const QRect &areaRect, const int iconWidth, const int iconHeight, + const int xOffset = 0) { + return QRect( + areaRect.left() + xOffset + ((areaRect.width() / 2) - (iconWidth / 2)), + areaRect.top() + ((areaRect.height() / 2) - (iconHeight / 2)), iconWidth, + iconHeight); } +} // namespace + class TopToBottomOrientation : public Orientation { const int CELL_WIDTH = 74; const int CELL_HEIGHT = 20; @@ -39,6 +48,7 @@ class TopToBottomOrientation : public Orientation { const int ICON_HEIGHT = 18; const int TRACKLEN = 60; const int SHIFTTRACE_DOT_OFFSET = 3; + const int CAMERA_CELL_WIDTH = 22; public: TopToBottomOrientation(); @@ -103,6 +113,7 @@ class LeftToRightOrientation : public Orientation { const int SHIFTTRACE_DOT_OFFSET = 5; const int LAYER_HEADER_PANEL_HEIGHT = 20; const int LAYER_FOOTER_PANEL_HEIGHT = 16; + const int CAMERA_CELL_HEIGHT = CELL_HEIGHT; public: LeftToRightOrientation(); @@ -153,7 +164,7 @@ NumberRange NumberRange::adjusted(int addFrom, int addTo) const { } double NumberRange::ratio(int at) const { - double result = ((double)at - _from) / (_to - _from); + double result = ((double)at - _from) / (_to - _from); if (result < 0) result = 0; if (result > 1) result = 1; return result; @@ -278,12 +289,18 @@ TopToBottomOrientation::TopToBottomOrientation() { // Cell viewer QRect cellRect(0, 0, CELL_WIDTH, CELL_HEIGHT); addRect(PredefinedRect::CELL, cellRect); + addRect(PredefinedRect::CAMERA_CELL, + QRect(0, 0, CAMERA_CELL_WIDTH, CELL_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 cameraKeyRect((CAMERA_CELL_WIDTH - KEY_ICON_WIDTH) / 2 + 1, + (CELL_HEIGHT - KEY_ICON_HEIGHT) / 2, KEY_ICON_WIDTH, + KEY_ICON_HEIGHT); + addRect(PredefinedRect::CAMERA_KEY_ICON, cameraKeyRect); QRect nameRect = cellRect.adjusted(8, 0, -6, 0); addRect(PredefinedRect::CELL_NAME, nameRect); addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME, @@ -310,6 +327,8 @@ TopToBottomOrientation::TopToBottomOrientation() { 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)); + addRect(PredefinedRect::CAMERA_LOOP_ICON, + QRect(cameraKeyRect.left(), 0, 10, 11)); addRect(PredefinedRect::FRAME_MARKER_AREA, QRect(0, 0, -1, -1)); // hide // Note viewer @@ -371,6 +390,8 @@ TopToBottomOrientation::TopToBottomOrientation() { addRect( PredefinedRect::FOLDED_LAYER_HEADER, QRect(0, 1, FOLDED_LAYER_HEADER_WIDTH, user_folded_header_height - 3)); + addRect(PredefinedRect::CAMERA_LAYER_HEADER, + QRect(0, 1, CAMERA_CELL_WIDTH, use_header_height - 3)); static int THUMBNAIL_HEIGHT; static int HDRROW_HEIGHT; @@ -381,8 +402,9 @@ TopToBottomOrientation::TopToBottomOrientation() { static int HDRROW3; static int HDRROW4; static int HDRROW5; - QRect layername, eyeArea, eye, previewArea, preview, lockArea, lock, - configArea, config, thumbnailArea, thumbnail, pegbarname, volumeArea; + QRect layername, eyeArea, previewArea, lockArea, cameraLockArea, configArea, + cameraConfigArea, thumbnailArea, thumbnail, cameraIconArea, pegbarname, + volumeArea; QPoint soundTopLeft; if (layout == QString("Compact")) { @@ -402,51 +424,52 @@ TopToBottomOrientation::TopToBottomOrientation() { layername = QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - 1, HDRROW_HEIGHT - 1); addRect(PredefinedRect::LAYER_NAME, layername); + addRect(PredefinedRect::CAMERA_LAYER_NAME, + QRect(INDENT + 1, HDRROW3, CAMERA_CELL_WIDTH - 1, + THUMBNAIL_HEIGHT + HDRROW_HEIGHT)); addRect(PredefinedRect::LAYER_NUMBER, QRect(INDENT + layername.width() - 20, HDRROW1, 20, HDRROW_HEIGHT)); eyeArea = QRect(INDENT, HDRROW2, ICON_WIDTH + 1, HDRROW_HEIGHT); // Compact addRect(PredefinedRect::EYE_AREA, eyeArea); - eye = QRect( - eyeArea.left() + 1 + ((eyeArea.width() / 2) - (ICON_WIDTH / 2)), - eyeArea.top() + ((eyeArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH, ICON_HEIGHT - 1); - addRect(PredefinedRect::EYE, eye); + addRect(PredefinedRect::EYE, + iconRect(eyeArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); previewArea = QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH + 1, HDRROW_HEIGHT); addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea); - preview = QRect( - previewArea.left() + 1 + ((previewArea.width() / 2) - (ICON_WIDTH / 2)), - previewArea.top() + - ((previewArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH, ICON_HEIGHT - 1); - addRect(PredefinedRect::PREVIEW_LAYER, preview); + addRect(PredefinedRect::PREVIEW_LAYER, + iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); lockArea = QRect(INDENT + eyeArea.width() + previewArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::LOCK_AREA, lockArea); - lock = QRect( - lockArea.left() + ((lockArea.width() / 2) - ((ICON_WIDTH - 1) / 2)), - lockArea.top() + ((lockArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH - 1, ICON_HEIGHT - 1); - addRect(PredefinedRect::LOCK, lock); + addRect(PredefinedRect::LOCK, + iconRect(lockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); + cameraLockArea = QRect(INDENT, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT); + addRect(PredefinedRect::CAMERA_LOCK_AREA, cameraLockArea); + addRect(PredefinedRect::CAMERA_LOCK, + iconRect(cameraLockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); configArea = QRect(INDENT + eyeArea.width() + previewArea.width() + lockArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::CONFIG_AREA, configArea); - config = QRect( - configArea.left() + ((configArea.width() / 2) - ((ICON_WIDTH - 1) / 2)), - configArea.top() + - ((configArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH - 1, ICON_HEIGHT - 1); - addRect(PredefinedRect::CONFIG, config); + addRect(PredefinedRect::CONFIG, + iconRect(configArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); + cameraConfigArea = QRect(INDENT, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT); + addRect(PredefinedRect::CAMERA_CONFIG_AREA, cameraConfigArea); + addRect(PredefinedRect::CAMERA_CONFIG, + iconRect(cameraConfigArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); thumbnailArea = QRect(INDENT, HDRROW3, CELL_WIDTH, THUMBNAIL_HEIGHT); addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea); thumbnail = thumbnailArea.adjusted(1, 1, 0, 0); addRect(PredefinedRect::THUMBNAIL, thumbnail); + + addRect(PredefinedRect::CAMERA_ICON_AREA, QRect(0, 0, -1, -1)); + addRect(PredefinedRect::CAMERA_ICON, QRect(0, 0, -1, -1)); + addRect(PredefinedRect::FILTER_COLOR, QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12)); @@ -481,6 +504,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true); addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true); addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true); + addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, false); addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true); addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, true); addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, true); @@ -488,6 +512,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true); addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, false); addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true); + addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, false); addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false); } else if (layout == QString("Classic-revised")) { THUMBNAIL_HEIGHT = 44; @@ -508,50 +533,53 @@ TopToBottomOrientation::TopToBottomOrientation() { layername = QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - 1, HDRROW_HEIGHT - 1); addRect(PredefinedRect::LAYER_NAME, layername); + addRect(PredefinedRect::CAMERA_LAYER_NAME, + QRect(INDENT + 1, HDRROW4, CAMERA_CELL_WIDTH - 1, + THUMBNAIL_HEIGHT + HDRROW_HEIGHT)); addRect(PredefinedRect::LAYER_NUMBER, QRect(INDENT + layername.width() - 20, HDRROW1, 20, HDRROW_HEIGHT)); eyeArea = QRect(INDENT, HDRROW2, CELL_WIDTH - ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::EYE_AREA, eyeArea); - eye = QRect( - eyeArea.left() + 1 + ((eyeArea.width() / 2) - (ICON_WIDTH / 2)), - eyeArea.top() + ((eyeArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH, ICON_HEIGHT - 1); - addRect(PredefinedRect::EYE, eye); + addRect(PredefinedRect::EYE, + iconRect(eyeArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); previewArea = QRect(INDENT, HDRROW3, CELL_WIDTH - ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea); - preview = QRect( - previewArea.left() + 1 + ((previewArea.width() / 2) - (ICON_WIDTH / 2)), - previewArea.top() + - ((previewArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH, ICON_HEIGHT - 1); - addRect(PredefinedRect::PREVIEW_LAYER, preview); + addRect(PredefinedRect::PREVIEW_LAYER, + iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); lockArea = QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::LOCK_AREA, lockArea); - lock = QRect( - lockArea.left() + ((lockArea.width() / 2) - ((ICON_WIDTH - 1) / 2)), - lockArea.top() + ((lockArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH - 1, ICON_HEIGHT - 1); - addRect(PredefinedRect::LOCK, lock); + addRect(PredefinedRect::LOCK, + iconRect(lockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); + cameraLockArea = QRect(INDENT, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT); + addRect(PredefinedRect::CAMERA_LOCK_AREA, cameraLockArea); + addRect(PredefinedRect::CAMERA_LOCK, + iconRect(cameraLockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); configArea = QRect(INDENT + previewArea.width(), HDRROW3, ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::CONFIG_AREA, configArea); - config = QRect( - configArea.left() + ((configArea.width() / 2) - ((ICON_WIDTH - 1) / 2)), - configArea.top() + - ((configArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)), - ICON_WIDTH - 1, ICON_HEIGHT - 1); - addRect(PredefinedRect::CONFIG, config); + addRect(PredefinedRect::CONFIG, + iconRect(configArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); + cameraConfigArea = QRect(INDENT, HDRROW3, CAMERA_CELL_WIDTH, HDRROW_HEIGHT); + addRect(PredefinedRect::CAMERA_CONFIG_AREA, cameraConfigArea); + addRect(PredefinedRect::CAMERA_CONFIG, + iconRect(cameraConfigArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); thumbnailArea = QRect(INDENT, HDRROW4, CELL_WIDTH, THUMBNAIL_HEIGHT); addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea); thumbnail = thumbnailArea.adjusted(1, 1, 0, 0); addRect(PredefinedRect::THUMBNAIL, thumbnail); + + cameraIconArea = QRect(INDENT, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT); + addRect(PredefinedRect::CAMERA_ICON_AREA, cameraIconArea); + addRect(PredefinedRect::CAMERA_ICON, + iconRect(cameraIconArea, ICON_WIDTH, ICON_HEIGHT)); + addRect(PredefinedRect::FILTER_COLOR, QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12)); @@ -586,6 +614,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true); addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true); addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true); + addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, false); addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true); addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, true); addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, true); @@ -593,6 +622,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true); addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, true); addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true); + addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true); addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false); } else { THUMBNAIL_HEIGHT = 43; @@ -612,6 +642,9 @@ TopToBottomOrientation::TopToBottomOrientation() { layername = QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - INDENT - 3, HDRROW_HEIGHT - 1); addRect(PredefinedRect::LAYER_NAME, layername); + addRect(PredefinedRect::CAMERA_LAYER_NAME, + QRect(1, HDRROW3, CAMERA_CELL_WIDTH - 1, + THUMBNAIL_HEIGHT + CELL_HEIGHT)); addRect(PredefinedRect::LAYER_NUMBER, QRect(0, 0, -1, -1)); eyeArea = @@ -628,24 +661,30 @@ TopToBottomOrientation::TopToBottomOrientation() { lockArea = QRect(INDENT, HDRROW2, ICON_WIDTH - 1, HDRROW_HEIGHT - 1); addRect(PredefinedRect::LOCK_AREA, lockArea); - /* - lock = QRect(lockArea.left() + ((lockArea.width() / 2) - - ((ICON_WIDTH - 3) / 2)), - lockArea.top() + ((lockArea.height() / 2) - - ((ICON_HEIGHT - 3) / 2)), - ICON_WIDTH - 3, ICON_HEIGHT - 3); - addRect(PredefinedRect::LOCK, lock); - */ addRect(PredefinedRect::LOCK, lockArea); + cameraLockArea = QRect(0, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT - 1); + addRect(PredefinedRect::CAMERA_LOCK_AREA, cameraLockArea); + addRect(PredefinedRect::CAMERA_LOCK, + iconRect(cameraLockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1)); addRect(PredefinedRect::CONFIG_AREA, QRect(0, 0, -1, -1)); addRect(PredefinedRect::CONFIG, QRect(0, 0, -1, -1)); + addRect(PredefinedRect::CAMERA_CONFIG, QRect(0, 0, -1, -1)); thumbnailArea = QRect(INDENT - 1, HDRROW3, CELL_WIDTH - INDENT - 1, THUMBNAIL_HEIGHT); addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea); thumbnail = thumbnailArea.adjusted(1, 1, 0, 0); addRect(PredefinedRect::THUMBNAIL, thumbnail); + + cameraIconArea = QRect(0, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT); + addRect(PredefinedRect::CAMERA_ICON_AREA, cameraIconArea); + addRect(PredefinedRect::CAMERA_ICON, + iconRect(cameraIconArea, ICON_WIDTH, ICON_HEIGHT)); + // clicking on the camera icon will switch the camera in "Classic" mode + addRect(PredefinedRect::CAMERA_CONFIG_AREA, + rect(PredefinedRect::CAMERA_ICON_AREA)); + addRect(PredefinedRect::FILTER_COLOR, QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12)); @@ -679,6 +718,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, false); addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true); addFlag(PredefinedFlag::CONFIG_AREA_BORDER, false); + addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, false); addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, false); addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, false); addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, true); @@ -686,6 +726,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true); addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, false); addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true); + addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true); addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, true); } @@ -715,7 +756,7 @@ TopToBottomOrientation::TopToBottomOrientation() { 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))); + verticalLine(CELL_WIDTH - 14, NumberRange(0, CELL_HEIGHT))); addLine(PredefinedLine::EXTENDER_LINE, horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0))); @@ -732,6 +773,7 @@ TopToBottomOrientation::TopToBottomOrientation() { addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION, QBoxLayout::Direction::TopToBottom); addDimension(PredefinedDimension::CENTER_ALIGN, Qt::AlignHCenter); + addDimension(PredefinedDimension::CAMERA_LAYER, CAMERA_CELL_WIDTH); // // Paths @@ -746,14 +788,12 @@ TopToBottomOrientation::TopToBottomOrientation() { fromTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE, -EASE_TRIANGLE_SIZE / 2)); fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE, -EASE_TRIANGLE_SIZE / 2)); fromTriangle.lineTo(QPointF(0, EASE_TRIANGLE_SIZE / 2)); - fromTriangle.translate(keyRect.center()); addPath(PredefinedPath::BEGIN_EASE_TRIANGLE, fromTriangle); QPainterPath toTriangle(QPointF(0, -EASE_TRIANGLE_SIZE / 2)); toTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE, EASE_TRIANGLE_SIZE / 2)); toTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE, EASE_TRIANGLE_SIZE / 2)); toTriangle.lineTo(QPointF(0, -EASE_TRIANGLE_SIZE / 2)); - toTriangle.translate(keyRect.center()); addPath(PredefinedPath::END_EASE_TRIANGLE, toTriangle); QPainterPath playFrom(QPointF(0, 0)); @@ -898,12 +938,14 @@ LeftToRightOrientation::LeftToRightOrientation() { // Cell viewer QRect cellRect(0, 0, CELL_WIDTH, CELL_HEIGHT); addRect(PredefinedRect::CELL, cellRect); + addRect(PredefinedRect::CAMERA_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 - 2, KEY_ICON_WIDTH, KEY_ICON_HEIGHT); addRect(PredefinedRect::KEY_ICON, keyRect); + addRect(PredefinedRect::CAMERA_KEY_ICON, keyRect); QRect nameRect = cellRect.adjusted(4, 4, -6, 0); addRect(PredefinedRect::CELL_NAME, nameRect); addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME, nameRect); @@ -926,6 +968,7 @@ LeftToRightOrientation::LeftToRightOrientation() { QRect(CELL_WIDTH - 2, CELL_DRAG_HEIGHT, 2, CELL_HEIGHT - CELL_DRAG_HEIGHT)); addRect(PredefinedRect::LOOP_ICON, QRect(0, keyRect.top(), 10, 11)); + addRect(PredefinedRect::CAMERA_LOOP_ICON, rect(PredefinedRect::LOOP_ICON)); QRect frameMarker((CELL_WIDTH - FRAME_MARKER_SIZE) / 2 - 1, CELL_HEIGHT - FRAME_MARKER_SIZE - 7, FRAME_MARKER_SIZE, FRAME_MARKER_SIZE); @@ -1002,6 +1045,8 @@ LeftToRightOrientation::LeftToRightOrientation() { addRect( PredefinedRect::FOLDED_LAYER_HEADER, QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 2, FOLDED_LAYER_HEADER_HEIGHT)); + addRect(PredefinedRect::CAMERA_LAYER_HEADER, + QRect(1, 0, LAYER_HEADER_WIDTH - 2, CAMERA_CELL_HEIGHT)); QRect columnName(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0, LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4, CELL_HEIGHT); addRect(PredefinedRect::RENAME_COLUMN, columnName); @@ -1018,14 +1063,20 @@ LeftToRightOrientation::LeftToRightOrientation() { addRect(PredefinedRect::LOCK_AREA, eyeArea.translated(2 * ICON_OFFSET, 0)); addRect(PredefinedRect::LOCK, eye.translated(2 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1)); + addRect(PredefinedRect::CAMERA_LOCK_AREA, rect(PredefinedRect::LOCK_AREA)); + addRect(PredefinedRect::CAMERA_LOCK, rect(PredefinedRect::LOCK)); addRect(PredefinedRect::CONFIG_AREA, eyeArea.translated(3 * ICON_OFFSET, 0)); addRect(PredefinedRect::CONFIG, eye.translated(3 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1)); + addRect(PredefinedRect::CAMERA_CONFIG_AREA, + rect(PredefinedRect::CONFIG_AREA)); + addRect(PredefinedRect::CAMERA_CONFIG, rect(PredefinedRect::CONFIG)); addRect(PredefinedRect::DRAG_LAYER, QRect(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0, LAYER_HEADER_WIDTH - ICONS_WIDTH - THUMBNAIL_WIDTH - 3, CELL_DRAG_HEIGHT)); addRect(PredefinedRect::LAYER_NAME, columnName); + addRect(PredefinedRect::CAMERA_LAYER_NAME, rect(PredefinedRect::LAYER_NAME)); addRect(PredefinedRect::LAYER_NUMBER, QRect(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0, LAYER_NUMBER_WIDTH, CELL_HEIGHT)); @@ -1033,6 +1084,10 @@ LeftToRightOrientation::LeftToRightOrientation() { addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea); QRect thumbnail = thumbnailArea.adjusted(1, 1, 0, 0); addRect(PredefinedRect::THUMBNAIL, thumbnail); + addRect(PredefinedRect::CAMERA_ICON_AREA, + rect(PredefinedRect::THUMBNAIL_AREA)); + addRect(PredefinedRect::CAMERA_ICON, rect(PredefinedRect::THUMBNAIL)); + addRect(PredefinedRect::FILTER_COLOR, QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12)); addRect(PredefinedRect::PEGBAR_NAME, QRect(0, 0, -1, -1)); // hide @@ -1085,6 +1140,7 @@ LeftToRightOrientation::LeftToRightOrientation() { addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true); addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true); addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true); + addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, true); addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true); addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, false); addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, false); @@ -1092,6 +1148,7 @@ LeftToRightOrientation::LeftToRightOrientation() { addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, false); addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, true); addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true); + addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true); addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false); // @@ -1121,6 +1178,7 @@ LeftToRightOrientation::LeftToRightOrientation() { addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION, QBoxLayout::Direction::LeftToRight); addDimension(PredefinedDimension::CENTER_ALIGN, Qt::AlignVCenter); + addDimension(PredefinedDimension::CAMERA_LAYER, CAMERA_CELL_HEIGHT); // // Paths @@ -1142,14 +1200,12 @@ LeftToRightOrientation::LeftToRightOrientation() { fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, EASE_TRIANGLE_SIZE)); fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, -EASE_TRIANGLE_SIZE)); fromTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE / 2, 0)); - fromTriangle.translate(keyRect.center()); addPath(PredefinedPath::BEGIN_EASE_TRIANGLE, fromTriangle); QPainterPath toTriangle(QPointF(-EASE_TRIANGLE_SIZE / 2, 0)); toTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE / 2, EASE_TRIANGLE_SIZE)); toTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE / 2, -EASE_TRIANGLE_SIZE)); toTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, 0)); - toTriangle.translate(keyRect.center()); addPath(PredefinedPath::END_EASE_TRIANGLE, toTriangle); QPainterPath playFrom(QPointF(0, 0)); diff --git a/toonz/sources/toonzlib/txsheet.cpp b/toonz/sources/toonzlib/txsheet.cpp index e89af0a..e5f5b82 100644 --- a/toonz/sources/toonzlib/txsheet.cpp +++ b/toonz/sources/toonzlib/txsheet.cpp @@ -169,7 +169,9 @@ TXsheet::TXsheetImp::~TXsheetImp() { void TXsheet::TXsheetImp::initColumnFans() { for (auto o : Orientations::all()) { int index = o->dimension(PredefinedDimension::INDEX); - m_columnFans[index].setDimension(o->dimension(PredefinedDimension::LAYER)); + m_columnFans[index].setDimensions( + o->dimension(PredefinedDimension::LAYER), + o->dimension(PredefinedDimension::CAMERA_LAYER)); } } @@ -779,7 +781,7 @@ void TXsheet::increaseStepCells(int r0, int c0, int &r1, int c1) { // controllo se devo cambiare la selezione bool allIncreaseIsEqual = true; for (c = 0; c < ends.size() - 1 && allIncreaseIsEqual; c++) - allIncreaseIsEqual = allIncreaseIsEqual && ends[c] == ends[c + 1]; + allIncreaseIsEqual = allIncreaseIsEqual && ends[c] == ends[c + 1]; if (allIncreaseIsEqual) r1 = ends[0]; } @@ -813,7 +815,7 @@ void TXsheet::decreaseStepCells(int r0, int c0, int &r1, int c1) { // controllo se devo cambiare la selezione bool allDecreaseIsEqual = true; for (c = 0; c < ends.size() - 1 && allDecreaseIsEqual; c++) - allDecreaseIsEqual = allDecreaseIsEqual && ends[c] == ends[c + 1]; + allDecreaseIsEqual = allDecreaseIsEqual && ends[c] == ends[c + 1]; if (allDecreaseIsEqual) r1 = ends[0]; }