void FilmstripFrames::showEvent(QShowEvent *) { TApp *app = TApp::instance(); // cambiamenti al livello TXshLevelHandle *levelHandle = app->getCurrentLevel(); connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onLevelSwitched(TXshLevel *))); connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(onLevelChanged())); connect(levelHandle, SIGNAL(xshLevelViewChanged()), this, SLOT(onLevelChanged())); // al frame corrente connect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); connect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(update())); // iconcine connect(IconGenerator::instance(), SIGNAL(iconGenerated()), this, SLOT(update())); // onion skin connect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, SLOT(update())); // enable navigator link with the Viewer in the InknPaint page ComboViewerPanel *inknPaintViewerPanel = app->getInknPaintViewerPanel(); if (inknPaintViewerPanel) { SceneViewer *viewer = inknPaintViewerPanel->getSceneViewer(); if (viewer) { connect(viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); connect(viewer, SIGNAL(refreshNavi()), this, SLOT(update())); } } }
void FilmstripFrames::hideEvent(QHideEvent *) { TApp *app = TApp::instance(); // cambiamenti al livello disconnect(app->getCurrentLevel()); // al frame corrente disconnect(app->getCurrentFrame(), SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); disconnect(app->getCurrentFrame(), SIGNAL(frameTypeChanged()), this, SLOT(update())); // iconcine disconnect(IconGenerator::instance(), SIGNAL(iconGenerated()), this, SLOT(update())); // onion skin disconnect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, SLOT(update())); ComboViewerPanel *inknPaintViewerPanel = app->getInknPaintViewerPanel(); if (inknPaintViewerPanel) { SceneViewer *viewer = inknPaintViewerPanel->getSceneViewer(); if (viewer) { disconnect(viewer, SIGNAL(onZoomChanged()), this, SLOT(update())); disconnect(viewer, SIGNAL(refreshNavi()), this, SLOT(update())); } } }
void RowArea::drawOnionSkinSelection(QPainter &p) { TApp *app = TApp::instance(); OnionSkinMask osMask = app->getCurrentOnionSkin()->getOnionSkinMask(); TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet(); assert(xsh); int currentRow = m_viewer->getCurrentRow(); if (m_showOnionToSet) { int y = m_viewer->rowToY(m_row) + 3; QRect rect(m_xa - 6, y + 1, 4, 4); p.setPen(m_viewer->getDarkLineColor()); p.drawRect(rect); p.fillRect(rect.adjusted(1, 1, 0, 0), QBrush(m_viewer->getLightLineColor())); } if (!osMask.isEnabled()) return; int i; for (i = 0; i < osMask.getFosCount(); i++) { int fos = osMask.getFos(i); if (fos == currentRow) continue; int y = m_viewer->rowToY(fos) + 3; QRect rect(m_xa - 6, y + 1, 4, 4); p.setPen(Qt::black); p.drawRect(rect); p.fillRect(rect.adjusted(1, 1, 0, 0), QBrush(m_viewer->getDarkLineColor())); } int lastY; int xc = m_xa - 10; #ifndef STUDENT int mosCount = osMask.getMosCount(); for (i = 0; i < mosCount; i++) { int mos = osMask.getMos(i); int y = m_viewer->rowToY(currentRow + mos) + 3; QRect rect(m_xa - 12, y + 1, 4, 4); p.setPen(Qt::black); p.drawRect(rect); p.fillRect(rect.adjusted(1, 1, 0, 0), QBrush(m_viewer->getLightLineColor())); if (i > 0 || mos > 0) { int ya = y; int yb; if (i == 0 || mos > 0 && osMask.getMos(i - 1) < 0) yb = m_viewer->rowToY(currentRow) + RowHeight; else yb = lastY + 5; p.setPen(Qt::black); p.drawLine(xc, ya, xc, yb); } lastY = y; if (mos < 0 && (i == mosCount - 1 || osMask.getMos(i + 1) > 0)) { int ya = m_viewer->rowToY(currentRow); int yb = lastY + 5; p.setPen(Qt::black); p.drawLine(xc, ya, xc, yb); } } #endif }
void RowArea::drawOnionSkinSelection(QPainter &p) { TApp *app = TApp::instance(); OnionSkinMask osMask = app->getCurrentOnionSkin()->getOnionSkinMask(); TXsheet *xsh = app->getCurrentScene()->getScene()->getXsheet(); assert(xsh); int currentRow = m_viewer->getCurrentRow(); // get onion colors TPixel frontPixel, backPixel; 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); int onionDotDiam = 8; int onionHandleDiam = RowHeight - 1; int onionDotYPos = (RowHeight - onionDotDiam) / 2; // If the onion skin is disabled, draw dash line instead. if (osMask.isEnabled()) p.setPen(Qt::red); else { QPen currentPen = p.pen(); currentPen.setStyle(Qt::DashLine); currentPen.setColor(QColor(128, 128, 128, 255)); p.setPen(currentPen); } // Draw onion skin extender handles. QRectF handleRect(3, m_viewer->rowToY(currentRow) + 1, onionHandleDiam, onionHandleDiam); int angle180 = 16 * 180; p.setBrush(QBrush(backColor)); p.drawChord(handleRect, 0, angle180); p.setBrush(QBrush(frontColor)); p.drawChord(handleRect, angle180, angle180); //-- draw movable onions // draw line between onion skin range int minMos = 0; int maxMos = 0; int mosCount = osMask.getMosCount(); for (int i = 0; i < mosCount; i++) { int mos = osMask.getMos(i); if (minMos > mos) minMos = mos; if (maxMos < mos) maxMos = mos; } p.setBrush(Qt::NoBrush); if (minMos < 0) // previous frames { int y0 = m_viewer->rowToY(currentRow + minMos) + onionDotYPos + onionDotDiam; int y1 = m_viewer->rowToY(currentRow); p.drawLine(onionDotDiam*1.5, y0, onionDotDiam*1.5, y1); } if (maxMos > 0) // foward frames { int y0 = m_viewer->rowToY(currentRow + 1); int y1 = m_viewer->rowToY(currentRow + maxMos) + onionDotYPos; p.drawLine(onionDotDiam*1.5, y0, onionDotDiam*1.5, y1); } // draw onion skin dots p.setPen(Qt::red); for (int i = 0; i < mosCount; i++) { // mos : frame offset from the current frame int mos = osMask.getMos(i); // skip drawing if the frame is under the mouse cursor if (m_showOnionToSet == Mos && currentRow + mos == m_row) continue; int y = m_viewer->rowToY(currentRow + mos) + onionDotYPos; if (osMask.isEnabled()) p.setBrush(mos < 0 ? backColor : frontColor); else p.setBrush(Qt::NoBrush); p.drawEllipse(onionDotDiam, y, onionDotDiam, onionDotDiam); } //-- draw fixed onions for (int i = 0; i < osMask.getFosCount(); i++) { int fos = osMask.getFos(i); if (fos == currentRow) continue; // skip drawing if the frame is under the mouse cursor if (m_showOnionToSet == Fos && fos == m_row) continue; int y = m_viewer->rowToY(fos) + onionDotYPos; if (osMask.isEnabled()) p.setBrush(QBrush(QColor(0, 255, 255, 128))); else p.setBrush(Qt::NoBrush); p.drawEllipse(0, y, onionDotDiam, onionDotDiam); } //-- draw highlighted onion if (m_showOnionToSet != None) { int y = m_viewer->rowToY(m_row) + onionDotYPos; int xPos = (m_showOnionToSet == Fos) ? 0 : onionDotDiam; p.setPen(QColor(255, 128, 0)); p.setBrush(QBrush(QColor(255, 255, 0, 200))); p.drawEllipse(xPos, y, onionDotDiam, onionDotDiam); } }