void FilmstripFrames::execNavigatorPan(const QPoint &point) { int index = y2index(point.y()); TFrameId fid = index2fid(index); int i0 = y2index(0); int frameHeight = m_iconSize.height() + fs_frameSpacing + fs_iconMarginTop + fs_iconMarginBottom; QPoint clickedPos = point - QPoint(0, (index - i0) * frameHeight); if (fid != TApp::instance()->getCurrentFrame()->getFid()) return; QRect iconRect = QRect(QPoint(fs_leftMargin + fs_iconMarginLR, fs_frameSpacing / 2 + fs_iconMarginTop) //<- top-left position of the icon , m_iconSize); QPointF delta = m_naviRectPos - clickedPos; if (iconRect.left() > clickedPos.x() || iconRect.right() < clickedPos.x()) delta.setX(0.0); if (iconRect.top() > clickedPos.y() || iconRect.bottom() < clickedPos.y()) delta.setY(0.0); if (delta.x() == 0.0 && delta.y() == 0.0) return; delta.setX(delta.x() * m_icon2ViewerRatio.x()); delta.setY(delta.y() * m_icon2ViewerRatio.y()); if (TApp::instance()->getInknPaintViewerPanel()) { SceneViewer *viewer = TApp::instance()->getInknPaintViewerPanel()->getSceneViewer(); if (viewer) viewer->navigatorPan(delta.toPoint()); } }
void HistoryField::paintEvent(QPaintEvent *evt) { QPainter p(this); QRect clipRect = evt->rect(); int i0 = y2index(clipRect.top()); int i1 = y2index(clipRect.bottom()); int currentHistoryIndex = TUndoManager::manager()->getCurrentHistoryIndex(); int currentHistoryCount = TUndoManager::manager()->getHistoryCount(); QRect undoChipRect(0, 0, width(), HISTORY_ITEM_HEIGHT); QRect undoIconRect(7, 2, 17, 17); for (int i = i0; i <= i1; i++) { if (0 <= i && i <= currentHistoryCount) { QRect tmpRect = undoChipRect.translated(0, HISTORY_ITEM_HEIGHT * (i - 1)); bool isCurrent = (i == currentHistoryIndex); bool isFuture = (i > currentHistoryIndex); p.setPen(QColor(64, 64, 64)); p.setBrush((isFuture) ? QColor(150, 150, 150) : QColor(192, 192, 192)); if (isCurrent) p.setBrush(QColor(0, 0, 128)); p.drawRect(tmpRect); //draw text QFont fon = p.font(); fon.setItalic(isFuture); p.setFont(fon); p.setPen((isFuture) ? QColor(64, 64, 64) : Qt::black); if (isCurrent) p.setPen(Qt::white); tmpRect.adjust(30, 0, 0, 0); TUndo *tmpUndo = TUndoManager::manager()->getUndoItem(i); p.drawText(tmpRect, Qt::AlignLeft | Qt::AlignVCenter, tmpUndo->getHistoryString()); QRect tmpIconRect = undoIconRect.translated(0, 20 * (i - 1)); p.drawPixmap(tmpIconRect, HistoryPixmapManager::instance()->getHistoryPm(tmpUndo->getHistoryType())); } } }
void FilmstripFrames::timerEvent(QTimerEvent *) { scroll(m_scrollSpeed); if (m_selecting) { QPoint pos = mapFromGlobal(m_pos); int index = y2index(pos.y()); select(index, DRAG_SELECT); update(); } }
void FilmstripFrames::mouseMoveEvent(QMouseEvent *e) { QPoint pos = e->pos(); int index = y2index(e->pos().y()); if (e->buttons() & Qt::LeftButton) { // navigator pan if (m_isNavigatorPanning) { execNavigatorPan(e->pos()); e->accept(); return; } if (m_dragDropArmed) { if ((m_pos - e->pos()).manhattanLength() > 10) { startDragDrop(); m_dragDropArmed = false; } } else if (m_selecting) { m_pos = e->globalPos(); select(index, DRAG_SELECT); } // autopan QRect visibleRect = visibleRegion().boundingRect(); if (pos.y() < visibleRect.top()) m_scrollSpeed = -(5 + (visibleRect.top() - pos.y()) / 4); else if (pos.y() > visibleRect.bottom()) m_scrollSpeed = (5 + (pos.y() - visibleRect.bottom()) / 4); else m_scrollSpeed = 0; if (m_scrollSpeed != 0) startAutoPanning(); else stopAutoPanning(); update(); } else if (e->buttons() & Qt::MidButton) { // scroll con il tasto centrale pos = e->globalPos(); scroll(m_pos.y() - pos.y()); m_pos = pos; } }
void HistoryField::mousePressEvent(QMouseEvent *event) { int index = y2index(event->pos().y()); int historyCount = TUndoManager::manager()->getHistoryCount(); if (index > historyCount || index <= 0) return; int currentIndex = TUndoManager::manager()->getCurrentHistoryIndex(); if (index == currentIndex) return; if (index < currentIndex) //undo { for (int i = 0; i < (currentIndex - index); i++) TUndoManager::manager()->undo(); } else //redo { for (int i = 0; i < (index - currentIndex); i++) TUndoManager::manager()->redo(); } }
bool FilmstripFrameHeadGadget::eventFilter(QObject *obj, QEvent *e) { if (!Preferences::instance()->isOnionSkinEnabled()) return false; QWidget *viewer = dynamic_cast<QWidget *>(obj); if (e->type() == QEvent::MouseButtonPress) { //方針:上下タブをクリック→ドラッグでオニオンスキンの増減 // 上下タブをダブルクリックでオニオンスキンの表示/非表示 // オニオンスキンの●エリア をクリックで各フレームのON/OFF切り替え→ドラッグで伸ばせる // Fixedオニオンスキンの●エリアをクリックで Fixedオニオンスキンの位置の指定 //----- それぞれのパーツの位置Rectの指定。各フレームの右上座標からのオフセットも含む。 //OnionSkinの円の左上座標のy値 int onionDotYPos = m_dy / 2 - 5; //OnionSkinの●のRect QRect onionDotRect(10, onionDotYPos, 10, 10); //FixedOnionSkinの●のRect QRect fixedOnionDotRect(0, onionDotYPos, 10, 10); //上方向のOnionSkinタブのRect QRect backOnionTabRect(0, m_dy - 15, 30, 15); //下方向のOnionSkinタブのRect QRect frontOnionTabRect(0, 0, 30, 15); //----- //----- ハイライト表示、actionのリセット m_action = None; // click if (m_highlightedFosFrame >= 0) { m_highlightedFosFrame = -1; viewer->update(); } if (m_highlightedMosFrame >= 0) { m_highlightedMosFrame = -1; viewer->update(); } //----- 以下、クリック位置に応じてアクションを変えていく //クリックされたフレームを取得 QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e); int frame = y2index(mouseEvent->pos().y()); m_buttonPressCellIndex = frame; int currentFrame = getCurrentFrame(); //各フレーム左上からの位置 QPoint clickedPos = mouseEvent->pos() + QPoint(0, -index2y(frame)); //カレントフレームの場合、無視 if (frame == currentFrame) return false; //カレントフレームの上下でタブをクリックした場合 else if ((frame == currentFrame - 1 && backOnionTabRect.contains(clickedPos)) || (frame == currentFrame + 1 && frontOnionTabRect.contains(clickedPos))) { //ドラッグに備える m_action = ActivateMos; } //カレントフレーム以外の場合 else { //通常のOnionSkinの場合 if (onionDotRect.contains(clickedPos)) { // 既にオニオンスキンなら、オフにする bool on = !isMos(frame); //アクションが決まる m_action = on ? ActivateMos : DeactivateMos; //カレントフレームでなければ、オニオンスキンを切り替え setMos(frame, on); } //FixedOnionSkinの場合 else if (fixedOnionDotRect.contains(clickedPos)) { // Fos bool on = !isFos(frame); m_action = on ? ActivateFos : DeactivateFos; setFos(frame, on); } else return false; } viewer->update(); } //---- 上下タブのダブルクリックで表示/非表示の切り替え else if (e->type() == QEvent::MouseButtonDblClick) { QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e); if (mouseEvent->buttons() & Qt::LeftButton) { int frame = y2index(mouseEvent->pos().y()); //各フレーム左上からの位置 QPoint clickedPos = mouseEvent->pos() + QPoint(0, -index2y(frame)); //カレントフレーム int currentFrame = getCurrentFrame(); //上方向のOnionSkinタブのRect QRect backOnionTabRect(0, m_dy - 15, 30, 15); //下方向のOnionSkinタブのRect QRect frontOnionTabRect(0, 0, 30, 15); if ((currentFrame - 1 == frame && backOnionTabRect.contains(clickedPos)) || (currentFrame + 1 == frame && frontOnionTabRect.contains(clickedPos))) { enableOnionSkin(!isOnionSkinEnabled()); viewer->update(); } } else return false; } //---- else if (e->type() == QEvent::MouseMove) { QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e); int frame = y2index(mouseEvent->pos().y()); //各フレーム左上からの位置 QPoint clickedPos = mouseEvent->pos() + QPoint(0, -index2y(frame)); //カレントフレーム int currentFrame = getCurrentFrame(); //マウスボタンが押されていない場合 if (mouseEvent->buttons() == 0) { //----- それぞれのパーツの位置Rectの指定。各フレームの右上座標からのオフセットも含む。 //OnionSkinの円の左上座標のy値 int onionDotYPos = m_dy / 2 - 5; //OnionSkinの●のRect QRect onionDotRect(10, onionDotYPos, 10, 10); //FixedOnionSkinの●のRect QRect fixedOnionDotRect(0, onionDotYPos, 10, 10); //上方向のOnionSkinタブのRect QRect backOnionTabRect(0, m_dy - 15, 30, 15); //下方向のOnionSkinタブのRect QRect frontOnionTabRect(0, 0, 30, 15); //----- //----- Fixed Onion Skin の ハイライト int highlightedFrame; if (currentFrame != frame && fixedOnionDotRect.contains(clickedPos)) highlightedFrame = frame; else highlightedFrame = -1; if (highlightedFrame != m_highlightedFosFrame) { m_highlightedFosFrame = highlightedFrame; viewer->update(); } //----- //----- 通常の Onion Skin の ハイライト if (currentFrame != frame && onionDotRect.contains(clickedPos)) highlightedFrame = frame; else highlightedFrame = -1; if (highlightedFrame != m_highlightedMosFrame) { m_highlightedMosFrame = highlightedFrame; viewer->update(); } //----- //----- ツールチップの表示 if (currentFrame == frame) { viewer->setToolTip(tr("")); return false; } //Fixed Onion Skin else if (fixedOnionDotRect.contains(clickedPos)) viewer->setToolTip(tr("Click to Toggle Fixed Onion Skin")); //通常の Onion Skin else if (onionDotRect.contains(clickedPos)) viewer->setToolTip(tr("Click / Drag to Toggle Onion Skin")); //カレントフレームの上下タブ else if ((currentFrame - 1 == frame && backOnionTabRect.contains(clickedPos)) || (currentFrame + 1 == frame && frontOnionTabRect.contains(clickedPos))) viewer->setToolTip(tr("Drag to Extend Onion Skin, Double Click to Toggle All")); else { viewer->setToolTip(tr("")); return false; } } //左ボタンドラッグの場合 else if (mouseEvent->buttons() & Qt::LeftButton) { //指定されたアクションに従い、ドラッグされたフレームも同じアクションを行う // drag switch (m_action) { case MoveHead: setCurrentFrame(frame); break; case ActivateMos: setMos(frame, true); break; case DeactivateMos: setMos(frame, false); break; case ActivateFos: setFos(frame, true); break; case DeactivateFos: setFos(frame, false); break; default: return false; } viewer->update(); } else if (mouseEvent->buttons() & Qt::MidButton) return false; } else return false; return true; }
bool FrameHeadGadget::eventFilter(QObject *obj, QEvent *e) { QWidget *viewer = dynamic_cast<QWidget *>(obj); if (e->type() == QEvent::MouseButtonPress) { m_action = None; // click if (m_highlightedFosFrame >= 0) { m_highlightedFosFrame = -1; viewer->update(); } QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e); int frame = y2index(mouseEvent->pos().y()); m_buttonPressCellIndex = frame; int currentFrame = getCurrentFrame(); int x = mouseEvent->pos().x(); int y = mouseEvent->pos().y() - index2y(frame); if (x > 24 || x > 12 && frame != currentFrame) return false; if (y < 12) { #ifdef STUDENT bool isMosArea = false; #else bool isMosArea = x < 6; #endif // click nel quadratino bianco. if (isMosArea) { // Mos bool on = !isMos(frame); m_action = on ? ActivateMos : DeactivateMos; if (frame != currentFrame) setMos(frame, on); } else if (frame == currentFrame) m_action = MoveHead; else { // Fos bool on = !isFos(frame); m_action = on ? ActivateFos : DeactivateFos; setFos(frame, on); } } else { // fuori dal quadratino bianco: muovo il frame corrente m_action = MoveHead; setCurrentFrame(frame); } viewer->update(); } else if (e->type() == QEvent::MouseButtonRelease) { QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e); int frame = y2index(mouseEvent->pos().y()); int currentFrame = getCurrentFrame(); int x = mouseEvent->pos().x(); int y = mouseEvent->pos().y() - index2y(frame); if (x > 24 || x > 12 && frame != currentFrame) return false; if (mouseEvent->button() == Qt::RightButton) return false; #ifndef STUDENT if (x < 12 && y < 12 && frame == currentFrame && m_buttonPressCellIndex == frame) { enableOnionSkin(!isOnionSkinEnabled()); viewer->update(); } #endif } else if (e->type() == QEvent::MouseMove) { QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(e); int frame = y2index(mouseEvent->pos().y()); int x = mouseEvent->pos().x(); int y = mouseEvent->pos().y() - index2y(frame); if (mouseEvent->buttons() == 0) { // mouse move int highlightedFosFrame = (6 <= x && x <= 12 && y < 12) ? frame : -1; if (highlightedFosFrame != m_highlightedFosFrame) { m_highlightedFosFrame = highlightedFosFrame; viewer->update(); } if (getCurrentFrame() == frame) viewer->setToolTip(tr("Current Frame")); else if (x < 7) { #ifdef STUDENT viewer->setToolTip(tr("Relative Onion Skin Toggle")); #else viewer->setToolTip(""); #endif } else if (x < 13) viewer->setToolTip(tr("Fixed Onion Skin Toggle")); else viewer->setToolTip(tr("")); } else if (mouseEvent->buttons() & Qt::LeftButton) { // drag switch (m_action) { case MoveHead: setCurrentFrame(frame); break; #ifndef STUDENT case ActivateMos: setMos(frame, true); break; #endif case DeactivateMos: setMos(frame, false); break; case ActivateFos: setFos(frame, true); break; case DeactivateFos: setFos(frame, false); break; default: return false; } viewer->update(); } else if (mouseEvent->buttons() & Qt::MidButton) return false; } else return false; return true; }
void FilmstripFrames::mousePressEvent(QMouseEvent *event) { m_selecting = false; int index = y2index(event->pos().y()); TFrameId fid = index2fid(index); TXshSimpleLevel *sl = getLevel(); int i0 = y2index(0); int frameHeight = m_iconSize.height() + fs_frameSpacing + fs_iconMarginTop + fs_iconMarginBottom; QPoint clickedPos = event->pos() - QPoint(0, (index - i0) * frameHeight); if (event->button() == Qt::LeftButton) { if (fid == TFrameId()) return; ComboViewerPanel *inknPaintViewerPanel = TApp::instance()->getInknPaintViewerPanel(); // navigator pan if (fid == TApp::instance()->getCurrentFrame()->getFid() && sl->getType() == TZP_XSHLEVEL && inknPaintViewerPanel && inknPaintViewerPanel->isVisible() && QRect(QPoint(fs_leftMargin + fs_iconMarginLR, fs_frameSpacing / 2 + fs_iconMarginTop) //<- top-left position of the icon , m_iconSize) .contains(clickedPos)) { m_isNavigatorPanning = true; execNavigatorPan(event->pos()); QApplication::setOverrideCursor(Qt::ClosedHandCursor); } else m_isNavigatorPanning = false; if (event->modifiers() & Qt::ShiftModifier) { select(index, SHIFT_SELECT); if (m_selection->isSelected(fid)) { // click su di un frame gia' selezionato. Puo' essere l'inizio di un // drag'n'drop m_dragDropArmed = true; m_pos = event->pos(); } } else if (event->modifiers() & Qt::ControlModifier) select(index, CTRL_SELECT); // inbetween else if (sl->getType() == PLI_XSHLEVEL && m_selection->isInInbetweenRange(fid) && event->pos().x() > width() - 20 - fs_rightMargin) { inbetween(); } else { // move current frame when clicked without modifier TApp *tapp = TApp::instance(); std::vector<TFrameId> fids; TXshLevel *level = tapp->getCurrentLevel()->getLevel(); level->getFids(fids); tapp->getCurrentFrame()->setFrameIds(fids); tapp->getCurrentFrame()->setFid(fid); if (!m_selection->isSelected(fid)) // selezione semplice { // click su un frame non selezionato m_selecting = true; // posso estendere la selezione con il drag select(index, START_DRAG_SELECT); } else if (m_selection->isSelected(fid)) { // click su di un frame gia' selezionato. Puo' essere l'inizio di un // drag'n'drop m_dragDropArmed = true; m_pos = event->pos(); } } update(); } else if (event->button() == Qt::MidButton) { m_pos = event->globalPos(); return; } else if (event->button() == Qt::RightButton) { select(index); } }
void FilmstripFrames::paintEvent(QPaintEvent *evt) { QPainter p(this); // p.setRenderHint(QPainter::Antialiasing, true); QRect clipRect = evt->rect(); p.fillRect(clipRect, Qt::black); // thumbnail rect, including offsets QRect iconImgRect = QRect(QPoint(fs_leftMargin + fs_iconMarginLR, fs_frameSpacing / 2 + fs_iconMarginTop), m_iconSize); // frame size with margins QSize frameSize = m_iconSize + QSize(fs_iconMarginLR * 2, fs_iconMarginTop + fs_iconMarginBottom); // .. and with offset QRect frameRect = QRect(QPoint(fs_leftMargin, fs_frameSpacing / 2), frameSize); int oneFrameHeight = frameSize.height() + fs_frameSpacing; // visible frame index range int i0 = y2index(clipRect.top()); int i1 = y2index(clipRect.bottom()); // fids, frameCount <- frames del livello std::vector<TFrameId> fids; TXshSimpleLevel *sl = getLevel(); if (sl) sl->getFids(fids); else { for (int i = i0; i <= i1; i++) { // draw white rectangles if obtaining the level is failed QRect iconRect = frameRect.translated(QPoint(0, oneFrameHeight * i)); p.setBrush(QColor(192, 192, 192)); p.setPen(Qt::NoPen); p.drawRect(iconRect); } return; } //--- compute navigator rect --- QRect naviRect; ComboViewerPanel *inknPaintViewerPanel = TApp::instance()->getInknPaintViewerPanel(); if (sl->getType() == TZP_XSHLEVEL && inknPaintViewerPanel) { // show navigator only if the inknpaint viewer is visible if (inknPaintViewerPanel->isVisible()) { SceneViewer *viewer = inknPaintViewerPanel->getSceneViewer(); // imgSize: image's pixel size QSize imgSize(sl->getProperties()->getImageRes().lx, sl->getProperties()->getImageRes().ly); // Viewer affine TAffine viewerAff = inknPaintViewerPanel->getSceneViewer()->getViewMatrix(); // pixel size which will be displayed with 100% scale in Viewer Stage TFrameId currentId = TApp::instance()->getCurrentFrame()->getFid(); double imgPixelWidth = (double)(imgSize.width()) / sl->getDpi(currentId).x * Stage::inch; double imgPixelHeight = (double)(imgSize.height()) / sl->getDpi(currentId).y * Stage::inch; // get the image's corner positions in viewer matrix (with current zoom // scale) TPointD imgTopRight = viewerAff * TPointD(imgPixelWidth / 2.0f, imgPixelHeight / 2.0f); TPointD imgBottomLeft = viewerAff * TPointD(-imgPixelWidth / 2.0f, -imgPixelHeight / 2.0f); // pixel size in viewer matrix ( with current zoom scale ) QSizeF imgSizeInViewer(imgTopRight.x - imgBottomLeft.x, imgTopRight.y - imgBottomLeft.y); // ratio of the Viewer frame's position and size QRectF naviRatio( (-(float)viewer->width() * 0.5f - (float)imgBottomLeft.x) / imgSizeInViewer.width(), 1.0f - ((float)viewer->height() * 0.5f - (float)imgBottomLeft.y) / imgSizeInViewer.height(), (float)viewer->width() / imgSizeInViewer.width(), (float)viewer->height() / imgSizeInViewer.height()); naviRect = QRect(iconImgRect.left() + (int)(naviRatio.left() * (float)iconImgRect.width()), iconImgRect.top() + (int)(naviRatio.top() * (float)iconImgRect.height()), (int)((float)iconImgRect.width() * naviRatio.width()), (int)((float)iconImgRect.height() * naviRatio.height())); // for drag move m_naviRectPos = naviRect.center(); naviRect = naviRect.intersected(frameRect); m_icon2ViewerRatio.setX(imgSizeInViewer.width() / (float)iconImgRect.width()); m_icon2ViewerRatio.setY(imgSizeInViewer.height() / (float)iconImgRect.height()); } } //--- compute navigator rect end --- int frameCount = (int)fids.size(); std::set<TFrameId> editableFrameRange; if (sl) editableFrameRange = sl->getEditableRange(); bool isReadOnly = false; if (sl) isReadOnly = sl->isReadOnly(); int i; int iconWidth = m_iconSize.width(); int x0 = m_frameLabelWidth; int x1 = x0 + iconWidth; int frameHeight = m_iconSize.height(); // linee orizzontali che separano i frames p.setPen(getLightLineColor()); for (i = i0; i <= i1; i++) { int y = index2y(i) + frameHeight; p.drawLine(0, y, x1, y); } TFilmstripSelection::InbetweenRange range = m_selection->getInbetweenRange(); // draw for each frames for (i = i0; i <= i1; i++) { QRect tmp_iconImgRect = iconImgRect.translated(QPoint(0, oneFrameHeight * i)); QRect tmp_frameRect = frameRect.translated(QPoint(0, oneFrameHeight * i)); bool isCurrentFrame = (i == sl->fid2index(TApp::instance()->getCurrentFrame()->getFid())); bool isSelected = (0 <= i && i < frameCount && m_selection->isSelected(fids[i])); if (0 <= i && i < frameCount) { TFrameId fid = fids[i]; // normal or inbetween (for vector levels) int flags = (sl->getType() == PLI_XSHLEVEL && range.first < fid && fid < range.second) ? F_INBETWEEN_RANGE : F_NORMAL; // draw icons drawFrameIcon(p, tmp_iconImgRect, i, fid, flags); p.setPen(Qt::NoPen); p.setBrush(Qt::NoBrush); p.drawRect(tmp_iconImgRect); // Frame number if (m_selection->isSelected(fids[i])) { if (TApp::instance()->getCurrentFrame()->isEditingLevel() && isCurrentFrame) p.setPen(Qt::red); else p.setPen(Qt::white); } else p.setPen(QColor(192, 192, 192)); p.setBrush(Qt::NoBrush); // for single frame QString text; if (fid.getNumber() == TFrameId::EMPTY_FRAME || fid.getNumber() == TFrameId::NO_FRAME) { text = QString("Single Frame"); } // for sequencial frame (with letter) else if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) { text = fidToFrameNumberWithLetter(fid.getNumber()); } // for sequencial frame else { text = QString::number(fid.getNumber()).rightJustified(4, '0'); } p.drawText(tmp_frameRect.adjusted(0, 0, -3, 2), text, QTextOption(Qt::AlignRight | Qt::AlignBottom)); p.setPen(Qt::NoPen); // Read-only frames (lock) if (0 <= i && i < frameCount) { if ((editableFrameRange.empty() && isReadOnly) || (isReadOnly && (!editableFrameRange.empty() && editableFrameRange.count(fids[i]) == 0))) { static QPixmap lockPixmap(":Resources/forbidden.png"); p.drawPixmap(tmp_frameRect.bottomLeft() + QPoint(3, -13), lockPixmap); } } } // navigator rect if (naviRect.isValid() && isCurrentFrame) { p.setPen(QPen(Qt::red, 1)); p.drawRect(naviRect.translated(0, oneFrameHeight * i)); p.setPen(Qt::NoPen); } // red frame for the current frame if (TApp::instance()->getCurrentFrame()->isEditingLevel() && (isCurrentFrame || isSelected)) { QPen pen; pen.setColor(Qt::red); pen.setWidth(2); pen.setJoinStyle(Qt::RoundJoin); p.setPen(pen); p.drawRect(tmp_frameRect.adjusted(-1, -1, 2, 2)); p.setPen(Qt::NoPen); } } // se sono in modalita' level edit faccio vedere la freccia che indica il // frame corrente if (TApp::instance()->getCurrentFrame()->isEditingLevel()) m_frameHeadGadget->draw(p, QColor(Qt::white), QColor(Qt::black)); }
void FilmstripFrames::mouseDoubleClickEvent(QMouseEvent *event) { int index = y2index(event->pos().y()); select(index, ONLY_SELECT); // ONLY_SELECT }